Skip to content

Commit

Permalink
add Path.feature
Browse files Browse the repository at this point in the history
  • Loading branch information
xtcyclist committed Dec 30, 2022
1 parent ffaa254 commit b37dc36
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 37 deletions.
2 changes: 1 addition & 1 deletion tests/tck/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def preload_space(
elif space == "ldbc_v0_3_3":
exec_ctx["ldbc_v0_3_3"] = load_ldbc_v0_3_3
elif space == "test":
exec_ctx["test"] = load_test_data
exec_ctx["space_desc"] = load_test_data
else:
raise ValueError(f"Invalid space name given: {space}")

Expand Down
74 changes: 74 additions & 0 deletions tests/tck/features/match/Path.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Matching paths

Background:
Given load "test" csv data to a new space

Scenario: distinct edges and paths
When executing query:
"""
match p = (v:Label_0)-[e:Rel_0]-(v1:Label_1)-[e1:Rel_1]-(v2:Label_2),
p = (v:Label_0)-[e:Rel_0]-(v1:Label_1)-[e1:Rel_1]-(v2:Label_2)
return *
"""
Then a SemanticError should be raised at runtime: `e': Redefined alias
When executing query:
"""
match p = (v:Label_0)-[e:Rel_0]-(v1:Label_1)-[e1:Rel_1]-(v2:Label_2),
p = (v:Label_0)-[e2:Rel_0]-(v1:Label_1)-[e1:Rel_1]-(v2:Label_2)
return *
"""
Then a SemanticError should be raised at runtime: `e1': Redefined alias
When executing query:
"""
match p = (v:Label_0)-[e:Rel_0]-(v1:Label_1)-[e1:Rel_1]-(v2:Label_2),
p = (v:Label_0)-[e2:Rel_0]-(v1:Label_1)-[er:Rel_1]-(v2:Label_2)
return *
"""
Then a SemanticError should be raised at runtime: `p': Redefined alias
When executing query:
"""
match p = (v:Label_5)-[e:Rel_0]-(v1:Label_1)-[e1:Rel_1]-(v2:Label_2),
p2 = (v:Label_8)-[e2:Rel_0]-(v1:Label_1)-[e3:Rel_1]-(v2:Label_2)
return count(p), count(p2)
"""
Then the result should be, in any order:
| count(p) | count(p2) |
| 966 | 966 |

Scenario: symmetry paths
When executing query:
"""
match p1 = (v1)-[e*1..2]->(v2) where id(v1) in [6]
match p2 = (v2)-[e*1..2]->(v1)
return count(*)
"""
Then the result should be, in any order:
| count(*) |
| 16 |
When executing query:
"""
match p1 = (v1)-[e*1..2]->(v2) where id(v1) in [6]
match p2 = (v2)-[e*1..2]->(v1)
return size(e)
"""
Then the result should be, in any order:
| size(e) |
| 1 |
| 1 |
| 1 |
| 1 |
| 2 |
| 2 |
| 2 |
| 2 |
| 2 |
| 2 |
| 2 |
| 2 |
| 2 |
| 2 |
| 2 |
| 2 |
41 changes: 41 additions & 0 deletions tests/tck/features/optimizer/CasesUsingTestSpace.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2022 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Push Filter Down Cases Using the test Space

Background:
Given load "test" csv data to a new space

Scenario: push filter down hash join bug fix
When profiling query:
"""
MATCH (v1:Label_6:Label_3)<-[e2:Rel_1]-(:Label_5)-[e3]->(v2)
WHERE (id(v1) in [20, 28, 31, 6, 4, 18, 15, 25, 9, 19, 21])
MATCH p0 = (v2)<-[e4]-()-[e5]->(v3:Label_6)
WITH min(v3.Label_6.Label_6_4_Int) AS pa0,
v3.Label_6.Label_6_1_Bool AS pa2
WHERE pa2
RETURN pa2
"""
Then the result should be, in any order:
| pa2 |
| true |
And the execution plan should be:
| id | name | dependencies | operator info |
| 17 | project | 19 | |
| 19 | aggregate | 24 | |
| 24 | HashInnerJoin | 21,29 | |
| 21 | project | 20 | |
| 20 | filter | 6 | |
| 6 | AppendVertices | 26 | |
| 26 | Traverse | 25 | |
| 25 | Traverse | 2 | |
| 2 | Dedup | 1 | |
| 1 | PassThrough | 3 | |
| 3 | Start | | |
| 29 | project | 28 | |
| 28 | Filter | 27 | {"condition": "$-.v3.Label_6.Label_6_1_Bool"} |
| 27 | AppendVertices | 11 | |
| 11 | Traverse | 10 | |
| 10 | Traverse | 9 | |
| 9 | Argument | | |
Original file line number Diff line number Diff line change
Expand Up @@ -256,39 +256,3 @@ Feature: Push Filter down HashInnerJoin rule
| 10 | Traverse | 8 | |
| 8 | Argument | 9 | |
| 9 | Start | | |

Scenario: push filter down hash join bug fix
Given an empty graph
And load "test" csv data to a new space
When profiling query:
"""
MATCH (v1:Label_6:Label_3)<-[e2:Rel_1]-(:Label_5)-[e3]->(v2)
WHERE (id(v1) in [20, 28, 31, 6, 4, 18, 15, 25, 9, 19, 21])
MATCH p0 = (v2)<-[e4]-()-[e5]->(v3:Label_6)
WITH min(v3.Label_6.Label_6_4_Int) AS pa0,
v3.Label_6.Label_6_1_Bool AS pa2
WHERE pa2
RETURN pa2
"""
Then the result should be, in any order:
| pa2 |
| true |
And the execution plan should be:
| id | name | dependencies | operator info |
| 17 | project | 19 | |
| 19 | aggregate | 24 | |
| 24 | HashInnerJoin | 21,29 | |
| 21 | project | 20 | |
| 20 | filter | 6 | |
| 6 | AppendVertices | 26 | |
| 26 | Traverse | 25 | |
| 25 | Traverse | 2 | |
| 2 | Dedup | 1 | |
| 1 | PassThrough | 3 | |
| 3 | Start | | |
| 29 | project | 28 | |
| 28 | Filter | 27 | {"condition": "$-.v3.Label_6.Label_6_1_Bool"} |
| 27 | AppendVertices | 11 | |
| 11 | Traverse | 10 | |
| 10 | Traverse | 9 | |
| 9 | Argument | | |

0 comments on commit b37dc36

Please sign in to comment.