Skip to content

Commit

Permalink
Support DecimalDtype meta in dask_cudf (#16634)
Browse files Browse the repository at this point in the history
To enable some tpch benchmarking for dask-cudf

Authors:
  - Matthew Roeschke (https://github.com/mroeschke)

Approvers:
  - Richard (Rick) Zamora (https://github.com/rjzamora)

URL: #16634
  • Loading branch information
mroeschke authored Aug 22, 2024
1 parent 8b20298 commit eaefcb4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/dask_cudf/dask_cudf/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def _get_non_empty_data(
return cudf.core.column.as_column(
np.arange(start=0, stop=2, dtype=s.dtype)
)
elif isinstance(s.dtype, cudf.core.dtypes.DecimalDtype):
return cudf.core.column.as_column(range(2), dtype=s.dtype)
else:
raise TypeError(
f"Don't know how to handle column of type {type(s).__name__}"
Expand Down
11 changes: 11 additions & 0 deletions python/dask_cudf/dask_cudf/tests/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,14 @@ def test_issue_12773():
expected.to_pandas(),
check_index=False,
)


@pytest.mark.parametrize(
"typ", [cudf.Decimal32Dtype, cudf.Decimal64Dtype, cudf.Decimal128Dtype]
)
def test_merge_on_decimal(typ):
df = cudf.DataFrame({"a": [1], "b": [2]}, dtype=typ(1))
ddf = dask_cudf.from_cudf(df, npartitions=1)
result = ddf.merge(ddf, left_on="a", right_on="a")
expected = df.merge(df, left_on="a", right_on="a")
dd.assert_eq(result, expected)

0 comments on commit eaefcb4

Please sign in to comment.