Skip to content

feat(r/sedonadb): Add R bindings#23

Merged
jiayuasu merged 14 commits intoapache:mainfrom
paleolimbot:r-bindings
Sep 10, 2025
Merged

feat(r/sedonadb): Add R bindings#23
jiayuasu merged 14 commits intoapache:mainfrom
paleolimbot:r-bindings

Conversation

@paleolimbot
Copy link
Member

@paleolimbot paleolimbot commented Sep 5, 2025

This PR adds R bindings to sedonadb. The exposed functionality is slightly less than that of Python but has generally the same scope (SQL, Arrow-based interop with the rest of the ecosystem). This works (and is tested on CI) for MacOS and Linux...Windows I ran into some trouble with and is a battle for a different day.

library(sedonadb)

url <- "https://github.com/geoarrow/geoarrow-data/releases/download/v0.2.0/microsoft-buildings_point_geo.parquet"
sd_read_parquet(url) |> sd_to_view("buildings", overwrite = TRUE)

filter <- "POLYGON ((-73.4341 44.0087, -73.4341 43.7981, -73.2531 43.7981, -73.2531 43.8889, -73.1531 43.8889, -73.1531 44.0087, -73.4341 44.0087))"

sd_sql(glue::glue("
  SELECT * FROM buildings
  WHERE ST_Intersects(ST_SetSRID(ST_GeomFromText('{filter}'), 4326), geometry)
")) |> sd_preview()
#> ┌─────────────────────────────────┐
#> │             geometry            │
#> │             geometry            │
#> ╞═════════════════════════════════╡
#> │ POINT(-73.29533522 44.00847556) │
#> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
#> │ POINT(-73.29092778 44.00421331) │
#> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
#> │ POINT(-73.277808 43.998823)     │
#> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
#> │ POINT(-73.277524 44.004619)     │
#> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
#> │ POINT(-73.2774573 44.0044719)   │
#> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
#> │ POINT(-73.27775838 44.0046742)  │
#> └─────────────────────────────────┘
#> Preview of up to 6 row(s)

@paleolimbot paleolimbot marked this pull request as ready for review September 10, 2025 20:06
@paleolimbot paleolimbot requested a review from Copilot September 10, 2025 20:06
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 adds comprehensive R bindings for Apache SedonaDB, providing R users with access to a lightweight spatial query engine with SQL capabilities and Arrow-based interoperability. The implementation includes full test coverage and CI support for macOS and Linux platforms.

Key changes:

  • R package structure with Rust backend integration using savvy framework
  • Spatial data processing capabilities with Arrow/nanoarrow integration
  • Test suite covering dataframes, contexts, and ADBC driver functionality

Reviewed Changes

Copilot reviewed 51 out of 57 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
r/sedonadb/tests/testthat/*.R Comprehensive test suite for dataframe operations, context management, and ADBC driver
r/sedonadb/src/rust/src/*.rs Rust implementation providing core functionality for contexts, dataframes, and runtime management
r/sedonadb/src/*.c, *.h C interface and initialization code for R integration
r/sedonadb/R/*.R R package code implementing user-facing API and S3 methods
r/sedonadb/man/*.Rd Documentation files for exported functions
r/sedonadb/DESCRIPTION, NAMESPACE Package metadata and exported functions
.github/workflows/r.yml CI configuration for testing R package on multiple platforms
Cargo.toml Updated workspace to include R package's Rust components

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

paleolimbot and others added 2 commits September 10, 2025 15:17
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jiayuasu jiayuasu merged commit e2b3627 into apache:main Sep 10, 2025
11 checks passed
@paleolimbot paleolimbot deleted the r-bindings branch October 8, 2025 20:05
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.

2 participants