@@ -1328,25 +1328,59 @@ private static Stream<Arguments> geospatialPredicateParameters() {
13281328 GeospatialBound max = GeospatialBound .createXY (3.0 , 4.0 );
13291329 BoundingBox bbox = new BoundingBox (min , max );
13301330
1331+ GeospatialBound minXYZ = GeospatialBound .createXYZ (1.0 , 2.0 , 3.0 );
1332+ GeospatialBound maxXYZ = GeospatialBound .createXYZ (3.0 , 4.0 , 5.0 );
1333+ BoundingBox bboxXYZ = new BoundingBox (minXYZ , maxXYZ );
1334+
1335+ GeospatialBound minXYM = GeospatialBound .createXYM (1.0 , 2.0 , 3.0 );
1336+ GeospatialBound maxXYM = GeospatialBound .createXYM (3.0 , 4.0 , 5.0 );
1337+ BoundingBox bboxXYM = new BoundingBox (minXYM , maxXYM );
1338+
1339+ GeospatialBound minXYZM = GeospatialBound .createXYZM (1.0 , 2.0 , 3.0 , 4.0 );
1340+ GeospatialBound maxXYZM = GeospatialBound .createXYZM (3.0 , 4.0 , 5.0 , 6.0 );
1341+ BoundingBox bboxXYZM = new BoundingBox (minXYZM , maxXYZM );
1342+
13311343 return Stream .of (
13321344 Arguments .of (
1333- Expressions .stIntersects ("geometry" , bbox ), "st_intersects(geometry, (boundingbox))" ),
1345+ Expressions .stIntersects ("geometry" , bbox ),
1346+ "st_intersects(geometry, (boundingbox-xy))" ,
1347+ "(boundingbox-xy)" ),
1348+ Arguments .of (
1349+ Expressions .stIntersects ("geography" , bbox ),
1350+ "st_intersects(geography, (boundingbox-xy))" ,
1351+ "(boundingbox-xy)" ),
1352+ Arguments .of (
1353+ Expressions .stDisjoint ("geometry" , bbox ),
1354+ "st_disjoint(geometry, (boundingbox-xy))" ,
1355+ "(boundingbox-xy)" ),
1356+ Arguments .of (
1357+ Expressions .stDisjoint ("geography" , bbox ),
1358+ "st_disjoint(geography, (boundingbox-xy))" ,
1359+ "(boundingbox-xy)" ),
13341360 Arguments .of (
1335- Expressions .stIntersects ("geography" , bbox ), "st_intersects(geography, (boundingbox))" ),
1361+ Expressions .stIntersects ("geometry" , bboxXYZ ),
1362+ "st_intersects(geometry, (boundingbox-xyz))" ,
1363+ "(boundingbox-xyz)" ),
13361364 Arguments .of (
1337- Expressions .stDisjoint ("geometry" , bbox ), "st_disjoint(geometry, (boundingbox))" ),
1365+ Expressions .stIntersects ("geometry" , bboxXYM ),
1366+ "st_intersects(geometry, (boundingbox-xym))" ,
1367+ "(boundingbox-xym)" ),
13381368 Arguments .of (
1339- Expressions .stDisjoint ("geography" , bbox ), "st_disjoint(geography, (boundingbox))" ));
1369+ Expressions .stIntersects ("geometry" , bboxXYZM ),
1370+ "st_intersects(geometry, (boundingbox-xyzm))" ,
1371+ "(boundingbox-xyzm)" ));
13401372 }
13411373
13421374 @ ParameterizedTest
13431375 @ MethodSource ("geospatialPredicateParameters" )
13441376 public void testSanitizeGeospatialPredicates (
1345- UnboundPredicate <ByteBuffer > geoPredicate , String expectedSanitizedString ) {
1377+ UnboundPredicate <ByteBuffer > geoPredicate ,
1378+ String expectedSanitizedString ,
1379+ String expectedLiteral ) {
13461380 Expression .Operation operation = geoPredicate .op ();
13471381 String columnName = geoPredicate .term ().ref ().name ();
13481382
1349- Expression predicateSanitized = Expressions .predicate (operation , columnName , "(boundingbox)" );
1383+ Expression predicateSanitized = Expressions .predicate (operation , columnName , expectedLiteral );
13501384 assertEquals (predicateSanitized , ExpressionUtil .sanitize (geoPredicate ));
13511385 assertEquals (predicateSanitized , ExpressionUtil .sanitize (STRUCT , geoPredicate , true ));
13521386
0 commit comments