feat(spark): add Spark-compatible date_from_unix_date function #74
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 239 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.328
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #74"
general
weight: 0.35
kosiew
Closes #152.
Summary
date_from_unix_date(days), ported from DataFusion Comet'sdatetime_funcs/date_from_unix_date.rs. It is the inverse ofunix_date.1.7gives 1970-01-02) and'100'gives 1970-04-11. BOOLEAN is rejected. NULL gives NULL.Date32, nullable only when the input is, as in Spark. The array path reinterprets theInt32buffer asDate32without copying.2147483648) or is not a valid number ('abc') raises an error from the cast, which matches Spark with ANSI mode on.#[user_doc]and implementsdocumentation(), following the guidelines inCONTRIBUTING.md(see #58).Known gaps
With ANSI mode off, Spark wraps an out-of-range BIGINT (
unix_date(date_from_unix_date(2147483648))is-2147483648) and returns NULL for a malformed string. DataFusion's cast errors in both cases. These need ANSI-aware casting (#88) and are recorded as commented-out queries in the slt.Testing
datetime/date_from_unix_date.slt, covering literal and column inputs, Comet's test cases, the INT range ends, overflow, strings, fractional inputs and BOOLEAN. The values for 0, 1000 and NULL come from Spark'sdate.sql.outgolden file. The rest were verified against PySpark 4.2.0, and the PySpark slt runner passes on the file.2147483647are valid but cannot be printed by Arrow's date formatter, so the slt checks them through aunix_dateround trip.cargo clippy --all-targets --all-features -- -D warnings,cargo test -p datafusion-sparkandcargo test -p datafusion-spark-sqllogictestpass.🤖 Generated with Claude Code