-
Notifications
You must be signed in to change notification settings - Fork 58
chore: implement add_op and del_op compilers #1955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d488892
to
8f5396a
Compare
38b44fe
to
3074a1f
Compare
if dtypes.is_numeric(left.dtype) and dtypes.is_numeric(right.dtype): | ||
left_expr = left.expr | ||
if left.dtype == dtypes.BOOL_DTYPE: | ||
left_expr = sge.Cast(this=left_expr, to="INT64") | ||
right_expr = right.expr | ||
if right.dtype == dtypes.BOOL_DTYPE: | ||
right_expr = sge.Cast(this=right_expr, to="INT64") | ||
return sge.Sub(this=left_expr, expression=right_expr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the boolean subtraction is not allowed either:
python-bigquery-dataframes/bigframes/operations/numeric_ops.py
Lines 201 to 202 in 51057fc
if left_type == dtypes.BOOL_DTYPE and right_type == dtypes.BOOL_DTYPE: | |
raise TypeError(f"Cannot subtract dtypes {left_type} and {right_type}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pandas does not allow both ops are bool types but allow one of ops is bool type: https://screenshot.googleplex.com/4Swcj3gUzMw9UWP
Fixes internal issue 430133370 🦕