Skip to content

Commit

Permalink
chore(snowflake): fix groupconcat impl
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Aug 2, 2024
1 parent a30996c commit 773d7fe
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ibis/backends/sql/compilers/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,14 @@ def visit_Last(self, op, *, arg, where, order_by):
return self.f.get(expr, self.f.array_size(expr) - 1)

def visit_GroupConcat(self, op, *, arg, where, sep, order_by):
out = sge.WithinGroup(
this=self.f.listagg(arg, sep), expression=sge.Order(expressions=order_by)
)
if where is not None:
out = self.if_(self.f.count_if(where) > 0, out, NULL)
arg = self.if_(where, arg, NULL)

out = self.f.listagg(arg, sep)

if order_by:
out = sge.WithinGroup(this=out, expression=sge.Order(expressions=order_by))

return out

def visit_TimestampBucket(self, op, *, arg, interval, offset):
Expand Down

0 comments on commit 773d7fe

Please sign in to comment.