Skip to content

feat(rust/sedona-testing): add ergonomic raster function test harness#945

Open
james-willis wants to merge 7 commits into
apache:mainfrom
james-willis:jw/raster-test-harness
Open

feat(rust/sedona-testing): add ergonomic raster function test harness#945
james-willis wants to merge 7 commits into
apache:mainfrom
james-willis:jw/raster-test-harness

Conversation

@james-willis

Copy link
Copy Markdown
Contributor

No description provided.

Adds RasterSpec, a terse declarative raster fixture (the raster analog of
WKT for geometry tests), plus tester and assertion plumbing:

- RasterSpec::d2/nd with band/band_values/band_nd/nodata/name/outdb
  modifiers, sequential default pixel fill, and a PixelValue trait for
  typed pixel data (little-endian)
- raster_array() for multi-row inputs with null rasters
- ScalarUdfTester::invoke_raster_scalar/invoke_raster_array/
  invoke_raster_array_scalar and a raster Literal path through scalar_lit
- AggregateUdfTester::aggregate_rasters for future raster aggregates
- Raster-aware assert_scalar_equal/assert_array_equal (null rows compared
  by validity, mismatches reported per-field instead of a struct dump)
- list_utf8_row/list_i64_row/band_pixels extractors for common return
  shapes
- Retrofit rs_bandpath and rs_band_accessors tests as demos
- Parameterized end-to-end Python tests for RS_ functions over a Zarr
  fixture, with a gated probe documenting that the Zarr byte loader is
  not yet reachable from RS_EnsureLoaded in Python
@github-actions github-actions Bot requested a review from paleolimbot June 12, 2026 01:47

@paleolimbot paleolimbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is great, thanks for working on it! Feel free to ignore any of this if you're still working through changes

Comment on lines +221 to +226
/// Override the GDAL geotransform
/// `[origin_x, scale_x, skew_x, origin_y, skew_y, scale_y]`.
pub fn transform(mut self, transform: [f64; 6]) -> Self {
self.transform = transform;
self
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to do this here, but Wwhen we get to some more spatial interactions, setting this from a BoundingBox might also be nice

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm adding some logics this week to build transforms from bboxes to support spatial:bbox attributes as a way to georeference datasets.

Comment thread python/sedonadb/tests/functions/conftest.py Outdated
…zarr-reader tests to sedonadb-zarr

The sedonadb-package raster function tests used a Zarr fixture, forcing a
zarr/sedonadb_zarr dependency. Switch them to an in-DB RS_Example() raster so
they run without zarr, and relocate the zarr-reader-specific RS tests
(per-chunk transform, fill_value->nodata, RS_BandPath chunk anchor,
RS_EnsureLoaded) plus their fixtures to the sedonadb-zarr package.
@james-willis james-willis marked this pull request as ready for review June 15, 2026 17:40
…ollision

Two test_raster_functions.py (sedonadb + sedonadb-zarr) collide under pytest's
rootdir import mode (no package __init__.py). Rename the sedonadb-zarr one to
test_zarr_raster_functions.py.
…in assert_raster_equal

assert_raster_equal only checked width/height/geotransform and band
metadata/bytes, so two rasters differing only in CRS, or with transposed
N-D spatial dims, compared equal. Add asserts for crs(), spatial_dims(),
spatial_shape(), and per-band dim_names()/shape(), plus a regression test
that a CRS-only difference is now caught. Also surface a clear assertion
(not a bare unwrap panic) when an in-db band is strided.
…aster test fixture

The apache#940 extension-registration refactor renamed the Zarr ExternalFormatSpec
from ZarrFormatSpec to Zarr; the relocated raster-function test fixture still
referenced the old name and errored at setup.
sedonadb_zarr is the package under test in this suite, not an optional
dependency, so import it directly rather than via importorskip — a missing
or broken build should fail loudly, not silently skip. (zarr/numpy stay on
importorskip; those are genuinely optional.)
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