We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81ade4d commit bf1f5c6Copy full SHA for bf1f5c6
1 file changed
packages/bigframes/bigframes/core/compile/lowering.py
@@ -482,6 +482,11 @@ def _lower_cast_to_substrait(
482
"substrait-datafusion", "substrait-acero"
483
] = "substrait-datafusion",
484
):
485
+ if arg.output_type == dtypes.BOOL_DTYPE and dtypes.is_numeric(cast_op.to_type):
486
+ # bool -> decimal/numeric needs two-step cast
487
+ new_arg = ops.AsTypeOp(to_type=dtypes.INT_DTYPE).as_expr(arg)
488
+ return cast_op.as_expr(new_arg)
489
+
490
if arg.output_type == dtypes.BOOL_DTYPE and cast_op.to_type == dtypes.STRING_DTYPE:
491
is_true_cond = ops.eq_op.as_expr(arg, expression.const(True))
492
is_false_cond = ops.eq_op.as_expr(arg, expression.const(False))
0 commit comments