Skip to content

Commit

Permalink
test(python): Add test for select(len()) (#20343)
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion authored Dec 18, 2024
1 parent 676f10d commit 6e4d717
Showing 1 changed file with 12 additions and 0 deletions.
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 @@ -618,3 +618,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

0 comments on commit 6e4d717

Please sign in to comment.