← Back to Pull requests

Accelerate Delta Lake 4.3 selective replacement with replaceOn and replaceUsing [databricks] #16619

Closed
unknown closed this pull request without merging on Nov 18, 2026 21:10 UTC
View on GitHub
unknown unknown commented on Oct 26, 2026 22:27 UTC
Author

Fixes #16280.

Description

Accelerated Delta Lake 4.3 selective replacement with replaceOn and replaceUsing, including matching against tables with persistent deletion vectors.

Reused upstream validation, expression resolution, source materialization, retry, and cleanup behavior while executing supported matching and writes on the GPU. Preserved CDF, constraints, commit metadata, metrics, and atomic partial overwrite semantics. Also fixed statistics collection for quoted column names.

Added coverage for V1 write APIs, column resolution, subqueries, DVs, CDF, partitioned tables, empty sources, retries, failure cleanup, command/operator fallback, and disabled writer feature flags. Added user-facing documentation covering setup, examples, API semantics, fallback behavior, and upstream limitations.

Validation (November 16): 41 CPU/GPU integration cases passed locally on Spark 4.1.1 with Delta 4.3.0 and an NVIDIA RTX 6000 Ada. Another 39 Scala unit tests passed across Spark 4.0.1 and 4.1.1, with one expected version-specific skip. These checks covered the changes combined with upstream/main. Standard premerge does not run these selective replacement Python tests; no nightly pass has been verified.

Performance: AB testing on spark2a on November 17 with 100M target rows, 1.1M source rows, and ten runs per arm. The baseline was CPU execution (spark.rapids.sql.enabled=false), compared against GPU execution with matched resources. Each measurement used a fresh target clone, with unmeasured warmups and balanced CPU/GPU and operation ordering.

| Operation | CPU/GPU speedup | 95% confidence interval | AB p-value |
|---|---:|---:|---:|
| replaceUsing, without DVs | 1.14x | 1.054–1.237x | 0.00255 |
| replaceOn, without DVs | 1.11x | 0.992–1.243x | 0.06609 |
| replaceUsing, with DVs | 1.09x | 1.032–1.156x | 0.00407 |
| replaceOn, with DVs | 1.02x | 0.865–1.198x | 0.82356 |

Only replaceUsing without DVs meets both AB’s default statistical significance and 500 ms improvement thresholds. The confidence intervals exclude a 10% GPU slowdown for the first three cases; replaceOn with DVs remains inconclusive. These are four unadjusted comparisons. Ratio confidence intervals were calculated separately using the same equal-variance t-test assumptions as AB.

Native internal DELETE metrics for the non-DV cases:

| Operation | Arm | Mean scanTimeMs | Mean rewriteTimeMs | numCopiedRows | Files touched |
|---|---|---:|---:|---:|---:|
| replaceUsing | CPU | 1862.8 | 2943.9 | 99,000,000 | 1,024/1,024 |
| replaceUsing | GPU | 1801.9 | 2290.7 | 99,000,000 | 1,024/1,024 |
| replaceOn | CPU | 1857.4 | 2944.1 | 99,000,000 | 1,024/1,024 |
| replaceOn | GPU | 1952.2 | 2300.1 | 99,000,000 | 1,024/1,024 |

Although only 1% of target rows matched, both non-DV operations touched every target file and copied 99M retained rows. Most of the GPU improvement came from rewriting these rows. The source was broadcast. DELETE phase timings exclude setup, warmups, and insertion. The native DV DELETE path does not populate these phase timers, so its reported zeros are not measured zero durations.

All 80 measured operations passed result validation, and GPU runs were checked for GPU matching, target scans, and writes.

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

  • (Please provide the names of the existing tests in the PR description.)
  • 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: 469 lines (+351 / -118) across 5 files Reviewer: sdrp713 Review duration: 33042m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 469 lines diff across 5 files
    0.46
    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.368
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #16619"
    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: 45.7% (MEDIUM) · Higher = larger blast radius
    45.7%
    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: 18% · Safe to merge
    18%