feat(spark): add Spark-compatible make_time function #72
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 341 lines diff across 4 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.349
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #72"
general
weight: 0.35
kosiew
Closes #212.
Summary
make_time(hour, minute, second), ported from DataFusion Comet'sdatetime_funcs/make_time.rs.Time64(Nanosecond)(Spark'sTIME(6)). NULL if any argument is NULL. The result does not depend on the session time zone.DATETIME_FIELD_OUT_OF_BOUNDS.WITHOUT_SUGGESTIONwith Spark's message, including the SQLSTATE (Invalid value for HourOfDay (valid values 0 - 23): -1. SQLSTATE: 22023), whatever the ANSI setting.DateTimeUtils.makeTime: seconds outside0..=2147483647are rejected first and reported truncated toward zero (-0.5reports0,4294967297.5reports4294967297). OtherwiseLocalTime.oforder applies: hour, then minute, then second.ImplicitCastInputTypes: any numeric or string to INT for hour and minute, and toDECIMAL(16, 6)for seconds (extra fractional digits round half up). DataFusion types bare integer literals as BIGINT, so a strict INT signature would rejectmake_time(1, 18, 19.87).Decimal128(_, 6).make_timewith#[user_doc], followingCONTRIBUTING.md.Known gap
The argument casts use DataFusion's cast, not Spark's, so values the cast cannot represent raise a cast error in both ANSI modes. With ANSI mode off Spark wraps an out-of-range integer (
make_time(4294967297::BIGINT, 0, 0)is01:00:00) and returns NULL for a malformed string or seconds that do not fitDECIMAL(16, 6); it returns NULL for NaN and Infinity seconds in both modes. With ANSI mode on both engines error, with different messages. Spark-compatible casts are tracked by #88. These cases are in the.sltfile as commented-out queries carrying Spark's result, and the gap is stated in the docs.Testing
datetime/make_time.slt: cases from Spark'stime.sql.out, issue #212 and Comet'smake_timeunit tests, withDECIMALvariants of the literal cases (DataFusion reads19.87as DOUBLE, see #97), seconds columns of INT, BIGINT, DECIMAL and DOUBLE, NULLs in each column, a non-UTC session time zone, and the bounds errors with ANSI mode on and off. Results and error messages were checked against PySpark 4.2.0; the PySpark runner passes every query it can run.cargo clippy --all-targets --all-features -- -D warnings,cargo test -p datafusion-sparkandcargo test -p datafusion-spark-sqllogictestpass.🤖 Generated with Claude Code