feat: add support for make_date expression#3147
Open
andygrove wants to merge 8 commits intoapache:mainfrom
Open
feat: add support for make_date expression#3147andygrove wants to merge 8 commits intoapache:mainfrom
andygrove wants to merge 8 commits intoapache:mainfrom
Conversation
Adds native Comet support for Spark's make_date function which creates a date from year, month, and day components. Closes apache#3091 Co-Authored-By: Claude Opus 4.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3147 +/- ##
============================================
+ Coverage 56.12% 59.99% +3.87%
- Complexity 976 1475 +499
============================================
Files 119 175 +56
Lines 11743 16167 +4424
Branches 2251 2681 +430
============================================
+ Hits 6591 9700 +3109
- Misses 4012 5114 +1102
- Partials 1140 1353 +213 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
comphead
approved these changes
Jan 16, 2026
Contributor
comphead
left a comment
There was a problem hiding this comment.
Thanks @andygrove
I dont see fuzzer here though
Add a custom SparkMakeDate implementation that returns NULL for invalid dates instead of throwing exceptions, matching Spark's behavior. Changes: - Add native/spark-expr/src/datetime_funcs/make_date.rs with: - Support for type coercion (Int64 -> Int32 for SQL literals) - Proper validation of month (1-12) and day (1-31) ranges - NULL return for invalid dates (e.g., Feb 30, non-leap year Feb 29) - Uses chrono for date validation and epoch calculation - Register SparkMakeDate in comet_scalar_funcs.rs - Add integration tests in spark_expr_reg.rs - Update test comments in CometTemporalExpressionSuite.scala Co-Authored-By: Claude Opus 4.5 <[email protected]>
Member
Author
|
Moving this to draft until #3328 is merged |
When these functions received a mix of scalar and array arguments (e.g., make_date(2023, month, day)), they incorrectly converted scalars to single-element arrays, causing only 1 row to be returned instead of matching the column's row count. Now determines the actual batch size from array arguments first, then broadcasts scalars to that size. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Member
Author
|
@comphead I migrated the tests to the new SQL file based testing approach and this uncovered a bug which is now fixed. Could you re-review when you have time? |
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
make_datefunctionmake_datefunctionTest Plan
CometTemporalExpressionSuiteCloses #3091