Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot turn on enable_intermediate_aggregation on query that contains reduce_agg #12848

Open
hellium01 opened this issue May 22, 2019 · 1 comment
Labels

Comments

@hellium01
Copy link
Contributor

hellium01 commented May 22, 2019

AddIntermediateAggregations assumed there is no lambda argument in the Aggregation function in FINAL step, thus it will always fail. Reproduce by running following query:

set session enable_intermediate_aggregations=true;
SELECT reduce_agg(y, 1, (a, b) -> a * b, (a, b) -> a * b) 
                        FROM (VALUES (1, 5), (1, 6), (1, 7), (2, 8), (2, 9), (3, 10)) AS t(x, y) ;

throws

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.facebook.presto.operator.aggregation.GenericAccumulatorFactory.createIntermediateAccumulator(GenericAccumulatorFactory.java:148)
        at com.facebook.presto.operator.Aggregator.<init>(Aggregator.java:40)
        at com.facebook.presto.operator.AggregationOperator.<init>(AggregationOperator.java:106)
        at com.facebook.presto.operator.AggregationOperator$AggregationOperatorFactory.createOperator(AggregationOperator.java:62)
        at com.facebook.presto.operator.DriverFactory.createDriver(DriverFactory.java:114)
        at com.facebook.presto.execution.SqlTaskExecution$DriverSplitRunnerFactory.createDriver(SqlTaskExecution.java:943)
        at com.facebook.presto.execution.SqlTaskExecution$DriverSplitRunner.processFor(SqlTaskExecution.java:1071)
        at com.facebook.presto.execution.executor.PrioritizedSplitRunner.process(PrioritizedSplitRunner.java:162)
        at com.facebook.presto.execution.executor.TaskExecutor$TaskRunner.run(TaskExecutor.java:483)
        at com.facebook.presto.$gen.Presto_0_219____20190507_234305_1.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
        at com.facebook.presto.operator.aggregation.GenericAccumulatorFactory.createIntermediateAccumulator(GenericAccumulatorFactory.java:145)
        ... 12 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60)
        at com.facebook.presto.$gen.IntegerIntegerReduceAggAccumulator_20190522_004310_6843883.<init>(Unknown Source)
        ... 17 more
@hellium01 hellium01 added the bug label May 22, 2019
@hellium01
Copy link
Contributor Author

cc @wenleix, @highker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant