2828from ibis .common .grounds import Concrete
2929from ibis .common .typing import VarTuple # noqa: TCH001
3030from ibis .expr .rewrites import rewrite_window_input
31- from ibis .expr .types .relations import bind
3231
3332if TYPE_CHECKING :
34- from collections .abc import Iterable , Sequence
33+ from collections .abc import Sequence
3534
3635
3736@public
@@ -65,13 +64,14 @@ def __getattr__(self, attr):
6564
6665 def aggregate (self , * metrics , ** kwds ) -> ir .Table :
6766 """Compute aggregates over a group by."""
67+ metrics = self .table .to_expr ().bind (* metrics , ** kwds )
6868 return self .table .to_expr ().aggregate (
69- metrics , by = self .groupings , having = self .havings , ** kwds
69+ metrics , by = self .groupings , having = self .havings
7070 )
7171
7272 agg = aggregate
7373
74- def having (self , * expr : ir .BooleanScalar ) -> GroupedTable :
74+ def having (self , * predicates : ir .BooleanScalar ) -> GroupedTable :
7575 """Add a post-aggregation result filter `expr`.
7676
7777 ::: {.callout-warning}
@@ -80,19 +80,19 @@ def having(self, *expr: ir.BooleanScalar) -> GroupedTable:
8080
8181 Parameters
8282 ----------
83- expr
84- An expression that filters based on an aggregate value.
83+ predicates
84+ Expressions that filters based on an aggregate value.
8585
8686 Returns
8787 -------
8888 GroupedTable
8989 A grouped table expression
9090 """
9191 table = self .table .to_expr ()
92- havings = tuple ( bind (table , expr ) )
92+ havings = table . bind (* predicates )
9393 return self .copy (havings = self .havings + havings )
9494
95- def order_by (self , * expr : ir .Value | Iterable [ ir . Value ] ) -> GroupedTable :
95+ def order_by (self , * by : ir .Value ) -> GroupedTable :
9696 """Sort a grouped table expression by `expr`.
9797
9898 Notes
@@ -101,7 +101,7 @@ def order_by(self, *expr: ir.Value | Iterable[ir.Value]) -> GroupedTable:
101101
102102 Parameters
103103 ----------
104- expr
104+ by
105105 Expressions to order the results by
106106
107107 Returns
@@ -110,7 +110,7 @@ def order_by(self, *expr: ir.Value | Iterable[ir.Value]) -> GroupedTable:
110110 A sorted grouped GroupedTable
111111 """
112112 table = self .table .to_expr ()
113- orderings = tuple ( bind (table , expr ) )
113+ orderings = table . bind (* by )
114114 return self .copy (orderings = self .orderings + orderings )
115115
116116 def mutate (
@@ -201,7 +201,7 @@ def _selectables(self, *exprs, **kwexprs):
201201 [`GroupedTable.mutate`](#ibis.expr.types.groupby.GroupedTable.mutate)
202202 """
203203 table = self .table .to_expr ()
204- values = bind (table , ( exprs , kwexprs ) )
204+ values = table . bind (* exprs , ** kwexprs )
205205 window = ibis .window (group_by = self .groupings , order_by = self .orderings )
206206 return [rewrite_window_input (expr .op (), window ).to_expr () for expr in values ]
207207
0 commit comments