From e89d5f619b0aeeda3df46c8afb346b38860c99d6 Mon Sep 17 00:00:00 2001 From: Charles Blackmon-Luca <20627856+charlesbluca@users.noreply.github.com> Date: Wed, 1 Dec 2021 13:13:09 -0500 Subject: [PATCH 1/3] Enforce boolean ascending for dask-cudf sort_values --- python/dask_cudf/dask_cudf/sorting.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/dask_cudf/dask_cudf/sorting.py b/python/dask_cudf/dask_cudf/sorting.py index 5f2af445170..90069326431 100644 --- a/python/dask_cudf/dask_cudf/sorting.py +++ b/python/dask_cudf/dask_cudf/sorting.py @@ -23,6 +23,7 @@ def set_index_post(df, index_name, drop, column_dtype): def _set_partitions_pre(s, divisions, ascending=True, na_position="last"): + breakpoint() if ascending: partitions = divisions.searchsorted(s, side="right") - 1 else: @@ -224,6 +225,8 @@ def sort_values( na_position="last", ): """Sort by the given list/tuple of column names.""" + # if not isinstance(ascending, bool): + # raise ValueError("ascending must be either True or False") if na_position not in ("first", "last"): raise ValueError("na_position must be either 'first' or 'last'") From a87a6a53a4dc5750f30f3556471b5ca49e6dcb54 Mon Sep 17 00:00:00 2001 From: Charles Blackmon-Luca <20627856+charlesbluca@users.noreply.github.com> Date: Wed, 1 Dec 2021 13:15:25 -0500 Subject: [PATCH 2/3] Remove breakpoint --- python/dask_cudf/dask_cudf/sorting.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/dask_cudf/dask_cudf/sorting.py b/python/dask_cudf/dask_cudf/sorting.py index 90069326431..9763383bb3f 100644 --- a/python/dask_cudf/dask_cudf/sorting.py +++ b/python/dask_cudf/dask_cudf/sorting.py @@ -23,7 +23,6 @@ def set_index_post(df, index_name, drop, column_dtype): def _set_partitions_pre(s, divisions, ascending=True, na_position="last"): - breakpoint() if ascending: partitions = divisions.searchsorted(s, side="right") - 1 else: From 951c3dc93750a9f6a18d42408476155190199e7b Mon Sep 17 00:00:00 2001 From: Charles Blackmon-Luca <20627856+charlesbluca@users.noreply.github.com> Date: Wed, 1 Dec 2021 13:15:50 -0500 Subject: [PATCH 3/3] Uncomment ascending enforcement --- python/dask_cudf/dask_cudf/sorting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/dask_cudf/dask_cudf/sorting.py b/python/dask_cudf/dask_cudf/sorting.py index 9763383bb3f..e8551493bb1 100644 --- a/python/dask_cudf/dask_cudf/sorting.py +++ b/python/dask_cudf/dask_cudf/sorting.py @@ -224,8 +224,8 @@ def sort_values( na_position="last", ): """Sort by the given list/tuple of column names.""" - # if not isinstance(ascending, bool): - # raise ValueError("ascending must be either True or False") + if not isinstance(ascending, bool): + raise ValueError("ascending must be either True or False") if na_position not in ("first", "last"): raise ValueError("na_position must be either 'first' or 'last'")