Skip to content

Fix MutableArrayData::extend for ListView#9562

Open
vegarsti wants to merge 4 commits intoapache:mainfrom
vegarsti:list-view-mutable-array-data-bug-repro
Open

Fix MutableArrayData::extend for ListView#9562
vegarsti wants to merge 4 commits intoapache:mainfrom
vegarsti:list-view-mutable-array-data-bug-repro

Conversation

@vegarsti
Copy link
Contributor

Which issue does this PR close?

Closes #9561.

The existing implementation in list_view.rs copies offsets and sizes but skips copying child data. The original code copies offsets and sizes into a new array that has an empty child values array, so the offsets may point into nothing if the child data doesn't exist anymore.

MutableArrayData's build_extend for ListView/LargeListView copies
offsets and sizes from the source array but never extends the child
data. This produces invalid arrays where offsets reference
nonexistent child elements, causing panics on access.
@github-actions github-actions bot added the arrow Changes to the arrow crate label Mar 16, 2026
Copy link
Contributor

@brancz brancz left a comment

Choose a reason for hiding this comment

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

I like this approach

// Copy the child range
let child_base = if child_max > child_min {
let base = mutable.child_data[0].len();
mutable.child_data[0].extend(index, child_min, child_max);
Copy link
Contributor

Choose a reason for hiding this comment

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

why not slice?

Copy link
Contributor Author

@vegarsti vegarsti Mar 16, 2026

Choose a reason for hiding this comment

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

Are you referring to extend_with_slice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, probably the slice operation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MutableArrayData::extend does not copy child values for ListView arrays

2 participants