ump45nose opened a new pull request, #11731:
URL: https://github.com/apache/arrow-rs/pull/11731

   # Which issue does this PR close?
   
   - Closes #11608.
   
   # Rationale for this change
   
   `take` with a null index failed on a `StructArray` or `FixedSizeListArray` 
when a child was a run-end encoded array with a non-nullable values field, or a 
union with no field that can hold a null. The parent's own validity already 
marks that row null and the child slot under it is unspecified, so the take 
does not need the child to store a null. This is the struct-masked follow-up 
left out of #10994.
   
   # What changes are included in this PR?
   
   - The struct and fixed-size list paths of `take` now take a child that 
cannot store an introduced null with dummy indices at the null positions, the 
same way sparse union `take` already handles its unselected children. Children 
that can store a null (every other type, and REE/union children that have a 
nullable descendant) are taken exactly as before.
   - `take_sparse_union_child` is renamed to `take_masked_child` since it now 
serves all three parents, and the type-level part of 
`field_can_represent_take_null` is split out into 
`data_type_can_represent_take_null`.
   - For an empty child, the all-null-indices shortcut is only used when every 
index is null, so a non-null out-of-bounds index is still reported by 
`take_impl`.
   
   # Are these changes tested?
   
   Yes. New tests cover a struct and a fixed-size list over a 
non-nullable-values REE child and over a union child with no nullable field 
(with the parent field both nullable and non-nullable), an empty struct taken 
with all-null indices, and a struct with a nullable `Int32` child to show those 
children still get a null. The struct and fixed-size list tests fail without 
the fix with the errors from the issue.
   
   # Are there any significant user-facing changes?
   
   No. `take` now succeeds for these inputs instead of returning an error.
   
   AI disclosure: I used an AI coding assistant to write the fix, the tests and 
this description, and I reviewed all of it. The part worth a reviewer's look is 
the `represent_nulls` choice for struct and fixed-size list children in 
`take_impl` and `take_fixed_size_list`.
   


-- 
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]

Reply via email to