You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sedona.apache.org by ji...@apache.org on 2024/04/26 02:10:15 UTC
(sedona) branch fix-python-import created (now 9c6bcb62e)
This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a change to branch fix-python-import
in repository https://gitbox.apache.org/repos/asf/sedona.git
at 9c6bcb62e Fix the bug
This branch includes the following new commits:
new 9c6bcb62e Fix the bug
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(sedona) 01/01: Fix the bug
Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch fix-python-import
in repository https://gitbox.apache.org/repos/asf/sedona.git
commit 9c6bcb62edb3d3aee263f95fdf1e4eda2f008a14
Author: Jia Yu <ji...@apache.org>
AuthorDate: Thu Apr 25 19:10:04 2024 -0700
Fix the bug
---
python/sedona/spark/__init__.py | 4 ++
python/sedona/sql/st_aggregates.py | 10 +--
python/sedona/sql/st_constructors.py | 24 ++-----
python/sedona/sql/st_functions.py | 122 ++-------------------------------
python/sedona/sql/st_predicates.py | 17 ++---
python/tests/sql/test_dataframe_api.py | 5 ++
6 files changed, 29 insertions(+), 153 deletions(-)
diff --git a/python/sedona/spark/__init__.py b/python/sedona/spark/__init__.py
index 7e80798a9..c98234a41 100644
--- a/python/sedona/spark/__init__.py
+++ b/python/sedona/spark/__init__.py
@@ -43,3 +43,7 @@ from sedona.spark.SedonaContext import SedonaContext
from sedona.raster_utils.SedonaUtils import SedonaUtils
from sedona.maps.SedonaKepler import SedonaKepler
from sedona.maps.SedonaPyDeck import SedonaPyDeck
+from sedona.sql.st_aggregates import *
+from sedona.sql.st_constructors import *
+from sedona.sql.st_functions import *
+from sedona.sql.st_predicates import *
diff --git a/python/sedona/sql/st_aggregates.py b/python/sedona/sql/st_aggregates.py
index 4fca3985e..184ed38cf 100644
--- a/python/sedona/sql/st_aggregates.py
+++ b/python/sedona/sql/st_aggregates.py
@@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+import inspect
+import sys
from functools import partial
@@ -23,11 +25,9 @@ from sedona.sql.dataframe_api import ColumnOrName, call_sedona_function, validat
_call_aggregate_function = partial(call_sedona_function, "st_aggregates")
-__all__ = [
- "ST_Envelope_Aggr",
- "ST_Intersection_Aggr",
- "ST_Union_Aggr",
-]
+# Automatically populate __all__
+__all__ = [name for name, obj in inspect.getmembers(sys.modules[__name__])
+ if inspect.isfunction(obj)]
@validate_argument_types
diff --git a/python/sedona/sql/st_constructors.py b/python/sedona/sql/st_constructors.py
index 4195a6fc9..aa7f2c976 100644
--- a/python/sedona/sql/st_constructors.py
+++ b/python/sedona/sql/st_constructors.py
@@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+import inspect
+import sys
from functools import partial
from typing import Optional, Union
@@ -23,25 +25,9 @@ from pyspark.sql import Column
from sedona.sql.dataframe_api import ColumnOrName, ColumnOrNameOrNumber, call_sedona_function, validate_argument_types
-__all__ = [
- "ST_GeomFromGeoHash",
- "ST_GeomFromGeoJSON",
- "ST_GeomFromGML",
- "ST_GeomFromKML",
- "ST_GeomFromText",
- "ST_GeomFromWKB",
- "ST_GeomFromWKT",
- "ST_GeomFromEWKT",
- "ST_LineFromText",
- "ST_LineStringFromText",
- "ST_Point",
- "ST_PointFromText",
- "ST_MakePoint"
- "ST_PolygonFromEnvelope",
- "ST_PolygonFromText",
- "ST_MLineFromText",
- "ST_MPolyFromText"
-]
+# Automatically populate __all__
+__all__ = [name for name, obj in inspect.getmembers(sys.modules[__name__])
+ if inspect.isfunction(obj)]
_call_constructor_function = partial(call_sedona_function, "st_constructors")
diff --git a/python/sedona/sql/st_functions.py b/python/sedona/sql/st_functions.py
index 3e9cb21f0..a72b17e50 100644
--- a/python/sedona/sql/st_functions.py
+++ b/python/sedona/sql/st_functions.py
@@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+import inspect
+import sys
from functools import partial
from typing import Optional, Union
@@ -23,123 +25,9 @@ from pyspark.sql import Column
from sedona.sql.dataframe_api import call_sedona_function, ColumnOrName, ColumnOrNameOrNumber, validate_argument_types
-__all__ = [
- "GeometryType",
- "ST_3DDistance",
- "ST_AddPoint",
- "ST_Area",
- "ST_AreaSpheroid",
- "ST_AsBinary",
- "ST_AsEWKB",
- "ST_AsEWKT",
- "ST_AsGeoJSON",
- "ST_AsGML",
- "ST_AsKML",
- "ST_AsText",
- "ST_Azimuth",
- "ST_BestSRID",
- "ST_Boundary",
- "ST_Buffer",
- "ST_BuildArea",
- "ST_Centroid",
- "ST_Collect",
- "ST_CollectionExtract",
- "ST_ClosestPoint",
- "ST_ConcaveHull",
- "ST_ConvexHull",
- "ST_CrossesDateLine",
- "ST_Difference",
- "ST_Dimension",
- "ST_Distance",
- "ST_DistanceSphere",
- "ST_DistanceSpheroid",
- "ST_Dump",
- "ST_DumpPoints",
- "ST_EndPoint",
- "ST_Envelope",
- "ST_ExteriorRing",
- "ST_FlipCoordinates",
- "ST_Force_2D",
- "ST_GeoHash",
- "ST_GeometricMedian",
- "ST_GeometryN",
- "ST_GeometryType",
- "ST_H3CellDistance",
- "ST_H3CellIDs",
- "ST_H3KRing",
- "ST_H3ToGeom",
- "ST_InteriorRingN",
- "ST_Intersection",
- "ST_IsClosed",
- "ST_IsEmpty",
- "ST_IsPolygonCW",
- "ST_IsRing",
- "ST_IsSimple",
- "ST_IsValid",
- "ST_IsValidReason",
- "ST_Length",
- "ST_LengthSpheroid",
- "ST_LineFromMultiPoint",
- "ST_LineInterpolatePoint",
- "ST_LineLocatePoint",
- "ST_LineMerge",
- "ST_LineSubstring",
- "ST_MakeLine",
- "ST_Polygon"
- "ST_Polygonize"
- "ST_MakePolygon",
- "ST_MakeValid",
- "ST_MinimumBoundingCircle",
- "ST_MinimumBoundingRadius",
- "ST_Multi",
- "ST_Normalize",
- "ST_NPoints",
- "ST_NDims",
- "ST_NumGeometries",
- "ST_NumInteriorRings",
- "ST_PointN",
- "ST_PointOnSurface",
- "ST_ReducePrecision",
- "ST_RemovePoint",
- "ST_Reverse",
- "ST_S2CellIDs",
- "ST_S2ToGeom",
- "ST_SetPoint",
- "ST_SetSRID",
- "ST_SRID",
- "ST_Split",
- "ST_StartPoint",
- "ST_SubDivide",
- "ST_SubDivideExplode",
- "ST_SimplifyPreserveTopology",
- "ST_SymDifference",
- "ST_IsPolygonCCW",
- "ST_ForcePolygonCCW",
- "ST_Transform",
- "ST_Union",
- "ST_X",
- "ST_XMax",
- "ST_XMin",
- "ST_Y",
- "ST_YMax",
- "ST_YMin",
- "ST_Z",
- "ST_ZMax",
- "ST_ZMin",
- "ST_NumPoints",
- "ST_Force3D",
- "ST_ForcePolygonCW",
- "ST_NRings",
- "ST_Translate",
- "ST_VoronoiPolygons",
- "ST_Angle",
- "ST_Degrees",
- "ST_FrechetDistance",
- "ST_CoordDim",
- "ST_IsCollection",
- "ST_Affine",
- "ST_BoundingDiagonal"
-]
+# Automatically populate __all__
+__all__ = [name for name, obj in inspect.getmembers(sys.modules[__name__])
+ if inspect.isfunction(obj)]
_call_st_function = partial(call_sedona_function, "st_functions")
diff --git a/python/sedona/sql/st_predicates.py b/python/sedona/sql/st_predicates.py
index ee8d08678..5106e0473 100644
--- a/python/sedona/sql/st_predicates.py
+++ b/python/sedona/sql/st_predicates.py
@@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+import inspect
+import sys
from functools import partial
@@ -23,18 +25,9 @@ from typing import Union, Optional
from sedona.sql.dataframe_api import ColumnOrName, call_sedona_function, validate_argument_types
-__all__ = [
- "ST_Contains",
- "ST_Crosses",
- "ST_Disjoint",
- "ST_Equals",
- "ST_Intersects",
- "ST_OrderingEquals",
- "ST_Overlaps",
- "ST_Touches",
- "ST_Within",
- "ST_DWithin"
-]
+# Automatically populate __all__
+__all__ = [name for name, obj in inspect.getmembers(sys.modules[__name__])
+ if inspect.isfunction(obj)]
_call_predicate_function = partial(call_sedona_function, "st_predicates")
diff --git a/python/tests/sql/test_dataframe_api.py b/python/tests/sql/test_dataframe_api.py
index ca319ab34..5bf79cc8a 100644
--- a/python/tests/sql/test_dataframe_api.py
+++ b/python/tests/sql/test_dataframe_api.py
@@ -21,6 +21,11 @@ from pyspark.sql import functions as f, Row
import pytest
from shapely.geometry.base import BaseGeometry
+from sedona.sql.st_aggregates import *
+from sedona.sql.st_constructors import *
+from sedona.sql.st_functions import *
+from sedona.sql.st_predicates import *
+
from sedona.sql import (
st_aggregates as sta,
st_constructors as stc,