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

   ## Problem
   
   `RS_SetGeoReference(raster, georef)` returns a raster whose band names are 
all NULL. User-visible for named bands — e.g. Zarr variable names like 
`temperature`.
   
   Confirmed on `main` (8e0a26328):
   
   ```
   SOURCE band_name = Some("temperature")
   COPIED band_name = None
   ```
   
   ## Root cause
   
   Band name lives on `RasterRef::band_name(index)` — **`BandRef` has no name 
accessor** — so `copy_into` has nothing to inherit it from. 
`BandOverrides.name` documents this: *"Name for the derived band (the source 
has none to inherit)."*
   
   `copy_raster_from` passed `BandOverrides::default()` (i.e. `name: None`), 
even though `source.band_name(band_idx)` was right there. `RS_SetGeoReference` 
is its only production caller.
   
   ## Fix
   
   Pass the name explicitly in the copy loop. Callers that build bands one at a 
time already have to do this; this makes the copy-whole helper match.
   
   ## Why nothing caught it
   
   Two gaps, both closed here:
   
   1. `copy_raster_from_overrides_transform_and_preserves_bands` used an 
**unnamed** band — despite the name, it asserted nothing about band names.
   2. **`assert_raster_arrays_equal` never compared band names at all.** It 
checks dim names, shape, dtype, nodata, pixels — but not the band name. That 
blind spot hid this suite-wide.
   
   Added the missing assertion to the shared comparator. It passes across 
`sedona-raster`, `sedona-raster-functions`, and `sedona-raster-zarr` with no 
other fallout, which confirms this was the only band-name drop in the tree.
   
   Then gave the affected fixtures real names. The new 
`preserves_per_band_names_across_multiple_bands` test uses two 
differently-named bands so the per-index mapping is pinned, not just the 
presence of a name.
   
   ## Verification
   
   Reverting only the one-line fix fails **7** `RS_SetGeoReference` tests plus 
the `copy_raster_from` builder test with `Band names do not match`.
   
   ```
   sedona-raster            177 passed; 0 failed
   sedona-raster-functions  255 passed; 0 failed
   sedona-raster-zarr        66 passed; 0 failed
   ```
   
   ## Follow-up (not in this PR)
   
   A `BandRef::name()` accessor would let `copy_into` inherit the name like it 
does `nodata` / `outdb_uri` / `outdb_format`, removing this footgun class 
rather than this one instance.


-- 
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