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

Remove max hop #3881

Merged
merged 11 commits into from
Feb 15, 2022
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
jackwener marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix name of Scenario.

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"}) |
20 changes: 4 additions & 16 deletions tests/tck/features/match/ZeroStep2.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#
# This source code is licensed under Apache 2.0 License.
Feature: test zero steps pattern
Examples:
| space_name |
| nba |
| nba_int_vid |
Examples:
| space_name |
| nba |
| nba_int_vid |

Background:
Given a graph with space named "<space_name>"
Expand All @@ -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