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

Jinfeng Ni resolved DRILL-2777.
-------------------------------
    Resolution: Fixed

> CTAS, order by and flatten of repeated list result in ExpandConversionRule 
> error
> --------------------------------------------------------------------------------
>
>                 Key: DRILL-2777
>                 URL: https://issues.apache.org/jira/browse/DRILL-2777
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>            Reporter: Rahul Challapalli
>            Assignee: Jinfeng Ni
>             Fix For: 1.2.0
>
>         Attachments: data.json, error.log
>
>
> git.commit.id.abbrev=f066786
> The below query results in an error :
> {code}
> create table dfs.ctas_flatten.`test` as select uid, flatten(lst_lst) lst, 
> flatten(lst_lst[0]) from `data1.json` order by flatten(lst_lst[0]);
> Query failed: IndexOutOfBoundsException: index (2) must be less than size (2)
> Error: exception while executing query: Failure while executing query. 
> (state=,code=0)
> {code}
> The logs indicate an assertion error :
> {code}
>  Caused by: java.lang.AssertionError: Internal error: Error while applying 
> rule ExpandConversionRule, args 
> [rel#1757858:AbstractConverter.PHYSICAL.SINGLETON([]).[2](child=rel#1757856:Subset#8.PHYSICAL.ANY([]).[2],convention=PHYSICAL,DrillDistributionTraitDef=SINGLETON([]),sort=[2])]
> {code}
> The query itself does not have any issues. Also the below variants work :
> {code}
> 1. No flatten of repeated list in the select clause
> create table dfs.ctas_flatten.`test` as select uid, flatten(lst_lst[0]) from 
> `data1.json` order by flatten(lst_lst[0]);
> 2. Removing the flatten from the order by. (Ordering by a scalar has no 
> issues) 
> create table dfs.ctas_flatten.`test` as select uid, flatten(lst_lst) lst, 
> flatten(lst_lst[0]) from `data1.json`;
> {code}
> Attached the data set and the complete error log file



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

Reply via email to