Mola-maker opened a new pull request, #12292:
URL: https://github.com/apache/arrow-rs/pull/12292
Closes #12284.
`OffsetBuffer::new_unchecked` never validated its input because
`arrow-buffer` had no `force_validate` feature, so decreasing offsets could
reach an array unchecked even in the CI job that runs with `force_validate`
(`GenericByteArray::try_new` trusts the `OffsetBuffer` type invariant).
This adds `force_validate = []` to `arrow-buffer`, wires `arrow-data`'s
`force_validate` to enable `arrow-buffer/force_validate`, and makes
`OffsetBuffer::new_unchecked` delegate to `Self::new` when the feature is on
(same pattern as `GenericByteArray::new_unchecked`). No other manifest needs to
change: `arrow-array` and `arrow` both enable `arrow-data/force_validate`.
## Are these changes tested?
Yes. New regression test
`buffer::offset::tests::non_monotonic_offsets_unchecked_force_validate`
(`#[should_panic]`, gated on `force_validate`): it fails before the fix ("test
did not panic as expected") and passes after. The issue's end-to-end scenario
(BinaryArray/StringArray built from offsets `[0, 2, 1, 3]` via `new_unchecked`)
now panics with "offsets must be monotonically increasing" under `cargo test -p
arrow-array --features force_validate`.
Test results (all 0 failed):
- arrow-buffer (default): 386 lib + 92 doc passed
- arrow-buffer (`--features force_validate`): 387 lib + 92 doc passed
- arrow-data (default): 88 lib + 13 doc passed
- arrow-data (`--features force_validate`): 83 lib + 13 doc passed
- arrow-array (default): 758 lib + 209 doc passed
- arrow-array (`--features force_validate`): 746 lib + 209 doc passed
Total: 2,448 lib + 628 doc = 3,076 passed, 0 failed. `cargo fmt --all --
--check` and `cargo clippy -p arrow-buffer -p arrow-data -p arrow-array
--all-targets --all-features` are clean.
AI usage disclosure: this PR was developed with AI assistance (harness:
Muse; model: Muse Spark; effort: issue triage, implementation, and
verification).
--
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]