diff --git a/ibis/expr/analysis.py b/ibis/expr/analysis.py index 17b9beaa55060..a627ea25d263b 100644 --- a/ibis/expr/analysis.py +++ b/ibis/expr/analysis.py @@ -176,11 +176,10 @@ def merge_windows(_, default_frame): return ops.WindowFunction(_.func, frame) -def windowize_function(expr, default_frame, merge_frames=False): +def windowize_function(expr, default_frame): ctx = {"default_frame": default_frame} node = expr.op() - if merge_frames: - node = node.replace(merge_windows, filter=p.Value, context=ctx) + node = node.replace(merge_windows, filter=p.Value, context=ctx) node = node.replace(wrap_analytic, filter=p.Value & ~p.WindowFunction, context=ctx) return node.to_expr() diff --git a/ibis/expr/types/core.py b/ibis/expr/types/core.py index 5e8246080de64..3167cbee373a4 100644 --- a/ibis/expr/types/core.py +++ b/ibis/expr/types/core.py @@ -589,7 +589,8 @@ def to_torch( def unbind(self) -> ir.Table: """Return an expression built on `UnboundTable` instead of backend-specific objects.""" - from ibis.expr.analysis import p, c, _ + from ibis.expr.analysis import p, c + from ibis.common.deferred import _ rule = p.DatabaseTable >> c.UnboundTable(name=_.name, schema=_.schema) return self.op().replace(rule).to_expr() diff --git a/ibis/expr/types/generic.py b/ibis/expr/types/generic.py index cbdb585d08629..a7f2b94cf0eeb 100644 --- a/ibis/expr/types/generic.py +++ b/ibis/expr/types/generic.py @@ -758,7 +758,7 @@ def over( def bind(table): frame = window.bind(table) - expr = an.windowize_function(self, frame, merge_frames=True) + expr = an.windowize_function(self, frame) if expr.equals(self): raise com.IbisTypeError( "No reduction or analytic function found to construct a window expression" diff --git a/ibis/expr/types/groupby.py b/ibis/expr/types/groupby.py index 8505fbf8bc04f..123b1ca8b71f6 100644 --- a/ibis/expr/types/groupby.py +++ b/ibis/expr/types/groupby.py @@ -254,12 +254,12 @@ def _selectables(self, *exprs, **kwexprs): order_by=bind_expr(self.table, self._order_by), ) return [ - an.windowize_function(e2, default_frame, merge_frames=True) + an.windowize_function(e2, default_frame) for expr in exprs for e1 in util.promote_list(expr) for e2 in util.promote_list(table._ensure_expr(e1)) ] + [ - an.windowize_function(e, default_frame, merge_frames=True).name(k) + an.windowize_function(e, default_frame).name(k) for k, expr in kwexprs.items() for e in util.promote_list(table._ensure_expr(expr)) ] diff --git a/ibis/expr/types/relations.py b/ibis/expr/types/relations.py index 51f3105a19f67..99012b318eddf 100644 --- a/ibis/expr/types/relations.py +++ b/ibis/expr/types/relations.py @@ -4338,7 +4338,8 @@ def _resolve_predicates( table: Table, predicates ) -> tuple[list[ir.BooleanValue], list[tuple[ir.BooleanValue, ir.Table]]]: import ibis.expr.types as ir - from ibis.expr.analysis import _, flatten_predicate, p + from ibis.common.deferred import _ + from ibis.expr.analysis import flatten_predicate, p # TODO(kszucs): clean this up, too much flattening and resolving happens here predicates = [