Skip to content

Commit

Permalink
fix return v.tag
Browse files Browse the repository at this point in the history
  • Loading branch information
xtcyclist committed Mar 27, 2023
1 parent f15e381 commit 7e1a63b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/graph/visitor/PropertyTrackerVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,20 @@ void PropertyTrackerVisitor::visit(AttributeExpression *expr) {
auto &propName = constVal.getStr();
switch (lhs->kind()) {
case Expression::Kind::kInputProperty:
case Expression::Kind::kVarProperty: { // $e.name
case Expression::Kind::kVarProperty: {
// maybe: $e.prop or $v.tag
auto *varPropExpr = static_cast<PropertyExpression *>(lhs);
auto &edgeAlias = varPropExpr->prop();
propsUsed_.insertEdgeProp(edgeAlias, unknownType_, propName);
auto &entityAlias = varPropExpr->prop();
propsUsed_.insertEdgeProp(entityAlias, unknownType_, propName);
// $v.tag
auto &tagName = propName;
auto ret = qctx_->schemaMng()->toTagID(space_, tagName);
if (!ret.ok()) {
status_ = std::move(ret).status();
return;
}
auto tagId = ret.value();
propsUsed_.insertVertexProp(entityAlias, tagId, "*");
break;
}
case Expression::Kind::kCase: { // (case xxx).name
Expand Down
10 changes: 8 additions & 2 deletions src/graph/visitor/PrunePropertiesVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,11 @@ void PrunePropertiesVisitor::pruneCurrent(AppendVertices *node) {
usedProps.insert(unknownIter->second.begin(), unknownIter->second.end());
}
if (tagIter != usedVertexProps.end()) {
usedProps.insert(tagIter->second.begin(), tagIter->second.end());
if (tagIter->second.find("*") != tagIter->second.end()) {
continue;
} else {
usedProps.insert(tagIter->second.begin(), tagIter->second.end());
}
}
if (usedProps.empty()) {
continue;
Expand All @@ -439,7 +443,9 @@ void PrunePropertiesVisitor::pruneCurrent(AppendVertices *node) {
newVProp.props_ref() = std::move(newProps);
prunedVertexProps->emplace_back(std::move(newVProp));
}
node->setVertexProps(std::move(prunedVertexProps));
if (!prunedVertexProps->empty()) {
node->setVertexProps(std::move(prunedVertexProps));
}
}

void PrunePropertiesVisitor::visit(HashJoin *node) {
Expand Down

0 comments on commit 7e1a63b

Please sign in to comment.