Skip to content

Conversation

@chelsea-lin
Copy link
Contributor

Fixes internal issue 452439789 🦕

@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 Oct 24, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_nary branch 3 times, most recently from 650b1fc to ce09b4a Compare October 27, 2025 16:57
@chelsea-lin chelsea-lin changed the title refactor: add struct_op for the sqlglot compiler refactor: add struct_op and sql_scalar_op for the sqlglot compiler Oct 27, 2025
@chelsea-lin chelsea-lin marked this pull request as ready for review October 27, 2025 22:00
@chelsea-lin chelsea-lin requested review from a team as code owners October 27, 2025 22:00
@chelsea-lin chelsea-lin requested a review from sycai October 27, 2025 22:00

@register_nary_op(ops.SqlScalarOp, pass_op=True)
def _(*operands: TypedExpr, op: ops.SqlScalarOp) -> sge.Expression:
# TODO: can we include a string in the sqlglot expression without parsing?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go/todo-style

Maybe we should create a bug for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was copied from the Ibis codes. Actually, I think the parse_one should be the right way to handle this. Hence, I would remove the TODO comment here.

op: ops.BinaryOp,
l_arg: str,
r_arg: Union[str, ex.Expression],
op: Union[ops.BinaryOp, ops.NaryOp],
Copy link
Contributor

@sycai sycai Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably define a separate _apply_nary_op instead. Some duplication can be helpful if it improves readability.

In this scenario, BinaryOp is not a subclass of NaryOp so it makes less sense to name the function _apply_nary_op while letting it accept a BinaryOp -- it confuses other folks who are going to use this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points. Added the _apply_binary_op back. Thanks

@chelsea-lin chelsea-lin requested a review from sycai October 27, 2025 22:41
@chelsea-lin chelsea-lin merged commit 4c98c95 into main Oct 27, 2025
20 of 25 checks passed
@chelsea-lin chelsea-lin deleted the main_chelsealin_nary branch October 27, 2025 23:31
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: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants