james-willis opened a new pull request, #1179:
URL: https://github.com/apache/sedona-db/pull/1179

   ## What
   
   Adds `BandStructArray` — a public reader for a **bare band `StructArray`** 
(one band per row, no enclosing raster). `try_new(&StructArray)` borrows it; 
`get(i)` returns a real `Box<dyn BandRef>`.
   
   ## Why
   
   #1161 made band rows *writable* without a raster envelope 
(`BandArrayBuilder`), but left no way to read them back: `BandRefImpl` is 
private, and the only public readers (`RasterStructArray`/`RasterRefImpl`) 
require an enclosing raster. This is the symmetric read half.
   
   Without it, an out-of-tree type reusing the Band physical layout (e.g. a 
tensor/chunk value that carries its own georeferencing rather than a raster's) 
has to reimplement the view→byte-stride derivation downstream — including 
`compose_byte_strides`' overflow hardening — where it would silently drift from 
this crate.
   
   ## How
   
   Reading a band depends only on `(band-level columns, row index)` — nothing 
about it is raster-specific. So the column references and the construction 
logic move into an internal `BandColumns`: view decode + validation, 0-D and 
unknown-dtype rejection, InDb/OutDb resolution, byte-stride composition, and 
the view-buffer bounds check.
   
   - `RasterRefImpl::band` resolves its band's absolute row through the 
raster's flattened `bands` list offsets, then delegates.
   - `BandStructArray::get` delegates with the row index directly.
   
   Neither reimplements any of it, so the two paths can't diverge.
   
   ## Behavior change
   
   None. `RasterRefImpl::band` is equivalent — proven directly by 
`bare_band_and_in_raster_band_agree`, which reads the *same* bands array both 
ways and asserts every accessor plus the full `nd_buffer` shape/strides/offset 
agree.
   
   ## Verification
   
   - `cargo test -p sedona-raster`: **182 passed** (178 existing and 
unmodified, +4 new — bare round-trip through `BandArrayBuilder`, non-identity 
view decode with correct strides/offset, the raster-vs-bare equivalence test, 
and rejection of an out-of-range index and a non-band struct).
   - `sedona-raster-functions` (254), `sedona-raster-zarr` (66), 
`sedona-spatial-join-raster` (13), `sedona-testing` (93): all pass, zero 
regressions.
   - `clippy --all-targets -- -D warnings` and `fmt --all -- --check`: clean.
   - `sedona-raster-gdal` not buildable on this machine (pre-existing local 
GDAL/`gdal-sys` version mismatch, fails identically on clean `main`); it uses 
only unchanged public API and doesn't implement `BandRef`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to