Skip to content
Snippets Groups Projects
Unverified Commit c305bfbe authored by Yee's avatar Yee Committed by GitHub
Browse files

Release symbols when optimizing (#806)

parent 83bc772a
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,9 @@ Status OptGroup::explore(const OptRule *rule) {
NG_RETURN_IF_ERROR(resStatus);
auto result = std::move(resStatus).value();
if (result.eraseAll) {
for (auto gnode : groupNodes_) {
gnode->node()->releaseSymbols();
}
groupNodes_.clear();
for (auto ngn : result.newGroupNodes) {
addGroupNode(ngn);
......@@ -86,6 +89,7 @@ Status OptGroup::explore(const OptRule *rule) {
}
if (result.eraseCurr) {
(*iter)->node()->releaseSymbols();
iter = groupNodes_.erase(iter);
} else {
++iter;
......
......@@ -100,7 +100,7 @@ public:
return group_;
}
const graph::PlanNode *node() const {
graph::PlanNode *node() const {
return node_;
}
......
......@@ -323,6 +323,16 @@ std::unique_ptr<PlanNodeDescription> PlanNode::explain() const {
return desc;
}
void PlanNode::releaseSymbols() {
auto symTbl = qctx_->symTable();
for (auto in : inputVars_) {
in && symTbl->deleteReadBy(in->name, this);
}
for (auto out : outputVars_) {
out && symTbl->deleteWrittenBy(out->name, this);
}
}
std::ostream& operator<<(std::ostream& os, PlanNode::Kind kind) {
os << PlanNode::toString(kind);
return os;
......
......@@ -234,6 +234,8 @@ public:
return inputVars_;
}
void releaseSymbols();
static const char* toString(Kind kind);
std::string toString() const;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment