Add GPU support for Databricks Delta MERGE ChecksumExpression [databricks] #16727
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.43) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 390 lines diff across 4 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.357
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #16727"
general
weight: 0.35
gerashegalov
Fixes #16489.
Description
On Databricks 17.3 and 18.3, Delta MERGE can wrap its materialized source in a
Filter(checksum(cols) AND true).ChecksumExpressionhad no GPU rule, so the filter ran on the CPU and added an extraGpuColumnarToRow/GpuRowToColumnarpair around it.This adds
GpuChecksumExpressionso the filter stays on the GPU. It is modeled on the Databricks expression:true. As a side effect, it adds a checksum of its children to the MERGE metric, which MERGE later verifies.pmod(xxhash64(child, seed), MOD)(a hash of 0 counts as 1), and the results are multiplied moduloMOD. This reusesGpuXxHash64andGpuPmod.GpuExpressionRetryable). A failed attempt is undone by multiplying by the modular inverse of what it added, since the metric cannot take a negative value.spark.rapids.sql.expression.ChecksumExpression=false.The rule is registered in
DatabricksDeltaProvider173183Base, so it applies to bothspark400db173andspark410db183. No new configuration is added.Tests
Added to
delta_lake_merge_test.py:test_delta_merge_cpu_command_checksum_expression_db173: the plan contains aGpuFilterwithgpu_checksum_expression.test_delta_merge_cpu_command_checksum_expression_types_db173: 11 nullable types, one batch and many batches, with OOM injection.checksumSource=ASSERTmeans a wrong metric fails the MERGE.test_delta_merge_cpu_command_checksum_expression_disabled_db173.Ran on DBR 17.3 and DBR 18.3: the new tests and the existing
test_delta_merge_cpu_command_increment_metric_db173pass on both, with none skipped.Performance
NDS
merge.tplquery 4 on 8 xStandard_NC8as_T4_v3, DBR 17.3 GPU, Parquet source (materialized), 277M row target, ANSI off. 1 warmup + 5 timed runs per mode, interleaved.| Mode | MERGE median | min | max |
|---|---|---|---|
| rule on | 63.2 s | 61.0 | 75.1 |
| rule off | 64.9 s | 64.0 | 82.5 |
| checksum off | 61.8 s | 60.4 | 74.2 |
The table compares MERGE wall time with the new GPU rule on, with it off (the old CPU Filter, which adds extra row↔columnar transitions), and with the checksum turned off entirely (the floor). The rule is slightly faster than before and only about 0.5-2 s above that floor, so it removes the CPU fallback without a measurable performance cost.
Checklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance