Skip to content

feat(rust/sedona-functions,c/sedona-geos): Implement geography kernels for structural transformations and accessors#844

Open
paleolimbot wants to merge 9 commits into
apache:mainfrom
paleolimbot:sitting-duck-geog-fns
Open

feat(rust/sedona-functions,c/sedona-geos): Implement geography kernels for structural transformations and accessors#844
paleolimbot wants to merge 9 commits into
apache:mainfrom
paleolimbot:sitting-duck-geog-fns

Conversation

@paleolimbot
Copy link
Copy Markdown
Member

@paleolimbot paleolimbot commented May 14, 2026

This PR adds geography matchers for a whack of functions whose output is the same for geometry and geography:

  • ST_FlipCoordinates
  • ST_Force2D, ST_Force3D, ST_Force3DM, ST_Force4D
  • ST_GeometryN
  • ST_InteriorRingN
  • ST_Reverse
  • ST_PointN
  • ST_Boundary
  • ST_LineMerge
  • ST_Normalize
  • ST_NRings
  • ST_NumInteriorRings
  • ST_NumPoints
  • ST_Points

There's no implementation changes here, only updates to the matchers so that we get geography -> geography and geometry -> geometry.

Closes #819

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends SedonaDB’s spatial function support so that a set of “mechanical” structural/accessor kernels accept geography inputs in addition to geometry, generally preserving the input type in the output. It also adds Python coverage for these geography transformations and updates GEOS-backed kernels to accept geography where appropriate.

Changes:

  • Add geography-aware kernel matchers for multiple Rust sedona-functions UDFs that return the same type as their input.
  • Update GEOS-backed C/Rust kernels (e.g., ST_Boundary, ST_LineMerge, ST_Normalize, ring/point counters) to accept geography inputs.
  • Add a comprehensive Python test suite validating geography behavior for these mechanical transforms/accessors.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
rust/sedona-functions/src/st_start_point.rs Adds separate geometry/geography kernels for start/end point accessors and updates tests.
rust/sedona-functions/src/st_reverse.rs Adds geography matcher support for ST_Reverse and updates tests.
rust/sedona-functions/src/st_points.rs Adds geography matcher support for ST_Points and updates tests.
rust/sedona-functions/src/st_pointn.rs Adds geography matcher support for ST_PointN and updates tests.
rust/sedona-functions/src/st_interiorringn.rs Adds geography matcher support for ST_InteriorRingN and updates tests.
rust/sedona-functions/src/st_geometryn.rs Adds geography matcher support for ST_GeometryN and updates tests.
rust/sedona-functions/src/st_force_dim.rs Extends force-dimension UDF tests to include geography.
rust/sedona-functions/src/st_flipcoordinates.rs Adds geography matcher support for ST_FlipCoordinates and updates tests.
python/sedonadb/tests/geography/test_geog_mechanical_transforms.py New Python tests validating geography behavior for multiple mechanical transforms/accessors.
c/sedona-geos/src/st_numpoints.rs Allows ST_NumPoints to accept geography via is_geometry_or_geography() and expands tests.
c/sedona-geos/src/st_numinteriorrings.rs Allows ST_NumInteriorRings to accept geography via is_geometry_or_geography() and expands tests.
c/sedona-geos/src/st_nrings.rs Allows ST_NRings to accept geography via is_geometry_or_geography() and expands tests.
c/sedona-geos/src/st_normalize.rs Adds separate geometry/geography kernels for ST_Normalize and updates tests.
c/sedona-geos/src/st_line_merge.rs Adds separate geometry/geography kernels for ST_LineMerge and updates tests.
c/sedona-geos/src/st_boundary.rs Adds separate geometry/geography kernels for ST_Boundary and updates tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rust/sedona-functions/src/st_start_point.rs
Comment thread rust/sedona-functions/src/st_reverse.rs
Comment thread rust/sedona-functions/src/st_points.rs Outdated
Comment thread rust/sedona-functions/src/st_pointn.rs
Comment thread rust/sedona-functions/src/st_geometryn.rs
Comment thread rust/sedona-functions/src/st_flipcoordinates.rs
Comment thread rust/sedona-functions/src/st_force_dim.rs
Comment thread c/sedona-geos/src/st_line_merge.rs
Comment thread c/sedona-geos/src/st_normalize.rs
Comment thread rust/sedona-functions/src/st_start_point.rs
@paleolimbot paleolimbot force-pushed the sitting-duck-geog-fns branch from 5710adc to 8d49a15 Compare May 15, 2026 19:48
@paleolimbot paleolimbot marked this pull request as ready for review May 15, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rust/sedona-functions: Add geography support for mechanical transformations

2 participants