-
Notifications
You must be signed in to change notification settings - Fork 933
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
Remove unneeded pylibcudf.libcudf.wrappers.duration usage in cudf #17010
Remove unneeded pylibcudf.libcudf.wrappers.duration usage in cudf #17010
Conversation
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.
I think you got this right. I went through and exposed the other types to see what it would look like, and I don't think you get anything extra from doing that (except following libcudf's API more closely). I would like to hear someone else's thoughts though.
|
||
|
||
cdef extern from "cudf/wrappers/durations.hpp" namespace "cudf" nogil: | ||
ctypedef int32_t duration_D |
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.
I think this would become
ctypedef int32_t duration_D | |
ctypedef duration[int32_t, days.period] duration_D |
But you'd need to extern duration
and days
cdef extern from "cudf/wrappers/durations.hpp" namespace "cudf" nogil:
cdef cppclass duration[int_type, period]:
pass
cdef cppclass days:
ctypedef int period
...
|
||
from libc.stdint cimport int64_t | ||
from libc.stdint cimport int32_t, int64_t |
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 would look like after you cimport
from durations.pxd
from libc.stdint cimport int32_t, int64_t | |
from libc.stdint cimport int32_t, int64_t | |
cdef extern from "cudf/wrappers/timestamps.hpp" namespace "cudf::detail" nogil: | |
cdef cppclass time_point[duration]: | |
pass | |
cdef cppclass timestamp[duration]: | |
pass |
|
||
|
||
cdef extern from "cudf/wrappers/timestamps.hpp" namespace "cudf" nogil: | ||
ctypedef int32_t timestamp_D |
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.
And this would become
ctypedef int32_t timestamp_D | |
ctypedef time_point[duration_D] timestamp_D |
The code here seems fine. I don't yet understand what question you're asking. I agree that we don't need to expose a python equivalent for these types. I expect that the only time we will need these is in pylibcudf Cython code for things like Scalar factories. I'm not sure we even need to add these types to pylibcudf at all, outside of pylibcudf.libcudf. Will we ever use them in any place that isn't pylibcudf internals working directly with libcudf types and functions? |
Yeah the second sentence here answered my question. I was essentially asking if a user should be able to do e.g.
It appears that |
To not continually edit my prior comment. Based on @vyasr's comment
And the discovery that cudf Python don't need these types either, I won't expose these types under a |
FWIW I think that we will need these types eventually. Currently we have no way of directly constructing pylibcudf Scalars other than via pyarrow. We definitely want that eventually, and when we address #17054 we will need the types in this PR available to pylibcudf. |
/merge |
Description
Contributes to #15162
I just assumed since the associated libcudf files just publicly expose C types, we just want to match the name spacing when importing from pylibcudf (avoid importing frompylibcudf.libcudf
) and not necessary expose a Python equivalent?Let me know if I am misunderstanding how to expose these types.#17010 (comment)
Checklist