You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "Victoria Markman (JIRA)" <ji...@apache.org> on 2015/06/25 23:22:04 UTC

[jira] [Created] (DRILL-3375) Window function in order by clause fails if window clause is used

Victoria Markman created DRILL-3375:
---------------------------------------

             Summary: Window function in order by clause fails if window clause is used
                 Key: DRILL-3375
                 URL: https://issues.apache.org/jira/browse/DRILL-3375
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
    Affects Versions: 1.0.0
            Reporter: Victoria Markman
            Assignee: Jinfeng Ni


This should work, I think. 

{code}
0: jdbc:drill:schema=dfs> select a1, sum(a1) over w from t1 window w as (partition by b1 order by c1 desc) order by sum(a1) over w;
Error: SYSTEM ERROR: SqlValidatorException: Window 't1.w' not found
[Error Id: 9c7f5bda-4e72-443d-a7f1-437fe4be2bff on atsqa4-133.qa.lab:31010] (state=,code=0)
{code}

This is an oddball, but should not throw NPE either:
{code}
0: jdbc:drill:schema=dfs> select a1, sum(a1) over w from t1 window w as (partition by b1 order by c1 desc) order by sum(a1) over (partition by b1 order by c1 desc);
Error: SYSTEM ERROR: NullPointerException
[Error Id: 9a483c53-897e-4f05-91e9-c413176e9aab on atsqa4-133.qa.lab:31010] (state=,code=0)
{code}

drillbit.log
{code}
[Error Id: b0442741-a164-4b3a-a2ba-0672a49942ac on atsqa4-133.qa.lab:31010]
org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: SqlValidatorException: Window 't1.w' not found


[Error Id: b0442741-a164-4b3a-a2ba-0672a49942ac on atsqa4-133.qa.lab:31010]
        at org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:523) ~[drill-common-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:737) [drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:839) [drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:781) [drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.common.EventProcessor.sendEvent(EventProcessor.java:73) [drill-common-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.work.foreman.Foreman$StateSwitch.moveToState(Foreman.java:783) [drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.work.foreman.Foreman.moveToState(Foreman.java:892) [drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:253) [drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.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: org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception during fragment initialization: At line 1, column 104: Window 't1.w' not found
        ... 4 common frames omitted
Caused by: org.apache.calcite.runtime.CalciteContextException: At line 1, column 104: Window 't1.w' not found
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_71]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[na:1.7.0_71]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.7.0_71]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526) ~[na:1.7.0_71]
        at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:348) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:686) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:674) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:3750) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql.validate.SqlValidatorImpl.getWindowByName(SqlValidatorImpl.java:3762) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql.validate.SqlValidatorImpl.resolveWindow(SqlValidatorImpl.java:3773) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql2rel.SqlToRelConverter.convertOver(SqlToRelConverter.java:1730) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql2rel.SqlToRelConverter.access$1000(SqlToRelConverter.java:180) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:3938) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectList(SqlToRelConverter.java:3327) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:609) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:564) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:2741) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:522) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.prepare.PlannerImpl.convert(PlannerImpl.java:198) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRel(DefaultSqlHandler.java:448) ~[drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert(DefaultSqlHandler.java:191) ~[drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:157) ~[drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:178) ~[drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:903) [drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:242) [drill-java-exec-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
        ... 3 common frames omitted
Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Window 't1.w' not found
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_71]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[na:1.7.0_71]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.7.0_71]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526) ~[na:1.7.0_71]
        at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:348) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:457) ~[calcite-core-1.1.0-drill-r9.jar:1.1.0-drill-r9]
        ... 23 common frames omitted
{code}



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