Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: Make ColumnVector.fromViewWithContiguousAllocation public #16784

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

jlowe
Copy link
Member

@jlowe jlowe commented Sep 10, 2024

Description

Exposes ColumnVector's fromViewWithContiguousAllocation method so code outside of cudf that builds contiguous table views can expose those columns in Java.

Checklist

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

@jlowe jlowe added Java Affects Java cuDF API. Spark Functionality that helps Spark RAPIDS improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Sep 10, 2024
@jlowe jlowe self-assigned this Sep 10, 2024
@jlowe jlowe requested a review from a team as a code owner September 10, 2024 16:29
Comment on lines +222 to +227
* Creates a ColumnVector from a native column_view using a contiguous device allocation.
*
* @param columnViewAddress address of the native column_view
* @param buffer device buffer containing the data referenced by the column view
*/
public static ColumnVector fromViewWithContiguousAllocation(long columnViewAddress, DeviceMemoryBuffer buffer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the role that a "contiguous allocation" plays here? I see that it is just creating a ColumnVector from device buffer and nothing else, so not sure what I'm missing here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Contiguous allocation meaning all of the underlying buffers from this column view (i.e.: validity, offsets, data, and recursively from child columns) comes from this single buffer. Normally these things are allocated separately and thus are not from a single buffer. The way contiguous tables work in Java is that we build up ColumnVector instances from views (zero-copy, so not like column vs. column_view in native) that reference the underlying buffer (i.e.: via incRefCount). The buffer is then closed, decrementing the refcount, but it stays allocated because of all the columns referencing it. When the last column referencing the buffer is finally closed, the buffer is closed when its refcount goes to zero.

So we need the buffer in this method for the reference semantics, and that buffer is the contiguous allocation holding this column (and probably others).

@ttnghia
Copy link
Contributor

ttnghia commented Sep 16, 2024

/merge

@rapids-bot rapids-bot bot merged commit 4033385 into rapidsai:branch-24.10 Sep 16, 2024
81 checks passed
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.

3 participants