Skip to content

Commit

Permalink
Fix mutil-match crash in optimization phase (#4780)
Browse files Browse the repository at this point in the history
fmt

small fix

small fix
  • Loading branch information
czpmango authored Oct 25, 2022
1 parent 7fbd566 commit f053a58
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
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) {
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

0 comments on commit f053a58

Please sign in to comment.