-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Implement constant folding for CAST #513
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
Conversation
| data_type, | ||
| } => match inner.as_ref() { | ||
| Expr::Literal(val) => { | ||
| let scalar_array = val.to_array(); |
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.
Great idea👍 I think converting to an array is the best we can do for now, without duplicating the code.
Dandandan
left a comment
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 think this is looking superb! Thanks @msathis
alamb
left a comment
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.
Thanks @msathis !
| .build() | ||
| .unwrap(); | ||
|
|
||
| let expected = "Projection: Int32(0)\ |
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.
this is beautiful ❤️ -- thank you @msathis
| .build() | ||
| .unwrap(); | ||
|
|
||
| let expected = "Projection: Int32(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.
👍
* adding chr null test * removing comments * repro bug * adding chr scalarfunc compatible with spark * remove ANSI configs, as it is not needed for chr * removing redundant test * Update core/src/execution/datafusion/expressions/scalar_funcs/chr.rs Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com> * adding support for scalar values * fix clippy errs * simplifying the scalar/array handling fn * fix fmt errors --------- Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com>
Which issue does this PR close?
Closes #417.
Rationale for this change
Optimize cast function during planning stage
What changes are included in this PR?
Optimize cast function during planning stage
Are there any user-facing changes?
N/A