-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement current_date scalar function #4022
Conversation
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.
Looks great to me @comphead -- thank you!
I left some minor suggestions, but I think this PR could be merged in without changes as well.
DataType::Date32 | ||
); | ||
|
||
let sql = "select case when current_date() = cast(now() as date) then 'OK' else 'FAIL' end result"; |
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.
Nice!
@@ -254,6 +258,7 @@ impl BuiltinScalarFunction { | |||
|
|||
// Stable builtin functions | |||
BuiltinScalarFunction::Now => Volatility::Stable, | |||
BuiltinScalarFunction::CurrentDate => Volatility::Stable, |
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.
👍
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
if this is merged first then i'll need to update: |
Since this appears to have some other work building behind it and it has two approvals, merging it in! |
Benchmark runs are scheduled for baseline = 35f786b and contender = f91eddf. f91eddf is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
* current_date impl * Update datafusion/expr/src/expr_fn.rs Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> * Update datafusion/physical-expr/src/functions.rs Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* current_date impl * Update datafusion/expr/src/expr_fn.rs Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> * Update datafusion/physical-expr/src/functions.rs Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* current_date impl * Update datafusion/expr/src/expr_fn.rs Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> * Update datafusion/physical-expr/src/functions.rs Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* current_date impl * Update datafusion/expr/src/expr_fn.rs Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> * Update datafusion/physical-expr/src/functions.rs Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Which issue does this PR close?
Closes #3981
Rationale for this change
DataFusion users need to be able to use the current date to calculate things like "all data in the last 30 days"
What changes are included in this PR?
Scalar current_date function
Are there any user-facing changes?