-
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
Push filter down HashInnerJoin rule #4956
Push filter down HashInnerJoin rule #4956
Conversation
tests/tck/features/optimizer/PushFilterDownBiInnerJoinRule.feature
Outdated
Show resolved
Hide resolved
724293e
to
20a0593
Compare
332b6e0
to
b829d79
Compare
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.
Well done!
crashed LDBC query:
|
03db518
to
72218de
Compare
ae90172
to
d7ff466
Compare
if (!depGroup) { | ||
return Status::Error("Could not find the dependent group in pattern leaves"); | ||
} | ||
if (depGroup->groupNodes_.size() != 1U || depGroup->groupNodesReferenced_.size() != 1U) { | ||
return Status::Error( | ||
"Invalid sub-plan generated when applying the rule: %s, " | ||
"planNode: %s, numGroupNodes: %lu, numGroupNodesRef: %lu", | ||
rule->toString().c_str(), | ||
PlanNode::toString(gn->node()->kind()), | ||
depGroup->groupNodes_.size(), | ||
depGroup->groupNodesReferenced_.size()); | ||
} |
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 is better not to pass optimizer errors to the user.
It might change this way:
DCHECK_NOTNULL(depGroup) << "Could not find the dependent group in pattern leaves";
or
// The `depGroup` should not be null bcz ...
DCHECK_NOTNULL(depGroup);
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 have converted the error message in QueryInstance. this return only for not crash in release version.
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.
Ok.
@@ -41,9 +41,81 @@ OptGroup::OptGroup(OptContext *ctx) noexcept : ctx_(ctx) { | |||
DCHECK(ctx != nullptr); | |||
} | |||
|
|||
Status OptGroup::validateSubPlan(const OptGroupNode *gn, |
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 can't find the call to this function. Did I miss something?
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.
Good catch! Actually I don't use it in this PR except to debug some crash. I want to use it when refactoring go planner, now i need to consider loop/select plan nodes, it's a little tedious!
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.
ACK.
if (!filterPicked) return nullptr; | ||
|
||
auto* newChildPlanNode = childPlanNode->clone(); | ||
DCHECK_NE(childPlanNode->outputVar(), newChildPlanNode->outputVar()); |
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.
Just the behavior of PlanNode::PlanNode(), need DCHECK here?
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.
Yeah, This line could be removed!
auto* newInnerJoinNode = static_cast<graph::HashInnerJoin*>(oldInnerJoinNode->clone()); | ||
auto newJoinGroup = rightFilterUnpicked ? OptGroup::create(octx) : filterGroupNode->group(); | ||
// TODO(yee): it's too tricky | ||
auto newGroupNode = rightFilterUnpicked |
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.
Maybe renaming rightFilterUnpicked
to filterRemained
would be more readable.
# This source code is licensed under Apache 2.0 License. | ||
Feature: Push Filter down HashInnerJoin rule | ||
|
||
Background: |
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.
Add test case:
match (a:player)-[:like]->(b) where b.player.age>30
match (b)-[:serve]->(c) where c.team.name>"A" and b.player.age+a.player.age>40 and a.player.age<45
return a,b,c
and
match (a:player)-[:like]->(b) where b.player.age>30 or b.player.age>45
match (b)-[:serve]->(c) where c.team.name>"A" or b.player.age+a.player.age>40 and a.player.age<45
return a,b,c
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.
Test cases related to OR
filter and non-query-part plan.
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.
ACK
More cases will be added in NEXT PR. |
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
fix #4979
Description:
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: