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

Types are not checked when building case expression #4660

Closed
2 tasks
HaoYang670 opened this issue Dec 17, 2022 · 3 comments
Closed
2 tasks

Types are not checked when building case expression #4660

HaoYang670 opened this issue Dec 17, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@HaoYang670
Copy link
Contributor

HaoYang670 commented Dec 17, 2022

Describe the bug
A clear and concise description of what the bug is.
The type of case expression is not checked when building the plan.

To Reproduce

DataFusion CLI v15.0.0
❯ create table t as select 2 as a;
0 rows in set. Query took 0.013 seconds.
❯ select case
    when a = 1 then true
    when a = 2 then 'abc'
    else 123
  end  
from t;
Internal("The type of Boolean AND Utf8 of binary physical should be same")

Expected behavior
We should return a DatafusionError::Plan(...), instead of an Internal error.

Additional context
The CaseBuilder does some type checking, but it seems that it is bypassed.
https://github.com/apache/arrow-datafusion/blob/c2f199adbec8b650de5668c97675f8a757607df8/datafusion/expr/src/conditional_expressions.rs#L100-L110

  • Check when expr
  • Check then and else
@HaoYang670 HaoYang670 added the bug Something isn't working label Dec 17, 2022
@HaoYang670 HaoYang670 self-assigned this Dec 17, 2022
@HaoYang670
Copy link
Contributor Author

Blocked by #4615

@HaoYang670
Copy link
Contributor Author

@HaoYang670
Copy link
Contributor Author

Close it as this has been fixed by #5820.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant