Skip to content

refactor(rust/sedona-raster): Pre-downcast band metadata arrays in RasterStructArray#588

Merged
Kontinuation merged 1 commit intoapache:mainfrom
Kontinuation:pr2-better-band-metadata-ref
Feb 11, 2026
Merged

refactor(rust/sedona-raster): Pre-downcast band metadata arrays in RasterStructArray#588
Kontinuation merged 1 commit intoapache:mainfrom
Kontinuation:pr2-better-band-metadata-ref

Conversation

@Kontinuation
Copy link
Member

Summary

  • Move the 5 downcast_ref calls for band metadata sub-arrays (nodata, storage_type, datatype, outdb_url, outdb_band_id) from per-band access time (BandsRef::band()) to batch construction time (RasterStructArray::new()).
  • This eliminates repeated downcasting on the hot path when iterating over bands in a raster batch.
  • Also simplifies BandsRef::len() to use value_length() instead of manual offset arithmetic.

…sterStructArray

Move the 5 downcast_ref calls for band metadata sub-arrays (nodata,
storage_type, datatype, outdb_url, outdb_band_id) from per-band access
time (BandsRef::band()) to batch construction time (RasterStructArray::new()).
This eliminates repeated downcasting on the hot path when iterating over
bands. Also simplify BandsRef::len() to use value_length() instead of
manual offset arithmetic.
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 optimizes band metadata access in the raster processing code by pre-downcasting band metadata arrays during batch construction instead of performing these operations repeatedly during iteration.

Changes:

  • Moved 5 downcast_ref operations for band metadata arrays from the hot path (BandsRef::band()) to initialization time (RasterStructArray::new())
  • Simplified BandsRef::len() implementation to use value_length() API instead of manual offset arithmetic
  • Updated struct definitions to store pre-downcast array references instead of the parent StructArray

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Kontinuation Kontinuation merged commit bb2f7d4 into apache:main Feb 11, 2026
16 checks passed
@paleolimbot paleolimbot added this to the 0.3.0 milestone Feb 19, 2026
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.

3 participants