Skip to content

Commit

Permalink
fix writternBy delete by optimizer (#3746)
Browse files Browse the repository at this point in the history
* fix bugs

* add tck features

* style

Co-authored-by: cpw <13495049+CPWstatic@users.noreply.github.com>
  • Loading branch information
heroicNeZha and CPWstatic authored Jan 20, 2022
1 parent fd59b45 commit 46b2aac
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
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

0 comments on commit 46b2aac

Please sign in to comment.