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

Fix loss of the table row type when the same schema name was specified as single path and as a complex path in the same query

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.14.0
    • None

    Description

      Current Drill behavior is to threat schema with different combinations of quotes in the same way: `dfs.tmp`, dfs.tmp, `dfs`.`tmp`

      After the fix for DRILL-5089, table information is lost when these different combinations of schema paths were used.
      For example, query:

      create table `dfs.tmp`.t1 as select 1 as c1
      
      create table dfs.tmp.t2 as select 1 as c2
      
      create table dfs.tmp.`t3` as SELECT 1 as c2,1 as c1
      
      select a.c2 from dfs.tmp.`t2` a
      join  dfs.tmp.`t3` b ON b.c2 = a.c2
      join `dfs.tmp`.t1 c ON b.c1 = c.c1
      

      fails with error:

      14:49:24.508 [24ae33bb-41be-f9c2-c0f0-4d8901becf62:foreman] ERROR o.a.drill.exec.work.foreman.Foreman - SYSTEM ERROR: AssertionError: Field ordinal 1 is invalid for  type '(DrillRecordRow[**])'
      
      
      [Error Id: 52254f1e-eefb-4de7-b8bd-2adff296a799 on user515050-pc:31010]
      org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: AssertionError: Field ordinal 1 is invalid for  type '(DrillRecordRow[**])'
      
      
      [Error Id: 52254f1e-eefb-4de7-b8bd-2adff296a799 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_171]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_171]
      	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
      Caused by: org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception during fragment initialization: while converting `b`.`c1` = `a`.`c1`
      	at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:294) [classes/:na]
      	... 3 common frames omitted
      Caused by: java.lang.RuntimeException: while converting `b`.`c1` = `a`.`c1`
      	at org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:90) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlNodeToRexConverterImpl.java:63) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4656) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3994) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:138) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:4558) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertJoinCondition(SqlToRelConverter.java:2601) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertFrom(SqlToRelConverter.java:2048) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:643) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:624) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3058) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:560) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.drill.exec.planner.sql.SqlConverter.toRel(SqlConverter.java:383) ~[classes/:na]
      	at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRel(DefaultSqlHandler.java:665) ~[classes/:na]
      	at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert(DefaultSqlHandler.java:207) ~[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
      Caused by: java.lang.reflect.InvocationTargetException: null
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_171]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_171]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171]
      	at org.apache.calcite.sql2rel.ReflectiveConvertletTable$1.convertCall(ReflectiveConvertletTable.java:87) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	... 22 common frames omitted
      Caused by: java.lang.AssertionError: Field ordinal 1 is invalid for  type '(DrillRecordRow[**])'
      	at org.apache.calcite.rex.RexBuilder.makeFieldAccess(RexBuilder.java:195) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertIdentifier(SqlToRelConverter.java:3623) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter.access$2200(SqlToRelConverter.java:214) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4665) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3994) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:344) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:4558) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.StandardConvertletTable.convertExpressionList(StandardConvertletTable.java:857) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.StandardConvertletTable.convertCall(StandardConvertletTable.java:833) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	at org.apache.calcite.sql2rel.StandardConvertletTable.convertCall(StandardConvertletTable.java:817) ~[calcite-core-1.16.0-drill-r6.jar:1.16.0-drill-r6]
      	... 27 common frames omitted
      14:49:24.695 [main] ERROR org.apache.drill.TestReporter - Test Failed (d: 0 B(1 B), h: -113.8 MiB(71.7 MiB), nh: 18.9 MiB(77.6 MiB)): testLocal(org.apache.drill.exec.physical.impl.TestSchema)
      org.apache.drill.exec.rpc.RpcException: org.apache.drill.common.exceptions.UserRemoteException: SYSTEM ERROR: AssertionError: Field ordinal 1 is invalid for  type '(DrillRecordRow[**])'
      

      Attachments

        Issue Links

          Activity

            People

              volodymyr Vova Vysotskyi
              volodymyr Vova Vysotskyi
              Vitalii Diravka Vitalii Diravka
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: