Geo Spatial Query in Druid SQL

Hi expert,

Can we do Geo-Spatial Query on Druid SQL? and how can we call it from spark for distributed cluster?

Thanks

Jitesh

Hey Jitesh,

Spatial filters aren’t added to Druid SQL yet. Do you have a suggestion on how you’d like to be able to use it in SQL syntax?

Hi Gian,

Thank you for your reply.

Usually, I use polygon query most of the time. In the polygon, we use abscissa and ordinate in Druid.

The query may be like :

select uid, time, coordinates from dataSource where abscissa IN (51.516354735680686, 51.51629917214027, 51.5161346171923, 51.51586739572348, 51.51550777859951) and ordinate IN ( -0.1593655, -0.15845899526373644, -0.157587333419949, -0.15678401739010359, -0.15607992179697625)

It should work in Sub-Query and Nested Query.

Thanks,

Jitesh

Hmm, I think the syntax would have to involve your geo column (coordinates?) in the filter, since otherwise we don’t know what column to apply abscissa/ordinate to. Maybe it could be one mega-function like SPATIAL_FILTER_POLYGON(coordinates, other-stuff). Would you mind raising a github issue with these ideas? After https://github.com/druid-io/druid/pull/4360 is merged it should be easier to add more functions like this.