Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-3348

NPE when two different window functions are used in projection list and order by clauses

    Details

      Description

      select 
              a1, 
              rank() over(partition by b1 order by a1) 
      from 
              t1 
      order by 
              row_number() over(partition by b1 order by a1);
      
      0: jdbc:drill:schema=dfs> select a1, rank() over(partition by b1 order by a1) from t1 order by row_number() over(partition by b1 order by a1);
      Error: SYSTEM ERROR: org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception during fragment initialization: null
      [Error Id: ba3e0fda-cc78-4650-a49b-51e4fd7d625d on atsqa4-133.qa.lab:31010] (state=,code=0)
      

      drillbit.log

      org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception during fragment initialization: null
      
      
      [Error Id: ba3e0fda-cc78-4650-a49b-51e4fd7d625d on atsqa4-133.qa.lab:31010]
              at org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:523) ~[drill-common-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
              at org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:738) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
              at org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:840) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
              at org.apache.drill.exec.work.foreman.Foreman$StateSwitch.processEvent(Foreman.java:782) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
              at org.apache.drill.common.EventProcessor.sendEvent(EventProcessor.java:73) [drill-common-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
              at org.apache.drill.exec.work.foreman.Foreman$StateSwitch.moveToState(Foreman.java:784) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
              at org.apache.drill.exec.work.foreman.Foreman.moveToState(Foreman.java:893) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
              at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:253) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.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: null
              ... 4 common frames omitted
      Caused by: java.lang.NullPointerException: null
              at org.apache.calcite.rex.RexBuilder.makeCast(RexBuilder.java:465) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.calcite.rex.RexBuilder.ensureType(RexBuilder.java:955) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.calcite.sql2rel.SqlToRelConverter.convertOver(SqlToRelConverter.java:1763) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.calcite.sql2rel.SqlToRelConverter.access$1000(SqlToRelConverter.java:180) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:3938) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectList(SqlToRelConverter.java:3327) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:609) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:564) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:2741) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:522) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.calcite.prepare.PlannerImpl.convert(PlannerImpl.java:198) ~[calcite-core-1.1.0-drill-r8.jar:1.1.0-drill-r8]
              at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRel(DefaultSqlHandler.java:448) ~[drill-java-exec-1.1.0-SNAPSHOT-rebuffed.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-rebuffed.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-rebuffed.jar:1.1.0-SNAPSHOT]
              at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:178) ~[drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
              at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:904) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
              at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:242) [drill-java-exec-1.1.0-SNAPSHOT-rebuffed.jar:1.1.0-SNAPSHOT]
              ... 3 common frames omitted
      

        Attachments

          Activity

            People

            • Assignee:
              seanhychu Sean Hsuan-Yi Chu
              Reporter:
              vicky Victoria Markman
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: