[ 
https://issues.apache.org/jira/browse/DRILL-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rahul Challapalli closed DRILL-1748.
------------------------------------

Verified and re-organized the below testcases

Functional/Passing/json_kvgenflatten/convert/convert_json_text8.q
Functional/Passing/json_kvgenflatten/convert/convert_json_text4.q

> Using convert_from (JSON) on top of text files and selecting multiple columns 
> results in a plan error
> -----------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-1748
>                 URL: https://issues.apache.org/jira/browse/DRILL-1748
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill, Query Planning & Optimization, 
> Storage - JSON
>            Reporter: Rahul Challapalli
>            Assignee: Mehant Baid
>             Fix For: 0.7.0
>
>         Attachments: DRILL-1748.patch
>
>
> git.commit.id.abbrev=108d29f
> Dataset :
> {code}
> 1|{"a":"b"}
> {code}
> The below query runs fine and returns the expected results
> {code}
> 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          |
> +------------+
> {code}
> However the below query fails with a planning issue
> {code}
> select columns[0] , convert_from(columns[1], 'JSON') from `convert.tbl`;
> {code}
> Error from the logs :
> {code}
> 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]
> {code}



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

Reply via email to