Open isVoid opened 3 years ago
I think there can be three scenarios when astype
is called on a cudf scalar s
:
s
host value is present, and its device value is not. This returns a new python object with a new host value, but still no device value.s
. In this case, we cast the host value, and construct a new cudf scalar from the result. The question is should the device value be set. My initial thought is that there's no reason to set it until it's actually needed, and .device_value
is accessed. s
device value is present, and the host value is not. Here I think we need to move the device value to host, cast it there and construct a new scalar again. The question is again should the device value be set - and I lean towards no for the same reasons as above - it shouldn't harm anything to leave it unsynchronized until it's used. Most of the time we'll obtain a numpy scalar and we can just use numpy casting to get the new scalar. But we'll need special handling for strings and decimals.
This issue has been labeled inactive-30d
due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d
if there is no activity in the next 60 days.
This issue has been labeled inactive-90d
due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.
What is the expected behavior of
Scalar.astype
?During implementing https://github.com/rapidsai/cudf/pull/7182, I realized
cudf.Scalar.astype
's behavior is not well-defined. Since cudf Scalar has a host-side and a device-side, which oneastype
should operate on and what is the expected behavior? In addition, device side scalar is not really operable since libcudf does not cast scalars types. How to resolve for the discrepancy?cc @kkraus14 @brandon-b-miller