fix(rust/sedona-functions): propagate NULL for scalar NULL SRID/CRS in ST_SetSRID/ST_SetCRS#629
Merged
Kontinuation merged 1 commit intoapache:mainfrom Feb 18, 2026
Conversation
…n ST_SetSRID/ST_SetCRS ST_SetSRID and ST_SetCRS behaved inconsistently for NULL SRID/CRS input: scalar NULL preserved the geometry (just unset CRS), while array NULL masked the geometry row as NULL. Fix the scalar path to also return NULL, consistent with SQL NULL propagation semantics.
976cb8e to
2904ac9
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes inconsistent NULL handling in ST_SetSRID and ST_SetCRS functions to match PostGIS behavior and standard SQL NULL propagation semantics.
Changes:
- Fix scalar NULL SRID/CRS to propagate NULL geometry instead of preserving geometry with unset CRS
- Extract shared
invoke_set_crs()helper function to deduplicate logic betweenSTSetSRIDandSTSetCRS - Update Rust unit tests and add Python integration test to validate the corrected NULL behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| rust/sedona-functions/src/st_setsrid.rs | Added new invoke_set_crs helper to handle NULL propagation consistently; refactored STSetSRID and STSetCRS to use shared logic; updated unit tests to verify NULL scalar returns NULL geometry |
| python/sedonadb/tests/functions/test_transforms.py | Added integration test to verify NULL SRID produces NULL geometry, matching PostGIS behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
paleolimbot
approved these changes
Feb 17, 2026
Member
paleolimbot
left a comment
There was a problem hiding this comment.
Thank you! The previous behaviour was definitely not intentional on my end 😬
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.
Rationale
ST_SetSRID should have consistent behavior regardless of whether the SRID arg is an array or not. Returning NULL when the input SRID is NULL identical to the behavior of ST_SetSRID in PostGIS.
Summary
ST_SetSRIDandST_SetCRS: scalar NULL SRID/CRS now returns NULL geometry instead of preserving the geometry with CRS unset, matching the existing array NULL behavior and standard SQL NULL propagation semantics.invoke_set_crs()helper to deduplicate identical logic betweenSTSetSRIDandSTSetCRSkernels.