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

Rahul Challapalli updated DRILL-2844:
-------------------------------------
    Attachment: data.json
                error.log

> Flatten & order by on an inner query and outer query results in an 
> IllegalStateException
> ----------------------------------------------------------------------------------------
>
>                 Key: DRILL-2844
>                 URL: https://issues.apache.org/jira/browse/DRILL-2844
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Relational Operators
>            Reporter: Rahul Challapalli
>            Assignee: Mehant Baid
>         Attachments: data.json, error.log
>
>
> git.commit.id.abbrev=5cd36c5
> The below query fails :
> {code}
> select s1.type type, flatten(s1.rms.rptd) rptds from (select d.type type, 
> d.uid uid, flatten(d.map.rm) rms from `data.json` d order by d.uid) s1 order 
> by s1.rms.mapid;
> +------------+------------+
> |    type    |   rptds    |
> +------------+------------+
> Query failed: SYSTEM ERROR: Failure while reading vector.  Expected vector 
> class of org.apache.drill.exec.vector.NullableIntVector but was holding 
> vector class org.apache.drill.exec.vector.NullableVarCharVector.
> Fragment 0:0
> [0dc08a63-bf6e-4d68-b77d-b9d485110990 on qa-node190.qa.lab:31010]
> java.lang.RuntimeException: java.sql.SQLException: Failure while executing 
> query.
>       at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2514)
>       at sqlline.SqlLine$TableOutputFormat.print(SqlLine.java:2148)
>       at sqlline.SqlLine.print(SqlLine.java:1809)
>       at sqlline.SqlLine$Commands.execute(SqlLine.java:3766)
>       at sqlline.SqlLine$Commands.sql(SqlLine.java:3663)
>       at sqlline.SqlLine.dispatch(SqlLine.java:889)
>       at sqlline.SqlLine.begin(SqlLine.java:763)
>       at sqlline.SqlLine.start(SqlLine.java:498)
>       at sqlline.SqlLine.main(SqlLine.java:460)
> {code}
> The below variations work :
> {code}
> 1. Get rid of outer flatten : select s1.type type from (select d.type type, 
> d.uid uid, flatten(d.map.rm) rms from `data.json` d order by d.uid) s1 order 
> by s1.rms.mapid;
> 2. Get rid of the outer order by : select s1.type type, flatten(s1.rms.rptd) 
> rptds from (select d.type type, d.uid uid, flatten(d.map.rm) rms from 
> `data.json` d order by d.uid) s1;
> 3. Get rid of the inner order by : select s1.type type, flatten(s1.rms.rptd) 
> rptds from (select d.type type, d.uid uid, flatten(d.map.rm) rms from 
> `data.json` d) s1 order by s1.rms.mapid;
> {code}
> I attached the log file and data file. Let me know if you have any questions



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

Reply via email to