-
Notifications
You must be signed in to change notification settings - Fork 849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ensure take_fixed_size_list can handle null indices #5170
fix: ensure take_fixed_size_list can handle null indices #5170
Conversation
Co-authored-by: Will Jones <[email protected]>
arrow-select/src/take.rs
Outdated
@@ -689,7 +689,7 @@ fn take_value_indices_from_fixed_size_list<IndexType>( | |||
where | |||
IndexType: ArrowPrimitiveType, | |||
{ | |||
let mut values = vec![]; | |||
let mut values = Vec::with_capacity(length as usize * indices.len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, we should make this PrimitiveBuilder
, since the conversion from Vec
is no longer zero-copy when it's an Option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to a builder
Co-authored-by: Will Jones <[email protected]>
Which issue does this PR close?
Closes #5169
Rationale for this change
See issue
What changes are included in this PR?
The take implementation for fixed size list currently works by expanding the indices from "list indices" into "child indices". In other words, if the list is a fixed size list of 3 and the indices are
[0, 5]
then it converts this into[0, 1, 2, 15, 16, 17]
. This process was ignoring null indices and the result was that the child array would be too short. For example,[0, null]
would turn into[0, 1, 2]
which is too short. This PR propagates the null into the child index list. So now[0, null]
turns into[0, 1, 2, null, null, null]
.Are there any user-facing changes?
None