fix: array_concat widens container variant for mixed List/LargeList inputs#21704
Open
hcrosse wants to merge 1 commit intoapache:mainfrom
Open
fix: array_concat widens container variant for mixed List/LargeList inputs#21704hcrosse wants to merge 1 commit intoapache:mainfrom
hcrosse wants to merge 1 commit intoapache:mainfrom
Conversation
…ist/LargeList inputs `ArrayConcat::coerce_types` only coerced the base element type, leaving the outer container variant unchanged. With a mix of `List` and `LargeList` (or `FixedSizeList` and `LargeList`) inputs, `array_concat_inner` would later try to downcast the `List` array to `GenericListArray<i64>` and fail with an internal cast error. When the resolved return type is `LargeList`, also promote each input's outermost `List` to `LargeList` so the cast targets match what `array_concat_inner` expects.
Jefffrey
approved these changes
Apr 18, 2026
| } | ||
|
|
||
| fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>> { | ||
| let base_type = base_type(&self.return_type(arg_types)?); |
Contributor
There was a problem hiding this comment.
I just realized something funny the existing implementation does; it calls return_type within coerce_types even though the docstring for return_type states that the input types are already coerced (i.e. coerce_types would have already been called) 😅
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
array_concathit an internal cast error when given a mix ofListandLargeList(orFixedSizeListandLargeList) arguments:ArrayConcat::coerce_typeswas coercing only the base element type, leaving the outer container alone. When the resolved return type isLargeList,array_concat_innerlater tries to downcast each arg toGenericListArray<i64>, which fails for anyListargument that slipped through.What changes are included in this PR?
In
ArrayConcat::coerce_types, after coercing the base type, also promote each input's outermostListtoLargeListwhen the return type is aLargeList.FixedSizeListinputs already go throughFixedSizedListToListfirst and then get promoted too. Per-arg dimensionality is preserved, so nested cases keep working withalign_array_dimensions.Are these changes tested?
Yes, added sqllogictests in
array_concat.sltcovering:List+LargeListLargeList+ListFixedSizeList+LargeListList,LargeList,ListEach 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
LargeListas expected. No API changes.