-
Notifications
You must be signed in to change notification settings - Fork 66
feat: add expression visitors #311
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
base: main
Are you sure you want to change the base?
Conversation
f88a20f to
b541297
Compare
- Add template ExpressionVisitor and BoundVisitor - Implement Binder, IsBoundVisitor and RewriteNot
Co-authored-by: Zehua Zou <zehuazou2000@gmail.com>
Co-authored-by: Zehua Zou <zehuazou2000@gmail.com>
Co-authored-by: Zehua Zou <zehuazou2000@gmail.com>
Co-authored-by: Zehua Zou <zehuazou2000@gmail.com>
Co-authored-by: Zehua Zou <zehuazou2000@gmail.com>
Co-authored-by: Zehua Zou <zehuazou2000@gmail.com>
Co-authored-by: Zehua Zou <zehuazou2000@gmail.com>
Co-authored-by: Zehua Zou <zehuazou2000@gmail.com>
HuaHuaY
left a comment
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.
LGTM
zhjwpku
left a comment
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.
+1, thanks for working on this.
| } | ||
|
|
||
| Result<bool> IsBoundVisitor::Or(bool left_result, bool right_result) { | ||
| return left_result && right_result; |
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.
| return left_result && right_result; | |
| return left_result || right_result; |
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 don't think this is correct because this is not a logical operation. We can only return true if both sides are bound expressions. See java impl for reference: https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/expressions/Binder.java#L208-L245
| Result<std::shared_ptr<Expression>> Binder::Predicate( | ||
| const std::shared_ptr<BoundPredicate>& pred) { | ||
| ICEBERG_DCHECK(pred != nullptr, "Predicate cannot be null"); | ||
| return InvalidExpression("Found already bound predicate: {}", pred->ToString()); |
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.
Does additional commentary need to be added here? If an already bound expression is encountered, choose to report an error rather than directly using it.
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.
Did you mean that we need to add a comment on why an error is returned here?
UnboundPredicateto use virtual inheritance ofExpressionto facilitate visitor pattern.ExpressionVisitorandBoundVisitor.Binder,IsBoundVisitorandRewriteNot.Closes #70 #71 #72