[GH-3369] Preserve declared geometry dimensions through serialization - #3374
Merged
jiayuasu merged 28 commits intoSep 21, 2026
Merged
Conversation
jiayuasu
marked this pull request as draft
September 16, 2026 07:19
This was referenced Sep 16, 2026
Signed-off-by: Jia Yu <jiayu@apache.org>
This was referenced Sep 18, 2026
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?
Closes #3369. Builds on merged #3377 and #3373.
This PR covers serialization and SQL constructors. Copy behavior is in merged #3377; file and adapter readers are in #3378.
org.datasyslab:jts-io-patch:1.21.0-datasyslab-2is published on Maven Central.WKB output is reviewed separately in #3381.
What changes were proposed in this PR?
Preserve layouts declared in WKB and Sedona geometry buffers, including empty primitive geometries and all-NaN Z/M values. A leading null in a GeoSeries does not change a geometry's layout.
Use IO2's shared declared-sequence types and
WKBReader.forDeclaredDimensions()directly. Sedona no longer definesDeclaredCoordinateSequence,DeclaredCoordinateSequenceFactory, orGeometryWkbReader. The JTS geometry factory remains ordinary; its sequence factory preserves declarations on copies without declaring subsequent sized allocations. Ordinary XY operations, includingST_GeneratePoints, remain XY.ST_SetSRIDuses the isolated copier through #3377.Spark's bundled JTS jar stays in place and the Sedona wire format is unchanged. Multipart geometries have one layout header, so conflicting declared component layouts raise the existing heterogeneous-layout error, including XY mixed with a declared empty Z component. Apply
ST_ForceCollectionbefore collection to retain individual layouts. Zero-member collections have no coordinate sequence carrying their own declaration.How was this patch tested?
At
ea830b85c19095b60457710d968b27c322ff9b54, 354 focused common tests passed against the publishedorg.datasyslab:jts-io-patch:1.21.0-datasyslab-2, covering geometry functions, SRID copying and dimension serialization. The branch includes merged #3377, and its diff contains only the serializer and constructor changes.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?
ST_CollectandST_Collect_Aggdocument layout requirements and the GeometryCollection alternative. No SQL API or wire-format change.