Skip to content

Use cuDF to count the total deleted row count for cuDF based Delta reader for deletion vectors - #15722

Open
sdrp713 wants to merge 7 commits into
NVIDIA:mainfrom
sdrp713:delta-row-cnt
Open

Use cuDF to count the total deleted row count for cuDF based Delta reader for deletion vectors#15722
sdrp713 wants to merge 7 commits into
NVIDIA:mainfrom
sdrp713:delta-row-cnt

Conversation

@sdrp713

@sdrp713 sdrp713 commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Fixes #14628

Related CUDF changes: NVIDIA/cudf#23978

Description

Update the cuDF based Delta deletion vector reader to use the new JNI/libcudf GPU row-count API.

The reader uses the GPU count when it needs the number of surviving rows for:

  • Zero-column scans such as SELECT count(*).
  • Populating partition columns before attaching them to a ColumnarBatch.

This removes host-side deletion-vector bitmap traversal from these paths while preserving the existing row-group metadata calculation.

Testing

  • 48 targeted Delta deletion-vector integration tests passed (test_delta_deletion_vector_read); remaining selected cases were skipped by existing runtime guards.
  • Validated PERFILE, COALESCING, and MULTITHREADED readers.

Performance

100 million rows, 5 million deleted rows, 2 warmups, and 10 measured runs. The cudf-spark and JNI changes were tested together.

Reader/query Baseline mean PR mean Speedup
PERFILE / count_star 0.747868s 0.702228s 1.06×
PERFILE / partition_aggregate 1.017174s 0.983110s 1.03×
COALESCING / count_star 0.484052s 0.432153s 1.12×
COALESCING / partition_aggregate 0.713125s 0.666528s 1.07×
MULTITHREADED / count_star 0.407790s 0.368274s 1.11×
MULTITHREADED / partition_aggregate 0.592371s 0.585036s 1.01×

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

@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no outstanding correctness, resource-lifecycle, or repository-rule violation was established.

Summary

  • Uses GPU deletion-vector cardinality computation under the RAPIDS retry and semaphore mechanisms.
  • Preserves serialized bitmap ownership through spillable host buffers.
  • Cancels outstanding bitmap loads and restores thread interruption when asynchronous preparation fails.
  • Precomputes row counts used by zero-column scans and partition-column population.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Load serialized deletion vectors] --> B[Spillable host buffers]
  B --> C[Group adjacent files by partition value]
  C --> D[cuDF computeNumDeletedRows]
  D --> E[Compute surviving rows]
  E --> F[Decode filtered table]
  E --> G[Populate partition columns]
Loading

@sameerz sameerz added the task Work required that improves the product but is not user facing label Aug 21, 2026
@sdrp713 sdrp713 self-assigned this Aug 21, 2026
@sdrp713
sdrp713 requested a review from a team August 24, 2026 21:05

loadFutures.zip(batchExtra.perFileEntries).foreach { case (future, entry) =>
try {
val gpuBitmap = future.get()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A future may succeed before it was cancelled. On this thread future.get will throw a cancelled exception and we will never get a hold of the gpuBitmap to close

Signed-off-by: Rahul Prabhu <raprabhu@nvidia.com>
@sdrp713
sdrp713 requested a review from gerashegalov September 8, 2026 18:38
serializedBitmap, isRetention, rowGroupOffsets, rowGroupNumRows)
GpuSemaphore.acquireIfNecessary(TaskContext.get())
val numDeletedRows = RmmRapidsRetryIterator.withRetryNoSplit {
DeletionVector.computeNumDeletedRows(dvInfo, maxChunkRows)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should batch the call per partition instead of per file. We don't really need to track the deleted row count per file. We just need to know it per partition. The cudf c++ API already supports the batch computation, but we may need to modify the JNI interface.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cudf PR for this here: NVIDIA/cudf#24047

Signed-off-by: Rahul Prabhu <raprabhu@nvidia.com>
@gerashegalov

Copy link
Copy Markdown
Collaborator

Fix builds for OSS Delta shims

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

task Work required that improves the product but is not user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TASK] Use new cuDF API to count the total deleted row count for cuDF-based Delta reader for deletion vectors

5 participants