-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix optimizer symbols. #4106
Fix optimizer symbols. #4106
Conversation
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.
Compared to help the OptRule author to rebuild the dependency relationships, I prefer to check them in optimizer and report a big warning for them if they don't do the right thing. This will help author know where the error is.
for (std::size_t i = 0; i < dependencies_.size(); i++) { | ||
const OptGroup *dep = dependencies_[i]; | ||
node_->setInputVar(dep->outputVar(), i); | ||
for (auto *groupNode : dep->groupNodes()) { |
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 we need not to rebuild all OptGroupNodes
in the depended OptGroup
since there are many unchanged nodes which are not in the path of the OptRule. It will save much time to rebuild the nodes of transformed by the OptRule. WDYT?
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 could let users do it in rule, and only check it here. As you said before.
@@ -31,6 +31,13 @@ const PlanNode *MatchedResult::planNode(const std::vector<int32_t> &pos) const { | |||
return DCHECK_NOTNULL(result->node)->node(); | |||
} | |||
|
|||
void MatchedResult::collectBoundary(std::vector<OptGroup *> &boundary) const { |
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's better to collect all OptGroupNode
rather than OptGroup
in the path of matched 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.
But the dependencies_
is OptGroup
.
@@ -30,6 +30,8 @@ class OptGroup; | |||
struct MatchedResult { | |||
const OptGroupNode *node{nullptr}; | |||
std::vector<MatchedResult> dependencies; | |||
// Boundary of the whole matched result, aka the dependencies of leaf node in MatchedResult. | |||
std::vector<OptGroup *> boundary_; |
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 looks like there is no need to save this variable.
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.
Yes, we could collect it in match
method directly.
Replaced by #4146 |
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Close #3826
Description:
Add two constraints to optimizer:
And add one implicit transform:
And some improvement:
How do you solve it?
Special notes for your reviewer, ex. impact of this fix, design document, etc:
Checklist:
Tests:
Affects:
Release notes:
Please confirm whether to be reflected in release notes and how to describe: