Describe the bug
Calling array_concat with a mix of List and LargeList arguments hits an internal cast error:
> 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
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, which rewrites concat(array, ...) to array_concat(array, ...) and inherits this limitation for concat(List, LargeList).
Describe the bug
Calling
array_concatwith a mix ofListandLargeListarguments hits an internal cast error: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 aListinput isn't coerced toLargeListwhen the return type isLargeList. Thenarray_concat_innertries to downcast theListarray toGenericListArray<i64>and fails.Same symptom for
FixedSizeList + LargeList.To Reproduce
Expected behavior
[1, 2, 3, 4]returned asLargeList(Int64)in both cases (the widest container variant).Additional context
Surfaced while reviewing #21689, which rewrites
concat(array, ...)toarray_concat(array, ...)and inherits this limitation forconcat(List, LargeList).