fix: List of FixedSizeList coercion issue in SQL#14468
Merged
alamb merged 2 commits intoapache:mainfrom Feb 5, 2025
Merged
Conversation
alamb
approved these changes
Feb 4, 2025
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thank you for this contribution @alan910127 ❤️
| List(Field { name: "item", data_type: List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }) | ||
| List(Field { name: "item", data_type: List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }) | ||
|
|
||
| List(Field { name: "item", data_type: FixedSizeList(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }, 2), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }) |
Contributor
There was a problem hiding this comment.
List of FixedSizeList makes more sense to me
Contributor
Author
Thank you, @alamb! 😊 Glad to contribute! Let me know if there's anything else I can improve. |
Contributor
|
🚀 -- I normally try to leave PRs open for 24 hours before merging them to ensure other committers in different timezones have a chance to review too if they like |
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?
ListofFixedSizedListin SQL #13819.Rationale for this change
Currently,
FixedSizeListvalues inside amake_arraycall 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
FixedSizeListis 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_arraywhen the type union resolves toFixedSizeList, ensuring thatmake_arrayno longer performs eager coercion.Creating
List(FixedSizeList)Previously,
make_arraywould automatically coerceFixedSizeListintoList, even when no operations were performed. With this fix, the expected behavior is preserved:Appending After Casting to
FixedSizeListIf an element is appended to a
FixedSizeList, coercion toListwill still occur, as expected:Are these changes tested?
One of the test cases in
sqllogictesthas been modified to reflect the updated behavior.Are there any user-facing changes?
Yes, users who previously relied on
make_arraycoercingFixedSizeListintoListby default will see a change in behavior. Now, coercion only occurs when modifications (e.g.,array_append) are applied.