fix(spark): use Spark field names in struct #410
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 214 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.321
Real PR Conversation Timeline
1 comments
"Review active on #410"
general
weight: 0.35
andygrove
Which issue does this PR close?
Rationale for this change
struct(1, 2, 3)uses DataFusion'sc0,c1, andc2field names instead of Spark'scol1,col2, andcol3. A column argument should keep its column name.What changes are included in this PR?
Rewrite SQL
structcalls and the Rust expression helper to DataFusion'snamed_struct, with field names as literal arguments. Names survive function lookup and plan reconstruction without a stateful UDF. The existing physical implementation and child nullability are retained; Sparknamed_structbehavior remains in #224.Two upstream gaps are recorded with deferred tests: empty
struct()syntax (apache/datafusion-sqlparser-rs#3048, with execution also depending on #224), and alias provenance for mixed named/unnamed fields (apache/datafusion#27723).Are these changes tested?
Yes.
struct/struct.sltcovers names, aliases, duplicates, nested fields, NULLs, arrays, and both ANSI settings. It also checks the reportedifregression, other common-type consumers, and DataFusion-only list syntax. Rust tests verify literal name arguments and schema preservation when reconstructing the expression through the function registry.Checked against Spark 4.2.0 with the repository PySpark runner: 24 records pass; the DataFusion-only list syntax is skipped. Existing map expectations now use Spark's field names and the #364 expected-failure marker is removed.
Are there any user-facing changes?
Unaliased SQL
structcalls with arguments use Spark's field names and retain column names. Mixed aliased/unnamed arguments remain blocked upstream.