-
Notifications
You must be signed in to change notification settings - Fork 16
Create PackedData from cudf PackedColumns #228
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
Create PackedData from cudf PackedColumns #228
Conversation
def __init__(self, PackedColumns packed_columns) -> None: | ||
self.c_obj = make_unique[cpp_PackedData]( | ||
move(deref(packed_columns.c_obj).metadata), | ||
move(deref(packed_columns.c_obj).gpu_data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to very clearly document that it takes ownership of the data in the passed in PackedColumns
object.
/ok to test |
Co-authored-by: Mads R. B. Kristensen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, only some minor suggestions.
@@ -13,3 +15,39 @@ cdef class PackedData: | |||
cdef PackedData self = PackedData.__new__(PackedData) | |||
self.c_obj = move(obj) | |||
return self | |||
|
|||
@staticmethod | |||
def from_cudf_packed_columns(PackedColumns packed_columns) -> PackedData: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No type notation in pyx
def from_cudf_packed_columns(PackedColumns packed_columns) -> PackedData: | |
def from_cudf_packed_columns(PackedColumns packed_columns): |
@@ -13,3 +15,39 @@ cdef class PackedData: | |||
cdef PackedData self = PackedData.__new__(PackedData) | |||
self.c_obj = move(obj) | |||
return self | |||
|
|||
@staticmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it a @classmethod
and do cls.__new__(cls)
like in the spill manager: https://github.com/rapidsai/rapidsmpf/blob/b77ed56a56a357d4e1f1bcb6208098a8078fb740/python/rapidsmpf/rapidsmpf/buffer/spill_manager.pyx#L95C33
Co-authored-by: Mads R. B. Kristensen <[email protected]>
Signed-off-by: niranda perera <[email protected]>
…ra/rapidsmpf into packed_data_from_packed_cols
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nirandaperera , left a few comments.
class PackedData: | ||
pass | ||
def __init__(self) -> None: ... | ||
@staticmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be @classmethod
like in the pyx file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, good catch. Thanks @pentschev
Co-authored-by: Peter Andreas Entschev <[email protected]>
Signed-off-by: niranda perera <[email protected]>
…ra/rapidsmpf into packed_data_from_packed_cols
Signed-off-by: niranda perera <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @nirandaperera !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I only one suggestion
""" | ||
cdef PackedData ret = cls.__new__(cls) | ||
with nogil: | ||
if not (deref(packed_columns.c_obj).metadata and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also check that packed_columns.c_obj
isn't null
Signed-off-by: niranda perera <[email protected]>
Co-authored-by: Mads R. B. Kristensen <[email protected]>
/merge |
Current PackedData cython API does not contain a constructor that takes in cudf packed columns. This PR adds it.