← Back to Pull requests

fix(spark): use Spark field names in struct #410

Open
unknown opened this pull request with 214 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 24, 2026 08:52 UTC
Author

Which issue does this PR close?

  • Fixes the reported literal and column cases in #364.
  • Rationale for this change

    struct(1, 2, 3) uses DataFusion's c0, c1, and c2 field names instead of Spark's col1, col2, and col3. A column argument should keep its column name.

    What changes are included in this PR?

    Rewrite SQL struct calls and the Rust expression helper to DataFusion's named_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; Spark named_struct behavior 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.slt covers names, aliases, duplicates, nested fields, NULLs, arrays, and both ANSI settings. It also checks the reported if regression, 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 struct calls with arguments use Spark's field names and retain column names. Mixed aliased/unnamed arguments remain blocked upstream.

    Diff: 214 lines (+160 / -54) across 2 files Reviewer: andygrove Review duration: 9086m
    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
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.6% (MEDIUM) · Higher = larger blast radius
    36.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.5% · Safe to merge
    19.5%