Skip to content

Conversation

chelsea-lin
Copy link
Contributor

Fixes internal issue 430133370 🦕

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Jul 30, 2025
@chelsea-lin chelsea-lin marked this pull request as ready for review July 30, 2025 21:48
@chelsea-lin chelsea-lin requested review from a team as code owners July 30, 2025 21:48
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_add branch from d488892 to 8f5396a Compare July 30, 2025 23:47
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Jul 30, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_add branch 2 times, most recently from 38b44fe to 3074a1f Compare July 30, 2025 23:49
@chelsea-lin chelsea-lin requested a review from sycai July 30, 2025 23:49
Comment on lines +78 to +85
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)
Copy link
Contributor

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:

if left_type == dtypes.BOOL_DTYPE and right_type == dtypes.BOOL_DTYPE:
raise TypeError(f"Cannot subtract dtypes {left_type} and {right_type}")

Copy link
Contributor Author

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

@chelsea-lin chelsea-lin enabled auto-merge (squash) August 8, 2025 20:24
@chelsea-lin chelsea-lin merged commit fed8039 into main Aug 8, 2025
18 of 25 checks passed
@chelsea-lin chelsea-lin deleted the main_chelsealin_add branch August 8, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants