drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aman Sinha (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-1302) Order by using table.col in subquery fails with ArrayIndexOutOfBoundsException
Date Wed, 20 Aug 2014 18:52:39 GMT

    [ https://issues.apache.org/jira/browse/DRILL-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14104336#comment-14104336
] 

Aman Sinha commented on DRILL-1302:
-----------------------------------

Here's a simplified query to repro the same issue: 
{code:sql}
   select x.n_name from
     (select nation.n_name from cp.`tpch/nation.parquet` nation 
        order by nation.n_regionkey) x
{code}
Note that the main characteristic is the subquery does an order-by on a column that is NOT
in the select list.  In such cases, the output stream of the subquery should not have a collation
trait.  By trying to create a collation trait on a non-existent column, Optiq runs into the
IOBE. 

I would have expected a similar query to fail if run directly within Optiq .. however it passes
if I run a unit test within Optiq.   This seems to be caused by how the 'PRESERVE' collation
trait gets handled.   Comparing the 2 runs  - one of Drill and one of just Optiq only - it
seems that within convertOrder() method in SqlToRelConverter,  the ProjectRel that is created
has the PRESERVE collation trait in the Drill run but it has empty trait in the Optiq run...thus
essentially ignoring the PRESERVE trait.  Additional investigation is needed to determine
how to correctly process this trait. 

> 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
>            Assignee: Aman Sinha
>             Fix For: 0.5.0
>
>
> 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)

Mime
View raw message