Krystal created DRILL-1302:
------------------------------

             Summary: Order by using table.col in subquery fails with 
ArrayIndexOutOfBoundsException 
                 Key: DRILL-1302
                 URL: https://issues.apache.org/jira/browse/DRILL-1302
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
            Reporter: Krystal


git.commit.id.abbrev=687b9b0

The following query runs successfully:
select cast(student.name as varchar(30)) name, cast(voter.registration as 
varchar(20)) registration from voter full outer join student on (student.name = 
voter.name) where student.age < 20 order by student.name;

If I put the above query in a sub-select, it fails:
0: jdbc:drill:schema=dfs> select tbl.name, tbl.registration from (select 
cast(student.name as varchar(30)) name, cast(voter.registration as varchar(20)) 
registration from `dfs`.`default`.`./voter` voter full outer join 
`dfs`.`default`.`./student` student on (student.name = voter.name) where 
student.age < 20 order by student.name) tbl;
Query failed: Failure while parsing sql. -1 
[fe42e70f-cf5b-4389-b879-5b1598ab887f]

Error: exception while executing query: Failure while trying to get next result 
batch. (state=,code=0)

If I change the query using "order by name" without specifying the student 
table, the query runs fine:
0: jdbc:drill:schema=dfs> select tbl.name, tbl.registration from (select 
cast(student.name as varchar(30)) name, cast(voter.registration as varchar(20)) 
registration from `dfs`.`default`.`./voter` voter full outer join 
`dfs`.`default`.`./student` student on (student.name = voter.name) where 
student.age < 20 order by student.name) tbl;

The student.name in the order by clause should work.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to