Skip to content

Commit b25c207

Browse files
committed
Use GeoTileBoundedPredicate for geotile bounds filtering
1 parent 3e760a2 commit b25c207

File tree

9 files changed

+114
-104
lines changed

9 files changed

+114
-104
lines changed

server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileBoundedPredicate.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public GeoTileBoundedPredicate(int precision, GeoBoundingBox bbox) {
5656
}
5757
}
5858

59+
public int precision() {
60+
return precision;
61+
}
62+
5963
/** Does the provided bounds crosses the dateline */
6064
public boolean crossesDateline() {
6165
return crossesDateline;

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ FROM airports
277277
;
278278

279279
count:long | centroid:geo_point | geotile:keyword
280-
36 | POINT (6.52789649553597 48.36977661703713) | 3/4/2
281-
5 | POINT (6.707012789323926 37.031419202685356) | 3/4/3
280+
100 | POINT (18.10569669920951 50.40505832391791) | 3/4/2
281+
79 | POINT (24.516750878736943 23.93036561181085) | 3/4/3
282282
;
283283

284284
gridGeotileStatsByWhereUK
@@ -304,7 +304,7 @@ required_capability: spatial_grid
304304

305305
FROM airports
306306
| EVAL bounds = ST_ENVELOPE(TO_GEOSHAPE("POLYGON((1.2305 60.8449, -1.582 61.6899, -10.7227 58.4017, -7.1191 55.3291, -7.9102 54.2139, -5.4492 54.0078, -5.2734 52.3756, -7.8223 49.6676, -5.0977 49.2678, 0.9668 50.5134, 2.5488 52.1065, 2.6367 54.0078, -0.9668 56.4625, 1.2305 60.8449))"))
307-
| EVAL geotile = ST_GEOTILE(location, 2, bounds)
307+
| EVAL geotile = ST_GEOTILE(location, 4, bounds)
308308
| WHERE geotile IS NOT NULL
309309
| STATS
310310
count = COUNT(location),
@@ -314,8 +314,10 @@ FROM airports
314314
;
315315

316316
count:long | centroid:geo_point | geotile:keyword
317-
20 | POINT (-3.3905635555274785 54.08363554766402) | 2/1/1
318-
1 | POINT (0.15865350142121315 49.36166098807007) | 2/2/1
317+
56 | POINT (10.54233039047436 47.85997457644304) | 4/8/5
318+
18 | POINT (-3.5578574100509286 51.27018998377025) | 4/7/5
319+
11 | POINT (14.310833624648778 59.85619530801407) | 4/8/4
320+
7 | POINT (-6.466632609122565 59.19681839378817) | 4/7/4
319321
;
320322

321323
gridGeotileInStatsBy

x-pack/plugin/esql/src/main/generated/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotileFromFieldAndFieldAndLiteralEvaluator.java

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/generated/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotileFromFieldAndLiteralAndLiteralEvaluator.java

Lines changed: 10 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/generated/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotileFromFieldDocValuesAndFieldAndLiteralEvaluator.java

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/generated/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StGeotileFromFieldDocValuesAndLiteralAndLiteralEvaluator.java

Lines changed: 10 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)