diff --git a/src/graph/executor/algo/AllPathsExecutor.cpp b/src/graph/executor/algo/AllPathsExecutor.cpp index 51d794dd5e5..ebbabdfef3f 100644 --- a/src/graph/executor/algo/AllPathsExecutor.cpp +++ b/src/graph/executor/algo/AllPathsExecutor.cpp @@ -342,6 +342,9 @@ folly::Future AllPathsExecutor::buildPathMultiJobs() { if (!paths.empty()) { time::Duration convertPathTime; + if (paths.size() > limit_) { + paths.resize(limit_); + } for (auto& path : paths) { result_.rows.emplace_back(convertNPath2Row(path.first, path.second)); } diff --git a/tests/tck/features/path/AllPath.feature b/tests/tck/features/path/AllPath.feature index 91afd8c9342..3d2f8f329e5 100644 --- a/tests/tck/features/path/AllPath.feature +++ b/tests/tck/features/path/AllPath.feature @@ -244,6 +244,14 @@ Feature: All Path | <("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tim Duncan")> | | <("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tony Parker")-[:like]->("Tim Duncan")> | | <("Tony Parker")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")> | + When executing query: + """ + FIND ALL PATH FROM "Tim Duncan" TO "Tony Parker","Spurs" OVER like,serve UPTO 10 STEPS YIELD path as p + | LIMIT 3 | YIELD count(*) AS cnt + """ + Then the result should be, in any order, with relax comparison: + | cnt | + | 3 | Scenario: [1] ALL PATH REVERSELY When executing query: