Skip to content

Commit

Permalink
more TCK tests for variable pattern match clause (#5215)
Browse files Browse the repository at this point in the history
* cleanup

* same src/dst for variable length pattern

* variable pattern in where clause

* variable scope tests in path pattern

* More tests

* More tests

Co-authored-by: jimingquan <mingquan.ji@vesoft.com>
  • Loading branch information
yixinglu and nevermore3 committed Jan 10, 2023
1 parent 4c62d60 commit 40258dc
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This source code is licensed under Apache 2.0 License.

.PHONY: fmt check check-and-diff init init-all clean test tck fail up down test-all ldbc
.PHONY: fmt check check-and-diff init init-all clean test tck fail up down test-all ldbc ps kill

PYPI_MIRROR = https://mirrors.aliyun.com/pypi/simple/
# PYPI_MIRROR = http://pypi.mirrors.ustc.edu.cn/simple --trusted-host pypi.mirrors.ustc.edu.cn
Expand Down
1 change: 0 additions & 1 deletion tests/tck/features/match/Base.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
@jie
Feature: Basic match

Background:
Expand Down
140 changes: 140 additions & 0 deletions tests/tck/features/match/VariableLengthPattern.feature
Original file line number Diff line number Diff line change
Expand Up @@ -375,3 +375,143 @@ Feature: Variable length Pattern match (m to n)
"""
Then the result should be, in any order:
| v.player.name |

Scenario: same src and dst for variable length pattern
When executing query:
"""
MATCH (v)-[e:like*0..0]-(v)
WHERE id(v) == 'Tim Duncan'
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
| 1 |
When executing query:
"""
MATCH (v)-[e:like*0..2]-(v)
WHERE id(v) == 'Tim Duncan'
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
| 5 |
When executing query:
"""
MATCH (v)-[e:like*2..3]-(v)
WHERE id(v) == 'Tim Duncan'
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
| 48 |
When executing query:
"""
MATCH (v)-[e:like*2..3]->(v)
WHERE id(v) == 'Tim Duncan'
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
| 4 |
When executing query:
"""
MATCH (v)-[e:like*0..]->(v)
WHERE id(v) == 'Tim Duncan'
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
| 13 |

Scenario: variable length pattern and list expression
When executing query:
"""
MATCH (v:player{name: 'Tim Duncan'})-[e:like*0..2]-(v2)
WHERE size([i in e WHERE i.likeness>90 | i])>1
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
| 18 |

@skip
# https://github.com/vesoft-inc/nebula/issues/5221
Scenario: variable scope test in path pattern
When executing query:
"""
MATCH (v:player{name: 'Tim Duncan'})-[e:like*0..2]-(v2)
WHERE size([i in e WHERE (v)-[i]-(v2) | i])>1
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
When executing query:
"""
MATCH (v:player{name: 'Tim Duncan'})-[e:like*0..2]-(v2)-[i]-(v3)
WHERE size([i in e WHERE (v)-[i]-(v2) | i])>1
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
When executing query:
"""
MATCH (v:player{name: 'Tim Duncan'})-[e:like*0..2]-(v2)-[i]-(v3)
WHERE size([i in e WHERE (v)-[i:like]-(v2) | i])>1
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
When executing query:
"""
MATCH (v:player)-[e*2]->(n)
WHERE size([n in e WHERE (v{name:'Tim Duncan'})-[n]-()])>3
RETURN v
"""
Then the result should be, in any order:
| v |
When executing query:
"""
MATCH (v:player)-[e*2]->()-[n]-()
WHERE size([n in e WHERE (v)-[n]-()])>0
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |

Scenario: variable pattern in where clause
When executing query:
"""
MATCH (v:player{name: 'Tim Duncan'})-[e*0..2]-(v2)
WHERE NOT (v)-[:like*0..1]-(v2)
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
| 182 |
When executing query:
"""
MATCH (v:player{name: 'Tim Duncan'})-[e*0..2]-(v2)
WHERE NOT (v)-[:like*1..2]-(v2)
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
| 182 |
When executing query:
"""
MATCH (v:player{name: 'Tim Duncan'})-[e:like*0..2]-(v2)
WHERE NOT (v)-[:like*0..1]-(v2)
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
| 56 |
When executing query:
"""
MATCH (v:player{name: 'Tim Duncan'})-[e:like*0..2]-(v2)
WHERE NOT (v)-[:like*1..2]-(v2)
RETURN count(*) AS cnt
"""
Then the result should be, in any order:
| cnt |
| 56 |

0 comments on commit 40258dc

Please sign in to comment.