feat(spark): implement Spark date_diff function#19845
Merged
Jefffrey merged 3 commits intoapache:mainfrom Jan 19, 2026
Merged
Conversation
Jefffrey
approved these changes
Jan 16, 2026
martin-g
reviewed
Jan 16, 2026
| Ok(ExprSimplifyResult::Simplified(binary_expr( | ||
| end.cast_to(&DataType::Int32, info.schema())?, | ||
| Operator::Minus, | ||
| start.cast_to(&DataType::Int32, info.schema())?, |
Member
There was a problem hiding this comment.
What if the argument data type is Date64 ? The signature allows it.
Date32 keeps the seconds since epoch, but Date64 keeps the milliseconds since epoch.
Contributor
Author
There was a problem hiding this comment.
oh good catch ! updated and added tests for it
…pes including string and timestamp
Contributor
|
Looks like some conflicts to fix |
Contributor
Author
fixed |
Contributor
de-bgunter
pushed a commit
to de-bgunter/datafusion
that referenced
this pull request
Mar 24, 2026
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes apache#123` indicates that this PR will close issue apache#123. --> - Closes apache#19844 - Part of apache#15914 ## Rationale for this change Add support for spark https://spark.apache.org/docs/latest/api/sql/index.html#date_diff function ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## Are these changes tested? yes in SLT ## Are there any user-facing changes? yes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
datafusion-sparkSpark Compatible Functions #15914Rationale for this change
Add support for spark https://spark.apache.org/docs/latest/api/sql/index.html#date_diff function
What changes are included in this PR?
Are these changes tested?
yes in SLT
Are there any user-facing changes?
yes