← Back to Pull requests

fix: preserve make_date argument and parent evaluation #7261

Closed
unknown closed this pull request without merging on Oct 28, 2026 00:16 UTC
View on GitHub
unknown unknown commented on Oct 27, 2026 17:52 UTC
Author

Which issue does this PR close?

Part of #6741. Second of four smaller changes replacing #7117; the issue stays open for operator evaluation and Date32 overflow fixes. The independent identity-broadcast fix is #7260; this PR targets main directly.

Rationale for this change

With ANSI enabled, make_date(y, month(make_date(2024, m, 1)), 1) must return NULL when y is NULL, even if m is 13. Eager native evaluation can evaluate the invalid inner date before checking the outer year. Parent expressions can likewise skip a date operand that native evaluation would evaluate.

What changes are included in this PR?

  • Preserve year → month → day NULL checks using the existing short-circuit lowering, with fallback where shared subexpressions prevent preserving Spark evaluation.

  • Guard parents that can skip a date operand, including empty IN predicates, while retaining native execution for supported conditionals and eager date operands. Nonempty IN retains native date probes for literal/column candidates and array/struct constructors of those values; other computed candidates fall back so Spark can skip them after a match or NULL probe.

  • Return an empty Date32 array before the physical date expression evaluates any argument on an empty batch, including when NULL short-circuiting is disabled or optimized away.

  • Document expression-level fallback behavior. Operator fallback and the Date32 overflow correction remain in the subsequent PRs.
  • How are these changes tested?

    Existing SQL and Scala fixtures cover NULL-skipped arguments, required argument errors, shared subexpressions, conditional parents, eager date operands, and empty IN/InSet predicates. Nonempty IN regressions cover native safe candidates, throwing scalar and struct candidates, NOT IN, NULL probes, and required-candidate errors. The JVM tests check both interpreted and generated Spark evaluation for the mixed-row first-match example. They use existing ANSI invalid-month errors so this PR can land before the overflow correction. Inline Rust regressions cover invalid scalar dates and throwing ANSI casts in each argument position, on empty and nonempty batches, with and without NULL short-circuiting.

    Full-reactor JVM and test-source compilation passes on Spark 4.1 / JDK 17, including formatting and style checks; Rust formatting also passes. All six tests in QueryPlanSerdeSuite pass. The computed-candidate regression fails before the fix and passes afterward. Local Rust and native SQL test execution remain blocked because the configured native dependency registry does not contain the locked aws-config 1.13.0 package. A maintainer must apply the run-spark-4.1-tests and run-all-spark-profiles CI labels before merging; the author account lacks permission to add them.

    Diff: 348 lines (+261 / -87) across 4 files Reviewer: sunchao Review duration: 383m
    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 · 348 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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
    Diff Size diff_size
    0.350
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #7261"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 42.4% (MEDIUM) · Higher = larger blast radius
    42.4%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 16.8% · Safe to merge
    16.8%