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

Fall back when casting a timestamp to numeric in cudf-polars #16232

Prev Previous commit
Next Next commit
use libcudf traits
  • Loading branch information
brandon-b-miller committed Jul 9, 2024
commit 1c6db1bc0db7169a1ad33babd2884c73255794dc
19 changes: 1 addition & 18 deletions python/cudf_polars/cudf_polars/dsl/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,24 +1123,7 @@ def __init__(self, dtype: plc.DataType, value: Expr) -> None:
"Need to implement cast to/from string separately."
)
# TODO: use exposed libcudf trait checking APIs
elif self.dtype.id() in {
plc.TypeId.TIMESTAMP_DAYS,
plc.TypeId.TIMESTAMP_MICROSECONDS,
plc.TypeId.TIMESTAMP_MILLISECONDS,
plc.TypeId.TIMESTAMP_NANOSECONDS,
} and value.dtype.id() in {
plc.TypeId.INT8,
plc.TypeId.INT16,
plc.TypeId.INT32,
plc.TypeId.INT64,
plc.TypeId.UINT8,
plc.TypeId.UINT16,
plc.TypeId.UINT32,
plc.TypeId.UINT64,
plc.TypeId.FLOAT32,
plc.TypeId.FLOAT64,
plc.TypeId.BOOL,
}:
elif plc.traits.is_chrono(self.dtype) and plc.traits.is_numeric(value.dtype):
raise NotImplementedError("Can't cast duration to numeric")

def do_evaluate(
Expand Down
Loading