Repository navigation
feat: add support for datediff expression - #3145
Merged
Merged
Conversation
Adds native Comet support for Spark's datediff function, which returns the number of days between two dates (endDate - startDate). Closes apache#3087 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
andygrove
marked this pull request as draft
January 14, 2026 23:49
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3145 +/- ##
============================================
+ Coverage 56.12% 60.02% +3.89%
- Complexity 976 1429 +453
============================================
Files 119 170 +51
Lines 11743 15748 +4005
Branches 2251 2602 +351
============================================
+ Hits 6591 9453 +2862
- Misses 4012 4976 +964
- Partials 1140 1319 +179 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| FuzzDataGenerator.generateDataFrame(r, spark, schema, 1000, DataGenOptions()) | ||
| } | ||
|
|
||
| test("datediff") { |
Contributor
There was a problem hiding this comment.
Tests using dates from leap years would be fun to try. Try this -
datediff( 1900-03-01, 1900-02-27) != datediff(2000-03-01, 2000-02-27)
Member
Author
There was a problem hiding this comment.
Good suggestion! I've added leap year edge case tests:
datediff('1900-03-01', '1900-02-27')= 2 days (1900 was NOT a leap year - divisible by 100 but not 400)datediff('2000-03-01', '2000-02-27')= 3 days (2000 WAS a leap year - divisible by 400)datediff('2004-03-01', '2004-02-28')= 2 days (2004 was a leap year - divisible by 4, not by 100)datediff('2100-03-01', '2100-02-28')= 1 day (2100 will NOT be a leap year - divisible by 100 but not 400)
All tests pass.
andygrove
marked this pull request as ready for review
January 15, 2026 02:25
Add tests for leap year handling as suggested in review: - 1900 was NOT a leap year (divisible by 100 but not 400) - 2000 WAS a leap year (divisible by 400) - 2004 was a leap year (divisible by 4, not by 100) - 2100 will NOT be a leap year (divisible by 100 but not 400) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
parthchandra
approved these changes
Jan 21, 2026
parthchandra
left a comment
Contributor
There was a problem hiding this comment.
lgtm. pending conflict resolution and ci.
Member
Author
|
Thanks for the review @parthchandra |
mixermt
added a commit
to mixermt/datafusion-comet
that referenced
this pull request
Oct 11, 2026
Brings in origin/main up to 9e13649 and moves the iceberg-rust pin to the current head of apache/iceberg-rust#3111 (0145ca6b), which still contains main's pin (af1da4c5). Main now loads the Iceberg scheme allow-lists from the native builtin_storage_schemes over JNI, so hdfs is admitted there (read and write) instead of in the two Scala sets. The pin brings apache/iceberg-rust apache#3145, which makes FileScanTaskDeleteFile's fields private behind a validating builder and its deletion-vector offsets unsigned: the planner builds delete files through the builder (rejecting a negative offset or size as iceberg-rust does for a manifest entry), and the delete-file sizing rebuilds each delete through it. The reworked HDFS backend validates every declared nameservice and a forwarded fs.defaultFS when it builds the storage, failing all I/O otherwise. Comet's gate now simulates its option expansion (hadoop.* keys win over the hdfs.name-node.<ns> sugar key by key) and declines those cases at planning. It also builds HDFS clients in a runtime of its own, so the AbortOnDrop comment about runtime-bound operators is replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
datedifffunctiondatediff(endDate, startDate)= endDate - startDateTest Plan
CometTemporalExpressionSuiteCloses #3087