Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
2 people authored and Sophie-Xie committed Jan 28, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 57ec832 commit cc4c586
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
@@ -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
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:
140 changes: 140 additions & 0 deletions tests/tck/features/match/VariableLengthPattern.feature
Original file line number Diff line number Diff line change
@@ -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 cc4c586

Please sign in to comment.