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

Using convert_from (JSON) on top of text files and selecting multiple columns results in a plan error

    XMLWordPrintableJSON

Details

    Description

      git.commit.id.abbrev=108d29f

      Dataset :

      1|{"a":"b"}
      

      The below query runs fine and returns the expected results

      select columns[0], columns[1] from `convert.tbl`;
      +------------+------------+
      |   EXPR$0   |   EXPR$1   |
      +------------+------------+
      | 1          | {"a":"b"}  |
      +------------+------------+
      
      select convert_from(columns[1], 'JSON') from `convert.tbl`;
      +------------+
      |   EXPR$0   |
      +------------+
      | {"a":"b"}  |
      +------------+
      
      select columns[0] from `convert.tbl`;
      +------------+
      |   EXPR$0   |
      +------------+
      | 1          |
      +------------+
      

      However the below query fails with a planning issue

      select columns[0] , convert_from(columns[1], 'JSON') from `convert.tbl`;
      

      Error from the logs :

      java.lang.AssertionError: RexInputRef index 1 out of range 0..0
       	at org.eigenbase.rex.RexChecker.visitInputRef(RexChecker.java:113) ~[optiq-core-0.9-drill-r8.jar:na]
       	at org.eigenbase.rex.RexChecker.visitInputRef(RexChecker.java:55) ~[optiq-core-0.9-drill-r8.jar:na]
       	at org.eigenbase.rex.RexInputRef.accept(RexInputRef.java:103) ~[optiq-core-0.9-drill-r8.jar:na]
       	at org.eigenbase.rel.ProjectRelBase.isValid(ProjectRelBase.java:156) ~[optiq-core-0.9-drill-r8.jar:na]
       	at org.eigenbase.rel.ProjectRelBase.<init>(ProjectRelBase.java:82) ~[optiq-core-0.9-drill-r8.jar:na]
       	at org.apache.drill.exec.planner.common.DrillProjectRelBase.<init>(DrillProjectRelBase.java:53) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.physical.ProjectPrel.<init>(ProjectPrel.java:43) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.physical.visitor.SplitUpComplexExpressions.visitProject(SplitUpComplexExpressions.java:135) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.physical.visitor.SplitUpComplexExpressions.visitProject(SplitUpComplexExpressions.java:58) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.physical.ProjectPrel.accept(ProjectPrel.java:69) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.physical.visitor.SplitUpComplexExpressions.visitPrel(SplitUpComplexExpressions.java:75) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.physical.visitor.SplitUpComplexExpressions.visitPrel(SplitUpComplexExpressions.java:58) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.physical.visitor.BasePrelVisitor.visitScreen(BasePrelVisitor.java:53) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.physical.ScreenPrel.accept(ScreenPrel.java:64) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToPrel(DefaultSqlHandler.java:203) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:136) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:132) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:385) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:204) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at org.apache.drill.exec.work.WorkManager$RunnableWrapper.run(WorkManager.java:249) [drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
       	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_51]
       	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_51]
       	at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51]
      

      Attachments

        1. DRILL-1748.patch
          3 kB
          Mehant Baid

        Activity

          People

            mehant Mehant Baid
            rkins Rahul Kumar Challapalli
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: