fix: List
of FixedSizeList
coercion issue in SQL
#14468
Merged
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?
List
ofFixedSizedList
in SQL #13819.Rationale for this change
Currently,
FixedSizeList
values inside amake_array
call are eagerly coerced intoList
, resulting in non-intuitive behavior.To improve consistency, this PR aligns the behavior with DuckDB: coercion should only occur when the
FixedSizeList
is modified. This approach makes coercion more predictable and avoids unnecessary type transformations.What changes are included in this PR?
This PR removes the coercion logic in
make_array
when the type union resolves toFixedSizeList
, ensuring thatmake_array
no longer performs eager coercion.Creating
List(FixedSizeList)
Previously,
make_array
would automatically coerceFixedSizeList
intoList
, even when no operations were performed. With this fix, the expected behavior is preserved:Appending After Casting to
FixedSizeList
If an element is appended to a
FixedSizeList
, coercion toList
will still occur, as expected:Are these changes tested?
One of the test cases in
sqllogictest
has been modified to reflect the updated behavior.Are there any user-facing changes?
Yes, users who previously relied on
make_array
coercingFixedSizeList
intoList
by default will see a change in behavior. Now, coercion only occurs when modifications (e.g.,array_append
) are applied.