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

   # Which issue does this PR close?
   
   Closes #11848
   
   # Rationale for this change
   
   Creating a `StructArray` with a very large non-nullable `NullArray` child 
can panic while allocating a logical null bitmap instead of returning a 
validation error.
   
   # What changes are included in this PR?
   
   When the parent has no nulls, validate the child using its logical null 
count. When the parent masks every row, there can be no unmasked child nulls. 
For a partially null parent, retain the bitmap containment check. This avoids 
materializing a `NullArray` bitmap in the reported case while preserving 
masked-null validation.
   
   A previous fix for this issue was proposed in #11849 and closed without 
merging. That PR special-cased the `Null` type; this change uses the logical 
null count when bitmap containment is unnecessary.
   
   # Are these changes tested?
   
   A regression reproduces the reported allocation panic on the unmodified code 
and expects an error for a `NullArray` of length `usize::MAX`. Additional cases 
cover an empty child, fully valid and fully null parents, partially masked 
nulls, and regular integer children with matching and non-matching masks. 
Workspace tests and Clippy passed locally; the final added boundary cases also 
passed the targeted StructArray tests.
   
   # Are there any significant user-facing changes?
   
   No API change.
   
   # AI assistance
   
   Codex (GPT-6) generated the implementation and tests and assisted with 
validation and this description.


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