Skip to content

Commit

Permalink
fix(api): compute the type from both branches of Where expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Jul 5, 2022
1 parent 6e9ad38 commit b8f4120
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ibis/expr/operations/logical.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from public import public

from ibis.common.validators import immutable_property
from ibis.expr import datatypes as dt
from ibis.expr import rules as rlz
from ibis.expr.operations.core import Binary, Unary, Value
Expand Down Expand Up @@ -164,7 +165,15 @@ class Where(Value):
true_expr = rlz.any
false_null_expr = rlz.any

output_dtype = rlz.dtype_like("true_expr")
@immutable_property
def output_dtype(self):
return rlz.highest_precedence_dtype(
[
self.true_expr,
self.false_null_expr,
]
)

output_shape = rlz.shape_like("bool_expr")


Expand Down

0 comments on commit b8f4120

Please sign in to comment.