Skip to content

Commit

Permalink
refactor(analysis): remove substitute_unbound() since it is used at…
Browse files Browse the repository at this point in the history
… a single place
  • Loading branch information
kszucs authored and cpcloud committed Oct 16, 2023
1 parent e966af8 commit 6a6ad19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
7 changes: 0 additions & 7 deletions ibis/expr/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,6 @@ def fn(node):
return substitute(fn, node)


def substitute_unbound(node):
"""Rewrite `node` by replacing table expressions with an equivalent unbound table."""
return node.replace(
p.DatabaseTable(name=x, schema=y) >> c.UnboundTable(name=x, schema=y)
)


def get_mutation_exprs(exprs: list[ir.Expr], table: ir.Table) -> list[ir.Expr | None]:
"""Return the exprs to use to instantiate the mutation."""
# The below logic computes the mutation node exprs by splitting the
Expand Down
5 changes: 3 additions & 2 deletions ibis/expr/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,10 @@ def to_torch(

def unbind(self) -> ir.Table:
"""Return an expression built on `UnboundTable` instead of backend-specific objects."""
from ibis.expr.analysis import substitute_unbound
from ibis.expr.analysis import p, c, _

return substitute_unbound(self.op()).to_expr()
rule = p.DatabaseTable >> c.UnboundTable(name=_.name, schema=_.schema)
return self.op().replace(rule).to_expr()

def as_table(self) -> ir.Table:
"""Convert an expression to a table."""
Expand Down

0 comments on commit 6a6ad19

Please sign in to comment.