rapidsai / cudf

cuDF - GPU DataFrame Library
https://docs.rapids.ai/api/cudf/stable/
Apache License 2.0
8.36k stars 892 forks source link

[BUG] Scalar.astype is ill-defined #7835

Open isVoid opened 3 years ago

isVoid commented 3 years ago

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 one astype 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

brandon-b-miller commented 3 years ago

I think there can be three scenarios when astype is called on a cudf scalar s:

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.

github-actions[bot] commented 3 years ago

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.

github-actions[bot] commented 2 years ago

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.