Skip to content

Commit

Permalink
Remove max hop (vesoft-inc#3881)
Browse files Browse the repository at this point in the history
* remove max hop

* fix review

* fix tck test

* fix tck test

* fix format

* rename
  • Loading branch information
jackwener authored and liwenhui-soul committed Feb 15, 2022
1 parent c0fe298 commit dc45435
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
3 changes: 0 additions & 3 deletions src/graph/validator/MatchValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,6 @@ Status MatchValidator::validateStepRange(const MatchStepRange *range) const {
return Status::SemanticError(
"Max hop must be greater equal than min hop: %ld vs. %ld", max, min);
}
if (max == std::numeric_limits<size_t>::max()) {
return Status::SemanticError("Cannot set maximum hop for variable length relationships");
}
return Status::OK();
}

Expand Down
37 changes: 37 additions & 0 deletions tests/tck/features/match/ZeroStep.feature
Original file line number Diff line number Diff line change
Expand Up @@ -454,3 +454,40 @@ Feature: Variable length Pattern match (0 step)
| [] | ("Trail Blazers" :team{name: "Trail Blazers"}) |
| [[:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}]] | ("Trail Blazers" :team{name: "Trail Blazers"}) |
| [] | ("Trail Blazers" :team{name: "Trail Blazers"}) |

Scenario: Multiple variable length with edge filter without max hop number
When executing query:
"""
MATCH p=(v:player{name:"Tim Duncan"})-[e:like*1..]->(v2)
RETURN v2 AS Friends;
"""
Then the result should be, in any order:
| Friends |
| ("Tony Parker" :player{age: 36, name: "Tony Parker"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("LaMarcus Aldridge" :player{age: 33, name: "LaMarcus Aldridge"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("Tony Parker" :player{age: 36, name: "Tony Parker"}) |
| ("Tony Parker" :player{age: 36, name: "Tony Parker"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("LaMarcus Aldridge" :player{age: 33, name: "LaMarcus Aldridge"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("Tony Parker" :player{age: 36, name: "Tony Parker"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"}) |
12 changes: 0 additions & 12 deletions tests/tck/features/match/ZeroStep2.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ Feature: test zero steps pattern
Then the result should be, in any order, with relax comparison:
| e |
| [] |
When executing query:
"""
MATCH (v:player{name: 'Tim Duncan'})-[e:like*]-()
RETURN e
"""
Then a SemanticError should be raised at runtime: Cannot set maximum hop for variable length relationships
When executing query:
"""
MATCH (v:player{name: 'Tim Duncan'})-[e:like*0..0]-()-[e2:like*0..0]-()
Expand Down Expand Up @@ -67,12 +61,6 @@ Feature: test zero steps pattern
"""
Then the result should be, in any order, with relax comparison:
| v |
When executing query:
"""
MATCH (v:player{name: "abc"}) -[:serve*1..]-> ()
RETURN *
"""
Then a SemanticError should be raised at runtime: Cannot set maximum hop for variable length relationships

Scenario Outline: Single edge with properties in both directions
When executing query:
Expand Down

0 comments on commit dc45435

Please sign in to comment.