-
Notifications
You must be signed in to change notification settings - Fork 184
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
feat: date_add and date_sub functions #910
Conversation
…eed to confirm if any other type of expression can occur here.
I'll drive into this test failure tomorrow. My assumption of the second expression for date_add always being a Literal does not appear sound.
|
spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala
Outdated
Show resolved
Hide resolved
q72 comparison (only SF 1 locally), last two rows of each (using Comet Exec) are relevant. main branch:
This PR:
|
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.
LGTM with one nit. Thanks @mbutrovich!
I added support for Int8 and Int16. I don't love this control flow. @viirya suggested macros, but I'm open to other ways to approach this. |
} | ||
macro_rules! array_date_arithmetic { |
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.
nit: style
} | |
macro_rules! array_date_arithmetic { | |
} | |
macro_rules! array_date_arithmetic { |
Which issue does this PR close?
Does not close an individual PR, but addresses an item in #858.
Rationale for this change
What changes are included in this PR?
New DateAdd and DateSub functions in QueryPlanSerde. They have two arguments: a date and an int32 representing the number of days. DataFusion does not fully support
date_add
, so this PR introduces functions using the scalar UDF interface. These functions use DataFusion interfaces to apply Arrow kernels to perform the computation.I also had to generate new q72 reference plans because it uses
date_add
.How are these changes tested?
New test cases for
date_add
anddate_sub
, both scalar and array arguments.fix: ReusedExchangeExec + CometShuffleExchangeExec under QueryStageExec + should be CometRoot
inCometExecSuite
also exercisesdate_add
. q72 also exercisesdate_add
as well.