Skip to content

Commit

Permalink
fix(datafusion): fix incorrect order of predicate -> select compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Apr 15, 2023
1 parent 15d8d11 commit 0092304
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ibis/backends/datafusion/compiler.py
Expand Up @@ -77,6 +77,11 @@ def sort_key(op):
def selection(op):
plan = translate(op.table)

if op.predicates:
predicates = map(translate, op.predicates)
predicate = functools.reduce(operator.and_, predicates)
plan = plan.filter(predicate)

selections = []
for arg in op.selections or [op.table]:
# TODO(kszucs) it would be nice if we wouldn't need to handle the
Expand All @@ -100,11 +105,6 @@ def selection(op):

plan = plan.select(*selections)

if op.predicates:
predicates = map(translate, op.predicates)
predicate = functools.reduce(operator.and_, predicates)
plan = plan.filter(predicate)

if op.sort_keys:
sort_keys = map(translate, op.sort_keys)
plan = plan.sort(*sort_keys)
Expand Down

0 comments on commit 0092304

Please sign in to comment.