refactor(rust/sedona-raster): Pre-downcast band metadata arrays in RasterStructArray#588
Merged
Kontinuation merged 1 commit intoapache:mainfrom Feb 11, 2026
Conversation
…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.
Contributor
There was a problem hiding this comment.
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_refoperations for band metadata arrays from the hot path (BandsRef::band()) to initialization time (RasterStructArray::new()) - Simplified
BandsRef::len()implementation to usevalue_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.
paleolimbot
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
downcast_refcalls 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()).BandsRef::len()to usevalue_length()instead of manual offset arithmetic.