Skip to content

Support any aggregation in cudf-polars #19145

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

Open
wants to merge 1 commit into
base: branch-25.08
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def __init__(
f"Unsupported aggregation {name=}"
) # pragma: no cover; all valid aggs are supported
# TODO: nan handling in groupby case
if name == "min":
if name == "any":
req = plc.aggregation.any()
elif name == "min":
req = plc.aggregation.min()
elif name == "max":
req = plc.aggregation.max()
Expand Down Expand Up @@ -98,6 +100,7 @@ def __init__(

_SUPPORTED: ClassVar[frozenset[str]] = frozenset(
[
"any",
"min",
"max",
"median",
Expand Down
3 changes: 3 additions & 0 deletions python/cudf_polars/tests/expressions/test_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@pytest.fixture(
params=[
# regular aggs from Agg
"any",
"min",
"max",
"median",
Expand Down Expand Up @@ -69,6 +70,8 @@ def df(dtype, with_nulls, is_sorted):


def test_agg(df, agg):
if agg == "any":
pytest.skip("Does not apply")
expr = getattr(pl.col("a"), agg)()
q = df.select(expr)

Expand Down
Loading