samarthjain opened a new issue #8093: SQL GroupBy query fails for aggregations 
returning complex type
URL: https://github.com/apache/incubator-druid/issues/8093
 
 
   Please provide a detailed title (e.g. "Broker crashes when using TopN query 
with Bound filter" instead of just "Broker crashes").
   
   ### Affected Version
   
   master
   
   ### Description
   
   I have been working on adding SQL support for T-Digest sketches and ran into 
an issue for group by queries that project aggregations returning a complex 
type. 
   
   For ex - the below query fails for bloom filter aggregators. 
   `SELECT BLOOM_FILTER(l1, 1000) FROM numfoo group by dim2`
   
   `java.lang.RuntimeException: Error while applying rule 
DruidQueryRule(AGGREGATE_PROJECT), args 
[rel#26:LogicalProject.NONE.[](input=rel#25:Subset#3.NONE.[],EXPR$0=$1), 
rel#33:DruidQueryRel.NONE.[](query={"queryType":"groupBy","dataSource":{"type":"table","name":"numfoo"},"intervals":{"type":"intervals","intervals":["-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"]},"virtualColumns":[],"filter":null,"granularity":{"type":"all"},"dimensions":[{"type":"default","dimension":"dim2","outputName":"_d0","outputType":"STRING"}],"aggregations":[{"type":"bloom","name":"a0:agg","field":{"type":"default","dimension":"dim1","outputName":"a0:dim1","outputType":"STRING"},"maxNumEntries":1000}],"postAggregations":[],"having":null,"limitSpec":{"type":"NoopLimitSpec"},"context":{"defaultTimeout":300000,"maxScatterGatherBytes":9223372036854775807,"sqlCurrentTimestamp":"2000-01-01T00:00:00Z","sqlQueryId":"dummy"},"descending":false},signature={_d0:STRING,
 a0:agg:COMPLEX})]
   
        at 
org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:236)
        at 
org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:646)
        at 
org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:339)
        at 
org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:358)
        at 
org.apache.calcite.prepare.PlannerImpl.transform(PlannerImpl.java:337)
        at 
org.apache.druid.sql.calcite.planner.DruidPlanner.planWithDruidConvention(DruidPlanner.java:119)
        at 
org.apache.druid.sql.calcite.planner.DruidPlanner.plan(DruidPlanner.java:89)
        at org.apache.druid.sql.SqlLifecycle.plan(SqlLifecycle.java:141)
        at 
org.apache.druid.sql.SqlLifecycle.planAndAuthorize(SqlLifecycle.java:207)
        at org.apache.druid.sql.SqlLifecycle.runSimple(SqlLifecycle.java:244)
        at 
org.apache.druid.query.aggregation.bloom.sql.BloomFilterSqlAggregatorTest.testBloomFilterAgg(BloomFilterSqlAggregatorTest.java:230)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at 
org.apache.druid.sql.calcite.util.QueryLogHook$1.evaluate(QueryLogHook.java:95)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
        at 
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
        at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
   Caused by: org.apache.druid.java.util.common.ISE: No ExprType for 
valueType[COMPLEX]
        at 
org.apache.druid.sql.calcite.expression.Expressions.exprTypeForValueType(Expressions.java:576)
        at 
org.apache.druid.sql.calcite.rel.Projection.postAggregatorDirectColumnIsOk(Projection.java:197)
        at 
org.apache.druid.sql.calcite.rel.Projection.postAggregation(Projection.java:108)
        at 
org.apache.druid.sql.calcite.rel.DruidQuery.computeGrouping(DruidQuery.java:313)
        at 
org.apache.druid.sql.calcite.rel.DruidQuery.<init>(DruidQuery.java:167)
        at 
org.apache.druid.sql.calcite.rel.PartialDruidQuery.build(PartialDruidQuery.java:306)
        at 
org.apache.druid.sql.calcite.rel.DruidQueryRel.toDruidQuery(DruidQueryRel.java:97)
        at 
org.apache.druid.sql.calcite.rel.DruidQueryRel.toDruidQueryForExplaining(DruidQueryRel.java:109)
        at 
org.apache.druid.sql.calcite.rel.DruidRel.isValidDruidQuery(DruidRel.java:62)
        at 
org.apache.druid.sql.calcite.rule.DruidRules$DruidQueryRule.onMatch(DruidRules.java:132)
        at 
org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:212)
        ... 39 more`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to