diff --git a/python/dask_cudf/dask_cudf/tests/test_join.py b/python/dask_cudf/dask_cudf/tests/test_join.py index 15e383ac4d9..73fd37df6fa 100644 --- a/python/dask_cudf/dask_cudf/tests/test_join.py +++ b/python/dask_cudf/dask_cudf/tests/test_join.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2022, NVIDIA CORPORATION. +# Copyright (c) 2019-2023, NVIDIA CORPORATION. from functools import partial @@ -359,3 +359,22 @@ def test_single_partition(): m2 = dleft.merge(right, how="inner") assert len(m2.dask) < len(dleft.dask) * 3 assert len(m2) == 100 + + +def test_issue_12773(): + # https://github.com/rapidsai/cudf/issues/12773 + df1 = cudf.DataFrame({"a": ["a", "b"], "b": [1, 2]}) + df2 = cudf.DataFrame({"a": ["a", "c"], "b": [2, 3]}) + + dleft = dd.from_pandas(df1, npartitions=2).set_index("a") + dright = dd.from_pandas(df2, npartitions=2).set_index("a") + + expected = df1.set_index("a").merge( + df2.set_index("a"), left_index=True, right_index=True, how="left" + ) + result = dleft.merge(dright, left_index=True, right_index=True, how="left") + dd.assert_eq( + result.compute().to_pandas(), + expected.to_pandas(), + check_index=False, + )