Skip to content

Commit 84582b8

Browse files
committed
chore: implement comparison_ops for sqlglot compiler
1 parent 3a4be75 commit 84582b8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

bigframes/core/compile/sqlglot/expressions/binary_compiler.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ def _(op, left: TypedExpr, right: TypedExpr) -> sge.Expression:
7373
)
7474

7575

76+
@BINARY_OP_REGISTRATION.register(ops.eq_op)
77+
def _(op, left: TypedExpr, right: TypedExpr) -> sge.Expression:
78+
left_expr = left.expr
79+
if left.dtype == dtypes.BOOL_DTYPE:
80+
left_expr = sge.Cast(this=left_expr, to="INT64")
81+
right_expr = right.expr
82+
if right.dtype == dtypes.BOOL_DTYPE:
83+
right_expr = sge.Cast(this=right_expr, to="INT64")
84+
return sge.EQ(this=left_expr, expression=right_expr)
85+
86+
7687
@BINARY_OP_REGISTRATION.register(ops.div_op)
7788
def _(op, left: TypedExpr, right: TypedExpr) -> sge.Expression:
7889
left_expr = left.expr

tests/system/small/engines/test_comparison_ops.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def apply_op_pairwise(
4848
return new_arr
4949

5050

51-
@pytest.mark.parametrize("engine", ["polars", "bq"], indirect=True)
51+
# @pytest.mark.parametrize("engine", ["polars", "bq", "bq-sqlglot"], indirect=True)
52+
@pytest.mark.parametrize("engine", ["bq-sqlglot"], indirect=True)
5253
@pytest.mark.parametrize(
5354
"op",
5455
[

0 commit comments

Comments
 (0)