Kontinuation commented on code in PR #14101:
URL: https://github.com/apache/iceberg/pull/14101#discussion_r2757945323
##########
api/src/test/java/org/apache/iceberg/expressions/TestExpressionBinding.java:
##########
@@ -509,4 +513,38 @@ public void testIsNullWithNestedStructs(List<Boolean>
requiredFields, Expression
TestHelpers.assertAllReferencesBound("NotNull", bound);
assertThat(bound.op()).isEqualTo(expression.negate().op());
}
+
+ @Test
+ public void testStIntersects() {
+ // 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);
+
+ Expression expr = Expressions.stIntersects("point", bbox);
+ Expression bound = Binder.bind(STRUCT, expr);
+
+ TestHelpers.assertAllReferencesBound("ST_Intersects", bound);
+ BoundPredicate<?> pred = TestHelpers.assertAndUnwrap(bound);
+ assertThat(pred.op()).isEqualTo(Expression.Operation.ST_INTERSECTS);
+ assertThat(pred.term().ref().fieldId()).as("Should bind point
correctly").isEqualTo(7);
+
assertThat(pred.asLiteralPredicate().literal().value()).isEqualTo(bbox.toByteBuffer());
+ }
+
+ @Test
+ public void testStDisjoint() {
+ // 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);
+
+ Expression expr = Expressions.stDisjoint("geography", bbox);
Review Comment:
I have refactored testStIntersectsBinding and testStDisjointBinding to be
parameterized and test both geometry type and geography type.
##########
api/src/test/java/org/apache/iceberg/expressions/TestExpressionBinding.java:
##########
@@ -509,4 +513,38 @@ public void testIsNullWithNestedStructs(List<Boolean>
requiredFields, Expression
TestHelpers.assertAllReferencesBound("NotNull", bound);
assertThat(bound.op()).isEqualTo(expression.negate().op());
}
+
+ @Test
+ public void testStIntersects() {
+ // 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);
+
+ Expression expr = Expressions.stIntersects("point", bbox);
Review Comment:
I have refactored testStIntersectsBinding and testStDisjointBinding to be
parameterized and test both geometry type and geography type.
--
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]