Skip to content

Commit

Permalink
chore: pluck out aliases kwarg
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 19, 2023
1 parent 8a9c13f commit 2422352
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ibis/backends/duckdb/compiler/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _physical_table(op, **_):


@translate_rel.register(ops.Selection)
def _selection(op: ops.Selection, *, table, needs_alias=False, **kw):
def _selection(op: ops.Selection, *, table, needs_alias=False, aliases, **kw):
# needs_alias should never be true here in explicitly, but it may get
# passed via a (recursive) call to translate_val
assert not needs_alias, "needs_alias is True"
Expand All @@ -44,7 +44,7 @@ def _selection(op: ops.Selection, *, table, needs_alias=False, **kw):
(join,) = args["joins"]
else:
from_ = join = None
tr_val = partial(translate_val, needs_alias=needs_alias, **kw)
tr_val = partial(translate_val, needs_alias=needs_alias, aliases=aliases, **kw)
selections = tuple(map(tr_val, op.selections)) or "*"
sel = sg.select(*selections).from_(from_ if from_ is not None else table)

Expand All @@ -53,7 +53,7 @@ def _selection(op: ops.Selection, *, table, needs_alias=False, **kw):

if predicates := op.predicates:
if join is not None:
sel = sg.select("*").from_(sel.subquery(kw["aliases"][op.table]))
sel = sg.select("*").from_(sel.subquery(aliases[op.table]))
sel = sel.where(sg.and_(*map(tr_val, predicates)))

if sort_keys := op.sort_keys:
Expand Down

0 comments on commit 2422352

Please sign in to comment.