Ok, now the query executes succesfully. But now the problem moved to flatten step.
Trying: select flatten(feature) from dfs.`tmp/1.json`; causes: Error: SYSTEM ERROR: SchemaChangeRuntimeException: Inner vector type mismatch. Requested type: [minor_type: BIGINT mode: OPTIONAL ], actual type: [minor_type: UNION mode: OPTIONAL sub_type: BIGINT sub_type: LIST ] Also it fails as before (unsupported operation) in udf where I'm using JsonReader and ComplexWriter to read json from string. Thank you for your support. On Fri, Feb 12, 2016 at 6:10 PM, Jinfeng Ni <[email protected]> wrote: > For such use case, you need to turn on union vector type support > (https://issues.apache.org/jira/browse/DRILL-3229) > > > 0: jdbc:drill:zk=local> alter session set `exec.enable_union_type` = true; > +-------+----------------------------------+ > | ok | summary | > +-------+----------------------------------+ > | true | exec.enable_union_type updated. | > +-------+----------------------------------+ > 1 row selected (0.093 seconds) > 0: jdbc:drill:zk=local> select * from dfs.`/tmp/1.json`; > +----------------------------------------+ > | feature | > +----------------------------------------+ > | [{"foo":[1,2]},{"foo":[[1,2],[1,2]]}] | > +----------------------------------------+ > > On Fri, Feb 12, 2016 at 3:07 AM, Karol Potocki <[email protected]> wrote: > > There is a problem querying json files with structure like below: > > > > { > > "feature": [ > > { "foo": [1, 2] }, > > { "foo": [[1, 2], [1, 2]] } > > ] > > } > > > > it fails with: > > Error: UNSUPPORTED_OPERATION ERROR: In a list of type BIGINT, encountered a > > value of type LIST. Drill does not support lists of different types. > > > > File /home/kap/bigdata/test2.json > > Record 1 > > Line 4 > > Column 16 > > Field foo > > Line 4 > > Column 16 > > Field foo > > Fragment 0:0 > > > > [Error Id: 549fd777-0cad-4728-af53-9fa988e53d00 on lpoz0775:31010] > > (state=,code=0) > > > > > > Such structures often exists in geojson files which contains geometries of > > different types i.e. Polygon and MultiPolygon: > > > > { > > "type": "GeometryCollection", > > "geometries": > > [ > > { "type": "Polygon", > > "coordinates": [ > > [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] > > ] > > }, > > { "type": "MultiPolygon", > > "coordinates": [ > > [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], > > [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], > > [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] > > ] > > } > > ] > > } > > > > ( which renders to: > > http://bl.ocks.org/anonymous/raw/b18e661defbb26df903b/[http://bl.ocks.org/anonymous/raw/b18e661defbb26df903b/][http://bl.ocks.org/anonymous/raw/b18e661defbb26df903b/[http://bl.ocks.org/anonymous/raw/b18e661defbb26df903b/]] > > ) > >
