Skip to content

Restore mergeAndSetValidity as a single ColumnView API - #23919

Open
rishic3 wants to merge 2 commits into
NVIDIA:mainfrom
rishic3:codex/restore-columnview-merge-validity
Open

Restore mergeAndSetValidity as a single ColumnView API#23919
rishic3 wants to merge 2 commits into
NVIDIA:mainfrom
rishic3:codex/restore-columnview-merge-validity

Conversation

@rishic3

@rishic3 rishic3 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

Supersedes #23249. This reverts the move of mergeAndSetValidity into ColumnVector.

By keeping the API on ColumnView, this ensures that for a caller holding a ColumnView, they may use this API without incurring an additional copy in the event that the mask changes (the call is not a no-op). I.e. consider this table comparing the placement of the API and the copies incurred:

Receiver and result Single API on ColumnView (this PR) Strictly ColumnVector
ColumnVector, no-op 0 data copies; refcount increment 0 data copies
ColumnVector, mask changes 1 deep copy 1 deep copy
True ColumnView, no-op 1 necessary materialization 1 materialization before calling
True ColumnView, mask changes 1 deep copy 2 deep copies

An example of the 4th case is NVIDIA/cudf-spark#14846.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Signed-off-by: Rishi Chandra <rishic@nvidia.com>
@rishic3
rishic3 requested a review from a team as a code owner September 1, 2026 18:13
@copy-pr-bot

copy-pr-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the Java Affects Java cuDF API. label Sep 1, 2026
@rishic3 rishic3 added Spark Functionality that helps Spark RAPIDS improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Sep 1, 2026
@rishic3

rishic3 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test aeb0926

@rishic3
rishic3 requested a review from ttnghia September 1, 2026 18:15
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 33fad119-a9b5-4047-afae-033ba89ac80d

📥 Commits

Reviewing files that changed from the base of the PR and between aeb0926 and ec35f42.

📒 Files selected for processing (1)
  • java/src/main/java/ai/rapids/cudf/ColumnView.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • java/src/main/java/ai/rapids/cudf/ColumnView.java

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Changes
    • Removed the column-vector validity-merging operation.
    • Retained validity merging for non-owning column views.
    • Clarified that column views support zero-copy validity merging when possible and materialize results when necessary.
    • Updated the API documentation to distinguish column-vector and column-view behavior.
    • Other column-vector functionality remains unchanged.

Walkthrough

Changes

Validity merge API cleanup

Layer / File(s) Summary
Java validity merge contract
java/src/main/java/ai/rapids/cudf/ColumnView.java, java/src/main/java/ai/rapids/cudf/ColumnVector.java
ColumnView.mergeAndSetValidity now documents owning and non-owning no-op behavior and is no longer deprecated. The ColumnVector implementation was removed.
Native binding cleanup
java/src/main/native/src/ColumnVectorJni.cpp
The native validity merge binding and its binary-operation and struct utility dependencies were removed.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to ec35f

This change restores the validity-merge API on ColumnView to avoid unnecessary copies for callers holding views. No current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains that the pull request restores mergeAndSetValidity on ColumnView, removes its ColumnVector placement, and reduces unnecessary copies.
Title check ✅ Passed The title accurately and concisely summarizes the main change: restoring mergeAndSetValidity as a single ColumnView API.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@rishic3 rishic3 changed the title Restore mergeAndSetValidity API as a single ColumnView API Restore mergeAndSetValidity as a single ColumnView API Sep 2, 2026
Comment on lines +886 to +888
* If applying the null mask would be a no-op and this is a {@link ColumnVector}, the original
* column is returned with incremented refcount. Otherwise, a deep copy of the column is made.
* For a non-owning ColumnView, a deep copy must be made in either case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm still not clear and don't see how the original column returns no-op incRefCount (to output ColumnVector) if calling from a ColumnView object?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It does not. As the docstring states if we have a ColumnView we have to do a deep copy to produce an owning result. (This would be row 3 of the table in the PR desc). Only if we have a ColumnVector do we have the no-op incRefCount.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But this PR is removing the ColumnVector overload thus the input is going to always be a ColumnView.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It removes the ColumnVector override, but ColumnVector extends ColumnView. So this will work:

ColumnVector cv = ...;
cv.mergeAndSetValidity(...);

and if the above is a no-op, we invoke copyToColumnVector(), which ColumnVector overrides to be just an incRefCount() and is thus zero copy.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

copyToColumnVector(), which ColumnVector overrides to be just an incRefCount()

This is the main point. Everything is explained by it. Yay!
Please add more comment on the docs clarifying this -- it is useful to understand what is going on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 added a comment to clarify.

@rishic3

rishic3 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test ec35f42

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

Labels

improvement Improvement / enhancement to an existing function Java Affects Java cuDF API. non-breaking Non-breaking change Spark Functionality that helps Spark RAPIDS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants