Skip to content

Commit

Permalink
[REVIEW] Fix a NameError in meta dispatch API (#7996)
Browse files Browse the repository at this point in the history
This PR fixes an incorrect usage with the correct usage of `column`(`cudf.core.column`).

cc: @charlesbluca
  • Loading branch information
galipremsagar authored Apr 20, 2021
1 parent 8e1ffd4 commit cdf7704
Showing 1 changed file with 7 additions and 7 deletions.
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

0 comments on commit cdf7704

Please sign in to comment.