@@ -1069,18 +1069,16 @@ public void testSpatialSort() {
10691069 assertEquals ("1:42: cannot sort on cartesian_shape" , error ("FROM countries_bbox_web | LIMIT 5 | sort shape" , countriesBboxWeb ));
10701070 for (String grid : new String [] { "geohash" , "geotile" , "geohex" }) {
10711071 String gridFunc = "ST_" + grid .toUpperCase (Locale .ROOT );
1072- String error = Build .current ().isSnapshot ()
1073- ? "1:" + (136 + grid .length ()) + ": cannot sort on " + grid
1074- : "1:95: Unknown function [" + gridFunc + "]" ;
1075- assertThat (grid , error (prefix + "| EVAL grid = " + gridFunc + "(TO_GEOPOINT(wkt),1) | limit 5 | sort grid" ), startsWith (error ));
1076- error = Build .current ().isSnapshot ()
1077- ? "1:" + (63 + grid .length ()) + ": cannot sort on " + grid
1078- : "1:39: Unknown function [" + gridFunc + "]" ;
1079- assertThat (
1080- grid ,
1081- error ("FROM airports | LIMIT 5 | EVAL grid = " + gridFunc + "(location, 1) | sort grid" , airports ),
1082- startsWith (error )
1083- );
1072+ String literalQuery = prefix + "| EVAL grid = " + gridFunc + "(TO_GEOPOINT(wkt),1) | limit 5 | sort grid" ;
1073+ String indexQuery = "FROM airports | LIMIT 5 | EVAL grid = " + gridFunc + "(location, 1) | sort grid" ;
1074+ String literalError = "1:" + (136 + grid .length ()) + ": cannot sort on " + grid ;
1075+ String indexError = "1:" + (63 + grid .length ()) + ": cannot sort on " + grid ;
1076+ if (EsqlCapabilities .Cap .SPATIAL_GRID_TYPES .isEnabled () == false ) {
1077+ literalError = "1:95: Unknown function [" + gridFunc + "]" ;
1078+ indexError = "1:39: Unknown function [" + gridFunc + "]" ;
1079+ }
1080+ assertThat (grid , error (literalQuery ), startsWith (literalError ));
1081+ assertThat (grid , error (indexQuery , airports ), startsWith (indexError ));
10841082 }
10851083 }
10861084
@@ -2077,7 +2075,7 @@ public void testChangePoint() {
20772075 public void testChangePoint_keySortable () {
20782076 assumeTrue ("change_point must be enabled" , EsqlCapabilities .Cap .CHANGE_POINT .isEnabled ());
20792077 List <DataType > sortableTypes = List .of (BOOLEAN , DOUBLE , DATE_NANOS , DATETIME , INTEGER , IP , KEYWORD , LONG , UNSIGNED_LONG , VERSION );
2080- List <DataType > unsortableTypes = Build . current (). isSnapshot ()
2078+ List <DataType > unsortableTypes = EsqlCapabilities . Cap . SPATIAL_GRID_TYPES . isEnabled ()
20812079 ? List .of (CARTESIAN_POINT , CARTESIAN_SHAPE , GEO_POINT , GEO_SHAPE , GEOHASH , GEOTILE , GEOHEX )
20822080 : List .of (CARTESIAN_POINT , CARTESIAN_SHAPE , GEO_POINT , GEO_SHAPE );
20832081 for (DataType type : sortableTypes ) {
@@ -2094,7 +2092,7 @@ public void testChangePoint_keySortable() {
20942092 public void testChangePoint_valueNumeric () {
20952093 assumeTrue ("change_point must be enabled" , EsqlCapabilities .Cap .CHANGE_POINT .isEnabled ());
20962094 List <DataType > numericTypes = List .of (DOUBLE , INTEGER , LONG , UNSIGNED_LONG );
2097- List <DataType > nonNumericTypes = Build . current (). isSnapshot ()
2095+ List <DataType > nonNumericTypes = EsqlCapabilities . Cap . SPATIAL_GRID_TYPES . isEnabled ()
20982096 ? List .of (
20992097 BOOLEAN ,
21002098 CARTESIAN_POINT ,
0 commit comments