Skip to content

Commit

Permalink
feat: implement coalesce for the pyspark backend
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and kszucs committed Mar 2, 2022
1 parent aca5312 commit 8183efe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ibis/backends/pyspark/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,17 @@ def compile_arbitrary(t, expr, scope, timecontext, context=None, **kwargs):
)


@compiles(ops.Coalesce)
def compile_coalesce(t, expr, scope, timecontext, **kwargs):
op = expr.op()

src_columns = t.translate(op.arg, scope, timecontext)
if len(src_columns) == 1:
return src_columns[0]
else:
return F.coalesce(*src_columns)


@compiles(ops.Greatest)
def compile_greatest(t, expr, scope, timecontext, **kwargs):
op = expr.op()
Expand Down

0 comments on commit 8183efe

Please sign in to comment.