Kontinuation commented on code in PR #14101:
URL: https://github.com/apache/iceberg/pull/14101#discussion_r2635235420


##########
api/src/test/java/org/apache/iceberg/expressions/TestExpressionUtil.java:
##########
@@ -1315,6 +1322,48 @@ private static VariantArray createArrayWithNestedTypes() 
{
     return (VariantArray) VariantValue.from(metadata, variantBB);
   }
 
+  private static Stream<Arguments> geospatialPredicateParameters() {
+    return Stream.of(
+        Arguments.of(Expression.Operation.ST_INTERSECTS, "geom"),
+        Arguments.of(Expression.Operation.ST_INTERSECTS, "geog"),
+        Arguments.of(Expression.Operation.ST_DISJOINT, "geom"),
+        Arguments.of(Expression.Operation.ST_DISJOINT, "geog"));
+  }
+
+  @ParameterizedTest
+  @MethodSource("geospatialPredicateParameters")
+  public void testSanitizeGeospatialPredicates(Expression.Operation operation, 
String columnName) {
+    // Create a schema with geometry and geography fields
+    Schema geoSchema =
+        new Schema(
+            Types.NestedField.required(1, "geom", Types.GeometryType.crs84()),
+            Types.NestedField.required(2, "geog", 
Types.GeographyType.crs84()));
+    Types.StructType geoStruct = geoSchema.asStruct();
+
+    // Create a bounding box for testing
+    GeospatialBound min = GeospatialBound.createXY(1.0, 2.0);
+    GeospatialBound max = GeospatialBound.createXY(3.0, 4.0);
+    BoundingBox bbox = new BoundingBox(min, max);
+
+    UnboundPredicate<ByteBuffer> geoPredicate =
+        Expressions.geospatialPredicate(operation, columnName, bbox);
+    Expression predicateSanitized = Expressions.predicate(operation, 
columnName, "(boundingbox)");

Review Comment:
   Updated the patch to produce sanitized string such as `(boundingbox-xy)`, 
`(boundingbox-xyz)`, etc.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to