Esri / spatial-framework-for-hadoop

The Spatial Framework for Hadoop allows developers and data scientists to use the Hadoop data processing system for spatial data analysis.
Apache License 2.0
369 stars 159 forks source link

More examples of how to use the JSON object inside of Hive? #167

Closed kylesorlietitlow closed 4 years ago

kylesorlietitlow commented 5 years ago

Could you provide some more sample queries inside of Hive that use the JSON object you describe/create on the "Hive JSON SerDe" page? Perhaps showing how it interacts with the UDF's. Thank you!

randallwhitman commented 5 years ago

Have you seen some or all of -

kylesorlietitlow commented 5 years ago

I was able to replicate the sample query from the demo:

SELECT counties.name, count(*) cnt FROM counties JOIN earthquakes WHERE ST_Contains(counties.boundaryshape, ST_Point(earthquakes.longitude, earthquakes.latitude)) GROUP BY counties.name ORDER BY cnt desc;

However, I am having trouble creating any other type of query. For instance, I want to do a query akin to getting all of the earthquakes inside of the polygon (reversing the SELET and JOIN tables from the query above) and it fails.

SELECT * FROM earthquakes JOIN counties WHERE ST_Contains(counties.boundaryshape, ST_Point(earthquakes.longitude, earthquakes.latitude));

It would be helpful to have more examples of spatial queries and joins that use the geometry attribute of the "counties" dataset.

randallwhitman commented 5 years ago

For me both those queries work OK on Spark-SQL-2.4 What error message? Which versions of Spatial-Framework-for-Hadoop, Hive, and Hadoop?