Avoid a clone when creating UnionArray from ArrayData#9188
Merged
Dandandan merged 2 commits intoapache:mainfrom Jan 18, 2026
Merged
Avoid a clone when creating UnionArray from ArrayData#9188Dandandan merged 2 commits intoapache:mainfrom
UnionArray from ArrayData#9188Dandandan merged 2 commits intoapache:mainfrom
Conversation
53cfd08 to
ff4a428
Compare
alamb
commented
Jan 15, 2026
| for (cd, (field_id, _)) in data.child_data().iter().zip(fields.iter()) { | ||
| boxed_fields[field_id as usize] = Some(make_array(cd.clone())); | ||
| for (cd, (field_id, _)) in child_data.into_iter().zip(fields.iter()) { | ||
| boxed_fields[field_id as usize] = Some(make_array(cd)); |
Contributor
Author
There was a problem hiding this comment.
this saves a clone of ArrayData (which each requires a Vec allocation) for each child of the UnionArray
Closed
1 task
alamb
commented
Jan 16, 2026
| } | ||
| Self { | ||
| data_type: data.data_type().clone(), | ||
| data_type, |
Contributor
Author
There was a problem hiding this comment.
this saves a call of DataType::drop
Contributor
|
Looks good 🚀 |
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?
make_array) #9061ArrayData(speed up reading from Parquet reader) #9058Rationale for this change
Let's make arrow-rs the fastest we can and the fewer allocations the better
What changes are included in this PR?
Apply pattern from #9114
Are these changes tested?
Existing tests
Are there any user-facing changes?
No