Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Jan 10, 2023
1 parent a1ca434 commit 519e2f9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
12 changes: 10 additions & 2 deletions src/graph/planner/match/MatchPathPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ Status MatchPathPlanner::leftExpandFromNode(size_t startIndex, SubPlan& subplan)
addNodeAlias(node);
bool expandInto = isExpandInto(dst.alias);
auto& edge = edgeInfos[i - 1];
MatchStepRange stepRange(1, 1);
if (edge.range != nullptr) {
stepRange = *edge.range;
}
auto traverse = Traverse::make(qctx, subplan.root, spaceId);
traverse->setSrc(nextTraverseStart);
auto vertexProps = SchemaUtil::getAllVertexProp(qctx, spaceId, true);
Expand All @@ -212,7 +216,7 @@ Status MatchPathPlanner::leftExpandFromNode(size_t startIndex, SubPlan& subplan)
traverse->setTagFilter(genVertexFilter(node));
traverse->setEdgeFilter(genEdgeFilter(edge));
traverse->setEdgeDirection(edge.direction);
traverse->setStepRange(*edge.range);
traverse->setStepRange(stepRange);
traverse->setDedup();
// If start from end of the path pattern, the first traverse would not
// track the previous path, otherwise, it should.
Expand Down Expand Up @@ -269,6 +273,10 @@ Status MatchPathPlanner::rightExpandFromNode(size_t startIndex, SubPlan& subplan
bool expandInto = isExpandInto(dst.alias);

auto& edge = edgeInfos[i];
MatchStepRange stepRange(1, 1);
if (edge.range != nullptr) {
stepRange = *edge.range;
}
auto traverse = Traverse::make(qctx, subplan.root, spaceId);
traverse->setSrc(nextTraverseStart);
auto vertexProps = SchemaUtil::getAllVertexProp(qctx, spaceId, true);
Expand All @@ -279,7 +287,7 @@ Status MatchPathPlanner::rightExpandFromNode(size_t startIndex, SubPlan& subplan
traverse->setTagFilter(genVertexFilter(node));
traverse->setEdgeFilter(genEdgeFilter(edge));
traverse->setEdgeDirection(edge.direction);
traverse->setStepRange(*edge.range);
traverse->setStepRange(stepRange);
traverse->setDedup();
traverse->setTrackPrevPath(i != startIndex);
traverse->setColNames(
Expand Down
7 changes: 6 additions & 1 deletion src/graph/planner/match/ShortestPathPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,19 @@ StatusOr<SubPlan> ShortestPathPlanner::transform(WhereClauseContext* bindWhereCl

auto cp = CrossJoin::make(qctx, leftPlan.root, rightPlan.root);

MatchStepRange stepRange(1, 1);
if (edge.range != nullptr) {
stepRange = *edge.range;
}

auto shortestPath = ShortestPath::make(qctx, cp, spaceId, singleShortest);
auto vertexProp = SchemaUtil::getAllVertexProp(qctx, spaceId, true);
NG_RETURN_IF_ERROR(vertexProp);
shortestPath->setVertexProps(std::move(vertexProp).value());
shortestPath->setEdgeProps(SchemaUtil::getEdgeProps(edge, false, qctx, spaceId));
shortestPath->setReverseEdgeProps(SchemaUtil::getEdgeProps(edge, true, qctx, spaceId));
shortestPath->setEdgeDirection(edge.direction);
shortestPath->setStepRange(*edge.range);
shortestPath->setStepRange(stepRange);
shortestPath->setColNames(std::move(colNames));

subplan.root = shortestPath;
Expand Down
4 changes: 2 additions & 2 deletions src/graph/validator/MatchValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ Status MatchValidator::buildEdgeInfo(const MatchPath *path,
AliasType aliasType = AliasType::kEdge;
auto stepRange = const_cast<nebula::MatchEdge *>(edge)->range();
if (stepRange != nullptr) {
NG_RETURN_IF_ERROR(validateStepRange(stepRange.get()));
NG_RETURN_IF_ERROR(validateStepRange(stepRange));
// Type of [e*1..2], [e*2] should be inference to EdgeList
if (stepRange->max() > stepRange->min() || stepRange->min() > 1) {
aliasType = AliasType::kEdgeList;
}
edgeInfos[i].range.reset(stepRange.release());
edgeInfos[i].range.reset(new MatchStepRange(*stepRange));
}
if (alias.empty()) {
anonymous = true;
Expand Down
4 changes: 2 additions & 2 deletions src/parser/MatchPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class MatchEdge final {
return props_;
}

std::unique_ptr<MatchStepRange> range() {
return std::move(range_);
MatchStepRange* range() const {
return range_.get();
}

std::string toString() const;
Expand Down

0 comments on commit 519e2f9

Please sign in to comment.