-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
planner operators refactoring #11680
Conversation
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
If a new flag is being introduced:
If a workflow is added or modified:
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
3d68b6e
to
5a9b638
Compare
// BottomUp rewrites an operator tree from the bottom up. BottomUp applies a transformation function to | ||
// the given operator tree from the bottom up. Each callback [f] returns a TreeIdentity that is aggregated | ||
// into a final output indicating whether the operator tree was changed. | ||
func BottomUp(root ops.Operator, f Func) (ops.Operator, error) { | ||
op, _, err := bottomUp(root, f) |
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.
looks like the comment should actually move to bottomUp
function where the logic resides.
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.
nah, the comment belongs here. the internal bottomUp
does the actual work, but the description belongs here, I think.
// TopDown applies a transformation function to the given operator tree from the bottom up. = | ||
// Each callback [f] returns a TreeIdentity that is aggregated into a final output indicating whether the | ||
// operator tree was changed. | ||
// The callback also returns a VisitRule that signals whether the children of this operator should be visited or not | ||
func TopDown(in ops.Operator, rewriter BreakableFunc) (ops.Operator, error) { | ||
op, _, err := breakableTopDown(in, rewriter) |
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.
similar comment here
Description
This is part of my ongoing refactoring of the planner operators in Vitess.
In this PR we handle horizon planning for the simplest cases (single sharded route plans) on the operators instead of using the logical plan version of horizon planning.
I'm also changing the rewriter to be easier to read - instead of true and false everywhere, I use named constants -
rewrite.NewTree
andrewrite.SkipChildren
are easier to read and understand than literal booleans.Related Issue(s)
#11626