diff --git a/src/graph/planner/ngql/SubgraphPlanner.cpp b/src/graph/planner/ngql/SubgraphPlanner.cpp index f071c58302d..0474f1a0824 100644 --- a/src/graph/planner/ngql/SubgraphPlanner.cpp +++ b/src/graph/planner/ngql/SubgraphPlanner.cpp @@ -75,8 +75,11 @@ StatusOr SubgraphPlanner::nSteps(SubPlan& startVidPlan, const std::stri subgraph->setOutputVar(input); subgraph->setBiDirectEdgeTypes(subgraphCtx_->biDirectEdgeTypes); subgraph->setColNames({nebula::kVid}); - - auto* condition = loopCondition(steps.steps() + 1, gn->outputVar()); + uint32_t maxSteps = steps.steps(); + if (subgraphCtx_->getEdgeProp || subgraphCtx_->withProp) { + ++maxSteps; + } + auto* condition = loopCondition(maxSteps, gn->outputVar()); auto* loop = Loop::make(qctx, startVidPlan.root, subgraph, condition); auto* dc = DataCollect::make(qctx, DataCollect::DCKind::kSubgraph);