[ 
https://issues.apache.org/jira/browse/DRILL-3653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Victoria Markman closed DRILL-3653.
-----------------------------------

> Assert in a query with both avg aggregate and avg window aggregate functions
> ----------------------------------------------------------------------------
>
>                 Key: DRILL-3653
>                 URL: https://issues.apache.org/jira/browse/DRILL-3653
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 1.2.0
>            Reporter: Victoria Markman
>            Assignee: Sean Hsuan-Yi Chu
>              Labels: window_funcion
>             Fix For: 1.2.0
>
>         Attachments: t1_parquet
>
>
> It seems to be the problem with just this combination and I can't believe I 
> did not find it earlier ...
> {code}
> 0: jdbc:drill:schema=dfs> select avg(a1), avg(a1) over () from t1 group by a1;
> Error: SYSTEM ERROR: AssertionError: Internal error: invariant violated: 
> conversion result not null
> [Error Id: 2f850005-a7f6-4215-bbc1-90da57cbb71f on atsqa4-133.qa.lab:31010] 
> (state=,code=0)
> {code}
> Works:
> {code}
> 0: jdbc:drill:schema=dfs> select avg(a1), sum(a1) over () from t1 group by a1;
> +---------+---------+
> | EXPR$0  | EXPR$1  |
> +---------+---------+
> | 1.0     | 47      |
> | 2.0     | 47      |
> | 3.0     | 47      |
> | 4.0     | 47      |
> | 5.0     | 47      |
> | 6.0     | 47      |
> | 7.0     | 47      |
> | 9.0     | 47      |
> | 10.0    | 47      |
> | null    | 47      |
> +---------+---------+
> 10 rows selected (0.54 seconds)
> {code}
> {code}
> 0: jdbc:drill:schema=dfs> select avg(a1), count(a1) over () from t1 group by 
> a1;
> +---------+---------+
> | EXPR$0  | EXPR$1  |
> +---------+---------+
> | 1.0     | 9       |
> | 2.0     | 9       |
> | 3.0     | 9       |
> | 4.0     | 9       |
> | 5.0     | 9       |
> | 6.0     | 9       |
> | 7.0     | 9       |
> | 9.0     | 9       |
> | 10.0    | 9       |
> | null    | 9       |
> +---------+---------+
> 10 rows selected (0.304 seconds)
> {code}
> {code}
> 0: jdbc:drill:schema=dfs> select avg(a1), count(a1) over (), sum(a1) 
> over(partition by b1) from t1 group by a1, b1;
> +---------+---------+---------+
> | EXPR$0  | EXPR$1  | EXPR$2  |
> +---------+---------+---------+
> | 1.0     | 9       | 1       |
> | 2.0     | 9       | 2       |
> | 3.0     | 9       | 3       |
> | 5.0     | 9       | 5       |
> | 6.0     | 9       | 6       |
> | 7.0     | 9       | 7       |
> | null    | 9       | null    |
> | 9.0     | 9       | 9       |
> | 10.0    | 9       | 10      |
> | 4.0     | 9       | 4       |
> +---------+---------+---------+
> 10 rows selected (0.788 seconds)
> {code}
> drillbit.log
> {code}
> 2015-08-15 00:06:20,260 [2a317d83-5099-1d1f-ba86-33173f88b00c:foreman] INFO  
> o.a.drill.exec.work.foreman.Foreman - State change requested.  PENDING --> 
> FAILED
> org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception 
> during fragment initialization: Internal error: while converting 
> `CastHigh`(SUM(`t1`.`a1`)) / COUNT(`t1`.`a1`)
>         at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:253) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  [na:1.7.0_71]
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_71]
>         at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
> Caused by: java.lang.AssertionError: Internal error: while converting 
> `CastHigh`(SUM(`t1`.`a1`)) / COUNT(`t1`.`a1`)
>         at org.apache.calcite.util.Util.newInternal(Util.java:790) 
> ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:96)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:60)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4070)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3508)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:130) 
> ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:3963)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.drill.exec.planner.sql.DrillAvgVarianceConvertlet.convertCall(DrillAvgVarianceConvertlet.java:72)
>  ~[drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
>         at 
> org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:60)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertOver(SqlToRelConverter.java:1762)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter.access$1000(SqlToRelConverter.java:180)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:3956)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter.createAggImpl(SqlToRelConverter.java:2539)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertAgg(SqlToRelConverter.java:2360)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:604)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:564)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:2759)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:522)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.calcite.prepare.PlannerImpl.convert(PlannerImpl.java:198) 
> ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         at 
> org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRel(DefaultSqlHandler.java:450)
>  ~[drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
>         at 
> org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert(DefaultSqlHandler.java:193)
>  ~[drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
>         at 
> org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:159)
>  ~[drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
>         at 
> org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:178)
>  ~[drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
>         at 
> org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:903) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
>         at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:242) 
> [drill-java-exec-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
>         ... 3 common frames omitted
> Caused by: java.lang.reflect.InvocationTargetException: null
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[na:1.7.0_71]
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
> ~[na:1.7.0_71]
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[na:1.7.0_71]
>         at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_71]
>         at 
> org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:87)
>  ~[calcite-core-1.1.0-drill-r16.jar:1.1.0-drill-r16]
>         ... 26 common frames omitted
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to