Skip to content

Commit 7f9fdd4

Browse files
cpcloudkszucs
authored andcommitted
fix(polars): project first when creating computed grouping keys
1 parent 6817981 commit 7f9fdd4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ibis/backends/polars/compiler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,11 @@ def aggregation(op, **kw):
267267
)
268268
)
269269

270+
# project first to handle computed group by columns
271+
lf = lf.with_columns([translate(arg, **kw) for arg in op.by])
272+
270273
if op.by:
271-
group_by = [translate(arg, **kw) for arg in op.by]
272-
lf = lf.group_by(group_by).agg
274+
lf = lf.group_by([pl.col(by.name) for by in op.by]).agg
273275
else:
274276
lf = lf.select
275277

0 commit comments

Comments
 (0)