Validate interleave indices before dispatch#10175
Open
fallintoplace wants to merge 1 commit into
Open
Conversation
Dandandan
reviewed
Jun 21, 2026
| return Ok(new_empty_array(data_type)); | ||
| } | ||
|
|
||
| validate_interleave_indices(values, indices)?; |
Contributor
There was a problem hiding this comment.
I think the cost of this separate pass will be quite high, other kernels don't do this (or make it optional).
Contributor
Author
There was a problem hiding this comment.
That makes sense. Would you prefer making this optional, similar to take bounds checking, or keeping the fast path unchanged and documenting that invalid indices may panic?
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.
What changed
interleave(values, indices)now validates every user-provided(array_idx, row_idx)before dispatching to specialized implementations. It returnsArrowError::InvalidArgumentErrorwhen an index references a missing input array or a row past the selected array length.The regression tests cover an out-of-bounds array index, an out-of-bounds row index, and the
StringViewArrayspecialized path that previously could reach direct view indexing.Why
interleaveis a public API, and invalid external indices should be reported as Arrow errors instead of reaching specialized kernels that can panic while indexing arrays or byte views.Validation
cargo fmt --package arrow-selectcargo test -p arrow-select out_of_bounds