Skip to content

Commit 33cd8ca

Browse files
committed
Fix failing tests
- ignore z-value in unit tests - and use capabilities to block new tests on older versions that do not have this fix
1 parent 4139c86 commit 33cd8ca

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/util/SpatialCoordinateTypes.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public long pointAsLong(double x, double y) {
3535
}
3636

3737
public GeometryValidator validator() {
38-
return GeographyValidator.instance(false);
38+
// We validate the lat/lon values, and ignore any z values
39+
return GeographyValidator.instance(true);
3940
}
4041
},
4142
CARTESIAN {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,6 +1790,7 @@ count:long
17901790

17911791
airportsDistanceLessThanInvalidPoint
17921792
required_capability: st_distance
1793+
required_capability: geo_validation
17931794

17941795
FROM airports
17951796
| EVAL distance = ST_DISTANCE(location, TO_GEOPOINT("POINT(-28.6359 153.5906)"))
@@ -1807,6 +1808,7 @@ count:l
18071808

18081809
airportsDistanceLessThanInvalidPoint2
18091810
required_capability: st_distance
1811+
required_capability: geo_validation
18101812

18111813
FROM airports
18121814
| EVAL distance = ST_DISTANCE(TO_GEOPOINT("POINT(-28.6359 153.5906)"), location)
@@ -1824,6 +1826,7 @@ count:l
18241826

18251827
airportsDistanceGreaterThanInvalidPoint
18261828
required_capability: st_distance
1829+
required_capability: geo_validation
18271830

18281831
FROM airports
18291832
| EVAL distance = ST_DISTANCE(location, TO_GEOPOINT("POINT(-28.6359 153.5906)"))
@@ -1841,6 +1844,7 @@ count:l
18411844

18421845
airportsDistanceGreaterThanInvalidPoint2
18431846
required_capability: st_distance
1847+
required_capability: geo_validation
18441848

18451849
FROM airports
18461850
| EVAL distance = ST_DISTANCE(TO_GEOPOINT("POINT(-28.6359 153.5906)"), location)

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ public enum Cap {
5555
*/
5656
SPATIAL_SHAPES,
5757

58+
/**
59+
* Do validation check on geo_point and geo_shape fields. Done in #128259.
60+
*/
61+
GEO_VALIDATION,
62+
5863
/**
5964
* Support for spatial aggregation {@code ST_CENTROID}. Done in #104269.
6065
*/

0 commit comments

Comments
 (0)