From 2bfd3af3b6f9161a62951e072adaa69e710d028a Mon Sep 17 00:00:00 2001 From: niklas-petersen Date: Thu, 22 Feb 2024 11:11:08 +0100 Subject: [PATCH] Fix ST_Split call --- python/sedona/sql/st_functions.py | 2 +- python/tests/sql/test_dataframe_api.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/sedona/sql/st_functions.py b/python/sedona/sql/st_functions.py index 3465b9c1625..1f384e86558 100644 --- a/python/sedona/sql/st_functions.py +++ b/python/sedona/sql/st_functions.py @@ -1270,7 +1270,7 @@ def ST_Split(input: ColumnOrName, blade: ColumnOrName) -> Column: :return: Multi-geometry representing the split of input by blade. :rtype: Column """ - return _call_st_function("ST_SymDifference", (input, blade)) + return _call_st_function("ST_Split", (input, blade)) @validate_argument_types diff --git a/python/tests/sql/test_dataframe_api.py b/python/tests/sql/test_dataframe_api.py index be8278c7276..b783c3e243c 100644 --- a/python/tests/sql/test_dataframe_api.py +++ b/python/tests/sql/test_dataframe_api.py @@ -145,7 +145,7 @@ (stf.ST_SetPoint, ("line", 1, lambda: f.expr("ST_Point(1.0, 1.0)")), "linestring_geom", "", "LINESTRING (0 0, 1 1, 2 0, 3 0, 4 0, 5 0)"), (stf.ST_SetSRID, ("point", 3021), "point_geom", "ST_SRID(geom)", 3021), (stf.ST_SimplifyPreserveTopology, ("geom", 0.2), "0.9_poly", "", "POLYGON ((0 0, 1 0, 1 1, 0 0))"), - (stf.ST_Split, ("a", "b"), "overlapping_polys", "", "MULTIPOLYGON (((1 0, 0 0, 0 1, 1 1, 1 0)), ((2 0, 2 1, 3 1, 3 0, 2 0)))"), + (stf.ST_Split, ("line", "points"), "multipoint_splitting_line", "", "MULTILINESTRING ((0 0, 0.5 0.5), (0.5 0.5, 1 1), (1 1, 1.5 1.5, 2 2))"), (stf.ST_SRID, ("point",), "point_geom", "", 0), (stf.ST_StartPoint, ("line",), "linestring_geom", "", "POINT (0 0)"), (stf.ST_SubDivide, ("line", 5), "linestring_geom", "", ["LINESTRING (0 0, 2.5 0)", "LINESTRING (2.5 0, 5 0)"]), @@ -437,6 +437,8 @@ def base_df(self, request): return TestDataFrameAPI.spark.sql("SELECT ST_GeomFromWKT('POINT (0.0 1.0)') AS point, ST_GeomFromWKT('LINESTRING (0 0, 1 0, 2 0, 3 0, 4 0, 5 0)') AS line") elif request.param == "line_and_point": return TestDataFrameAPI.spark.sql("SELECT ST_GeomFromWKT('LINESTRING (0 2, 1 1, 2 0)') AS line, ST_GeomFromWKT('POINT (0 0)') AS point") + elif request.param == "multipoint_splitting_line": + return TestDataFrameAPI.spark.sql("SELECT ST_GeomFromWKT('LINESTRING (0 0, 1.5 1.5, 2 2)') AS line, ST_GeomFromWKT('MULTIPOINT (0.5 0.5, 1 1)') AS points") elif request.param == "origin_and_point": return TestDataFrameAPI.spark.sql("SELECT ST_GeomFromWKT('POINT (0 0)') AS origin, ST_GeomFromWKT('POINT (1 0)') as point") elif request.param == "ny_seattle":