← Back to Pull requests

Accelerate DML writes to DV-enabled tables on Databricks 17.3/18.3 [databricks] #16183

Closed
unknown closed this pull request without merging on Oct 30, 2026 16:59 UTC
View on GitHub
unknown unknown commented on Oct 06, 2026 22:27 UTC
Author

Fixes #15993 .

Description

This PR enables GPU execution of Delta Lake DELETE, UPDATE, and MERGE on deletion vector enabled tables in Databricks 17.3 and 18.3. Previously, commands that wrote persistent deletion vectors fell back to CPU execution. Supported operations now keep the data intensive scan, predicate evaluation, and changed row writes on the GPU while preserving Delta's native deletion vector and transaction handling.

Implementation

  • Use DBR metadata row indexes and native deletion vector predicate pushdown to identify physical rows in files that may already have DVs.

  • For DELETE and UPDATE, build compact per-file deletion bitmaps from GPU selected rows; combine them with existing DVs using DBR's native DV writer and transaction actions.

  • For MERGE, write changed rows on the GPU and update DVs for affected target rows without copying unaffected rows into replacement files. Existing duplicate match and clause behavior remains covered by integration tests.

  • Keep DV serialization, delta metadata operations, and commit on their native CPU paths. Fall back to CPU when the required metadata row index or predicate pushdown support is unavailable or a user column conflicts with the internal row index column.

  • Fall back to CPU, with one shared set of checks for DELETE, UPDATE, and MERGE, when the target scan cannot run on the GPU: Parquet or the file scan disabled, spark.sql.legacy.parquet.nanosAsLong, or VARIANT/unsupported column types. MERGE also falls back for row-tracked tables, matching UPDATE. If a CPU scan still produces a null physical row index, the command fails instead of silently leaving matched rows undeleted.

  • Conditions containing a Python UDF or a subquery attach input_file_name() before the filter, so every row keeps its own file. Other conditions keep the filter-before-file-name path that allows predicate pushdown into the scan.

  • The index only deletion vector reader builds batches from surviving row ranges rather than per-row arrays. Each batch's indexes are built on the GPU with a constant number of operations regardless of how fragmented the DV is, and only each row group's bitmap window is visited.

  • DBR 18.3 shares the 17.3 implementation. The bitmap generator and target-scan helpers live in the shared 17.3/18.3 sources, with a small per-runtime shim for the one API difference (DBR 18.3's processUnmodifiedData takes the data-skipping string prefix length).

  • Update the DBR compatibility documentation and add focused DML, fallback, metrics, and metadata scope tests.
  • Testing

  • DBR 17.3 and 18.3 builds completed on test clusters. The shared sources also build on DBR 14.3.

  • Full delta_lake_delete_test.py, delta_lake_update_test.py, and delta_lake_merge_test.py run with 225 passed, 20 skipped, 16 xfailed, 97 xpassed

  • The DV-enabled xfails are dropped for DBR 17.3+, and test_delta_merge_dv_clauses (CDF, NOT MATCHED BY SOURCE, duplicate-source DELETE) now runs on 17.3+.

  • New tests: Python UDF and IN subquery conditions across multiple files (DELETE and UPDATE); scan-eligibility fallbacks for DELETE/UPDATE/MERGE (Parquet switches, file scan disabled, nanosAsLong); MERGE with row tracking and persistent DVs; and a fragmented DV index only scan test for both reader types.

  • Verified on single- node A10G clusters after the latest changes:
  • | Runtime | Tests | Result |
    | --- | --- | --- |
    | DBR 14.3 | full delta_lake_delete_test.py, delta_lake_update_test.py, delta_lake_merge_test.py | 150 passed, 0 failed |
    | DBR 17.3 | DV-focused subset of the same three files | 161 passed, 0 failed |
    | DBR 18.3 | DV-focused subset of the same three files; full delta_lake_low_shuffle_merge_test.py | 162 passed; 363 passed, 0 failed |

    Delta Lake integration tests are still disabled in CI for DBR 18.3 (#16282), so DBR 18.3 is covered by these manual runs.

    Performance

    Measured on Databricks Runtime 17.3 (Spark 4.0.0) in local mode on one NVIDIA A10G, with the NDS SF3000 store_sales sample stored on local disk. The input contained 15.07 GB of data; the materialized target was 16.28 GB, with 293.8 million rows and pre-existing DVs. Each command affected 29.38 million rows (about 10%). Timings include the DML command, not table preparation or result validation. One warmup was excluded; the table reports medians from three measured CPU/GPU pairs on the same machine.

    | Command | CPU median | GPU median | Speedup |
    | --- | ---: | ---: | ---: |
    | DELETE | 6.878 s | 6.254 s | 1.10x |
    | UPDATE | 86.964 s | 38.516 s | 2.26x |
    | MERGE | 586.259 s | 249.785 s | 2.35x |

    ##### AB Results
    Workload used an NDS SF3000 store_sales parquet sample materialized as a deletion vector enabled Delta table. The prepared table had approximately 317.5 million rows and pre existing deletion vectors. DELETE, UPDATE, and matched update MERGE each affected approximately 10%.

    CPU and GPU ran with four g4dn.4xlarge workers and unchanged AB baseline settings.

    | Operation | CPU median | GPU median | Speedup |
    | --- | ---: | ---: | ---: |
    | DELETE | 22.1 s | 22.6 s | 0.98× |
    | UPDATE | 266.8 s | 186.0 s | 1.43× |
    | MERGE | 519.25 s | 178.65 s | 2.907× |

    The single broad UPDATE run (50% of rows, one run) took 249.0 s on GPU against 894.4 s on CPU, about 3.6× speedup.

    ##### Fragmented deletion vectors

    An index-only target scan (MERGE ... ON t.p = s.p WHEN MATCHED THEN DELETE) over a single 4M-row file with alternating deleted rows, so every surviving row is its own range. Each run uses a freshly written table, on one A10G in local mode, after a small warm-up:

    | Deletion vector | Before | After |
    | --- | ---: | ---: |
    | Fragmented (alternating rows) | 398.1 / 390.2 / 417.1 s | 5.00 / 4.19 / 5.15 s |
    | Contiguous (control) | 4.01 / 4.04 / 3.99 s | 4.51 / 3.85 / 3.88 s |

    This is a worst case; most of the remaining ~4 s is fixed MERGE overhead. Typical scattered deletions produce fewer ranges, so the gain is smaller.

    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: 650 lines (+487 / -163) across 8 files Reviewer: sdrp713 Review duration: 34231m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #16183"
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 20.5% · Safe to merge
    20.5%