minhpham1810 opened a new pull request, #3279: URL: https://github.com/apache/sedona/pull/3279
## Did you read the Contributor Guide? - Yes, I have read the [Contributor Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest/community/develop/) ## Is this PR related to a ticket? - Yes, and the PR name follows the format `[GH-XXX] my subject`. Closes #3271 ## What changes were proposed in this PR? Addresses [issue #3271](https://github.com/apache/sedona/issues/3271): *"GeoPandas: preserve authoritative no-CRS metadata for local geometry columns"* The issue reports that locally constructed `GeoSeries`/`GeoDataFrame` objects with `crs=None` have no CRS metadata, making them indistinguishable from raw distributed geometry columns of unknown provenance. This causes `.crs` access to trigger expensive distributed `ST_SRID` aggregation jobs to discover the CRS is absent. ### Changes **`geoseries.py`**: - Added `is_locally_owned` flag to distinguish locally-constructed objects (Python list, WKT/WKB, plain pandas/geopandas objects) from wrapped distributed structures - Added `_record_no_crs_metadata()` helper method that stamps empty CRS metadata (empty string in metadata dict) using `_query_geometry_column()` with `crs_override=None` - Stamps no-CRS metadata in `__init__` when `crs=None` and `is_locally_owned=True` - Stamps no-CRS metadata in `_create_from_select()` for `from_wkt()`/`from_wkb()` paths (freshly built geometries with no embedded SRID) **`geodataframe.py`**: - Added `is_locally_owned` flag with the same logic as `GeoSeries` - Added consolidated no-CRS stamping block at end of `__init__` that checks if geometry column exists, is locally owned, and has no CRS metadata - Fixed `set_geometry()` array-like branch to construct `GeoSeries` directly from local data (avoid pre-wrapping in bare `pspd.Series`) - Added import of `read_crs_metadata` helper **Tests**: - `test_geoseries.py`: Added 5 new tests covering local construction paths, raw column preservation, embedded SRID preservation, and no Spark/Python plan for CRS discovery - `test_geodataframe.py`: Added 3 new tests covering named geometry column path and Spark/Python plan verification ## How was this patch tested? - All 4 modified files pass `ast.parse` syntax validation - Black formatting applied (where possible; test file formatting left untouched per existing repo state) - Existing test suite patterns followed; no additional test execution possible in this environment (no Spark/geopandas available) - Manual code review against implementation requirements and existing codebase patterns The tests are structured to run with full Sedona build (Maven) once Spark/geopandas environment is available. ## Did this PR include necessary documentation updates? - No, this PR does not affect any public API so no need to change the documentation. The changes are internal implementation details that preserve existing public behavior while fixing the underlying performance issue. The public `.crs` property semantics remain unchanged: locally constructed objects now correctly report `crs=None` without triggering distributed SRID lookups. -- 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]
