[ https://issues.apache.org/jira/browse/DRILL-1660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hanifi Gunes reassigned DRILL-1660: ----------------------------------- Assignee: Hanifi Gunes (was: Parth Chandra) > JSON : selecting from an array of empty, null maps results in an exception > -------------------------------------------------------------------------- > > Key: DRILL-1660 > URL: https://issues.apache.org/jira/browse/DRILL-1660 > Project: Apache Drill > Issue Type: Bug > Components: Storage - JSON > Reporter: Rahul Challapalli > Assignee: Hanifi Gunes > Fix For: 0.7.0 > > Attachments: DRILL-1660.1.patch.txt, DRILL-1660.2.patch.txt, error.log > > > git.commit.id.abbrev=60aa446 > I ran the below test against the branch from Jason's github fork which has > some patches for bugs related to flatten which are not yet merged into the > master. > Dataset 1 : > {code} > { > "id":1, > "evnts":[ > {}, > {"key":null} > ] > } > {code} > Queries : > {code} > 0: jdbc:drill:schema=dfs.drillTestDir> select id, evnts from > `json_kvgenflatten/empty-null-map.json`; > +------------+------------+ > | id | evnts | > +------------+------------+ > java.lang.IndexOutOfBoundsException: DrillBuf(ridx: 0, widx: 0, cap: 0/0, > unwrapped: DrillBuf(ridx: 0, widx: 17, cap: 17/17, unwrapped: DrillBuf(ridx: > 103, widx: 103, cap: 103/103, unwrapped: > UnsafeDirectLittleEndian(PooledUnsafeDirectByteBuf(ridx: 0, widx: 0, cap: > 103/103))))).slice(0, 8) > at io.netty.buffer.DrillBuf.<init>(DrillBuf.java:94) > at io.netty.buffer.DrillBuf.slice(DrillBuf.java:293) > at org.apache.drill.exec.vector.UInt4Vector.load(UInt4Vector.java:179) > at > org.apache.drill.exec.vector.complex.RepeatedMapVector.load(RepeatedMapVector.java:417) > at > org.apache.drill.exec.record.RecordBatchLoader.load(RecordBatchLoader.java:91) > at org.apache.drill.jdbc.DrillCursor.next(DrillCursor.java:102) > at > net.hydromatic.avatica.AvaticaResultSet.next(AvaticaResultSet.java:187) > at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2503) > 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) > 0: jdbc:drill:schema=dfs.drillTestDir> select id, flatten(evnts) from > `json_kvgenflatten/empty-null-map.json`; > +------------+------------+ > | id | EXPR$1 | > +------------+------------+ > | 1 | {} | > | 1 | {} | > +------------+------------+ > 2 rows selected (0.193 seconds) > {code} > Dataset 2: > {code} > {"id":1,"evnts":[]} > {code} > Queries : > {code} > 0: jdbc:drill:schema=dfs.drillTestDir> select id, evnts from > `json_kvgenflatten/temp.json`; > +------------+------------+ > | id | evnts | > +------------+------------+ > | 1 | null | > +------------+------------+ > 1 row selected (0.12 seconds) > 0: jdbc:drill:schema=dfs.drillTestDir> select id, flatten(evnts) from > `json_kvgenflatten/temp.json`; > Query failed: Failure while running fragment., > org.apache.drill.exec.vector.NullableIntVector cannot be cast to > org.apache.drill.exec.vector.RepeatedVector [ > cb7dfdf1-1f48-4fa1-ac73-6ffbbba0e32a on qa-node191.qa.lab:31010 ] > Error: exception while executing query: Failure while executing query. > (state=,code=0) > {code} > Dataset 3: > {code} > {"id":1,"evnts":[{}]} > {code} > Queries : > {code} > 0: jdbc:drill:schema=dfs.drillTestDir> select id, evnts from > `json_kvgenflatten/temp1.json`; > +------------+------------+ > | id | evnts | > +------------+------------+ > java.lang.IndexOutOfBoundsException: DrillBuf(ridx: 0, widx: 0, cap: 0/0, > unwrapped: DrillBuf(ridx: 0, widx: 17, cap: 17/17, unwrapped: DrillBuf(ridx: > 103, widx: 103, cap: 103/103, unwrapped: > UnsafeDirectLittleEndian(PooledUnsafeDirectByteBuf(ridx: 0, widx: 0, cap: > 103/103))))).slice(0, 8) > at io.netty.buffer.DrillBuf.<init>(DrillBuf.java:94) > at io.netty.buffer.DrillBuf.slice(DrillBuf.java:293) > at org.apache.drill.exec.vector.UInt4Vector.load(UInt4Vector.java:179) > at > org.apache.drill.exec.vector.complex.RepeatedMapVector.load(RepeatedMapVector.java:417) > at > org.apache.drill.exec.record.RecordBatchLoader.load(RecordBatchLoader.java:91) > at org.apache.drill.jdbc.DrillCursor.next(DrillCursor.java:102) > at > net.hydromatic.avatica.AvaticaResultSet.next(AvaticaResultSet.java:187) > at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2503) > 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) > 0: jdbc:drill:schema=dfs.drillTestDir> select id, flatten(evnts) from > `json_kvgenflatten/temp1.json`; > +------------+------------+ > | id | EXPR$1 | > +------------+------------+ > | 1 | {} | > +------------+------------+ > 1 row selected (0.179 seconds) > {code} > I attached the error log for the first dataset. Let me know if you need > anything else -- This message was sent by Atlassian JIRA (v6.3.4#6332)