Skip to content

Commit 32b9abb

Browse files
cpcloudkszucs
authored andcommitted
feat(pyspark): implement Where
1 parent ddbfc31 commit 32b9abb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ibis/backends/pyspark/compiler.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,3 +2022,13 @@ def compile_radians(t, expr, scope, timecontext, **kwargs):
20222022
def compile_zero_if_null(t, expr, scope, timecontext, **kwargs):
20232023
col = t.translate(expr.op().arg, scope, timecontext, **kwargs)
20242024
return F.when(col.isNull() | F.isnan(col), F.lit(0)).otherwise(col)
2025+
2026+
2027+
@compiles(ops.Where)
2028+
def compile_where(t, expr, scope, timecontext, **kwargs):
2029+
op = expr.op()
2030+
2031+
return F.when(
2032+
t.translate(op.bool_expr, scope, timecontext, **kwargs),
2033+
t.translate(op.true_expr, scope, timecontext, **kwargs),
2034+
).otherwise(t.translate(op.false_null_expr, scope, timecontext, **kwargs))

0 commit comments

Comments
 (0)