Copilot commented on code in PR #2930:
URL: https://github.com/apache/sedona/pull/2930#discussion_r3206807509
##########
flink/src/test/java/org/apache/sedona/flink/FunctionTest.java:
##########
@@ -535,6 +535,25 @@ public void testExpand() {
assertEquals(expected, actual);
}
+ @Test
+ public void testExpandBox2D() {
+ Table t =
+ tableEnv.sqlQuery(
+ "SELECT ST_Expand(ST_Box2D(ST_GeomFromText('POLYGON((1 2, 1 5, 4
5, 4 2, 1 2))')), 1.0) AS uniform,"
+ + " ST_Expand(ST_Box2D(ST_GeomFromText('POLYGON((1 2, 1 5, 4
5, 4 2, 1 2))')), 2.0, 0.5) AS per_axis");
+ Row row = first(t);
+ Box2D uniform = (Box2D) row.getField(0);
+ assertEquals(0.0, uniform.getXMin(), 0.0);
+ assertEquals(1.0, uniform.getYMin(), 0.0);
+ assertEquals(5.0, uniform.getXMax(), 0.0);
+ assertEquals(6.0, uniform.getYMax(), 0.0);
+ Box2D perAxis = (Box2D) row.getField(1);
+ assertEquals(-1.0, perAxis.getXMin(), 0.0);
+ assertEquals(1.5, perAxis.getYMin(), 0.0);
+ assertEquals(6.0, perAxis.getXMax(), 0.0);
+ assertEquals(5.5, perAxis.getYMax(), 0.0);
+ }
Review Comment:
This test validates the numeric expansion results, but it doesn’t cover NULL
propagation for the new Box2D overloads. Add a query case with a NULL Box2D
(e.g., ST_Box2D(ST_GeomFromText(CAST(NULL AS STRING)))) and assert ST_Expand
returns NULL for both signatures.
##########
python/tests/sql/test_function.py:
##########
@@ -243,6 +243,24 @@ def test_st_expand(self):
expected = "POLYGON Z((44 45 4, 44 85 4, 86 85 0, 86 45 0, 44 45 4))"
assert expected == actual
+ def test_st_expand_box_2d(self):
+ df = self.spark.sql("""
+ SELECT
+ ST_Expand(ST_Box2D(ST_GeomFromText('POLYGON((1 2, 1 5, 4 5, 4 2,
1 2))')), 1.0) AS uniform,
+ ST_Expand(ST_Box2D(ST_GeomFromText('POLYGON((1 2, 1 5, 4 5, 4 2,
1 2))')), 2.0, 0.5) AS per_axis
+ """)
+ row = df.first()
Review Comment:
The Box2D ST_Expand test exercises only non-null inputs. Since the overload
contract is NULL-propagating, add at least one assertion that a NULL Box2D
input (e.g., ST_Box2D(ST_GeomFromText(NULL))) returns NULL for both the uniform
and (dx,dy) variants so Python deserialization of NULL→None is covered too.
--
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]