feat: Implement native Rust ST_Centroid and ST_Length functions#33
Merged
jiayuasu merged 24 commits intoapache:mainfrom Sep 8, 2025
Merged
Conversation
Kontinuation
reviewed
Sep 8, 2025
paleolimbot
reviewed
Sep 8, 2025
paleolimbot
reviewed
Sep 8, 2025
paleolimbot
approved these changes
Sep 8, 2025
Member
paleolimbot
left a comment
There was a problem hiding this comment.
Thank you! (One nit to handle now or in a follow-up!)
rust/sedona-geometry/src/is_empty.rs
Outdated
Comment on lines
24
to
30
| #[derive(Error, Debug)] | ||
| pub enum IsEmptyError { | ||
| #[error("Invalid geometry type")] | ||
| InvalidGeometryType, | ||
| } | ||
|
|
||
| pub fn is_geometry_empty<G: GeometryTrait<T = f64>>(geometry: &G) -> Result<bool, IsEmptyError> { |
Member
There was a problem hiding this comment.
Sorry I didn't catch this on the last round - we have SedonaGeometryError already and we should use that!
28 tasks
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.
Implements native Rust versions of ST_Centroid and ST_Length functions using the geo-generic-alg library, providing substantial performance improvements over the existing GEOS-based implementations.
Added ST_Centroid implementation (
rust/sedona-geo/src/st_centroid.rs)Added ST_Length implementation (
rust/sedona-geo/src/st_length.rs)Updated benchmark tests (
benchmarks/test_functions.py)ST_Centroid
Before the fix:
After the fix:
ST_Length
Before the fix:
After the fix:
Performance Results
The native Rust implementations provide significant performance benefits, especially for simpler geometries, while maintaining full compatibility with the existing API.