Skip to content

fix(arrow-data): account for FixedSizeList parent offset in MutableArrayData - #11636

Merged
Jefffrey merged 2 commits into
apache:mainfrom
ahlag:fix-fsl-extend-offset
Oct 17, 2026
Merged

Jefffrey merged 2 commits into
apache:mainfrom
ahlag:fix-fsl-extend-offset

Conversation

@ahlag

@ahlag ahlag commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

MutableArrayData::extend on a FixedSizeList with a nonzero parent offset copied the child values from the start of the child instead of from the offset.

What changes are included in this PR?

build_extend in transform/fixed_size_list.rs adds array.offset() to start before computing the child range, the same way #10934 did for structs.

Are these changes tested?

Yes, test_extend_fixed_size_list_accounts_for_parent_offset in arrow-data/src/data.rs (next to the struct test from #10934). It fails without the fix.

Are there any significant user-facing changes?

No.

AI use: I used Claude Code to find the cause and write the fix and test. I reviewed the change and checked that the test fails without the fix.

@github-actions github-actions Bot added the arrow-core Core crates related to representing arrow data label Oct 17, 2026
@ahlag
ahlag marked this pull request as ready for review October 17, 2026 00:56

Box::new(
move |mutable: &mut _MutableArrayData, index: usize, start: usize, len: usize| {
let start = start + offset;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps this should be a checked addition to guard overflows

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jefffrey Can you check the commit 24198f6? I have addressed your feedback.

@Jefffrey Jefffrey added the bug Squash those bugs label Oct 17, 2026
@Jefffrey
Jefffrey enabled auto-merge October 17, 2026 07:26
@Jefffrey

Copy link
Copy Markdown
Contributor

thanks

@Jefffrey
Jefffrey added this pull request to the merge queue Oct 17, 2026
Merged via the queue into apache:main with commit 9827aaa Oct 17, 2026
35 checks passed
starpact pushed a commit to starpact/arrow-rs that referenced this pull request Oct 19, 2026
…ayData (apache#11693)

# Which issue does this PR close?

- Closes apache#11686.

# Rationale for this change

`MutableArrayData::extend` on sparse union `ArrayData` with a nonzero
offset took the type ids from the right rows but copied the children's
values from the rows before the offset. So each type id was paired with
the wrong value. A sparse union's children are not sliced by the
parent's offset, and `array.buffer::<i8>(0)` applies the offset only to
the type ids.

# What changes are included in this PR?

`build_extend_sparse` in `arrow-data/src/transform/union.rs` adds
`array.offset()` to `start` before it extends the children, the same way
apache#10934 did for structs and apache#11636 did for fixed size lists. The overflow
checks match those two fixes. Dense unions are not changed, because
their offsets buffer already gives each row's child index.

# Are these changes tested?

Yes. `test_extend_sparse_union_accounts_for_parent_offset` in
`arrow-data/src/data.rs` (next to the struct and fixed size list tests)
builds a sparse union with two children and offset 1, extends it, and
checks the type ids and both children. Without the fix, child `a` comes
back as `[10, 20]` instead of `[20, 30]`.

I also ran `cargo test -p arrow-data`, `cargo test -p arrow --test
array_transform`, `cargo test -p arrow-select --lib` and `cargo clippy
-p arrow-data --all-targets -- -D warnings`.

# Are there any significant user-facing changes?

No.

AI disclosure: I used an AI coding assistant to write the fix, the test
and this description, and I reviewed all of it. The part worth a
reviewer's look is that the type ids keep using the already offset
buffer while only the children get the added offset.
alamb pushed a commit that referenced this pull request Oct 19, 2026
…fset in MutableArrayData (#11683)

- Backport #11636
- For inclusion in #11664

Cherry-pick of
9827aaa

Co-authored-by: Chang Yong Lik <[email protected]>
alamb pushed a commit that referenced this pull request Oct 21, 2026
…fset in MutableArrayData (#11756)

- Backport #11636
- For inclusion in #11665

Cherry-pick of
9827aaa

Co-authored-by: Chang Yong Lik <[email protected]>
alamb pushed a commit that referenced this pull request Oct 22, 2026
…fset in MutableArrayData (#11809)

- Backport #11636
- For inclusion in #11666

Cherry-pick of
9827aaa

Co-authored-by: Chang Yong Lik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow-core Core crates related to representing arrow data bug Squash those bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MutableArrayData::extend ignores the offset of FixedSizeList ArrayData

2 participants