Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Apr 4, 2023
1 parent 3e62eb2 commit 8122412
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/graph/validator/MatchValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Status MatchValidator::buildPathExpr(const MatchPath *path,
auto min = range->min();
if (min != 0 && min != 1) {
return Status::SemanticError(
"`shortestPath(...)' does not support a minimal length different from 0 or 1");
"The minimal number of steps for shortestPath() must be either 0 or 1.");
}
}
pathInfo.pathType = static_cast<Path::PathType>(pathType);
Expand Down
34 changes: 34 additions & 0 deletions tests/tck/features/match/AllShortestPaths.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,40 @@ Feature: allShortestPaths
Background:
Given a graph with space named "nba"

Scenario: shortest path invalid step
When executing query:
"""
WITH ["Tim Duncan","Tony Parker"] as list1
MATCH allShortestPaths((v1:player)-[e*2]-(v2:player))
WHERE id(v1) in list1 AND id(v2) in list1
RETURN e
"""
Then a SemanticError should be raised at runtime: The minimal number of steps for shortestPath() must be either 0 or 1.
When executing query:
"""
WITH ["Tim Duncan","Tony Parker"] as list1
MATCH allShortestPaths((v1:player)-[e*2..4]-(v2:player))
WHERE id(v1) in list1 AND id(v2) in list1
RETURN e
"""
Then a SemanticError should be raised at runtime: The minimal number of steps for shortestPath() must be either 0 or 1.
When executing query:
"""
WITH ["Tim Duncan","Tony Parker"] as list1
MATCH allShortestPaths((v1:player)-[e]->(b)--(v2:player))
WHERE id(v1) in list1 AND id(v2) in list1
RETURN e
"""
Then a SemanticError should be raised at runtime: `shortestPath(...)' only support pattern like (start)-[edge*..hop]-(end)
When executing query:
"""
WITH ["Tim Duncan","Tony Parker"] as list1
MATCH allShortestPaths((v1:player)-[e]->(b)-[e2:like]-(v2:player))
WHERE id(v1) in list1 AND id(v2) in list1
RETURN e
"""
Then a SemanticError should be raised at runtime: `shortestPath(...)' only support pattern like (start)-[edge*..hop]-(end)

Scenario: zero step shortest path
When executing query:
"""
Expand Down
34 changes: 34 additions & 0 deletions tests/tck/features/match/SingleShorestPath.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,40 @@ Feature: single shortestPath
Background:
Given a graph with space named "nba"

Scenario: shortest path invalid step
When executing query:
"""
WITH ["Tim Duncan","Tony Parker"] as list1
MATCH shortestPath((v1:player)-[e*2]-(v2:player))
WHERE id(v1) in list1 AND id(v2) in list1
RETURN e
"""
Then a SemanticError should be raised at runtime: The minimal number of steps for shortestPath() must be either 0 or 1.
When executing query:
"""
WITH ["Tim Duncan","Tony Parker"] as list1
MATCH shortestPath((v1:player)-[e*2..4]-(v2:player))
WHERE id(v1) in list1 AND id(v2) in list1
RETURN e
"""
Then a SemanticError should be raised at runtime: The minimal number of steps for shortestPath() must be either 0 or 1.
When executing query:
"""
WITH ["Tim Duncan","Tony Parker"] as list1
MATCH shortestPath((v1:player)-[e]->(b)--(v2:player))
WHERE id(v1) in list1 AND id(v2) in list1
RETURN e
"""
Then a SemanticError should be raised at runtime: `shortestPath(...)' only support pattern like (start)-[edge*..hop]-(end)
When executing query:
"""
WITH ["Tim Duncan","Tony Parker"] as list1
MATCH shortestPath((v1:player)-[e]->(b)-[e2:like]-(v2:player))
WHERE id(v1) in list1 AND id(v2) in list1
RETURN e
"""
Then a SemanticError should be raised at runtime: `shortestPath(...)' only support pattern like (start)-[edge*..hop]-(end)

Scenario: zero step shortestpath
When executing query:
"""
Expand Down

0 comments on commit 8122412

Please sign in to comment.