This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git
The following commit(s) were added to refs/heads/master by this push:
new 7d62d0860e [GH-2136] Add redirection and warnings for old Python
public functions (#2146)
7d62d0860e is described below
commit 7d62d0860e174282b916a530e4d432f963585024
Author: Jia Yu <[email protected]>
AuthorDate: Wed Jul 23 17:50:49 2025 -0700
[GH-2136] Add redirection and warnings for old Python public functions
(#2146)
* Add redirection and warnings for old Python public functions
* Add tests for `from sedona.spark import *`
* Add back inspect
---
python/sedona/__init__.py | 6 ++
.../geoarrow => core/SpatialRDD}/__init__.py | 7 +-
python/sedona/{ => core}/__init__.py | 4 -
.../getis_ord => core/enums}/__init__.py | 7 +-
python/sedona/{ => core/formatMapper}/__init__.py | 4 -
.../formatMapper/geo_json_reader.py} | 7 +-
.../formatMapper/shapefileParser}/__init__.py | 4 -
.../shapefileParser/shape_file_reader.py} | 9 +-
python/sedona/{ => core/geom}/__init__.py | 4 -
.../weighting/__init__.py => core/geom/circle.py} | 7 +-
.../__init__.py => core/geom/envelope.py} | 7 +-
.../__init__.py => core/geom/geography.py} | 7 +-
python/sedona/{ => core/jvm}/__init__.py | 4 -
.../getis_ord/__init__.py => core/jvm/config.py} | 7 +-
.../geoarrow => core/spatialOperator}/__init__.py | 12 ++-
python/sedona/spark/__init__.py | 36 ++++---
python/sedona/spark/geoarrow/__init__.py | 4 +-
python/sedona/spark/sql/__init__.py | 8 +-
python/sedona/{ => sql}/__init__.py | 4 -
.../getis_ord/__init__.py => sql/st_aggregates.py} | 8 +-
.../__init__.py => sql/st_constructors.py} | 8 +-
.../getis_ord/__init__.py => sql/st_functions.py} | 8 +-
.../getis_ord/__init__.py => sql/st_predicates.py} | 8 +-
.../{stats/weighting/__init__.py => sql/types.py} | 7 +-
.../weighting/__init__.py => stac/client.py} | 7 +-
.../__init__.py => stac/collection_client.py} | 7 +-
.../{getis_ord/__init__.py => getis_ord.py} | 7 +-
.../stats/hotspot_detection/getis_ord/__init__.py | 2 +
python/sedona/stats/weighting/__init__.py | 10 +-
.../weighting/__init__.py => utils/adapter.py} | 7 +-
.../utils/{geoarrow/__init__.py => geoarrow.py} | 7 +-
python/sedona/utils/geoarrow/__init__.py | 6 +-
.../__init__.py => utils/spatial_rdd_parser.py} | 7 +-
python/tests/test_path_compatibility.py | 120 +++++++++++++++++++++
python/tests/test_path_compatibility_all.py | 88 +++++++++++++++
35 files changed, 345 insertions(+), 110 deletions(-)
diff --git a/python/sedona/__init__.py b/python/sedona/__init__.py
index 5e359b3b9a..0daf946199 100644
--- a/python/sedona/__init__.py
+++ b/python/sedona/__init__.py
@@ -14,7 +14,13 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+import warnings
+warnings.warn(
+ "The 'sedona' package structure has been reorganized. Please update your
imports to use 'sedona.spark' prefix instead.",
+ DeprecationWarning,
+ stacklevel=2,
+)
from .version import version
__all__ = ["version"]
diff --git a/python/sedona/utils/geoarrow/__init__.py
b/python/sedona/core/SpatialRDD/__init__.py
similarity index 76%
copy from python/sedona/utils/geoarrow/__init__.py
copy to python/sedona/core/SpatialRDD/__init__.py
index 11839f7271..f17d300156 100644
--- a/python/sedona/utils/geoarrow/__init__.py
+++ b/python/sedona/core/SpatialRDD/__init__.py
@@ -16,13 +16,12 @@
# under the License.
import warnings
-
-from sedona.spark.geoarrow.geoarrow import create_spatial_dataframe
+from sedona.spark.core.SpatialRDD import CircleRDD, PolygonRDD, PointRDD,
RectangleRDD
warnings.warn(
- "The 'sedona.utils.geoarrow' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.geoarrow' instead.",
+ "Importing from 'sedona.core.SpatialRDD' is deprecated. Please use
'sedona.spark.core.SpatialRDD' instead.",
DeprecationWarning,
stacklevel=2,
)
-__all__ = ["create_spatial_dataframe"]
+__all__ = ["CircleRDD", "PolygonRDD", "PointRDD", "RectangleRDD"]
diff --git a/python/sedona/__init__.py b/python/sedona/core/__init__.py
similarity index 93%
copy from python/sedona/__init__.py
copy to python/sedona/core/__init__.py
index 5e359b3b9a..13a83393a9 100644
--- a/python/sedona/__init__.py
+++ b/python/sedona/core/__init__.py
@@ -14,7 +14,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-
-from .version import version
-
-__all__ = ["version"]
diff --git a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
b/python/sedona/core/enums/__init__.py
similarity index 78%
copy from python/sedona/stats/hotspot_detection/getis_ord/__init__.py
copy to python/sedona/core/enums/__init__.py
index 537861064f..b6f0fe99b2 100644
--- a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
+++ b/python/sedona/core/enums/__init__.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.hotspot_detection.getis_ord import g_local
-
import warnings
+from sedona.spark.core.enums import FileDataSplitter, GridType, IndexType
warnings.warn(
- "The 'sedona.stats.hotspot_detection.getis_ord' module is deprecated and
will be removed in future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.core.enums' is deprecated. Please use
'sedona.spark.core.enums' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["FileDataSplitter", "GridType", "IndexType"]
diff --git a/python/sedona/__init__.py
b/python/sedona/core/formatMapper/__init__.py
similarity index 93%
copy from python/sedona/__init__.py
copy to python/sedona/core/formatMapper/__init__.py
index 5e359b3b9a..13a83393a9 100644
--- a/python/sedona/__init__.py
+++ b/python/sedona/core/formatMapper/__init__.py
@@ -14,7 +14,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-
-from .version import version
-
-__all__ = ["version"]
diff --git a/python/sedona/utils/geoarrow/__init__.py
b/python/sedona/core/formatMapper/geo_json_reader.py
similarity index 77%
copy from python/sedona/utils/geoarrow/__init__.py
copy to python/sedona/core/formatMapper/geo_json_reader.py
index 11839f7271..d8983b5ffc 100644
--- a/python/sedona/utils/geoarrow/__init__.py
+++ b/python/sedona/core/formatMapper/geo_json_reader.py
@@ -16,13 +16,12 @@
# under the License.
import warnings
-
-from sedona.spark.geoarrow.geoarrow import create_spatial_dataframe
+from sedona.spark.core.formatMapper.geo_json_reader import GeoJsonReader
warnings.warn(
- "The 'sedona.utils.geoarrow' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.geoarrow' instead.",
+ "Importing from 'sedona.core.formatMapper.geo_json_reader' is deprecated.
Please use 'sedona.spark.core.formatMapper.geo_json_reader' instead.",
DeprecationWarning,
stacklevel=2,
)
-__all__ = ["create_spatial_dataframe"]
+__all__ = ["GeoJsonReader"]
diff --git a/python/sedona/__init__.py
b/python/sedona/core/formatMapper/shapefileParser/__init__.py
similarity index 93%
copy from python/sedona/__init__.py
copy to python/sedona/core/formatMapper/shapefileParser/__init__.py
index 5e359b3b9a..13a83393a9 100644
--- a/python/sedona/__init__.py
+++ b/python/sedona/core/formatMapper/shapefileParser/__init__.py
@@ -14,7 +14,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-
-from .version import version
-
-__all__ = ["version"]
diff --git a/python/sedona/utils/geoarrow/__init__.py
b/python/sedona/core/formatMapper/shapefileParser/shape_file_reader.py
similarity index 73%
copy from python/sedona/utils/geoarrow/__init__.py
copy to python/sedona/core/formatMapper/shapefileParser/shape_file_reader.py
index 11839f7271..7c302cf3e8 100644
--- a/python/sedona/utils/geoarrow/__init__.py
+++ b/python/sedona/core/formatMapper/shapefileParser/shape_file_reader.py
@@ -16,13 +16,14 @@
# under the License.
import warnings
-
-from sedona.spark.geoarrow.geoarrow import create_spatial_dataframe
+from sedona.spark.core.formatMapper.shapefileParser.shape_file_reader import (
+ ShapefileReader,
+)
warnings.warn(
- "The 'sedona.utils.geoarrow' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.geoarrow' instead.",
+ "Importing from
'sedona.core.formatMapper.shapefileParser.shape_file_reader' is deprecated.
Please use 'sedona.spark.core.formatMapper.shapefileParser.shape_file_reader'
instead.",
DeprecationWarning,
stacklevel=2,
)
-__all__ = ["create_spatial_dataframe"]
+__all__ = ["ShapefileReader"]
diff --git a/python/sedona/__init__.py b/python/sedona/core/geom/__init__.py
similarity index 93%
copy from python/sedona/__init__.py
copy to python/sedona/core/geom/__init__.py
index 5e359b3b9a..13a83393a9 100644
--- a/python/sedona/__init__.py
+++ b/python/sedona/core/geom/__init__.py
@@ -14,7 +14,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-
-from .version import version
-
-__all__ = ["version"]
diff --git a/python/sedona/stats/weighting/__init__.py
b/python/sedona/core/geom/circle.py
similarity index 80%
copy from python/sedona/stats/weighting/__init__.py
copy to python/sedona/core/geom/circle.py
index abbb2b8db0..789da88a6f 100644
--- a/python/sedona/stats/weighting/__init__.py
+++ b/python/sedona/core/geom/circle.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.weighting import add_binary_distance_band_column
-
import warnings
+from sedona.spark.core.geom.circle import Circle
warnings.warn(
- "The 'sedona.stats.weighting' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.core.geom.circle' is deprecated. Please use
'sedona.spark.core.geom.circle' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["Circle"]
diff --git a/python/sedona/stats/weighting/__init__.py
b/python/sedona/core/geom/envelope.py
similarity index 80%
copy from python/sedona/stats/weighting/__init__.py
copy to python/sedona/core/geom/envelope.py
index abbb2b8db0..1de52abe99 100644
--- a/python/sedona/stats/weighting/__init__.py
+++ b/python/sedona/core/geom/envelope.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.weighting import add_binary_distance_band_column
-
import warnings
+from sedona.spark.core.geom.envelope import Envelope
warnings.warn(
- "The 'sedona.stats.weighting' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.core.geom.envelope' is deprecated. Please use
'sedona.spark.core.geom.envelope' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["Envelope"]
diff --git a/python/sedona/stats/weighting/__init__.py
b/python/sedona/core/geom/geography.py
similarity index 80%
copy from python/sedona/stats/weighting/__init__.py
copy to python/sedona/core/geom/geography.py
index abbb2b8db0..2e323cfd0d 100644
--- a/python/sedona/stats/weighting/__init__.py
+++ b/python/sedona/core/geom/geography.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.weighting import add_binary_distance_band_column
-
import warnings
+from sedona.spark.core.geom.geography import Geography
warnings.warn(
- "The 'sedona.stats.weighting' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.core.geom.geography' is deprecated. Please use
'sedona.spark.core.geom.geography' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["Geography"]
diff --git a/python/sedona/__init__.py b/python/sedona/core/jvm/__init__.py
similarity index 93%
copy from python/sedona/__init__.py
copy to python/sedona/core/jvm/__init__.py
index 5e359b3b9a..13a83393a9 100644
--- a/python/sedona/__init__.py
+++ b/python/sedona/core/jvm/__init__.py
@@ -14,7 +14,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-
-from .version import version
-
-__all__ = ["version"]
diff --git a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
b/python/sedona/core/jvm/config.py
similarity index 79%
copy from python/sedona/stats/hotspot_detection/getis_ord/__init__.py
copy to python/sedona/core/jvm/config.py
index 537861064f..52260a8c76 100644
--- a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
+++ b/python/sedona/core/jvm/config.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.hotspot_detection.getis_ord import g_local
-
import warnings
+from sedona.spark.core.jvm.config import is_greater_or_equal_version
warnings.warn(
- "The 'sedona.stats.hotspot_detection.getis_ord' module is deprecated and
will be removed in future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.core.jvm.config' is deprecated. Please use
'sedona.spark.core.jvm.config' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["is_greater_or_equal_version"]
diff --git a/python/sedona/utils/geoarrow/__init__.py
b/python/sedona/core/spatialOperator/__init__.py
similarity index 74%
copy from python/sedona/utils/geoarrow/__init__.py
copy to python/sedona/core/spatialOperator/__init__.py
index 11839f7271..5b26056b71 100644
--- a/python/sedona/utils/geoarrow/__init__.py
+++ b/python/sedona/core/spatialOperator/__init__.py
@@ -16,13 +16,17 @@
# under the License.
import warnings
-
-from sedona.spark.geoarrow.geoarrow import create_spatial_dataframe
+from sedona.spark.core.spatialOperator import (
+ JoinQuery,
+ JoinQueryRaw,
+ KNNQuery,
+ RangeQuery,
+)
warnings.warn(
- "The 'sedona.utils.geoarrow' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.geoarrow' instead.",
+ "Importing from 'sedona.core.spatialOperator' is deprecated. Please use
'sedona.spark.core.spatialOperator' instead.",
DeprecationWarning,
stacklevel=2,
)
-__all__ = ["create_spatial_dataframe"]
+__all__ = ["JoinQuery", "JoinQueryRaw", "KNNQuery", "RangeQuery"]
diff --git a/python/sedona/spark/__init__.py b/python/sedona/spark/__init__.py
index 51f01c5588..eeb7fadc50 100644
--- a/python/sedona/spark/__init__.py
+++ b/python/sedona/spark/__init__.py
@@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.core import Envelope
-from sedona.spark.sql.functions import sedona_vectorized_udf
try:
import pyspark
@@ -24,9 +22,21 @@ except ImportError:
"Apache Sedona requires PySpark. Please install PySpark before using
Sedona spark."
)
+from sedona.spark.SedonaContext import SedonaContext
+from sedona.spark.core.SpatialRDD import (
+ CircleRDD,
+ LineStringRDD,
+ PointRDD,
+ PolygonRDD,
+ RectangleRDD,
+ SpatialRDD,
+)
from sedona.spark.core.enums import FileDataSplitter, GridType, IndexType
from sedona.spark.core.formatMapper import GeoJsonReader, WkbReader, WktReader
from sedona.spark.core.formatMapper.shapefileParser import ShapefileReader
+from sedona.spark.core.geom.circle import Circle
+from sedona.spark.core.geom.envelope import Envelope
+from sedona.spark.core.geom.geography import Geography
from sedona.spark.core.spatialOperator import (
JoinQuery,
JoinQueryRaw,
@@ -34,25 +44,27 @@ from sedona.spark.core.spatialOperator import (
RangeQuery,
RangeQueryRaw,
)
-from sedona.spark.core.SpatialRDD import (
- CircleRDD,
- LineStringRDD,
- PointRDD,
- PolygonRDD,
- RectangleRDD,
- SpatialRDD,
-)
+from sedona.spark.geoarrow import create_spatial_dataframe, dataframe_to_arrow
+from sedona.spark.geoarrow.geoarrow import dataframe_to_arrow
from sedona.spark.maps.SedonaKepler import SedonaKepler
from sedona.spark.maps.SedonaPyDeck import SedonaPyDeck
from sedona.spark.raster_utils.SedonaUtils import SedonaUtils
from sedona.spark.register import SedonaRegistrator
-from sedona.spark.SedonaContext import SedonaContext
+from sedona.spark.sql.functions import sedona_vectorized_udf
from sedona.spark.sql.st_aggregates import *
from sedona.spark.sql.st_constructors import *
from sedona.spark.sql.st_functions import *
from sedona.spark.sql.st_predicates import *
from sedona.spark.sql.types import GeometryType, GeographyType, RasterType
+from sedona.spark.stac import Client
+from sedona.spark.stac.collection_client import CollectionClient
+from sedona.spark.stats.clustering.dbscan import dbscan
+from sedona.spark.stats.hotspot_detection.getis_ord import g_local
+from sedona.spark.stats.weighting import (
+ add_distance_band_column,
+ add_binary_distance_band_column,
+)
from sedona.spark.utils import KryoSerializer, SedonaKryoRegistrator
from sedona.spark.utils.adapter import Adapter
+from sedona.spark.utils.spatial_rdd_parser import GeoData
from sedona.spark.utils.structured_adapter import StructuredAdapter
-from sedona.spark.geoarrow.geoarrow import dataframe_to_arrow
diff --git a/python/sedona/spark/geoarrow/__init__.py
b/python/sedona/spark/geoarrow/__init__.py
index b4c71c9886..890b6b4431 100644
--- a/python/sedona/spark/geoarrow/__init__.py
+++ b/python/sedona/spark/geoarrow/__init__.py
@@ -15,6 +15,6 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.geoarrow.geoarrow import create_spatial_dataframe
+from sedona.spark.geoarrow.geoarrow import create_spatial_dataframe,
dataframe_to_arrow
-__all__ = ["create_spatial_dataframe"]
+__all__ = ["create_spatial_dataframe", "dataframe_to_arrow"]
diff --git a/python/sedona/spark/sql/__init__.py
b/python/sedona/spark/sql/__init__.py
index f60bf6993f..f193b1ce5e 100644
--- a/python/sedona/spark/sql/__init__.py
+++ b/python/sedona/spark/sql/__init__.py
@@ -15,20 +15,22 @@
# specific language governing permissions and limitations
# under the License.
+import inspect
+import sys
+
# These allow use to access the __all__
import sedona.spark.sql.st_aggregates as st_aggregates
import sedona.spark.sql.st_constructors as st_constructors
import sedona.spark.sql.st_functions as st_functions
import sedona.spark.sql.st_predicates as st_predicates
+from sedona.spark.sql.functions import sedona_vectorized_udf
# These bring the contents of the modules into this module
from sedona.spark.sql.st_aggregates import *
from sedona.spark.sql.st_constructors import *
from sedona.spark.sql.st_functions import *
from sedona.spark.sql.st_predicates import *
-import inspect
-import sys
-
+from sedona.spark.sql.types import GeometryType, GeographyType, RasterType
__all__ = (
[
diff --git a/python/sedona/__init__.py b/python/sedona/sql/__init__.py
similarity index 93%
copy from python/sedona/__init__.py
copy to python/sedona/sql/__init__.py
index 5e359b3b9a..13a83393a9 100644
--- a/python/sedona/__init__.py
+++ b/python/sedona/sql/__init__.py
@@ -14,7 +14,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-
-from .version import version
-
-__all__ = ["version"]
diff --git a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
b/python/sedona/sql/st_aggregates.py
similarity index 78%
copy from python/sedona/stats/hotspot_detection/getis_ord/__init__.py
copy to python/sedona/sql/st_aggregates.py
index 537861064f..51b6ad1f12 100644
--- a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
+++ b/python/sedona/sql/st_aggregates.py
@@ -15,12 +15,14 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.hotspot_detection.getis_ord import g_local
-
import warnings
+from sedona.spark.sql import st_aggregates as sta
+from sedona.spark.sql.st_aggregates import *
warnings.warn(
- "The 'sedona.stats.hotspot_detection.getis_ord' module is deprecated and
will be removed in future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.sql.st_aggregates' is deprecated. Please use
'sedona.spark.sql.st_aggregates' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = sta.__all__
diff --git a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
b/python/sedona/sql/st_constructors.py
similarity index 78%
copy from python/sedona/stats/hotspot_detection/getis_ord/__init__.py
copy to python/sedona/sql/st_constructors.py
index 537861064f..8e1e62e30a 100644
--- a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
+++ b/python/sedona/sql/st_constructors.py
@@ -15,12 +15,14 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.hotspot_detection.getis_ord import g_local
-
import warnings
+from sedona.spark.sql import st_constructors as stc
+from sedona.spark.sql.st_constructors import *
warnings.warn(
- "The 'sedona.stats.hotspot_detection.getis_ord' module is deprecated and
will be removed in future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.sql.st_constructors' is deprecated. Please use
'sedona.spark.sql.st_constructors' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = stc.__all__
diff --git a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
b/python/sedona/sql/st_functions.py
similarity index 78%
copy from python/sedona/stats/hotspot_detection/getis_ord/__init__.py
copy to python/sedona/sql/st_functions.py
index 537861064f..b9b0a9f397 100644
--- a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
+++ b/python/sedona/sql/st_functions.py
@@ -15,12 +15,14 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.hotspot_detection.getis_ord import g_local
-
import warnings
+from sedona.spark.sql import st_functions as stf
+from sedona.spark.sql.st_functions import *
warnings.warn(
- "The 'sedona.stats.hotspot_detection.getis_ord' module is deprecated and
will be removed in future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.sql.st_functions' is deprecated. Please use
'sedona.spark.sql.st_functions' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = stf.__all__
diff --git a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
b/python/sedona/sql/st_predicates.py
similarity index 78%
copy from python/sedona/stats/hotspot_detection/getis_ord/__init__.py
copy to python/sedona/sql/st_predicates.py
index 537861064f..f9d1e8e1fa 100644
--- a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
+++ b/python/sedona/sql/st_predicates.py
@@ -15,12 +15,14 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.hotspot_detection.getis_ord import g_local
-
import warnings
+from sedona.spark.sql import st_predicates as stp
+from sedona.spark.sql.st_predicates import *
warnings.warn(
- "The 'sedona.stats.hotspot_detection.getis_ord' module is deprecated and
will be removed in future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.sql.st_predicates' is deprecated. Please use
'sedona.spark.sql.st_predicates' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = stp.__all__
diff --git a/python/sedona/stats/weighting/__init__.py
b/python/sedona/sql/types.py
similarity index 80%
copy from python/sedona/stats/weighting/__init__.py
copy to python/sedona/sql/types.py
index abbb2b8db0..4f78d765c8 100644
--- a/python/sedona/stats/weighting/__init__.py
+++ b/python/sedona/sql/types.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.weighting import add_binary_distance_band_column
-
import warnings
+from sedona.spark.sql.types import GeographyType, GeometryType
warnings.warn(
- "The 'sedona.stats.weighting' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.sql.types' is deprecated. Please use
'sedona.spark.sql.types' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["GeographyType", "GeometryType"]
diff --git a/python/sedona/stats/weighting/__init__.py
b/python/sedona/stac/client.py
similarity index 80%
copy from python/sedona/stats/weighting/__init__.py
copy to python/sedona/stac/client.py
index abbb2b8db0..9214ee2e7d 100644
--- a/python/sedona/stats/weighting/__init__.py
+++ b/python/sedona/stac/client.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.weighting import add_binary_distance_band_column
-
import warnings
+from sedona.spark.stac.client import Client
warnings.warn(
- "The 'sedona.stats.weighting' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.stac.client' is deprecated. Please use
'sedona.spark.stac.client' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["Client"]
diff --git a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
b/python/sedona/stac/collection_client.py
similarity index 79%
copy from python/sedona/stats/hotspot_detection/getis_ord/__init__.py
copy to python/sedona/stac/collection_client.py
index 537861064f..97ddade1d4 100644
--- a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
+++ b/python/sedona/stac/collection_client.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.hotspot_detection.getis_ord import g_local
-
import warnings
+from sedona.spark.stac.collection_client import CollectionClient
warnings.warn(
- "The 'sedona.stats.hotspot_detection.getis_ord' module is deprecated and
will be removed in future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.stac.collection_client' is deprecated. Please use
'sedona.spark.stac.collection_client' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["CollectionClient"]
diff --git a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
b/python/sedona/stats/hotspot_detection/getis_ord.py
similarity index 84%
copy from python/sedona/stats/hotspot_detection/getis_ord/__init__.py
copy to python/sedona/stats/hotspot_detection/getis_ord.py
index 537861064f..f1559b1736 100644
--- a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
+++ b/python/sedona/stats/hotspot_detection/getis_ord.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.hotspot_detection.getis_ord import g_local
-
import warnings
+from sedona.spark.stats.hotspot_detection.getis_ord import g_local
warnings.warn(
- "The 'sedona.stats.hotspot_detection.getis_ord' module is deprecated and
will be removed in future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.stats.hotspot_detection.getis_ord' is deprecated.
Please use 'sedona.spark.stats.hotspot_detection.getis_ord' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["g_local"]
diff --git a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
b/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
index 537861064f..a1b3c16a1a 100644
--- a/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
+++ b/python/sedona/stats/hotspot_detection/getis_ord/__init__.py
@@ -24,3 +24,5 @@ warnings.warn(
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["g_local"]
diff --git a/python/sedona/stats/weighting/__init__.py
b/python/sedona/stats/weighting/__init__.py
index abbb2b8db0..6b43d6d6cc 100644
--- a/python/sedona/stats/weighting/__init__.py
+++ b/python/sedona/stats/weighting/__init__.py
@@ -15,7 +15,10 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.weighting import add_binary_distance_band_column
+from sedona.spark.stats.weighting import (
+ add_distance_band_column,
+ add_binary_distance_band_column,
+)
import warnings
@@ -24,3 +27,8 @@ warnings.warn(
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = [
+ "add_distance_band_column",
+ "add_binary_distance_band_column",
+]
diff --git a/python/sedona/stats/weighting/__init__.py
b/python/sedona/utils/adapter.py
similarity index 80%
copy from python/sedona/stats/weighting/__init__.py
copy to python/sedona/utils/adapter.py
index abbb2b8db0..5671a6b6d7 100644
--- a/python/sedona/stats/weighting/__init__.py
+++ b/python/sedona/utils/adapter.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.weighting import add_binary_distance_band_column
-
import warnings
+from sedona.spark.utils.adapter import Adapter
warnings.warn(
- "The 'sedona.stats.weighting' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.utils.adapter' is deprecated. Please use
'sedona.spark.utils.adapter' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["Adapter"]
diff --git a/python/sedona/utils/geoarrow/__init__.py
b/python/sedona/utils/geoarrow.py
similarity index 75%
copy from python/sedona/utils/geoarrow/__init__.py
copy to python/sedona/utils/geoarrow.py
index 11839f7271..bbcb5aa608 100644
--- a/python/sedona/utils/geoarrow/__init__.py
+++ b/python/sedona/utils/geoarrow.py
@@ -16,13 +16,12 @@
# under the License.
import warnings
-
-from sedona.spark.geoarrow.geoarrow import create_spatial_dataframe
+from sedona.spark.geoarrow import create_spatial_dataframe, dataframe_to_arrow
warnings.warn(
- "The 'sedona.utils.geoarrow' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.geoarrow' instead.",
+ "The 'sedona.geoarrow' module is deprecated and will be removed in future
versions. Please use 'sedona.spark.geoarrow' instead.",
DeprecationWarning,
stacklevel=2,
)
-__all__ = ["create_spatial_dataframe"]
+__all__ = ["create_spatial_dataframe", "dataframe_to_arrow"]
diff --git a/python/sedona/utils/geoarrow/__init__.py
b/python/sedona/utils/geoarrow/__init__.py
index 11839f7271..07b2bb12f1 100644
--- a/python/sedona/utils/geoarrow/__init__.py
+++ b/python/sedona/utils/geoarrow/__init__.py
@@ -17,12 +17,12 @@
import warnings
-from sedona.spark.geoarrow.geoarrow import create_spatial_dataframe
+from sedona.spark.geoarrow.geoarrow import create_spatial_dataframe,
dataframe_to_arrow
warnings.warn(
- "The 'sedona.utils.geoarrow' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.geoarrow' instead.",
+ "The 'sedona.geoarrow' module is deprecated and will be removed in future
versions. Please use 'sedona.spark.geoarrow' instead.",
DeprecationWarning,
stacklevel=2,
)
-__all__ = ["create_spatial_dataframe"]
+__all__ = ["create_spatial_dataframe", "dataframe_to_arrow"]
diff --git a/python/sedona/stats/weighting/__init__.py
b/python/sedona/utils/spatial_rdd_parser.py
similarity index 80%
copy from python/sedona/stats/weighting/__init__.py
copy to python/sedona/utils/spatial_rdd_parser.py
index abbb2b8db0..9e3b75c85f 100644
--- a/python/sedona/stats/weighting/__init__.py
+++ b/python/sedona/utils/spatial_rdd_parser.py
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-from sedona.spark.stats.weighting import add_binary_distance_band_column
-
import warnings
+from sedona.spark.utils.spatial_rdd_parser import GeoData
warnings.warn(
- "The 'sedona.stats.weighting' module is deprecated and will be removed in
future versions. Please use 'sedona.spark.stats' instead.",
+ "Importing from 'sedona.utils.spatial_rdd_parser' is deprecated. Please
use 'sedona.spark.utils.spatial_rdd_parser' instead.",
DeprecationWarning,
stacklevel=2,
)
+
+__all__ = ["GeoData"]
diff --git a/python/tests/test_path_compatibility.py
b/python/tests/test_path_compatibility.py
new file mode 100644
index 0000000000..6f04b559b2
--- /dev/null
+++ b/python/tests/test_path_compatibility.py
@@ -0,0 +1,120 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# The test file is to ensure compatibility with the path structure and imports
with Apache Sedona < 1.8.0
+# We will drop this test file in the future when we remove path compatibility
for Apache Sedona < 1.8.0
+
+from sedona.core.SpatialRDD import CircleRDD, PolygonRDD, PointRDD
+from sedona.core.enums import FileDataSplitter, GridType, IndexType
+from sedona.core.formatMapper.geo_json_reader import GeoJsonReader
+from sedona.core.formatMapper.shapefileParser.shape_file_reader import
ShapefileReader
+from sedona.core.geom.circle import Circle
+from sedona.core.geom.envelope import Envelope
+from sedona.core.geom.geography import Geography
+from sedona.core.spatialOperator import JoinQuery
+from sedona.core.spatialOperator import JoinQueryRaw, KNNQuery, RangeQuery
+from sedona.sql import st_aggregates as sta
+from sedona.sql import st_constructors as stc
+from sedona.sql import st_functions as stf
+from sedona.sql import st_predicates as stp
+from sedona.sql.st_aggregates import ST_Union_Aggr
+from sedona.sql.st_constructors import ST_MakePoint
+from sedona.sql.st_functions import ST_X
+from sedona.sql.st_predicates import ST_Intersects
+from sedona.sql.types import GeographyType, GeometryType
+from sedona.stac.client import Client
+from sedona.stac.collection_client import CollectionClient
+from sedona.stats.clustering import dbscan
+from sedona.stats.hotspot_detection.getis_ord import g_local
+from sedona.stats.weighting import (
+ add_distance_band_column,
+ add_binary_distance_band_column,
+)
+from sedona.utils.adapter import Adapter
+from sedona.utils.geoarrow import create_spatial_dataframe
+from sedona.utils.spatial_rdd_parser import GeoData
+from tests.test_base import TestBase
+
+
+class TestPathCompatibility(TestBase):
+
+ def test_spatial_rdd_imports(self):
+ # Test CircleRDD, PolygonRDD and PointRDD imports
+ assert PointRDD is not None
+ assert CircleRDD is not None
+ assert PolygonRDD is not None
+
+ def test_enums_imports(self):
+ # Test FileDataSplitter, GridType, IndexType imports
+ assert FileDataSplitter is not None
+ assert GridType is not None
+ assert IndexType is not None
+
+ def test_geometry_imports(self):
+ # Test Envelope, Geography, Circle imports
+ assert Envelope is not None
+ assert Geography is not None
+ assert Circle is not None
+
+ def test_sql_type_imports(self):
+ # Test GeographyType and GeometryType imports
+ assert GeographyType is not None
+ assert GeometryType is not None
+
+ def test_spatial_operators_imports(self):
+ # Test JoinQuery, KNNQuery, RangeQuery imports
+ assert JoinQuery is not None
+ assert JoinQueryRaw is not None
+ assert KNNQuery is not None
+ assert RangeQuery is not None
+
+ def test_stac_imports(self):
+ # Test STAC related imports
+ assert Client is not None
+ assert CollectionClient is not None
+
+ def test_stats_imports(self):
+ # Test statistics related imports
+ assert dbscan is not None
+ assert g_local is not None
+ assert add_distance_band_column is not None
+ assert add_binary_distance_band_column is not None
+
+ def test_util_imports(self):
+ # Test utility imports
+ assert Adapter is not None
+ assert GeoData is not None
+
+ def test_format_mapper_imports(self):
+ # Test GeoJsonReader and ShapefileReader imports
+ assert GeoJsonReader is not None
+ assert ShapefileReader is not None
+
+ def test_sql_module_imports(self):
+ # Test SQL module imports
+ assert sta is not None
+ assert stc is not None
+ assert stf is not None
+ assert stp is not None
+ assert ST_MakePoint is not None
+ assert ST_X is not None
+ assert ST_Union_Aggr is not None
+ assert ST_Intersects is not None
+
+ def test_geoarrow_import(self):
+ # Test create_spatial_dataframe import
+ assert create_spatial_dataframe is not None
diff --git a/python/tests/test_path_compatibility_all.py
b/python/tests/test_path_compatibility_all.py
new file mode 100644
index 0000000000..e14d912db1
--- /dev/null
+++ b/python/tests/test_path_compatibility_all.py
@@ -0,0 +1,88 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# The test file is to ensure compatibility with the path structure and imports
with Apache Sedona < 1.8.0
+# We will drop this test file in the future when we remove path compatibility
for Apache Sedona < 1.8.0
+
+from sedona.spark import *
+from tests.test_base import TestBase
+
+
+class TestPathCompatibilityAll(TestBase):
+
+ def test_spatial_rdd_imports(self):
+ # Test CircleRDD, PolygonRDD and PointRDD imports
+ assert PointRDD is not None
+ assert CircleRDD is not None
+ assert PolygonRDD is not None
+
+ def test_enums_imports(self):
+ # Test FileDataSplitter, GridType, IndexType imports
+ assert FileDataSplitter is not None
+ assert GridType is not None
+ assert IndexType is not None
+
+ def test_geometry_imports(self):
+ # Test Envelope, Geography, Circle imports
+ assert Envelope is not None
+ assert Geography is not None
+ assert Circle is not None
+
+ def test_sql_type_imports(self):
+ # Test GeographyType and GeometryType imports
+ assert GeographyType is not None
+ assert GeometryType is not None
+
+ def test_spatial_operators_imports(self):
+ # Test JoinQuery, KNNQuery, RangeQuery imports
+ assert JoinQuery is not None
+ assert JoinQueryRaw is not None
+ assert KNNQuery is not None
+ assert RangeQuery is not None
+
+ def test_stac_imports(self):
+ # Test STAC related imports
+ assert Client is not None
+ assert CollectionClient is not None
+
+ def test_stats_imports(self):
+ # Test statistics related imports
+ assert dbscan is not None
+ assert g_local is not None
+ assert add_distance_band_column is not None
+ assert add_binary_distance_band_column is not None
+
+ def test_util_imports(self):
+ # Test utility imports
+ assert Adapter is not None
+ assert GeoData is not None
+
+ def test_format_mapper_imports(self):
+ # Test GeoJsonReader and ShapefileReader imports
+ assert GeoJsonReader is not None
+ assert ShapefileReader is not None
+
+ def test_sql_module_imports(self):
+ # Test SQL module imports
+ assert ST_MakePoint is not None
+ assert ST_X is not None
+ assert ST_Union_Aggr is not None
+ assert ST_Intersects is not None
+
+ def test_geoarrow_import(self):
+ # Test create_spatial_dataframe import
+ assert create_spatial_dataframe is not None