Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support List type coercion for CASE-WHEN-THEN expression #12490

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

goldmedal
Copy link
Contributor

@goldmedal goldmedal commented Sep 16, 2024

Which issue does this PR close?

Closes #12370.

Rationale for this change

The rule for the List type is to choose the wider type (LargeList > List > FixedSizeList) as the target type.

What changes are included in this PR?

  • The type coercion rule for List type comparison.
  • Support to coerce the list type for then expressions
  • Support to compare nested type for case-when expression

Are these changes tested?

yes

Are there any user-facing changes?

no

@github-actions github-actions bot added optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels Sep 16, 2024
@goldmedal
Copy link
Contributor Author

I tried to add some sql test for FixedSizeList case but I can't find the way to create it through SQL API 🤔

> select arrow_cast([1,2,3], 'FixedSizeList(Int64, 10)');
Error during planning: Unsupported type 'FixedSizeList(Int64, 10)'. Must be a supported arrow type name such as 'Int32' or 'Timestamp(Nanosecond, None)'. Error finding i64 for FixedSizeList, got 'Int64'

@goldmedal goldmedal marked this pull request as ready for review September 16, 2024 15:32
@goldmedal goldmedal marked this pull request as draft September 17, 2024 13:58
@github-actions github-actions bot added the physical-expr Physical Expressions label Sep 17, 2024
@goldmedal goldmedal changed the title Support List, FixedSizeList and LargeList type coercion for comparison Support List type coercion for CASE-WHEN-THEN expression Sep 17, 2024
@goldmedal goldmedal marked this pull request as ready for review September 17, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimizer Optimizer rules physical-expr Physical Expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LargeList and List type coercion not working in CASE WHEN
1 participant