jiayuasu commented on code in PR #2930:
URL: https://github.com/apache/sedona/pull/2930#discussion_r3206885011
##########
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:
Done in 5158213d — added NULL Box2D coverage to both signatures. NULL row
deserializes to None as expected.
##########
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:
Done in 5158213d — added NULL Box2D coverage to both Flink signatures. NULL
field comes back as null Java reference through getField.
--
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]