Skip to content

Commit

Permalink
Remove cudf._lib.groupby in favor of inlining pylibcudf (#17582)
Browse files Browse the repository at this point in the history
Contributes to #17317

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

Approvers:
  - Matthew Murray (https://github.com/Matt711)

URL: #17582
  • Loading branch information
mroeschke authored Dec 19, 2024
1 parent 8e9254b commit 989fac4
Show file tree
Hide file tree
Showing 8 changed files with 316 additions and 321 deletions.
2 changes: 1 addition & 1 deletion python/cudf/cudf/_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# the License.
# =============================================================================

set(cython_sources column.pyx groupby.pyx scalar.pyx strings_udf.pyx types.pyx utils.pyx)
set(cython_sources column.pyx scalar.pyx strings_udf.pyx types.pyx utils.pyx)
set(linked_libraries cudf::cudf)

rapids_cython_create_modules(
Expand Down
5 changes: 1 addition & 4 deletions python/cudf/cudf/_lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
import numpy as np

from . import (
groupby,
strings_udf,
)
from . import strings_udf

MAX_COLUMN_SIZE = np.iinfo(np.int32).max
MAX_COLUMN_SIZE_STR = "INT32_MAX"
Expand Down
281 changes: 0 additions & 281 deletions python/cudf/cudf/_lib/groupby.pyx

This file was deleted.

4 changes: 2 additions & 2 deletions python/cudf/cudf/core/_internals/aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@

class Aggregation:
def __init__(self, agg: plc.aggregation.Aggregation) -> None:
self.c_obj = agg
self.plc_obj = agg

@property
def kind(self) -> str:
name = self.c_obj.kind().name
name = self.plc_obj.kind().name
return _agg_name_map.get(name, name)

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions python/cudf/cudf/core/column/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ def scan(self, scan_op: str, inclusive: bool, **kwargs) -> Self:
return type(self).from_pylibcudf( # type: ignore[return-value]
plc.reduce.scan(
self.to_pylibcudf(mode="read"),
aggregation.make_aggregation(scan_op, kwargs).c_obj,
aggregation.make_aggregation(scan_op, kwargs).plc_obj,
plc.reduce.ScanType.INCLUSIVE
if inclusive
else plc.reduce.ScanType.EXCLUSIVE,
Expand Down Expand Up @@ -1637,7 +1637,7 @@ def reduce(self, reduction_op: str, dtype=None, **kwargs) -> ScalarLike:
with acquire_spill_lock():
plc_scalar = plc.reduce.reduce(
self.to_pylibcudf(mode="read"),
aggregation.make_aggregation(reduction_op, kwargs).c_obj,
aggregation.make_aggregation(reduction_op, kwargs).plc_obj,
dtype_to_pylibcudf_type(col_dtype),
)
result_col = type(self).from_pylibcudf(
Expand Down
Loading

0 comments on commit 989fac4

Please sign in to comment.