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

more TCK tests for variable pattern match clause #5215

Merged
merged 7 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |