Skip to content

Commit 16072c8

Browse files
committed
Added geo_grid queries (no lucene pushdown)
1 parent fdedf0e commit 16072c8

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/spatial-grid.csv-spec

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,29 @@ count:long | centroid:geo_point | geohashString:keyw
177177
// end::st_geohash-grid-result[]
178178
;
179179

180+
gridGeohashQuery
181+
required_capability: spatial_grid
182+
183+
FROM airports
184+
| WHERE ST_GEOHASH(location, 1) == ST_GEOHASH_TO_LONG("7")
185+
| EVAL geohash = ST_GEOHASH(location, 2)
186+
| STATS
187+
count = COUNT(*),
188+
centroid = ST_CENTROID_AGG(location)
189+
BY geohash
190+
| EVAL geohashString = ST_GEOHASH_TO_STRING(geohash)
191+
| KEEP count, centroid, geohashString
192+
| SORT count DESC, geohashString ASC
193+
;
194+
195+
count:long | centroid:geo_point | geohashString:keyword
196+
4 | POINT (-35.22712387377396 -7.672965489327908) | 7n
197+
3 | POINT (-41.86607404612005 -3.8085224060341716) | 7p
198+
2 | POINT (-42.66381660941988 -22.868987743277103) | 75
199+
2 | POINT (-42.12605922482908 -19.945099228061736) | 7h
200+
1 | POINT (-38.3347990270704 -12.91436152998358) | 7j
201+
;
202+
180203
gridGeohashStatsByBounds
181204
required_capability: spatial_grid
182205

@@ -503,6 +526,26 @@ count:long | centroid:geo_point | geotileString:key
503526
// end::st_geotile-grid-result[]
504527
;
505528

529+
gridGeotileQuery
530+
required_capability: spatial_grid
531+
532+
FROM airports
533+
| WHERE ST_GEOTILE(location, 2) == ST_GEOTILE_TO_LONG("2/0/2")
534+
| EVAL geotile = ST_GEOTILE(location, 3)
535+
| STATS
536+
count = COUNT(*),
537+
centroid = ST_CENTROID_AGG(location)
538+
BY geotile
539+
| EVAL geotileString = ST_GEOTILE_TO_STRING(geotile)
540+
| SORT count DESC, geotileString ASC
541+
| KEEP count, centroid, geotileString
542+
;
543+
544+
count:long | centroid:geo_point | geotileString:keyword
545+
7 | POINT (-167.3069146488394 -17.976190628084755) | 3/0/4
546+
1 | POINT (-109.43006442859769 -27.15877384878695) | 3/1/4
547+
;
548+
506549
gridGeotileStatsByBounds
507550
required_capability: spatial_grid
508551

@@ -804,6 +847,30 @@ count:long | centroid:geo_point | geohexString:keywo
804847
// end::st_geohex-grid-result[]
805848
;
806849

850+
gridGeohexQuery
851+
required_capability: spatial_grid
852+
853+
FROM airports
854+
| WHERE ST_GEOHEX(location, 1) == ST_GEOHEX_TO_LONG("812bbffffffffff")
855+
| EVAL geohex = ST_GEOHEX(location, 2)
856+
| STATS
857+
count = COUNT(*),
858+
centroid = ST_CENTROID_AGG(location)
859+
BY geohex
860+
| EVAL geohexString = ST_GEOHEX_TO_STRING(geohex)
861+
| KEEP count, centroid, geohexString
862+
| SORT count DESC, geohexString ASC
863+
;
864+
865+
count:long | centroid:geo_point | geohexString:keyword
866+
3 | POINT (-74.35916994698346 43.44888433814049) | 822b8ffffffffff
867+
2 | POINT (-74.84681587200612 45.50167993409559) | 822b87fffffffff
868+
2 | POINT (-80.11034240014851 46.490730887744576) | 822b97fffffffff
869+
2 | POINT (-78.6383319273591 43.40425574686378) | 822b9ffffffffff
870+
2 | POINT (-72.56662221159786 46.1249598255381) | 822baffffffffff
871+
1 | POINT (-81.37204706668854 48.56615798547864) | 820ecffffffffff
872+
;
873+
807874
gridGeohexStatsByBounds
808875
required_capability: spatial_grid
809876

0 commit comments

Comments
 (0)