Skip to content

Commit

Permalink
refactor(sql): align logic for filtered reductions
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman authored and cpcloud committed Nov 9, 2023
1 parent ea2d317 commit 0347036
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ibis/backends/base/sql/registry/aggregate.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
from __future__ import annotations

import itertools

import ibis
import ibis.expr.operations as ops


def _reduction_format(translator, func_name, where, arg, *args):
def _reduction_format(translator, func_name, where, *args):
if where is not None:
arg = ops.IfElse(where, arg, ibis.NA)
args = (ops.IfElse(where, arg, ibis.NA) for arg in args)

return "{}({})".format(
func_name,
", ".join(map(translator.translate, itertools.chain([arg], args))),
", ".join(map(translator.translate, args)),
)


Expand Down

0 comments on commit 0347036

Please sign in to comment.