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

Query with unnest of column from nested subquery fails

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.15.0
    • Component/s: None
    • Labels:

      Description

      This query:

      select t2.o from (select * from cp.`lateraljoin/nested-customer.json` limit 1) t, unnest(t.orders) t2(o)
      

      fails with error:

      org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: AssertionError
      
      
      [Error Id: 6868e327-ab2c-44a2-ab0c-cf30f4a64349 on user515050-pc:31010]
      	at org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:633) ~[classes/:na]
      	at org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:761) [classes/:na]
      	at org.apache.drill.exec.work.foreman.QueryStateProcessor.checkCommonStates(QueryStateProcessor.java:325) [classes/:na]
      	at org.apache.drill.exec.work.foreman.QueryStateProcessor.planning(QueryStateProcessor.java:221) [classes/:na]
      	at org.apache.drill.exec.work.foreman.QueryStateProcessor.moveToState(QueryStateProcessor.java:83) [classes/:na]
      	at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:293) [classes/:na]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_181]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_181]
      	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
      Caused by: org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception during fragment initialization: null
      	at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:294) [classes/:na]
      	... 3 common frames omitted
      Caused by: java.lang.AssertionError: null
      	at org.apache.calcite.sql.SqlUnnestOperator.inferReturnType(SqlUnnestOperator.java:80) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.SqlOperator.validateOperands(SqlOperator.java:437) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.UnnestNamespace.validateImpl(UnnestNamespace.java:67) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:947) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:928) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:2975) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.drill.exec.planner.sql.SqlConverter$DrillValidator.validateFrom(SqlConverter.java:273) ~[classes/:na]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:2960) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.drill.exec.planner.sql.SqlConverter$DrillValidator.validateFrom(SqlConverter.java:273) ~[classes/:na]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateJoin(SqlValidatorImpl.java:3012) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:2969) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.drill.exec.planner.sql.SqlConverter$DrillValidator.validateFrom(SqlConverter.java:273) ~[classes/:na]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3219) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:947) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:928) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:226) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:903) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:613) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.drill.exec.planner.sql.SqlConverter.validate(SqlConverter.java:191) ~[classes/:na]
      	at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateNode(DefaultSqlHandler.java:648) ~[classes/:na]
      	at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert(DefaultSqlHandler.java:204) ~[classes/:na]
      	at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:176) ~[classes/:na]
      	at org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan(DrillSqlWorker.java:145) ~[classes/:na]
      	at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:83) ~[classes/:na]
      	at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:567) [classes/:na]
      	at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:266) [classes/:na]
      	... 3 common frames omitted
      20:23:14.516 [main] ERROR org.apache.drill.TestReporter - Test Failed (d: 0 B(1 B), h: -148.1 MiB(49.6 MiB), nh: 3.5 MiB(62.6 MiB)): testMultipleBatchesLateral_WithStreamingAggNoGroup(org.apache.drill.exec.physical.impl.lateraljoin.TestE2EUnnestAndLateral)
      org.apache.drill.exec.rpc.RpcException: org.apache.drill.common.exceptions.UserRemoteException: SYSTEM ERROR: AssertionError
      

      The problem is in Calcite: (CALCITE-2422)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vvysotskyi Volodymyr Vysotskyi
                Reporter:
                vvysotskyi Volodymyr Vysotskyi
                Reviewer:
                Sorabh Hamirwasia
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: