Skip to content

Revert "Refactor ApproximateMostFrequent to use type annotations"#21712

Merged
feilong-liu merged 1 commit intomasterfrom
revert-21418-npochhi_approx_most_frequent_refactor
Jan 17, 2024
Merged

Revert "Refactor ApproximateMostFrequent to use type annotations"#21712
feilong-liu merged 1 commit intomasterfrom
revert-21418-npochhi_approx_most_frequent_refactor

Conversation

@feilong-liu
Copy link
Contributor

@feilong-liu feilong-liu commented Jan 17, 2024

Reverts #21418

The refactor code fails for NULL input, for example:

presto:tpch> select k, approx_most_frequent(2, v, 10) from (values (1, null), (2, 3)) t(k, v) group by k;

Query 20240117_041732_00044_a7kid, FAILED, 1 node
http://localhost:8080/ui/query.html?20240117_041732_00044_a7kid
Splits: 9 total, 8 done (88.89%)
CPU Time: 0.1s total,     0 rows/s,     0B/s, 35% active
Per Node: 0.1 parallelism,     0 rows/s,     0B/s
Parallelism: 0.1
Peak User Memory: 0B
Peak Total Memory: 0B
Peak Task Total Memory: 0B
S0-driverCountPerTask: sum=9 count=1 min=9 max=9
S0-taskBlockedTimeNanos: sum=0:01 count=1 min=0:01 max=0:01
S0-taskElapsedTimeNanos: sum=0:01 count=1 min=0:01 max=0:01
S0-taskQueuedTimeNanos: sum=257ms count=1 min=257ms max=257ms
S0-taskScheduledTimeNanos: sum=301ms count=1 min=301ms max=301ms
fragmentPlanTimeNanos: sum=11ms count=1 min=11ms max=11ms
getCanonicalInfoTimeNanos: sum=0ms count=1 min=0ms max=0ms
logicalPlannerTimeNanos: sum=31ms count=1 min=31ms max=31ms
optimizerTimeNanos: sum=171ms count=1 min=171ms max=171ms
[Latency: client-side: 0:01, server-side: 0:01] [0 rows, 0B] [0 rows/s, 0B/s]

Query 20240117_041732_00044_a7kid failed: Map keys must not be null
java.lang.IllegalArgumentException: Map keys must not be null
	at com.facebook.presto.common.block.MapBlockBuilder.appendStructureInternal(MapBlockBuilder.java:458)
	at com.facebook.presto.common.block.AbstractMapBlock.writePositionTo(AbstractMapBlock.java:329)
	at com.facebook.presto.common.type.MapType.appendTo(MapType.java:237)
	at com.facebook.presto.operator.project.MergingPageOutput.buffer(MergingPageOutput.java:246)
	at com.facebook.presto.operator.project.MergingPageOutput.process(MergingPageOutput.java:234)
	at com.facebook.presto.operator.project.MergingPageOutput.getOutput(MergingPageOutput.java:139)
	at com.facebook.presto.operator.FilterAndProjectOperator.getOutput(FilterAndProjectOperator.java:105)
	at com.facebook.presto.operator.Driver.processInternal(Driver.java:436)
	at com.facebook.presto.operator.Driver.lambda$processFor$10(Driver.java:319)
	at com.facebook.presto.operator.Driver.tryWithLock(Driver.java:740)
	at com.facebook.presto.operator.Driver.processFor(Driver.java:312)
	at com.facebook.presto.execution.SqlTaskExecution$DriverSplitRunner.processFor(SqlTaskExecution.java:1079)
	at com.facebook.presto.execution.executor.PrioritizedSplitRunner.process(PrioritizedSplitRunner.java:165)
	at com.facebook.presto.execution.executor.TaskExecutor$TaskRunner.run(TaskExecutor.java:621)
	at com.facebook.presto.$gen.Presto_null__testversion____20240117_041622_3.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

After revert, it succeeds:

presto:tpch> select k, approx_most_frequent(2, v, 10) from (values (1, null), (2, 3)) t(k, v) group by k;
 k | _col1 
---+-------
 1 | NULL  
 2 | {3=1} 
(2 rows)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants