← Back to Pull requests

Fix Delta write GPU planning with AQE on DBR 17.3 [databricks] #16376

Closed
unknown closed this pull request without merging on Oct 16, 2026 15:50 UTC
View on GitHub
unknown unknown commented on Oct 16, 2026 01:18 UTC
Author

Fixes #16372.

Description

With AQE enabled on DBR 17.3, Delta UPDATE and MERGE operations can retain the CPU write stub because AQE insertion skips the remaining preparation rules. This causes unintended row execution and CPU optimized-write exchange selection.

Apply the normal columnar rules to the unreplaced write stub after AQE insertion, preserving QueryExecution ownership, shuffle-cleanup policy, and intentional metadata-query fallback. Also remove duplicate driver updates to the optimized-write partition counter, which shuffle-read tasks already update preventing Databricks SQL metrics conflicts.

AI assistance: Codex assisted with implementation and validation. The author reviewed and approved the complete changes before posting the PR.

<details>
<summary>Validation and performance results</summary>

Validated on DBR 17.3 / Spark 4.0 / Scala 2.13 / Tesla T4:

  • All 11 integration cases passed, covering the five reported UPDATE/MERGE variants, empty/nonempty writes, and metadata fallback.

  • The baseline fails the three affected DML cases. The final artifact uses GPU write stubs and GPU optimized exchanges, preserves exact rows and mutation counts, and produces no partition-counter conflicts or SQL-listener worker errors.
  • Focused 10-million-row Parquet-to-Delta comparison using local[2], with eight timed writes per artifact/AQE mode after warmups across paired fresh sessions:

    | AQE | Baseline median | Patched median | Elapsed-time change |
    | --- | ---: | ---: | ---: |
    | Enabled | 11.058 s | 9.559 s | -13.6% |
    | Disabled | 9.340 s | 9.050 s | -3.1% |

    </details>

    Checklists

    Documentation

  • Updated for new or modified user-facing features or behaviors

  • No user-facing change
  • Testing

  • Added or modified tests to cover new code paths

  • Covered by existing tests

  • Not required
  • Performance

  • Tests ran and results are added in the PR description

  • Issue filed with a link in the PR description

  • Not required
  • Diff: 248 lines (+186 / -62) across 3 files Reviewer: gerashegalov Review duration: 872m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 248 lines diff across 3 files
    0.39
    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%
    56%
    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.330
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #16376"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 38.9% (MEDIUM) · Higher = larger blast radius
    38.9%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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%