-
Notifications
You must be signed in to change notification settings - Fork 63
refactor: add struct_op and sql_scalar_op for the sqlglot compiler #2197
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
650b1fc to
ce09b4a
Compare
|
|
||
| @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? |
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.
Maybe we should create a bug for this?
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.
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], |
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.
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.
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.
Good points. Added the _apply_binary_op back. Thanks
b35c579 to
88c7636
Compare
Fixes internal issue 452439789 🦕