From 2c1ac36f838d0ea3ed3fca0edcc270adab8f3de8 Mon Sep 17 00:00:00 2001 From: Kristin Cowalcijk Date: Wed, 31 Jul 2024 21:02:14 +0800 Subject: [PATCH] Fix importing GeometryType from sedona.spark --- python/sedona/sql/st_functions.py | 2 +- python/tests/sql/test_st_function_imports.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/python/sedona/sql/st_functions.py b/python/sedona/sql/st_functions.py index e9d07f8f65..f95a452886 100644 --- a/python/sedona/sql/st_functions.py +++ b/python/sedona/sql/st_functions.py @@ -2050,4 +2050,4 @@ def ST_Rotate(geometry: ColumnOrName, angle: Union[ColumnOrName, float], originX # Automatically populate __all__ __all__ = [name for name, obj in inspect.getmembers(sys.modules[__name__]) - if inspect.isfunction(obj)] + if inspect.isfunction(obj) and name != 'GeometryType'] diff --git a/python/tests/sql/test_st_function_imports.py b/python/tests/sql/test_st_function_imports.py index 5ffb650edf..81bc768f1c 100644 --- a/python/tests/sql/test_st_function_imports.py +++ b/python/tests/sql/test_st_function_imports.py @@ -33,3 +33,8 @@ def test_import(self): ST_Point ST_Contains ST_Envelope_Aggr + + def test_geometry_type_should_be_a_sql_type(self): + from sedona.spark import GeometryType + from pyspark.sql.types import UserDefinedType + assert isinstance(GeometryType(), UserDefinedType)