Skip to content

Conversation

@paleolimbot
Copy link
Member

@paleolimbot paleolimbot commented Dec 3, 2025

We haven't used the ffi scalar kernels in the sedona crate yet, which were based on the rust/DataFusion versions. To properly get geography working everywhere I'd like to avoid the Rust wrapper around s2geography, which means being able to fully express a scalar kernel in C. Luckily the existing C definition we'd been using is fairly close...this PR removes the previous FFI scalar kernel implementation in favour of a C one. Once this is merged I'll follow-up with a change to s2geography to actually use it (which will remove almost all of the wrapper cod there, too).

This PR also implements exporting any of our implementations as C-callable implementations, which would let any of these functions be called from something like Java given some glue code on the other side.

This PR has an eye towards other types of C extensions like the C GPU joiner in #310, where we can simplify the development for both libgpuspatial and sedonadb by completely separating the builds.

@paleolimbot paleolimbot requested a review from Copilot December 3, 2025 22:57
Copy link
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 refactors the FFI scalar kernel implementation by moving it from Rust-based DataFusion wrappers to a C-based implementation in the new c/sedona-extension crate. This change enables full expression of scalar kernels in C without requiring Rust wrappers, supporting better integration with C extensions like GPU joiners and the s2geography library.

Key changes:

  • Removed the rust/sedona/src/ffi.rs module containing DataFusion-based FFI implementations
  • Created new c/sedona-extension crate with C-compatible scalar kernel definitions
  • Implemented import/export wrappers for C scalar kernels in Rust

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rust/sedona/src/lib.rs Removed reference to deleted ffi module
rust/sedona/src/ffi.rs Deleted entire DataFusion-based FFI implementation (515 lines)
c/sedona-extension/src/sedona_extension.h Added C header with Arrow C Data Interface definitions and scalar kernel structs
c/sedona-extension/src/scalar_kernel.rs Implemented Rust wrappers to import/export C scalar kernels with comprehensive tests
c/sedona-extension/src/lib.rs Created new crate entry point exposing extension and scalar_kernel modules
c/sedona-extension/src/extension.rs Added Rust FFI representations of C scalar kernel structs with safety implementations
c/sedona-extension/Cargo.toml Defined new crate with dependencies on arrow, datafusion, and sedona components
Cargo.toml Added c/sedona-extension to workspace members

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

@paleolimbot paleolimbot marked this pull request as ready for review December 4, 2025 02:33
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.

1 participant