feat: add support for date_from_unix_date expression#3144
feat: add support for date_from_unix_date expression#3144andygrove merged 19 commits intoapache:mainfrom
Conversation
Adds native Comet support for Spark's last_day function, which returns the last day of the month for a given date. Uses the SparkLastDay implementation from datafusion-spark crate. Closes apache#3090 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds native Comet support for Spark's date_from_unix_date function, which converts an integer representing days since Unix epoch (1970-01-01) to a Date32 value. Closes apache#3089 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3144 +/- ##
============================================
+ Coverage 56.12% 59.96% +3.83%
- Complexity 976 1473 +497
============================================
Files 119 175 +56
Lines 11743 16169 +4426
Branches 2251 2682 +431
============================================
+ Hits 6591 9695 +3104
- Misses 4012 5126 +1114
- Partials 1140 1348 +208 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…x-date # Conflicts: # docs/source/user-guide/latest/configs.md # native/spark-expr/src/comet_scalar_funcs.rs # native/spark-expr/src/datetime_funcs/mod.rs # native/spark-expr/src/lib.rs # spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala # spark/src/main/scala/org/apache/comet/serde/datetime.scala # spark/src/test/scala/org/apache/comet/CometTemporalExpressionSuite.scala
|
Moving this to draft until #3328 is merged |
…x-date # Conflicts: # native/spark-expr/src/comet_scalar_funcs.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…x-date Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…x-date # Conflicts: # native/spark-expr/src/comet_scalar_funcs.rs # spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala # spark/src/main/scala/org/apache/comet/serde/datetime.scala
|
Thanks @andygrove! Claude summarized my notes for me. Hopefully it didn't transcribe anything wrong or hallucinate :)
|
- Return ScalarValue::Date32 directly in the scalar path instead of converting to a 1-element array, preserving scalar-in/scalar-out contract for proper broadcast semantics - Mark date_from_unix_date as supported in spark_expressions_support.md - Add Int32 boundary values (2147483647, -2147483648) to test coverage
| -- specific language governing permissions and limitations | ||
| -- under the License. | ||
|
|
||
| -- ConfigMatrix: parquet.enable.dictionary=false,true |
There was a problem hiding this comment.
nit: I think parquet.enable.dictionary=false,true is removed everywhere recently
kazuyukitanimura
left a comment
There was a problem hiding this comment.
Pending ci (it looks there is a format issue)
|
@mbutrovich regarding |
Replace INT_MAX (2147483647) and INT_MIN (-2147483648) with Spark's actual date boundaries (-719162 for 0001-01-01 and 2932896 for 9999-12-31) to fix EXPRESSION_DECODING_FAILED error when Spark tries to convert out-of-range dates to Java Date objects.
|
Merged. Thanks @kazuyukitanimura @mbutrovich |
Summary
date_from_unix_datefunctionTest Plan
CometTemporalExpressionSuiteCloses #3089