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

test(python): Add test for select(len()) #20343

Merged
merged 1 commit into from
Dec 18, 2024
Merged
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
12 changes: 12 additions & 0 deletions py-polars/tests/unit/test_projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,15 @@ def test_with_columns_projection_pushdown() -> None:
def test_projection_pushdown_height_20221() -> None:
q = pl.LazyFrame({"a": range(5)}).select("a", b=pl.col("a").first()).select("b")
assert_frame_equal(q.collect(), pl.DataFrame({"b": [0, 0, 0, 0, 0]}))


def test_select_len_20337() -> None:
strs = [str(i) for i in range(3)]
q = pl.LazyFrame({"a": strs, "b": strs, "c": strs, "d": range(3)})

q = q.group_by(pl.col("c")).agg(
(pl.col("d") * j).alias(f"mult {j}") for j in [1, 2]
)

q = q.with_row_index("foo")
assert q.select(pl.len()).collect().item() == 3
Loading