You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "jiayuasu (via GitHub)" <gi...@apache.org> on 2026/09/23 07:56:51 UTC

[PR] [GH-3393] Preserve empty multipart members in Python serde [sedona]

jiayuasu opened a new pull request, #3394:
URL: https://github.com/apache/sedona/pull/3394

   ## Did you read the Contributor Guide?
   
   Yes. 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?
   
   Closes #3393.
   
   This is the serde prerequisite extracted from #3389. It can be reviewed and merged independently of the GeoPandas `transform` feature; #3389 should land afterward.
   
   ## What changes were proposed in this PR?
   
   Preserve empty members when Python decodes multipart geometries. For example, `MULTIPOINT (EMPTY, (1 2), EMPTY)` must retain three members with emptiness flags `[True, False, True]` after a round trip.
   
   The pure-Python fallback currently discards empty MultiPoint, MultiLineString, and MultiPolygon members. Reconstruct multipart values containing empty members through a shared WKB helper to retain their positions and supported coordinate layouts. Normal multipart values retain their existing constructor path. Points with only one NaN XY ordinate remain nonempty.
   
   The native MultiPoint decoder currently assumes NaN coordinates create an empty point. GEOS 3.13 creates nonempty NaN points through these constructors, so construct stored empty points with a zero-length coordinate sequence while preserving their XY/XYZ/XYM/XYZM layout. Nonempty 2D points retain the fast path.
   
   These are existing deserialization bugs. The wire format and public API are unchanged; this PR contains only the two serde implementation files, two test files, and a release note.
   
   ## How was this patch tested?
   
   Rebuilt the native CPython 3.11 extension from this branch and confirmed each test run loaded that extension. Ran both complete modules:
   
   ```sh
   PYTHONPATH=python python -m pytest -p no:cacheprovider \
     python/tests/utils/test_geomserde_speedup.py \
     python/tests/utils/test_geometry_serde_empty.py -q
   ```
   
   - Shapely 2.1.2 / GEOS 3.13.1: **164 passed**.
   - Shapely 2.0.0 / GEOS 3.11.1: **130 passed, 34 skipped**.
   - Shapely 1.8.5.post1 / GEOS 3.10.3: **123 passed, 41 skipped**.
   
   `mvn spotless:apply`, `git diff --check`, and all applicable commit hooks passed.
   
   The compatibility skips cover unsupported layouts/features. Tests cover member positions, all-empty and zero-member collections, supported coordinate layouts, SRIDs, consumed byte offsets, and partially NaN points. Native tests assert `is_empty` explicitly, since WKB alone cannot distinguish the affected NaN points from empty points.
   
   The original combined branch reproduced the two Spark transform failures before this native fix and passed all six multipart integration cases afterward. The standalone branch has no dependency on the transform implementation. GEOS 3.8 has not been tested locally.
   
   ## Did this PR include necessary documentation updates?
   
   Yes. Added a Python bug-fix release note. No public API documentation change is required.
   


-- 
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: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [GH-3393] Preserve empty multipart members in Python serde [sedona]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #3394:
URL: https://github.com/apache/sedona/pull/3394


-- 
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: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org