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

Remove Scalar container type from polars interpreter #15953

Merged
merged 14 commits into from
Jun 11, 2024
Prev Previous commit
Use set.difference
  • Loading branch information
wence- committed Jun 11, 2024
commit 7fc75e9b9b30e6ae35512b137a35e33a62926cfe
6 changes: 3 additions & 3 deletions python/cudf_polars/cudf_polars/dsl/ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from cudf_polars.utils import sorting

if TYPE_CHECKING:
from collections.abc import MutableMapping, Set
from collections.abc import MutableMapping
from typing import Literal

from cudf_polars.typing import Schema
Expand Down Expand Up @@ -96,14 +96,14 @@ def broadcast(
``target_length`` is provided and not all columns are length-1
(i.e. ``n != 1``), then ``target_length`` must be equal to ``n``.
"""
lengths: Set[int] = {column.obj.size() for column in columns}
lengths: set[int] = {column.obj.size() for column in columns}
if lengths == {1}:
if target_length is None:
return list(columns)
nrows = target_length
else:
try:
(nrows,) = lengths - {1}
(nrows,) = lengths.difference([1])
except ValueError as e:
raise RuntimeError("Mismatching column lengths") from e
if target_length is not None and nrows != target_length:
Expand Down
Loading