kartik00052 opened a new pull request, #51646:
URL: https://github.com/apache/arrow/pull/51646

   ### Rationale for this change
   
   Casting a struct containing a null-typed field to its own type could produce 
an invalid array when the struct child length differed from the enclosing 
execution batch length, such as a list containing multiple structs in one row 
or a sliced struct array. The null child was created using the parent execution 
length instead of the input child span length.
   
   ### What changes are included in this PR?
   
   - Use the input ArraySpan length when creating null-filled cast results.
   - Add C++ regression coverage for sliced structs and nested list/struct 
cases.
   - Add PyArrow coverage for array, chunked array, compute, record batch, and 
Parquet casts.
   
   ### Are these changes tested?
   
   - C++ scalar cast regression tests added.
   - PyArrow compute and Parquet regression tests added.
   - Python syntax, C++ diagnostics, and git diff whitespace checks pass.
   - Native C++ and PyArrow test execution is pending a compiler-enabled build 
environment; the current environment has no C/C++ compiler and no built local 
pyarrow extension.
   
   ### Are there any user-facing changes?
   
   Yes. Struct casts involving null-typed children now produce valid arrays 
instead of silently returning invalid arrays or raising during validation.
   
   ### Critical Fix
   
   This fixes incorrect or invalid data structures produced by a cast operation.
   
   ### Was AI used for this PR?
   
   - [ ] Human
   - [x] AI
   
   The implementation and test changes were reviewed against the existing Arrow 
cast kernels, nested-array length handling, and repository conventions.
   
   * GitHub Issue: #51639


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