petern48 commented on code in PR #691:
URL: https://github.com/apache/sedona-db/pull/691#discussion_r2932516202
##########
python/sedonadb/tests/functions/test_predicates.py:
##########
@@ -330,115 +330,32 @@ def test_st_within(eng, geom1, geom2, expected):
)
[email protected](reason="https://github.com/tidwall/tg/issues/20")
[email protected]("eng", [SedonaDB, PostGIS])
[email protected](
- ("geom1", "geom2", "expected"),
- [
- # These cases demonstrates the weirdness of ST_Contains:
- # Both POINT(0 0) and GEOMETRYCOLLECTION (POINT (0 0)) contains POINT
(0 0),
- # but GEOMETRYCOLLECTION (POINT (0 0), LINESTRING (0 0, 1 1)) does not
contain POINT (0 0).
- # See
https://lin-ear-th-inking.blogspot.com/2007/06/subtleties-of-ogc-covers-spatial.html
- (
- "POINT (0 0)",
- "GEOMETRYCOLLECTION (POINT (0 0), LINESTRING (0 0, 1 1))",
- False,
- ),
- (
- "POINT (0 0)",
- "GEOMETRYCOLLECTION (POINT (0 0), LINESTRING (0 0, 1 1), POLYGON
((0 0, 1 0, 1 1, 0 1, 0 0)))",
- False,
- ),
- ],
-)
-def test_st_within_skipped(eng, geom1, geom2, expected):
- eng = eng.create_or_skip()
- eng.assert_query_result(
- f"SELECT ST_Within({geom_or_null(geom1)}, {geom_or_null(geom2)})",
- expected,
- )
-
-
@pytest.mark.parametrize("eng", [SedonaDB, PostGIS])
@pytest.mark.parametrize(
("geom1", "geom2", "expected"),
[
(None, None, None),
("POINT (0 0)", None, None),
(None, "POINT (0 0)", None),
- ("POINT (0 0)", "POINT EMPTY", False),
- ("POINT (0 0)", "POINT (0 0)", False),
- ("POINT (0.5 0.5)", "LINESTRING (0 0, 1 1)", False),
- ("POINT (0 0)", "LINESTRING (0 0, 1 1)", False),
- ("POINT (0.5 0.5)", "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))", False),
- ("POINT (0 0)", "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))", False),
- ("LINESTRING (0 0, 1 1)", "LINESTRING (0 1, 1 0)", True),
- ("LINESTRING (0 0, 1 1)", "LINESTRING (1 1, 2 2)", False),
- ("LINESTRING (0 0, 2 2)", "LINESTRING (1 1, 3 3)", False),
- ("LINESTRING (-1 -1, 1 1)", "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))",
True),
- ("LINESTRING (-1 0, 0 0)", "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))",
False),
+ ("POINT (0 0)", "POINT (1 1)", "FF0FFF0F2"),
+ ("POINT (0 0)", "POINT (0 0)", "0FFFFFFF2"),
+ ("POINT (0 0)", "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))", "F0FFFF212"),
+ ("POINT (0.5 0.5)", "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))",
"0FFFFF212"),
(
- "LINESTRING (0.1 0.1, 0.5 0.5)",
"POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))",
- False,
+ "POLYGON ((5 5, 6 5, 6 6, 5 6, 5 5))",
+ "FF2FF1212",
),
(
"POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))",
"POLYGON ((1 1, 3 1, 3 3, 1 3, 1 1))",
- False,
- ),
- ],
-)
-def test_st_crosses(eng, geom1, geom2, expected):
- eng = eng.create_or_skip()
- eng.assert_query_result(
- f"SELECT ST_Crosses({geom_or_null(geom1)}, {geom_or_null(geom2)})",
- expected,
- )
-
-
[email protected]("eng", [SedonaDB, PostGIS])
[email protected](
- ("geom1", "geom2", "expected"),
- [
- (None, None, None),
- ("POINT (0 0)", None, None),
- (None, "POINT (0 0)", None),
- ("POINT (0 0)", "POINT EMPTY", False),
- ("POINT (0 0)", "LINESTRING (0 0, 1 1)", False),
- ("LINESTRING (0 0, 2 2)", "POLYGON ((1 1, 3 1, 3 3, 1 3, 1 1))",
False),
- ("MULTIPOINT ((0 0), (1 1))", "MULTIPOINT ((1 1), (2 2))", True),
- ("MULTIPOINT ((0 0), (1 1))", "MULTIPOINT ((0 0), (1 1))", False),
- ("POINT (0 0)", "POINT (0 0)", False),
- ("LINESTRING (0 0, 2 2)", "LINESTRING (1 1, 3 3)", True),
- ("LINESTRING (0 0, 1 1)", "LINESTRING (0 1, 1 0)", False),
- ("LINESTRING (0 0, 1 1)", "LINESTRING (1 1, 2 2)", False),
- ("LINESTRING (0 0, 1 1)", "LINESTRING (0 0, 1 1)", False),
- (
- "POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))",
- "POLYGON ((1 1, 3 1, 3 3, 1 3, 1 1))",
- True,
- ),
- (
- "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))",
- "POLYGON ((1 0, 2 0, 2 1, 1 1, 1 0))",
- False,
- ),
- (
- "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))",
- "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))",
- False,
- ),
- (
- "POLYGON ((0 0, 3 0, 3 3, 0 3, 0 0))",
- "POLYGON ((1 1, 2 1, 2 2, 1 2, 1 1))",
- False,
+ "212101212",
),
],
)
-def test_st_overlaps(eng, geom1, geom2, expected):
+def test_st_relate(eng, geom1, geom2, expected):
eng = eng.create_or_skip()
eng.assert_query_result(
- f"SELECT ST_Overlaps({geom_or_null(geom1)}, {geom_or_null(geom2)})",
+ f"SELECT ST_Relate({geom_or_null(geom1)}, {geom_or_null(geom2)})",
Review Comment:
Please don't delete existing tests. There should be no red diffs (deletions)
in this file.
(sorry i know it's in draft, but I figured I'd call this out since I'm here
anyways)
--
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]