Hi Luca,
Currently Drill supports the same way MongoDB inserts Json records,
which is each Json object is seperated by newlines,
{ "type": "Feature", "geometry".....}
{ "type": "Feature", "geometry".....}
It's possible we can extend our options like MongoDB does
(http://zaiste.net/2012/08/importing_json_into_mongodb/)
either expecting it in a array or comma seperated and read the json
files through some added options.
I see Yash already filed a JIRA, feel free to contribute as well.
Thanks!
Tim
On Sat, Aug 9, 2014 at 9:51 PM, Luca Morandini <lmorandini@ieee.org> wrote:
> I put Drill to the test on GeoJSON data (GeoJSON is, as the name implies, a
> way to serialize geo-spatial data in JSON, see an example at the end of this
> post), but found an issue.
>
> The trouble is that geometry features are held in a vector, which is where
> all the selection should happen, but how I have to figure out how to do it.
>
> I tried this statement:
> select t.features.properties.name from
> dfs.`/opt/drill/sample-data/geo2.json` t;
>
> but...
> Query failed: Failure while running fragment.
> org.apache.drill.exec.vector.complex.RepeatedMapVector cannot be cast to
> org.apache.drill.exec.vector.complex.MapVector
> [4098f044-ebba-4ca4-8bec-c8b2760dd2ec]
>
> Error: exception while executing query: Failure while trying to get next
> result batch. (state=,code=0)
>
> While, specifying the vector index works as expected:
> select t.features[0].properties.name from
> dfs.`/opt/drill/sample-data/geo2.json` t;
>
> Help appreciated,
>
> Luca Morandini
> Data Architect - AURIN project
> Melbourne eResearch Group
> Department of Computing and Information Systems
> University of Melbourne
> Tel. +61 03 903 58 380
> Skype: lmorandini
>
> {
> "type": "FeatureCollection",
> "features": [
> { "type": "Feature",
> "geometry": {"type": "Point", "coordinates": [-75.343, 39.984]},
> "properties": {
> "name": "Location A",
> "category": "Store"
> }
> },
> { "type": "Feature",
> "geometry": {"type": "Point", "coordinates": [-75.833, 39.284]},
> "properties": {
> "name": "Location B",
> "category": "House"
> }
> },
> { "type": "Feature",
> "geometry": {"type": "Point", "coordinates": [ -75.534, 39.123]},
> "properties": {
> "name": "Location C",
> "category": "Office"
> }
> }
> ]
> }
>
|