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:a single node self-loop when executing NOLOOP #5805

Merged
merged 6 commits into from
Jan 18, 2024
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
5 changes: 5 additions & 0 deletions src/graph/executor/algo/AllPathsExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ folly::Future<std::vector<AllPathsExecutor::NPath*>> AllPathsExecutor::doBuildPa
continue;
}
for (auto& edge : adjEdges) {
if (noLoop_) {
if (edge.getEdge().dst == edge.getEdge().src) {
continue;
}
}
threadLocalPtr_->emplace_back(NPath(src, edge));
newPathsPtr->emplace_back(&threadLocalPtr_->back());
}
Expand Down
57 changes: 57 additions & 0 deletions tests/tck/features/path/NoLoop.feature
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,60 @@ Feature: NoLoop Path
| [[:like "Tony Parker"->"Tim Duncan" @0 {}]] |
| [[:like "LaMarcus Aldridge"->"Tim Duncan" @0 {}], [:like "Tony Parker"->"LaMarcus Aldridge" @0 {}]] |
| [[:like "Manu Ginobili"->"Tim Duncan" @0 {}], [:like "Tony Parker"->"Manu Ginobili" @0 {}]] |

Scenario: Query with NO LOOP on a node without self-loop
When executing query:
"""
CREATE SPACE TestNoLoopSpace(vid_type=fixed_string(20));
"""
And wait 3 seconds
Then the execution should be successful
When executing query:
"""
USE TestNoLoopSpace;
"""
And wait 3 seconds
Then the execution should be successful
When executing query:
"""
CREATE TAG Person(name string);
"""
And wait 1 seconds
Then the execution should be successful
When executing query:
"""
CREATE EDGE Link();
"""
And wait 1 seconds
Then the execution should be successful
When executing query:
"""
INSERT VERTEX Person(name) VALUES "nodea":("Node A");
"""
And wait 1 seconds
Then the execution should be successful
When executing query:
"""
INSERT EDGE Link() VALUES "nodea" -> "nodea":();
"""
And wait 1 seconds
Then the execution should be successful
When executing query:
"""
FIND NOLOOP PATH FROM "nodea" TO "nodea" OVER Link YIELD PATH AS p;
"""
Then the result should be, in any order:
| p |
When executing query:
"""
FIND ALL PATH FROM "nodea" TO "nodea" OVER Link YIELD PATH AS p;
"""
Then the result should be, in any order:
| p |
| <("nodea")<-[:Link@0 {}]-("nodea")> |
When executing query:
"""
DROP SPACE TestNoLoopSpace
"""
And wait 1 seconds
Then the execution should be successful
Loading