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/ )
>

Reply via email to