[GH-3369] Preserve empty components when setting SRID - #3377
Merged
Merged
Conversation
This was referenced Sep 16, 2026
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Did you read the Contributor Guide?
Yes.
Is this PR related to a ticket?
Prerequisite for #3374 and #3369. Uses the merged JTS copy fix in jiayuasu/jts#10.
What changes were proposed in this PR?
ST_SetSRIDcurrently removes empty members while copying a collection. For example, a collection containing an empty point and a populated point returns only the populated point after changing SRID. Empty polygon holes are also dropped. A standalone empty polygon can be returned as the original object, mutating its SRID rather than creating a copy.Use the isolated JTS
GeometryCopierwith the requested SRID and the input's coordinate-sequence factory. This preserves every component and ring, including empty holes, and creates independent coordinate storage. Copies discarduserData; the source geometry and its metadata remain unchanged. The copy logic is maintained in JTS, so this PR adds no Sedona geometry factory or serialization classes.org.datasyslab:jts-io-patch:1.21.0-datasyslab-2is published on Maven Central. It uses stock JTS 1.20 geometry types and does not require replacing Spark's bundled JTS jar.How was this patch tested?
The regressions fail against the base implementation and pass with the fix. They cover nested empty components, all three multipart types, empty polygon holes, empty-polygon input mutation, XYM/XYZ/XYZM layouts, packed sequences, geometry and factory SRIDs, independent copies, and source/userData preservation. A Spark SQL regression checks the empty-hole count before and after
ST_SetSRID.At this PR head, 337 common
FunctionsTestcases passed against the snapshot.Validated the combined Sedona stack at
76f59c947971e06657d01229a4f940863d3e5253againstorg.datasyslab:jts-io-patch:1.21.0-datasyslab-2-SNAPSHOT, built from merged JTS commit1a382cc402f495adf1ea39c4905cafbac491e40f:ST_GeneratePointsstayed XY.The published
1.21.0-datasyslab-2artifact passes 32 isolated-artifact tests against stock JTS 1.20. All nine implementation class files are byte-for-byte identical to the tested snapshot; public downloads and signatures were verified. The full CI matrix and MySQL/Docker constructor suite were not part of these local checks.Did this PR include necessary documentation updates?
No public SQL API or configuration was added. Changing SRID retains the input's geometry structure.