hcrosse opened a new issue, #21702: URL: https://github.com/apache/datafusion/issues/21702
### Describe the bug Calling `array_concat` with a mix of `List` and `LargeList` arguments hits an internal cast error: ```sql > select array_concat(make_array(1, 2), arrow_cast([3, 4], 'LargeList(Int64)')); DataFusion error: Internal error: could not cast array of type List(Int64) to arrow_array::array::list_array::GenericListArray<i64>. ``` The issue is in `ArrayConcat::coerce_types` (`datafusion/functions-nested/src/concat.rs`). It uses the return type's base element type to coerce items but leaves the container variant alone, so a `List` input isn't coerced to `LargeList` when the return type is `LargeList`. Then `array_concat_inner` tries to downcast the `List` array to `GenericListArray<i64>` and fails. Same symptom for `FixedSizeList + LargeList`. ### To Reproduce ```sql select array_concat(make_array(1, 2), arrow_cast([3, 4], 'LargeList(Int64)')); select array_concat(arrow_cast([1, 2], 'FixedSizeList(2, Int64)'), arrow_cast([3, 4], 'LargeList(Int64)')); ``` ### Expected behavior `[1, 2, 3, 4]` returned as `LargeList(Int64)` in both cases (the widest container variant). ### Additional context Surfaced while reviewing [#21689](https://github.com/apache/datafusion/pull/21689), which rewrites `concat(array, ...)` to `array_concat(array, ...)` and inherits this limitation for `concat(List, LargeList)`. -- 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]
