test: replace arrow_cast with :: casts where a SQL type is equivalent #76
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 296 lines diff across 3 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.341
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #76"
general
weight: 0.35
kosiew
Which issue does this PR close?
N/A. Follow-up to #54 (the PySpark runner skips any query that calls
arrow_cast, because Spark has no such function).Rationale for this change
Many
.sltqueries usearrow_castonly to pick a type that has a plain SQL name. Writing those as::casts makes the tests easier to read, and Spark can run them, so the PySpark runner checks these queries instead of skipping them.What changes are included in this PR?
arrow_cast(x, 'T')becomesx::SQLTYPEin 58 files (482 lines) when DataFusion maps the SQL type to exactly the same Arrow type and Spark accepts the type name:| Arrow type | SQL type |
|---|---|
|
Int8/Int16/Int32/Int64|TINYINT/SMALLINT/INT/BIGINT||
Float32/Float64|FLOAT/DOUBLE||
Boolean,Binary,Date32|BOOLEAN,BINARY,DATE||
Utf8View|STRING||
Decimal128(p, s), p ≤ 38 |DECIMAL(p, s)||
List(Int32)|ARRAY<INT>|::binds tighter than unary minus, so negative literals and expressions are wrapped in parentheses, for example(-128)::TINYINT. Without them,-128::TINYINTcasts128first and overflows.Spark cannot cast an integer to
DATE, so anarrow_cast(n, 'Date32')of an integer day count becomesdate_from_unix_date(n)rather thann::DATE. A test that reads aDATEresult back as a day count usesunix_date(...), because Spark'sCASTof aDATEtoINTreturns NULL.arrow_castis kept where no SQL type gives the same Arrow type:Utf8, becauseSTRINGandVARCHARmap toUtf8Viewby defaultFloat16,Large,View,Date64,Time32,Decimal32/Decimal64/Decimal256,FixedSize*,Dictionary,StructandMapTime64Utf8Viewcasts of a column that is alreadyUtf8View(inbround.sltandpositive.slt), wherecolumn1::STRINGgets the same name as plaincolumn1and DataFusion rejects the duplicate projectionAre these changes tested?
Only test files changed.
cargo test -p datafusion-spark-sqllogictestpasses, apart frommath/expm1.slt, which also fails on main on macOS and is fixed by #359. The PySpark runner now checks the converted queries on Spark 4.2, and none of them adds a new difference from Spark.Are there any user-facing changes?
No.