CodingCossack opened a new pull request, #11065:
URL: https://github.com/apache/arrow-rs/pull/11065
# Which issue does this PR close?
Closes #10975.
# Rationale for this change
Slicing a ListArray or LargeListArray retains offsets into the original
child array. Casting the slice to FixedSizeList currently reads from child
position zero on the fast path and when copying the first pending run on
the padding path. This can return excluded values or overfill the padded
output.
# What changes are included in this PR?
Start child selection and the first pending copy at the first retained
offset. Replace the numeric cursor sentinel and first-row special case
with Option<usize>, distinguishing no replacement from a valid source
position, including for empty rows.
Preserve the existing safe/strict length handling and perform child
conversion after selecting or padding the retained rows.
# Are these changes tested?
Three regression tests cover both list offset widths, fast and padding
paths, non-zero offsets, excluded values during child conversion, nulls,
safe/strict behaviour, empty slices and zero-width output.
Local validation executed by Codex:
- All three regression tests failed before the fix and passed afterwards.
- cargo test -p arrow-cast --all-features: 425 unit tests and 15 doctests
passed.
- cargo test -p arrow-cast --release --lib --tests: 382 tests passed.
- Strict Clippy, unused-dependency checks, formatting, spelling and
git diff --check passed.
# Are there any user-facing changes?
Affected sliced List and LargeList casts now select the correct child
values and avoid padding-path overfill. No public API changes.
# AI assistance
OpenAI Codex generated the implementation and regression tests and ran
the local validation. ChatGPT assisted with an independent static review
and this PR description.
--
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]