-
Notifications
You must be signed in to change notification settings - Fork 80
chore: IsBoundVisitor mixed bound/unbound predicate should error #503
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
src/iceberg/expression/binder.cc
Outdated
| } | ||
|
|
||
| Result<bool> IsBoundVisitor::AlwaysTrue() { return true; } | ||
| Result<std::optional<bool>> IsBoundVisitor::AlwaysTrue() { return std::nullopt; } |
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 think the Java impl is overly complicated to return null by default and then a lot of places should handle null with different meanings.
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.
What about letting each visitors to handle this instead of complicating the return type?
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.
Fixed.
1ba9c7d to
366c586
Compare
366c586 to
7730c88
Compare
|
|
||
| Result<bool> IsBoundVisitor::And(bool left_result, bool right_result) { | ||
| return left_result && right_result; | ||
| ICEBERG_PRECHECK(left_result == right_result, "Found partially bound expression"); |
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. If we want to keep the same behavior as the Java impl, we might need to return error for AlwaysTrue() and AlwaysFalse() and then revert changes to And and Or.
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.
But if we do that, mixed bound and unbound will be evaluated as false, is that expected?
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.
That is expected. IsBoundVisitor checks if all expressions are bound and returns false if any is unbound. This is used to check if the expression has called bind function along the tree.
No description provided.