This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
Refactor join. #1263
Closed
Closed
Refactor join. #1263
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5c211cd
Rename promise to notifier and future to receiver.
CPWstatic 7ce9b3e
Using binary input join,
CPWstatic 06d2696
Fix go.
CPWstatic bd7094a
Fix clone
CPWstatic 1045324
Fix push filter down join.
CPWstatic 57b78d2
Use start.
CPWstatic 35b2098
Fix executor test.
CPWstatic 8b8e067
Fix validator test
CPWstatic 2ad5c03
Fix test.
CPWstatic aee727d
Fix compile.
CPWstatic e58614f
Add more msg.
CPWstatic c46e266
Fix filter push down join opt.
CPWstatic af9ca47
Merge branch 'master' into refactor_join
Shylock-Hg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,28 @@ const PlanNode *MatchedResult::planNode(const std::vector<int32_t> &pos) const { | |
return DCHECK_NOTNULL(result->node)->node(); | ||
} | ||
|
||
std::string MatchedResult::toString() const { | ||
std::stringstream ss; | ||
std::queue<const MatchedResult*> queue; | ||
std::unordered_set<const MatchedResult*> visited; | ||
queue.emplace(this); | ||
|
||
while (!queue.empty()) { | ||
auto* n = queue.front(); | ||
queue.pop(); | ||
visited.emplace(n); | ||
ss << n->node->node()->outputVar() << ","; | ||
|
||
for (auto& dep : n->dependencies) { | ||
queue.emplace(&dep); | ||
} | ||
} | ||
|
||
auto ret = ss.str(); | ||
ret.pop_back(); | ||
return ret; | ||
} | ||
|
||
Pattern Pattern::create(graph::PlanNode::Kind kind, std::initializer_list<Pattern> patterns) { | ||
Pattern pattern; | ||
pattern.kind_ = kind; | ||
|
@@ -77,14 +99,40 @@ StatusOr<MatchedResult> Pattern::match(const OptGroup *group) const { | |
return Status::Error(); | ||
} | ||
|
||
std::string Pattern::toString() const { | ||
std::stringstream ss; | ||
std::queue<const Pattern*> queue; | ||
std::unordered_set<const Pattern*> visited; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
queue.emplace(this); | ||
while (!queue.empty()) { | ||
auto& p = queue.front(); | ||
queue.pop(); | ||
visited.emplace(p); | ||
|
||
ss << p->kind_ << ","; | ||
for (auto& pattern : p->dependencies_) { | ||
queue.emplace(&pattern); | ||
} | ||
} | ||
|
||
auto ret = ss.str(); | ||
ret.pop_back(); | ||
return ss.str(); | ||
} | ||
|
||
StatusOr<MatchedResult> OptRule::match(OptContext *ctx, const OptGroupNode *groupNode) const { | ||
VLOG(1) << "Apply rule: " + this->toString() | ||
<< " to node: " << groupNode->node()->outputVar(); | ||
const auto &pattern = this->pattern(); | ||
auto status = pattern.match(groupNode); | ||
NG_RETURN_IF_ERROR(status); | ||
auto matched = std::move(status).value(); | ||
if (!this->match(ctx, matched)) { | ||
return Status::Error(); | ||
} | ||
VLOG(1) << "Hit rule: " + this->toString() | ||
<< " pattern: " << pattern.toString() | ||
<< " subtree of plan: " << matched.toString(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you cleanup these debug logs? |
||
return matched; | ||
} | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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 seems that you can delete the
visited
variable.