Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Jan 6, 2023
1 parent 0e8dc25 commit dc46934
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 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

0 comments on commit dc46934

Please sign in to comment.