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

Deprecate merge_sorted, change dask cudf usage to internal method #10713

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
19 changes: 19 additions & 0 deletions python/cudf/cudf/core/reshape.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2018-2022, NVIDIA CORPORATION.

import itertools
import warnings
from collections import abc
from typing import Dict, Optional

Expand Down Expand Up @@ -791,6 +792,24 @@ def merge_sorted(
A new, lexicographically sorted, DataFrame/Series.
"""

warnings.warn(
"merge_sorted is deprecated and will be removed in a "
"future release.",
FutureWarning,
)
return _merge_sorted(
objs, keys, by_index, ignore_index, ascending, na_position
)


def _merge_sorted(
objs,
keys=None,
by_index=False,
ignore_index=False,
ascending=True,
na_position="last",
):
if not pd.api.types.is_list_like(objs):
raise TypeError("objs must be a list-like of Frame-like objects")

Expand Down
10 changes: 6 additions & 4 deletions python/cudf/cudf/tests/test_reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def test_df_merge_sorted(nparts, keys, na_position, ascending):
expect = df.sort_values(
keys_1, na_position=na_position, ascending=ascending
)
result = cudf.merge_sorted(
result = cudf.core.reshape._merge_sorted(
dfs, keys=keys, na_position=na_position, ascending=ascending
)
if keys:
Expand All @@ -290,7 +290,9 @@ def test_df_merge_sorted_index(nparts, index, ascending):
)

expect = df.sort_index(ascending=ascending)
result = cudf.merge_sorted(dfs, by_index=True, ascending=ascending)
result = cudf.core.reshape._merge_sorted(
dfs, by_index=True, ascending=ascending
)
rjzamora marked this conversation as resolved.
Show resolved Hide resolved

assert_eq(expect.index, result.index)

Expand All @@ -317,7 +319,7 @@ def test_df_merge_sorted_ignore_index(keys, na_position, ascending):
expect = df.sort_values(
keys_1, na_position=na_position, ascending=ascending
)
result = cudf.merge_sorted(
result = cudf.core.reshape._merge_sorted(
dfs,
keys=keys,
na_position=na_position,
Expand Down Expand Up @@ -347,7 +349,7 @@ def test_series_merge_sorted(nparts, key, na_position, ascending):
)

expect = df.sort_values(na_position=na_position, ascending=ascending)
result = cudf.merge_sorted(
result = cudf.core.reshape._merge_sorted(
dfs, na_position=na_position, ascending=ascending
)

Expand Down
2 changes: 1 addition & 1 deletion python/dask_cudf/dask_cudf/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _append_counts(val, count):
return val

# Sort by calculated quantile values, then number of observations.
combined_vals_counts = gd.merge_sorted(
combined_vals_counts = gd.core.reshape._merge_sorted(
[*map(_append_counts, vals, counts)]
)
combined_counts = cupy.asnumpy(combined_vals_counts["_counts"].values)
Expand Down