-
Notifications
You must be signed in to change notification settings - Fork 728
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
Add funciton coalesce #5922
Add funciton coalesce #5922
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Thanks for the contribution! Please review the labels and make any necessary changes. |
@TianLangStudio We can transform |
@sundy-li Thanks. As you know I am a newbie. I thought it didn't support this way until I saw the function NULLIF last week. I will commit later and may not have time to add tests and documents recently. Maybe you can review the function coalesce first. |
@@ -586,6 +588,39 @@ impl<'a> TypeChecker<'a> { | |||
.await? | |||
} | |||
|
|||
Expr::Coalesce { span, exprs } => { | |||
// Rewrite COALESCE(expr1, expr2, ...) to IF(IS_NOT_NULL(expr1), expr1, expr2) | |||
let resolve_args = exprs.iter().rev().fold( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can filter exprs to remove Literal::Null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add the filter later.
@TianLangStudio Thanks for your contribution, I'll continue this task based on your commits. |
/LGTM |
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
Add funciton coalesce WIP
Changelog
Related Issues
Fixes #5768