Support Iceberg v3 row lineage writes on GPU - #15866
Open
res-life wants to merge 28 commits into
Open
Conversation
Signed-off-by: Chong Gao <chongg@nvidia.com>
Contributor
|
res-life
marked this pull request as draft
September 1, 2026 13:47
Signed-off-by: Chong Gao <chongg@nvidia.com>
Update the Spark 4.1 retry suite for the merge output schema. Keep Iceberg DML tests in operation-specific suites and require staged scans to execute on GPU. Signed-off-by: Chong Gao <chongg@nvidia.com>
8 tasks
Signed-off-by: Chong Gao <chongg@nvidia.com>
Reuse the DELETE comparison helper with a custom metadata read so CPU and GPU results validate row positions and lineage fields. Signed-off-by: Chong Gao <chongg@nvidia.com>
Compare CPU and GPU MERGE results through a shared helper instead of asserting literal row-lineage values. Signed-off-by: Chong Gao <chongg@nvidia.com>
Compare CPU and GPU append, rewrite, and overwrite results through a shared helper instead of asserting literal metadata values. Signed-off-by: Chong Gao <chongg@nvidia.com>
Reuse the UPDATE comparison helper with a custom lineage read instead of asserting literal metadata values. Signed-off-by: Chong Gao <chongg@nvidia.com>
res-life
marked this pull request as ready for review
September 7, 2026 09:50
Signed-off-by: Chong Gao <chongg@nvidia.com>
Signed-off-by: Chong Gao <chongg@nvidia.com>
Signed-off-by: Chong Gao <chongg@nvidia.com>
Signed-off-by: Chong Gao <chongg@nvidia.com>
Signed-off-by: Chong Gao <chongg@nvidia.com>
Signed-off-by: Chong Gao <chongg@nvidia.com>
Collaborator
Author
|
The last test result of Iceberg ITs: |
Signed-off-by: Chong Gao <chongg@nvidia.com>
Signed-off-by: Chong Gao <chongg@nvidia.com>
Signed-off-by: Chong Gao <chongg@nvidia.com>
Signed-off-by: Chong Gao <chongg@nvidia.com>
gerashegalov
requested changes
Sep 10, 2026
Signed-off-by: Chong Gao <chongg@nvidia.com>
Signed-off-by: Chong Gao <chongg@nvidia.com>
Signed-off-by: Chong Gao <chongg@nvidia.com>
res-life
added a commit
to res-life/spark-rapids
that referenced
this pull request
Sep 11, 2026
Keep Spark 4 INSERT and REINSERT rows in partition order with an aligned reinsert mask. Restore missing lineage from reinsert metadata and let new rows inherit lineage. Align mixed MERGE action outputs before concatenation, and cover row order, metadata and ownership in unit tests. Addresses review: NVIDIA#15866 (comment) Signed-off-by: Chong Gao <chongg@nvidia.com>
res-life
added a commit
to res-life/spark-rapids
that referenced
this pull request
Sep 11, 2026
Extend existing DML, read, SQL UI and view tests to format v3 while preserving parameter interactions, IDs and marks. Retain tests with specific delete-file-format contracts and verify the current v3 MOR fallback, including the insert-only MERGE rewrite to GPU append. Addresses review: NVIDIA#15866 (comment) Signed-off-by: Chong Gao <chongg@nvidia.com>
Keep Spark 4 INSERT and REINSERT rows in partition order with an aligned reinsert mask. Restore missing lineage from reinsert metadata and let new rows inherit lineage. Align mixed MERGE action outputs before concatenation, and cover row order, metadata and ownership in unit tests. Addresses review: NVIDIA#15866 (comment) Signed-off-by: Chong Gao <chongg@nvidia.com>
Extend existing DML, read, SQL UI and view tests to format v3 while preserving parameter interactions, IDs and marks. Retain tests with specific delete-file-format contracts and verify the current v3 MOR fallback, including the insert-only MERGE rewrite to GPU append. Addresses review: NVIDIA#15866 (comment) Signed-off-by: Chong Gao <chongg@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15441.
Description
Adds GPU support for preserving Iceberg v3 row lineage during writes.
This keeps row IDs stable for unchanged rows, assigns lineage to inserted rows, and advances sequence lineage only for modified rows while preserving CPU/GPU interoperability.
Earlier copy-on-write measurements showed 1.33x–1.70x GPU speedups for UPDATE, DELETE and MERGE. These measurements predate the review fixes and were not rerun for the current head.
Before the review fixes, the following local Iceberg v3 copy-on-write microbenchmarks used an NVIDIA L4, Spark 3.5.6, Iceberg 1.10.1, Scala 2.12, Java 17,
local[16], 16 shuffle partitions, and AQE disabled. Each result is the median of three measured runs after one warmup. Unless noted otherwise, each input contained 5 million rows.CPU/GPUvalues greater than 1 indicate a GPU speedup.The short read and direct-write cases are dominated by fixed planning and commit overhead at this scale. The runtime-heavy copy-on-write DML cases are 1.33x-1.70x faster on GPU. Every GPU benchmark captured and verified its expected GPU execution operator, and every iteration checked row-lineage correctness.
A separate Iceberg v2 GPU MERGE regression control measured the parent at 1.669 s and this branch at 1.633 s, so no regression was observed (the branch was 2.2% lower). Both revisions used the same current JNI snapshot and the same
applyRetentionMaskcompatibility patch from #15848, which is not included in this PR.The write path propagates Iceberg's hidden lineage columns with their required field IDs and ordering. Scan staging preserves row-position information needed by copy-on-write rows, and merge-row execution distinguishes unchanged, modified, and inserted rows so Iceberg can inherit the correct lineage values.
The integration coverage validates read, append, CTAS, UPDATE, DELETE, MERGE, and insert-overwrite behavior, including snapshot metadata, all supported RAPIDS Iceberg reader types, and CPU reads of GPU-written tables. Operation-specific row-lineage tests live in their corresponding UPDATE, DELETE, and MERGE suites. The CTAS test captures its command plan, requires the expected GPU operator, and rejects the corresponding CPU fallback.
Spark 4 position-delta writes preserve REINSERT metadata while keeping INSERT and REINSERT rows in their original partition order. The writer restores missing lineage by metadata column name, retains existing row IDs for reinserted rows, and leaves inserted-row lineage null for Iceberg inheritance. Mixed MERGE action outputs are padded with typed nulls before concatenation.
The GPU batch contract is an independent Java
GpuDeltaBatchWriterinsql-plugin-api, packaged once at the JAR root.GpuIcebergDeltaWriterdirectly implements Spark'sDeltaWriterand the batch contract; the two Spark-shimGpuDeltaWritertraits are removed.Existing v3 coverage is expanded across 140 test functions while retaining parameter interactions, IDs and marks. Tests with specific delete-file-format contracts retain those contracts. The CTAS plan callback accepts both CPU and GPU plans and continues to assert GPU execution.
Full GPU v3 merge-on-read still requires the deletion-vector writer tracked in #15442 / #15717. The tests assert CPU delta-write fallback where that writer is unavailable, while allowing Spark's GPU append rewrite for insert-only MERGE.
Validation
Review-fix builds and runtime checks ran at
874d19a0b. The published head71a95da74differs from that revision only in theappendLineageandwriteInsertsScaladoc comments and examples; builds/tests were not repeated for those comment-only amendments.ICEBERG_EXTRA_CLASSPATHICEBERG_EXTRA_CLASSPATHThe 92 focused integration cases cover MERGE, partition evolution, UPDATE, DELETE, CTAS and row lineage. Normal and extra-classpath runs use identical selected cases for each Spark/runtime pair. Extra-classpath verification puts both the matching flattened RAPIDS aggregator and Iceberg runtime on the system classpath and removes
spark.jars.packages. All JUnit reports show zero failures, errors or skips. Spark 4 pytest summaries and complete JUnit reports confirm 23 passes per run; the outer command exit codes were not preserved after a session interruption.The Java API bytecode is identical across the three builds and independent compilations against Spark 3.3.0, 3.5.6 and 4.1.3. The five affected duplicate Iceberg writer classes are bitwise-identical between Iceberg 1.9.x and 1.10.x for Spark 356, separately for Scala 2.12 and 2.13. Both distribution JARs contain exactly one new API class at the root and no old
GpuDeltaWriterclass under either package. Builds used Java 17 and skipped ScalaDoc generation. Diff, copyright and commit identity/DCO checks passed.The complete Iceberg suites and performance benchmarks were not rerun after these review fixes.
Earlier validation, before the review fixes
git diff --checkand copyright-year checks — passed.AI assistance: Codex assisted with implementation, review-feedback fixes, documentation and validation.
Checklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance