diff --git a/py-polars/tests/unit/test_projections.py b/py-polars/tests/unit/test_projections.py index 95b4ad1ef535..f395bee590ea 100644 --- a/py-polars/tests/unit/test_projections.py +++ b/py-polars/tests/unit/test_projections.py @@ -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