Skip to content

Commit

Permalink
check maximum length of variable length relationship
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Apr 22, 2022
1 parent 2d124f2 commit cb79e32
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/graph/validator/MatchValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,9 @@ Status MatchValidator::validateAliases(
Status MatchValidator::validateStepRange(const MatchStepRange *range) const {
auto min = range->min();
auto max = range->max();
if (max == std::numeric_limits<size_t>::max()) {
return Status::SemanticError("Maximum hop for variable length relationship must be set");
}
if (min > max) {
return Status::SemanticError(
"Max hop must be greater equal than min hop: %ld vs. %ld", max, min);
Expand Down
15 changes: 15 additions & 0 deletions tests/tck/features/match/VariableLengthPattern.feature
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,21 @@ Feature: Variable length Pattern match (m to n)
RETURN p
"""
Then a SemanticError should be raised at runtime: Alias used but not defined: `e'
When executing query:
"""
Match (a:player{name:"Tim Duncan"})-[e:like*]-(b) return b
"""
Then a SemanticError should be raised at runtime: Maximum hop for variable length relationship must be set
When executing query:
"""
Match (a:player{name:"Tim Duncan"})-[e:like*]->(b) return b
"""
Then a SemanticError should be raised at runtime: Maximum hop for variable length relationship must be set
When executing query:
"""
Match (a:player{name:"Tim Duncan"})<-[e:like*]-(b) return b
"""
Then a SemanticError should be raised at runtime: Maximum hop for variable length relationship must be set

Scenario: Over expand end
When executing query:
Expand Down

0 comments on commit cb79e32

Please sign in to comment.