Skip to content
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 mutil-match crash #4780

Merged
merged 1 commit into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/graph/planner/plan/PlanNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,11 @@ BinaryInputNode::BinaryInputNode(QueryContext* qctx,
}

addDep(right);
readVariable(right->outputVarPtr());
if (right != nullptr) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why right will be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like BinaryInputNode(qctx, kind, nullptr, nullptr)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BiLeftJoin::clone()

readVariable(right->outputVarPtr());
} else {
inputVars_.emplace_back(nullptr);
}
}

// It's used for clone
Expand Down
12 changes: 9 additions & 3 deletions src/graph/planner/plan/Query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,9 @@ std::unique_ptr<PlanNodeDescription> BiLeftJoin::explain() const {
}

PlanNode* BiLeftJoin::clone() const {
auto* newLeftJoin = BiLeftJoin::make(qctx_, nullptr, nullptr);
auto* lnode = left() ? left()->clone() : nullptr;
auto* rnode = right() ? right()->clone() : nullptr;
auto* newLeftJoin = BiLeftJoin::make(qctx_, lnode, rnode);
newLeftJoin->cloneMembers(*this);
return newLeftJoin;
}
Expand All @@ -886,7 +888,9 @@ std::unique_ptr<PlanNodeDescription> BiInnerJoin::explain() const {
}

PlanNode* BiInnerJoin::clone() const {
auto* newInnerJoin = BiInnerJoin::make(qctx_, nullptr, nullptr);
auto* lnode = left() ? left()->clone() : nullptr;
auto* rnode = right() ? right()->clone() : nullptr;
auto* newInnerJoin = BiInnerJoin::make(qctx_, lnode, rnode);
newInnerJoin->cloneMembers(*this);
return newInnerJoin;
}
Expand Down Expand Up @@ -925,7 +929,9 @@ void RollUpApply::cloneMembers(const RollUpApply& r) {
}

PlanNode* RollUpApply::clone() const {
auto* newRollUpApply = RollUpApply::make(qctx_, nullptr, nullptr, {}, nullptr);
auto* lnode = left() ? left()->clone() : nullptr;
auto* rnode = right() ? right()->clone() : nullptr;
auto* newRollUpApply = RollUpApply::make(qctx_, lnode, rnode, {}, nullptr);
newRollUpApply->cloneMembers(*this);
return newRollUpApply;
}
Expand Down
15 changes: 15 additions & 0 deletions tests/tck/features/match/MatchById.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,21 @@ Feature: Match By Id
RETURN id(a) as src, id(b) as dst
"""
Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down.
When executing query:
"""
MATCH (n) MATCH (n) WHERE id(n) == 'James Harden' RETURN n
"""
Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down.
When executing query:
"""
OPTIONAL MATCH (n) MATCH (n) WHERE id(n) == 'James Harden' RETURN n
"""
Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down.
When executing query:
"""
OPTIONAL MATCH (n) OPTIONAL MATCH (n) WHERE id(n) == 'James Harden' RETURN n
"""
Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down.
When executing query:
"""
MATCH (v1)-[:like]->(v2:player)-[:serve]->(v3)
Expand Down