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 writternBy delete by optimizer #3746

Merged
merged 5 commits into from
Jan 20, 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
1 change: 1 addition & 0 deletions src/graph/optimizer/OptGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void OptGroup::addGroupNode(OptGroupNode *groupNode) {
DCHECK(groupNode != nullptr);
DCHECK(groupNode->group() == this);
groupNodes_.emplace_back(groupNode);
groupNode->node()->updateSymbols();
}

OptGroupNode *OptGroup::makeGroupNode(PlanNode *node) {
Expand Down
9 changes: 9 additions & 0 deletions src/graph/planner/plan/PlanNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,15 @@ void PlanNode::releaseSymbols() {
}
}

void PlanNode::updateSymbols() {
auto symTbl = qctx_->symTable();
for (auto out : outputVars_) {
if (out != nullptr) {
symTbl->updateWrittenBy(out->name, out->name, this);
}
}
}

std::ostream& operator<<(std::ostream& os, PlanNode::Kind kind) {
os << PlanNode::toString(kind);
return os;
Expand Down
2 changes: 2 additions & 0 deletions src/graph/planner/plan/PlanNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ class PlanNode {

void releaseSymbols();

void updateSymbols();

static const char* toString(Kind kind);
std::string toString() const;

Expand Down
11 changes: 11 additions & 0 deletions tests/tck/features/match/MultiQueryParts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ Feature: Multi Query Parts
| "Tim Duncan" | "Aron Baynes" | "Pistons" | "Grant Hill" |
| "Tim Duncan" | "Aron Baynes" | "Spurs" | "Aron Baynes" |
| "Tim Duncan" | "Aron Baynes" | "Spurs" | "Boris Diaw" |
When executing query:
"""
MATCH (v:player{name:"Tony Parker"})
WITH v AS a
MATCH p=(o:player{name:"Tim Duncan"})-[]->(a)
RETURN o.player.name
"""
Then the result should be, in order:
| o.player.name |
| "Tim Duncan" |
| "Tim Duncan" |

Scenario: Optional Match
When executing query:
Expand Down