Skip to content

test(integration): RS_Resample parity between SedonaDB and Sedona Spark - #1213

Closed
james-willis wants to merge 3 commits into
jw/compare-expectedfrom
jw/parity-resample
Closed

test(integration): RS_Resample parity between SedonaDB and Sedona Spark#1213
james-willis wants to merge 3 commits into
jw/compare-expectedfrom
jw/parity-resample

Conversation

@james-willis

Copy link
Copy Markdown
Contributor

Stacked on #1211#1212. Based on #1212's branch (jw/compare-expected), so this diff shows only the new resample module; merge those first.

The next step of the parity roadmap from #1203/#1212: RS_Resample, probed first on both engines, then locked in with anchored compare() calls where agreement holds and xfail-cataloged where it doesn't. RS_MapAlgebra is out of scope (SedonaDB doesn't implement it; the roadmap docstring is updated accordingly).

What agrees (13 passing tests, all anchored)

The nearest-neighbour path is bit-for-bit identical across every overload:

  • Dimension mode: 2x upsample (uint8 and float64-with-nodata), identity, non-integer-ratio downsample, integer SQL literals, lowercase algorithm spelling.
  • Scale mode: exact tiling, and the grown-extent case — ceil(extent/pixel) output, border filled with band nodata or 0 when absent (both engines share the 0-fill convention).
  • Reference-raster overload (4-arg, via CROSS JOIN) and the grid-snap overload (7-arg) with centres strictly inside the source.
  • Both engines refuse zero width / zero scale (parity on refusal, per-engine pytest.raises).

Nearest resampling on the seeded grid is hand-computable (block replication up, centre-rule decimation down), so every passing test states its exact expected DecodedRaster — no vacuous agreement.

What diverges (12 xfails)

  • Positive scaleY: SedonaDB keeps the origin at the top edge and grids upward off the raster; Spark rebases to the bottom edge and covers the source south-up.
  • Bilinear (uint8 + float64) and Bicubic: both engines really interpolate, but GDAL and JAI kernels differ (edge clamping vs nodata/zero fill, integer rounding).
  • Silent fallback family (Cubic, CubicSpline, Lanczos, Average, Mode): Sedona Spark only implements NearestNeighbor/Bilinear/Bicubic and silently resamples nearest for every other name — SedonaDB runs the real kernel. Probed on a downsample, where Average/Mode can't agree by construction.
  • Unknown algorithm: SedonaDB rejects 'sinc'; Spark silently resamples nearest.
  • Fractional width: SedonaDB rejects; Spark truncates 3.5 → 3 columns.
  • Grid-snap edge centres: output centres landing exactly on the source's left edge — GDAL samples the edge pixel, JAI zero-fills.

Verification

The nearest-neighbour path agrees bit-for-bit across dimension mode, scale
mode (including grown-extent border fill), and the reference-raster and
grid-snap overloads; those cases are locked with hand-computed expected=
anchors. Interpolating algorithms diverge: Sedona Spark really implements
only NearestNeighbor, Bilinear, and Bicubic, silently resampling nearest
for every other name it accepts, and even the shared Bilinear/Bicubic
kernels differ pixel-wise from GDAL's. Divergences are xfail-cataloged.

13 passing tests, 12 xfails. RS_MapAlgebra is out of scope (SedonaDB does
not implement it).
With DecodedRaster's bbox construction (#1211), every extent-preserving
resample anchors on the fixture's own BBOX, and the grown/snapped grids
state their extents readably instead of as transform tuples.
@james-willis

Copy link
Copy Markdown
Contributor Author

Re-raised from the fork as #1219 (contributor branches shouldn't live in the Apache repo). Same commits; the apache branch is deleted.

@james-willis
james-willis deleted the jw/parity-resample branch September 2, 2026 16: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.

1 participant