refactor: add struct_op and sql_scalar_op for the sqlglot compiler#2197
Merged
chelsea-lin merged 5 commits intomainfrom Oct 27, 2025
Merged
refactor: add struct_op and sql_scalar_op for the sqlglot compiler#2197chelsea-lin merged 5 commits intomainfrom
chelsea-lin merged 5 commits intomainfrom
Conversation
650b1fc to
ce09b4a
Compare
sycai
reviewed
Oct 27, 2025
|
|
||
| @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? |
Contributor
There was a problem hiding this comment.
Maybe we should create a bug for this?
Contributor
Author
There was a problem hiding this comment.
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], |
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
Good points. Added the _apply_binary_op back. Thanks
b35c579 to
88c7636
Compare
sycai
approved these changes
Oct 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes internal issue 452439789 🦕