patrickswedish opened a new pull request, #26379:
URL: https://github.com/apache/datafusion/pull/26379

   ## Which issue does this PR close?
   
   Closes #26342.
   
   ## Rationale for this change
   
   In `datafusion/functions-nested/src/repeat.rs`, `general_list_repeat` 
reconstructs `inner_list` with a hardcoded nullable list field:
   ```rust
   Arc::new(Field::new_list_field(list_array.value_type().clone(), true))
   ```
   When given a list whose element field is non-nullable (e.g. `List(non-null 
Int32)`), the outer list expects `list_array.data_type()`, but `inner_list` has 
`List(Int32)` (nullable). Arrow's `GenericListArray::try_new` validates that 
the values array data type matches the field data type, causing an Arrow type 
mismatch error:
   ```text
   ListArray expected data type List(non-null Int32) got List(Int32)
   ```
   
   ## What changes are included in this PR?
   
   - Extracted the element `field` directly from `list_array.data_type()` and 
reused it when constructing `inner_list`, preserving nullability, field name, 
and metadata.
   - Added a regression unit test 
`test_array_repeat_nested_non_nullable_elements` in 
`datafusion/functions-nested/src/repeat.rs` verifying nested lists with 
non-nullable element fields are repeated without error.
   
   ## Are these changes tested?
   
   Yes, new unit test `test_array_repeat_nested_non_nullable_elements` added to 
`datafusion/functions-nested/src/repeat.rs`.
   
   ---
   *Diff minimization and pre-flight validation performed with [ZeroSlop™ 
CI](https://github.com/marketplace/actions/zeroslop-by-ribbsaeter-systems) — 
[Ribbsaeter Systems](https://ribbsaetersystems.com/).*
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to