Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix noloop path limit #5751

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/graph/executor/algo/AllPathsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ folly::Future<Status> AllPathsExecutor::buildPathMultiJobs() {
})
.thenValue([this, conjunctPathTime](auto&& resps) {
NG_RETURN_IF_ERROR(resps);
if (result_.rows.size() > limit_) {
result_.rows.resize(limit_);
}
if (offset_ != 0) {
result_.rows.erase(result_.rows.begin(), result_.rows.begin() + offset_);
}
addState("conjunct_path_time", conjunctPathTime);
return Status::OK();
});
Expand Down Expand Up @@ -557,12 +563,6 @@ folly::Future<Status> AllPathsExecutor::conjunctPath(std::vector<NPath*>& leftPa
std::make_move_iterator(rows.begin()),
std::make_move_iterator(rows.end()));
}
if (result_.rows.size() > limit_) {
result_.rows.resize(limit_);
}
if (offset_ != 0) {
result_.rows.erase(result_.rows.begin(), result_.rows.begin() + offset_);
}
return Status::OK();
})
.thenError(folly::tag_t<std::bad_alloc>{},
Expand Down
2 changes: 1 addition & 1 deletion src/parser/scanner.lex
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ LABEL_FULL_WIDTH {CN_EN_FULL_WIDTH}{CN_EN_NUM_FULL_WIDTH}*
"SHORTEST" { return TokenType::KW_SHORTEST; }
"NOLOOP" { return TokenType::KW_NOLOOP; }
"SHORTESTPATH" { return TokenType::KW_SHORTESTPATH; }
"AllSHORTESTPATHS" { return TokenType::KW_ALLSHORTESTPATHS; }
"ALLSHORTESTPATHS" { return TokenType::KW_ALLSHORTESTPATHS; }
"OUT" { return TokenType::KW_OUT; }
"BOTH" { return TokenType::KW_BOTH; }
"SUBGRAPH" { return TokenType::KW_SUBGRAPH; }
Expand Down
10 changes: 10 additions & 0 deletions tests/tck/features/path/AllPath.IntVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ Feature: Integer Vid All Path
| <("Tony Parker")-[:like@0]->("Manu Ginobili")-[:like@0]->("Tim Duncan")> |
| <("Tony Parker")-[:like@0]->("Tim Duncan")> |
| <("Tony Parker")-[:like@0]->("Tim Duncan")-[:like@0]->("Manu Ginobili")-[:like@0]->("Tim Duncan")> |
When executing query:
"""
lookup on player where player.age>20 YIELD id(vertex) as vid
| go 1 step from $-.vid over * where "player" in labels($$) yield distinct id($$) as dst,$-.vid as src
| find noloop path from $-.src to $-.dst over * upto 1 step yield path as p | limit 10,10
| yield count(*)
"""
Then the result should be, in any order, with relax comparison:
| count(*) |
| 10 |

Scenario: Integer Vid [1] ALL PATH REVERSELY
Given a graph with space named "nba_int_vid"
Expand Down
10 changes: 10 additions & 0 deletions tests/tck/features/path/AllPath.feature
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,16 @@ Feature: All Path
Then the result should be, in any order, with relax comparison:
| count(*) |
| 0 |
When executing query:
"""
lookup on player where player.age>20 YIELD id(vertex) as vid
| go 1 step from $-.vid over * where "player" in labels($$) yield distinct id($$) as dst,$-.vid as src
| find noloop path from $-.src to $-.dst over * upto 1 step yield path as p | limit 10,10
| yield count(*)
"""
Then the result should be, in any order, with relax comparison:
| count(*) |
| 10 |

Scenario: [1] ALL PATH REVERSELY
When executing query:
Expand Down