add test to catch mis-aligned ipc buffers - #10405
Merged
Merged
Conversation
Contributor
Author
|
🤔, it may also be worth to add a similar test at the arrow-flight level for |
Jefffrey
approved these changes
Jul 23, 2026
| // Fixed-width: alignment == element byte width. | ||
| // Variable-width (e.g. StringArray): the offsets buffer drives alignment (Int32 → 4). | ||
| let cases: Vec<(ArrayRef, usize)> = vec![ | ||
| (Arc::new(Int32Array::from_iter(0i32..20_000)) as _, 4), |
Contributor
There was a problem hiding this comment.
do we strictly need arrays this large? could reduce down to 1000 elements? (or even 500)
Contributor
Author
There was a problem hiding this comment.
nope, an array of size 2 would be testing the same thing.
Contributor
|
thanks @Rich-T-kid |
Contributor
|
Epic -- thank you both |
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.
Which issue does this PR close?
Rationale for this change
see #10394
What changes are included in this PR?
Adds a single test
test_misaligned_buffers_error()inarrow-ipc/src/reader.rsthat verifies misaligned IPC buffers are caught by require_alignment = true. The test loops over byte offsets 0..128 across both fixed-width (Int32, Int64) and variable-width (StringArray, LargeStringArray) array types, asserting that any offset not satisfying the type's alignment requirement returns a "Misaligned buffers" error, and that aligned offsets decode successfulldy.Are these changes tested?
yes
Are there any user-facing changes?
no