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

Rahul Challapalli commented on DRILL-1608:
------------------------------------------

Looks like the no of records in the json document matters. This error did not 
happen when my json file has odd no of records

Neeraja, 
Can you check if you have an even no of records? If so add one more record and 
run the query without the limit.

- Rahul

> Unable to use flatten without limit 
> ------------------------------------
>
>                 Key: DRILL-1608
>                 URL: https://issues.apache.org/jira/browse/DRILL-1608
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Neeraja
>            Assignee: Jason Altekruse
>             Fix For: 0.7.0
>
>
> Unable to use flatten without limit.
> 0: jdbc:drill:zk=local> select flatten(children) as f from 
> dfs.`/Users/nrentachintala/Downloads/drillreleases/apache-drill-0.7.0-incubating-SNAPSHOT/sample-data/test.json`;
> +------------+------------+
> |     f      |     f      |
> +------------+------------+
> java.lang.RuntimeException: java.sql.SQLException: invalid column ordinal: 2
>       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)
> Applying explicit limit works fine as well as including it as part of a 
> subquery works fine.
> 0: jdbc:drill:zk=local> select flatten(children) as f from 
> dfs.`/Users/nrentachintala/Downloads/drillreleases/apache-drill-0.7.0-incubating-SNAPSHOT/sample-data/test.json`
>  limit 6;
> +------------+
> |     f      |
> +------------+
> | {"name":"Jane","gender":"Female","age":"6"} |
> | {"name":"John","gender":"Male","age":"15"} |
> | {"name":"Earl","gender":"Male","age":"10"} |
> | {"name":"Sam","gender":"Male","age":"6"} |
> | {"name":"Kit","gender":"Male","age":"8"} |
> +------------+
> 0: jdbc:drill:zk=local> select c.f.name, c.f.gender,c.f.age from 
> . . . . . . . . . . . > (select flatten(children) as f from 
> dfs.`/Users/nrentachintala/Downloads/drillreleases/apache-drill-0.7.0-incubating-SNAPSHOT/sample-data/test.json`)
>  c;
> +------------+------------+------------+
> |   EXPR$0   |   EXPR$1   |   EXPR$2   |
> +------------+------------+------------+
> | Jane       | Female     | 6          |
> | John       | Male       | 15         |
> | Earl       | Male       | 10         |
> | Sam        | Male       | 6          |
> | Kit        | Male       | 8          |
> +------------+------------+------------+



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

Reply via email to