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

[REVIEW] Fix a NameError in meta dispatch API #7996

Merged
merged 2 commits into from
Apr 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions python/dask_cudf/dask_cudf/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,20 @@ def _get_non_empty_data(s):
if len(s._column.categories)
else [UNKNOWN_CATEGORIES]
)
codes = column.full(size=2, fill_value=0, dtype="int32")
codes = cudf.core.column.full(size=2, fill_value=0, dtype="int32")
ordered = s._column.ordered
data = column.build_categorical_column(
data = cudf.core.column.build_categorical_column(
categories=categories, codes=codes, ordered=ordered
)
elif is_string_dtype(s.dtype):
data = pa.array(["cat", "dog"])
else:
if pd.api.types.is_numeric_dtype(s.dtype):
data = column.as_column(cp.arange(start=0, stop=2, dtype=s.dtype))
data = cudf.core.column.as_column(
cp.arange(start=0, stop=2, dtype=s.dtype)
)
else:
data = column.as_column(
data = cudf.core.column.as_column(
cp.arange(start=0, stop=2, dtype="int64")
).astype(s.dtype)
return data
Expand Down Expand Up @@ -244,8 +246,6 @@ def is_categorical_dtype_cudf(obj):

from dask.dataframe.utils import group_split_dispatch, hash_object_dispatch

from cudf.core.column import column

def safe_hash(frame):
index = frame.index
if isinstance(frame, cudf.DataFrame):
Expand All @@ -265,7 +265,7 @@ def hash_object_cudf_index(ind, index=None):
if isinstance(ind, cudf.MultiIndex):
return safe_hash(ind.to_frame(index=False))

col = column.as_column(ind)
col = cudf.core.column.as_column(ind)
return safe_hash(cudf.Series(col))

@group_split_dispatch.register((cudf.Series, cudf.DataFrame))
Expand Down