Accelerate Delta GenerateIdentityValues on Databricks 17.3/18.3 [databricks] #17103
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 513 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.373
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #17103"
general
weight: 0.35
sdrp713
Fixes #16865.
Description
Problem.
MERGE INTOa Delta table with an identity column on Databricks 17.3+ plansGenerateIdentityValuesinside the MERGE output projection. It had no GPU rule, so the whole projection fell back to the CPU.Change.
GpuGenerateIdentityValuesand its rule for the 400db173 and 410db183 shims. Partitionpstarts atbase + p stepand advances bynumPartitions stepper row, wherebaseisstartor the high water mark plusstep. It is retryable (checkpoint/restore), so a batch retried after an OOM gets the same values.GpuIdentityColumnnow tracks the identity high water mark by physical column name when column mapping is on (matching the delta-io variant). Before, it used the logical name. It applies to all DBR versions that share this source.Behavior differences from the CPU.
CASE WHENbranch rows filtered the whole wide batch just to count rows. Identity values stay unique and increasing but are not consecutive. A MERGE that rewrites N rows consumes about N x numPartitions x step of the Long range.Long.MaxValue/2orLong.MinValue/2, or when |step| > 2^20.Scope. Databricks only (400db173, 410db183). OSS Delta support is deferred: I prototyped it but the quarter seeded merge was slower on spark2a (cause not found), so it isn't part of this PR.
Testing
test_delta_merge_identity_column: start/step, column mapping, partitions and low-shuffle merge on/off. The tests assert GPU commands, noGenerateIdentityValuesfallback and the high water mark ordering.test_delta_merge_identity_column_overflow_guard: both sides of each guard boundary, asserting whether the GPU expression was used.test_delta_write_identity_columns_column_mapping_sqlfor the column mapping fix.GpuGenerateIdentityValuesSuite: 7 unit tests (continuity, zero-row batch, checkpoint/restore, checkpoint before first evaluation, overflow, partition offset, guard boundaries).test_delta_write_identity_columns_sqland the multiple-identity-column test pass on 17.3.delta_lake_merge_testpassed on DBR 17.3 (299 passed, 25 skipped, 0 failed).Performance
The same plugin jar on both arms, both on the GPU. The arms differ only in
spark.rapids.sql.expression.GenerateIdentityValues: off makes the expression fall back to the CPU (and with it the whole MERGE output projection, as onmain), on runs it on the GPU. Table setup, seeding and correctness checks run on the CPU outside the timed section, and every measured run passed its checks.delta_sf3000loaded via abdatasets.Results (merge time in seconds, runs pooled over both arm orders):
| Workload | Rule off | Rule on | Median change | p-value |
|---|---|---|---|---|
| Quarter-seeded | 171.5, 163.9, 208.3, 173.1, 158.4, 166.9 | 149.0, 156.6, 137.2, 146.2, 153.1, 164.4 | -10.7% | 0.026 |
| Empty target | 80.9, 68.0, 122.5, 78.6, 71.3, 116.3 | 73.4, 61.2, 92.6, 82.4, 58.9, 81.5 | -2.9% | 0.22 |
Checklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance