From 40258dcad72ae577312fe641ed9563ae10ed4ee5 Mon Sep 17 00:00:00 2001 From: Yee <2520865+yixinglu@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:05:33 +0800 Subject: [PATCH] more TCK tests for variable pattern match clause (#5215) * 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 --- tests/Makefile | 2 +- tests/tck/features/match/Base.feature | 1 - .../match/VariableLengthPattern.feature | 140 ++++++++++++++++++ 3 files changed, 141 insertions(+), 2 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 8e33ae1efc8..caf4f48176c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -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 diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index a1f6f29c096..f8c0f8c07b1 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -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: diff --git a/tests/tck/features/match/VariableLengthPattern.feature b/tests/tck/features/match/VariableLengthPattern.feature index c3c19133787..a8e74e88ea5 100644 --- a/tests/tck/features/match/VariableLengthPattern.feature +++ b/tests/tck/features/match/VariableLengthPattern.feature @@ -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 |