hcrosse opened a new pull request, #21704: URL: https://github.com/apache/datafusion/pull/21704
## Which issue does this PR close? - Closes #21702. ## Rationale for this change `array_concat` hit an internal cast error when given a mix of `List` and `LargeList` (or `FixedSizeList` and `LargeList`) arguments: ```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>. ``` `ArrayConcat::coerce_types` was coercing only the base element type, leaving the outer container alone. When the resolved return type is `LargeList`, `array_concat_inner` later tries to downcast each arg to `GenericListArray<i64>`, which fails for any `List` argument that slipped through. ## What changes are included in this PR? In `ArrayConcat::coerce_types`, after coercing the base type, also promote each input's outermost `List` to `LargeList` when the return type is a `LargeList`. `FixedSizeList` inputs already go through `FixedSizedListToList` first and then get promoted too. Per-arg dimensionality is preserved, so nested cases keep working with `align_array_dimensions`. ## Are these changes tested? Yes, added sqllogictests in `array_concat.slt` covering: - `List` + `LargeList` - `LargeList` + `List` - `FixedSizeList` + `LargeList` - Three-way mix `List`, `LargeList`, `List` Each one also asserts `arrow_typeof(...) = LargeList(Int64)`. ## Are there any user-facing changes? Queries that previously returned an internal cast error now return the concatenated `LargeList` as expected. No API changes. -- 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]
