From e2b7b5ec6ac357c9acd2483f899f5050b6c9d69b Mon Sep 17 00:00:00 2001 From: jimingquan Date: Fri, 13 Jan 2023 14:24:43 +0800 Subject: [PATCH 1/5] add allpath test --- tests/tck/features/path/AllPath.feature | 148 ++++++++++++++++++++++-- 1 file changed, 141 insertions(+), 7 deletions(-) diff --git a/tests/tck/features/path/AllPath.feature b/tests/tck/features/path/AllPath.feature index 53efe544b1f..d865966c7fb 100644 --- a/tests/tck/features/path/AllPath.feature +++ b/tests/tck/features/path/AllPath.feature @@ -1,10 +1,13 @@ # Copyright (c) 2020 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. +@jmq Feature: All Path - Scenario: [1] ALL Path + Background: Given a graph with space named "nba" + + Scenario: ALL Path one TO one When executing query: """ FIND ALL PATH FROM "Tim Duncan" TO "Tim Duncan" OVER * UPTO 2 STEPS YIELD path as p @@ -30,6 +33,13 @@ Feature: All Path | <("Tim Duncan")-[:like]->("Tony Parker")> | | <("Tim Duncan")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")-[:like]->("Tony Parker")> | | <("Tim Duncan")-[:like]->("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:like]->("Tony Parker")> | + When executing query: + """ + FIND ALL PATH FROM "Tim Duncan" TO "Tony Parker" OVER like, noexist UPTO 3 STEPS YIELD path as p + """ + Then a SemanticError should be raised at runtime: noexist not found in space [nba]. + + Scenario: ALL Path one TO M When executing query: """ FIND ALL PATH FROM "Tim Duncan" TO "Tony Parker", "Manu Ginobili" OVER like UPTO 3 STEPS YIELD path as p @@ -69,8 +79,99 @@ Feature: All Path | <("Tim Duncan")-[:like]->("Tony Parker")-[:like]->("LaMarcus Aldridge")-[:serve]->("Spurs")> | | <("Tim Duncan")-[:like]->("Tony Parker")-[:like]->("Manu Ginobili")-[:serve]->("Spurs")> | + Scenario: ALL PATH M to one + When executing query: + """ + FIND ALL PATH FROM "Tony Parker","Spurs" TO "Tim Duncan" OVER like,serve UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Tony Parker")-[:like@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tim Duncan")> | + | <("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Tony Parker")-[:like@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + | <("Tony Parker")-[:like@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Tony Parker")-[:like@0 {}]->("Tim Duncan")-[:like@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + When executing query: + """ + FIND ALL PATH FROM "noexist", "Tony Parker","Spurs" TO "Tim Duncan" OVER like,serve UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Tony Parker")-[:like@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tim Duncan")> | + | <("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Tony Parker")-[:like@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + | <("Tony Parker")-[:like@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Tony Parker")-[:like@0 {}]->("Tim Duncan")-[:like@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + + Scenario: ALL PATH M to N + When executing query: + """ + FIND ALL PATH FROM "Yao Ming","Manu Ginobili" TO "Tim Duncan", "Larkers" OVER * UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Yao Ming")-[:like@0 {}]->("Shaquille O'Neal")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Danny Green")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Danny Green")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:like@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:like@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:like@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:like@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:like@0 {}]->("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:like@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + When executing query: + """ + FIND ALL PATH FROM "Yao Ming","Manu Ginobili" TO "Tim Duncan", "Larkers", "noexist" OVER * UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Yao Ming")-[:like@0 {}]->("Shaquille O'Neal")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Danny Green")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Danny Green")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("LaMarcus Aldridge")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:like@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:like@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:like@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:like@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:like@0 {}]->("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tony Parker")-[:teammate@0 {}]->("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:like@0 {}]->("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:like@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")> | + | <("Manu Ginobili")-[:teammate@0 {}]->("Tim Duncan")-[:teammate@0 {}]->("Manu Ginobili")-[:like@0 {}]->("Tim Duncan")> | + Scenario: [1] ALL Path Run Time Input - Given a graph with space named "nba" When executing query: """ GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst | @@ -101,7 +202,6 @@ Feature: All Path | <("Tony Parker")-[:like]->("Tim Duncan")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")> | Scenario: [1] ALL Path With Limit - Given a graph with space named "nba" When executing query: """ FIND ALL PATH FROM "Tim Duncan" TO "Tony Parker","Spurs" OVER like,serve UPTO 3 STEPS YIELD path as p | @@ -127,7 +227,6 @@ Feature: All Path | <("Tony Parker")-[:like]->("Manu Ginobili")-[:like]->("Tim Duncan")> | Scenario: [1] ALL PATH REVERSELY - Given a graph with space named "nba" When executing query: """ FIND ALL PATH FROM "Tim Duncan" TO "Nobody","Spur" OVER like REVERSELY UPTO 3 STEPS YIELD path as p @@ -164,7 +263,6 @@ Feature: All Path | <("Tim Duncan")<-[:like]-("Tony Parker")<-[:like]-("LaMarcus Aldridge")<-[:like]-("Tony Parker")> | Scenario: [2] ALL PATH BIDIRECT - Given a graph with space named "nba" When executing query: """ FIND ALL PATH FROM "Tim Duncan" TO "Tony Parker" OVER like BIDIRECT UPTO 3 STEPS YIELD path as p @@ -210,8 +308,25 @@ Feature: All Path | <("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"})-[:like@0 {likeness: 95}]->("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})-[:like@0 {likeness: 90}]->("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"})-[:like@0 {likeness: 95}]->("Tony Parker" :player{age: 36, name: "Tony Parker"})> | | <("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"})-[:like@0 {likeness: 95}]->("Tony Parker" :player{age: 36, name: "Tony Parker"})-[:like@0 {likeness: 90}]->("LaMarcus Aldridge" :player{age: 33, name: "LaMarcus Aldridge"})-[:like@0 {likeness: 75}]->("Tony Parker" :player{age: 36, name: "Tony Parker"})> | - Scenario: ALL Path WITH FILTER - Given a graph with space named "nba" + Scenario: ALL Path constant filter + When executing query: + """ + FIND ALL PATH WITH PROP FROM "Tim Duncan" TO "Yao Ming" OVER * BIDIRECT + WHERE 1 > 2 UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + When executing query: + """ + FIND ALL PATH WITH PROP FROM "Tim Duncan" TO "Yao Ming" OVER * BIDIRECT + WHERE 1 < 2 UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Tim Duncan" :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"})<-[:like@0 {likeness: 80}]-("Shaquille O'Neal" :player{age: 47, name: "Shaquille O'Neal"})<-[:like@0 {likeness: 90}]-("Yao Ming" :player{age: 38, name: "Yao Ming"})> | + | <("Tim Duncan" :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"})-[:serve@0 {end_year: 2016, start_year: 1997}]->("Spurs" :team{name: "Spurs"})<-[:serve@0 {end_year: 2013, start_year: 2013}]-("Tracy McGrady" :player{age: 39, name: "Tracy McGrady"})<-[:like@0 {likeness: 90}]-("Yao Ming" :player{age: 38, name: "Yao Ming"})> | + + Scenario: ALL Path edge filter When executing query: """ FIND ALL PATH WITH PROP FROM "Tim Duncan" TO "Yao Ming" OVER * BIDIRECT @@ -242,6 +357,25 @@ Feature: All Path | <("Yao Ming" :player{age: 38, name: "Yao Ming"})-[:like@0 {likeness: 90}]->("Shaquille O'Neal" :player{age: 47, name: "Shaquille O'Neal"})-[:like@0 {likeness: 80}]->("Tim Duncan" :bachelor{name: "Tim Duncan", speciality: "psychology"} :player{age: 42, name: "Tim Duncan"})-[:teammate@0 {end_year: 2016, start_year: 2010}]->("Danny Green" :player{age: 31, name: "Danny Green"})> | | <("Yao Ming" :player{age: 38, name: "Yao Ming"})-[:like@0 {likeness: 90}]->("Tracy McGrady" :player{age: 39, name: "Tracy McGrady"})-[:serve@0 {end_year: 2000, start_year: 1997}]->("Raptors" :team{name: "Raptors"})<-[:serve@0 {end_year: 2019, start_year: 2018}]-("Danny Green" :player{age: 31, name: "Danny Green"})> | | <("Yao Ming" :player{age: 38, name: "Yao Ming"})-[:like@0 {likeness: 90}]->("Tracy McGrady" :player{age: 39, name: "Tracy McGrady"})-[:serve@0 {end_year: 2013, start_year: 2013}]->("Spurs" :team{name: "Spurs"})<-[:serve@0 {end_year: 2018, start_year: 2010}]-("Danny Green" :player{age: 31, name: "Danny Green"})> | + When executing query: + """ + FIND ALL PATH WITH PROP FROM "Yao Ming" TO "Danny Green" OVER * BIDIRECT + WHERE like.likeness is EMPTY OR like.likeness >= 80 AND 1 > 2 UPTO 3 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + When executing query: + """ + GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst, like.likeness AS val | + FIND ALL PATH FROM $-.src TO $-.dst OVER like WHERE like.likeness > $-.val UPTO 3 STEPS YIELD path as p + """ + Then a SemanticError should be raised at runtime: Not support `(like.likeness>$-.val)' in where sentence. + When executing query: + """ + $v = GO FROM "Tim Duncan" over * YIELD like._dst AS src, serve._src AS dst, like.likeness AS val; + FIND ALL PATH FROM $v.src TO $v.dst OVER like WHERE like.likeness > $v.val UPTO 3 STEPS YIELD path as p + """ + Then a SemanticError should be raised at runtime: Not support `(like.likeness>$v.val)' in where sentence. Scenario: Dangling edge Given an empty graph From 5217e7da4c11fffc8ab55650866c38bbfbd001af Mon Sep 17 00:00:00 2001 From: jimingquan Date: Fri, 13 Jan 2023 14:54:59 +0800 Subject: [PATCH 2/5] add shortest path test case --- tests/tck/features/path/AllPath.feature | 22 +++++++++- tests/tck/features/path/ShortestPath.feature | 46 ++++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/tests/tck/features/path/AllPath.feature b/tests/tck/features/path/AllPath.feature index d865966c7fb..91afd8c9342 100644 --- a/tests/tck/features/path/AllPath.feature +++ b/tests/tck/features/path/AllPath.feature @@ -1,12 +1,31 @@ # Copyright (c) 2020 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. -@jmq Feature: All Path Background: Given a graph with space named "nba" + Scenario: ALL Path zero step + When executing query: + """ + FIND ALL PATH FROM "Tim Duncan" TO "Tim Duncan" OVER * UPTO 0 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + When executing query: + """ + FIND ALL PATH FROM "Tim Duncan" TO "Spurs", "Tony Parker" OVER * UPTO 0 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + When executing query: + """ + FIND ALL PATH FROM "Tim Duncan", "Tony Parker" TO "Tim Duncan" OVER * UPTO 0 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + Scenario: ALL Path one TO one When executing query: """ @@ -413,7 +432,6 @@ Feature: All Path Then drop the used space Scenario: ALL PATH YIELD PATH - Given a graph with space named "nba" When executing query: """ FIND ALL PATH WITH PROP FROM "Yao Ming" TO "Danny Green" OVER * BIDIRECT diff --git a/tests/tck/features/path/ShortestPath.feature b/tests/tck/features/path/ShortestPath.feature index 3c950029381..e421b3cd7ec 100644 --- a/tests/tck/features/path/ShortestPath.feature +++ b/tests/tck/features/path/ShortestPath.feature @@ -1,11 +1,31 @@ # Copyright (c) 2021 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. +@jmq Feature: Shortest Path Background: Given a graph with space named "nba" + Scenario: Shortest Path zero step + When executing query: + """ + FIND SHORTEST PATH FROM "Tim Duncan" , "Yao Ming" TO "Tony Parker" OVER like UPTO 0 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + When executing query: + """ + FIND SHORTEST PATH FROM "Tim Duncan", "Yao Ming" TO "Tony Parker", "Spurs" OVER * UPTO 0 STEPS YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + When executing query: + """ + FIND SHORTEST PATH FROM "Tim Duncan", "Yao Ming" TO "Tony Parker", "Spurs" OVER * UPTO -1 STEPS YIELD path as p + """ + Then a SyntaxError should be raised at runtime: syntax error near `-1 STEPS' + Scenario: [1] SinglePair Shortest Path When executing query: """ @@ -14,6 +34,32 @@ Feature: Shortest Path Then the result should be, in any order, with relax comparison: | p | | <("Tim Duncan")-[:like]->("Tony Parker")> | + When executing query: + """ + FIND SHORTEST PATH FROM "Tim Duncan" TO "Tony Parker", "noexist" OVER like YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Tim Duncan")-[:like]->("Tony Parker")> | + When executing query: + """ + FIND SHORTEST PATH FROM "Tim Duncan", "noexist" TO "Tony Parker" OVER like YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Tim Duncan")-[:like]->("Tony Parker")> | + When executing query: + """ + FIND SHORTEST PATH FROM "Tim Duncan", "noexist" TO "Tony Parker", "noexist" OVER like YIELD path as p + """ + Then the result should be, in any order, with relax comparison: + | p | + | <("Tim Duncan")-[:like]->("Tony Parker")> | + When executing query: + """ + FIND SHORTEST PATH FROM "Tim Duncan", "noexist" TO "Tony Parker", "noexist" OVER noexistedge,like YIELD path as p + """ + Then a SemanticError should be raised at runtime: noexistedge not found in space [nba]. Scenario: [2] SinglePair Shortest Path When executing query: From 5a848c90ddaf0a40abc071a6d1d4cb8b216c142b Mon Sep 17 00:00:00 2001 From: jimingquan Date: Fri, 13 Jan 2023 15:30:01 +0800 Subject: [PATCH 3/5] add subgraph test case --- tests/tck/features/path/ShortestPath.feature | 1 - tests/tck/features/subgraph/subgraph.feature | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/tck/features/path/ShortestPath.feature b/tests/tck/features/path/ShortestPath.feature index e421b3cd7ec..e08cf5e51ee 100644 --- a/tests/tck/features/path/ShortestPath.feature +++ b/tests/tck/features/path/ShortestPath.feature @@ -1,7 +1,6 @@ # Copyright (c) 2021 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. -@jmq Feature: Shortest Path Background: diff --git a/tests/tck/features/subgraph/subgraph.feature b/tests/tck/features/subgraph/subgraph.feature index 9169159d30f..d965c2e4734 100644 --- a/tests/tck/features/subgraph/subgraph.feature +++ b/tests/tck/features/subgraph/subgraph.feature @@ -1,6 +1,7 @@ # Copyright (c) 2021 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. +@jmq Feature: subgraph Background: @@ -57,6 +58,11 @@ Feature: subgraph $a = GO FROM "Tim Duncan" OVER like YIELD like._dst AS id, like._src AS id; GET SUBGRAPH WITH PROP FROM $a.id YIELD vertices as nodes """ Then a SemanticError should be raised at runtime: Duplicate Column Name : `id' + When executing query: + """ + GET SUBGRAPH FROM 'Tim Duncan' OUT like, noexist YIELD vertices as v + """ + Then a ExecutionError should be raised at runtime: EdgeNotFound: EdgeName `noexist` Scenario: zero step When executing query: From ced7b744019be85f93957500676dec94de90ecd5 Mon Sep 17 00:00:00 2001 From: jimingquan Date: Fri, 13 Jan 2023 15:41:43 +0800 Subject: [PATCH 4/5] add go test case --- tests/tck/features/go/GO.feature | 23 ++++++++++++++++++++ tests/tck/features/subgraph/subgraph.feature | 1 - 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/tck/features/go/GO.feature b/tests/tck/features/go/GO.feature index 9948f3eb869..4c56cce1cdb 100644 --- a/tests/tck/features/go/GO.feature +++ b/tests/tck/features/go/GO.feature @@ -1,6 +1,7 @@ # Copyright (c) 2021 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. +@jmq Feature: Go Sentence Background: @@ -1615,6 +1616,28 @@ Feature: Go Sentence | name | | EMPTY | + Scenario: negative step + When executing query: + """ + GO -1 STEPS FROM 'Tim Duncan' OVER serve BIDIRECT YIELD serve._dst + """ + Then a SyntaxError should be raised at runtime: syntax error near `-1 STEPS' + When executing query: + """ + GO -1 TO 2 STEPS FROM 'Tim Duncan' OVER serve BIDIRECT YIELD serve._dst + """ + Then a SyntaxError should be raised at runtime: syntax error near `-1 TO 2' + When executing query: + """ + GO -1 TO -2 STEPS FROM 'Tim Duncan' OVER serve BIDIRECT YIELD serve._dst + """ + Then a SyntaxError should be raised at runtime: syntax error near `-1 TO -2' + When executing query: + """ + GO -1 TO 2 STEPS FROM 'Tim Duncan' OVER serve BIDIRECT YIELD serve._dst + """ + Then a SyntaxError should be raised at runtime: syntax error near `-1 TO 2 ' + Scenario: zero step When executing query: """ diff --git a/tests/tck/features/subgraph/subgraph.feature b/tests/tck/features/subgraph/subgraph.feature index d965c2e4734..f06c8e2dcd1 100644 --- a/tests/tck/features/subgraph/subgraph.feature +++ b/tests/tck/features/subgraph/subgraph.feature @@ -1,7 +1,6 @@ # Copyright (c) 2021 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. -@jmq Feature: subgraph Background: From f6d1e77ca036d68e2b7a23d3a29e912f41329536 Mon Sep 17 00:00:00 2001 From: jimingquan Date: Fri, 13 Jan 2023 15:44:28 +0800 Subject: [PATCH 5/5] add go test case --- tests/tck/features/go/GO.feature | 48 +++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/tests/tck/features/go/GO.feature b/tests/tck/features/go/GO.feature index 4c56cce1cdb..e39a5058b97 100644 --- a/tests/tck/features/go/GO.feature +++ b/tests/tck/features/go/GO.feature @@ -1,7 +1,6 @@ # Copyright (c) 2021 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. -@jmq Feature: Go Sentence Background: @@ -15,6 +14,25 @@ Feature: Go Sentence Then the result should be, in any order, with relax comparison: | serve._dst | | "Spurs" | + When executing query: + """ + GO FROM "Tim Duncan" OVER serve WHERE 1 > 0 YIELD serve._dst + """ + Then the result should be, in any order, with relax comparison: + | serve._dst | + | "Spurs" | + When executing query: + """ + GO FROM "Tim Duncan" OVER serve WHERE 1 < 0 YIELD serve._dst + """ + Then the result should be, in any order, with relax comparison: + | serve._dst | + When executing query: + """ + GO FROM "Tim Duncan" OVER serve WHERE 'Tim Duncan' > 0 YIELD serve._dst + """ + Then the result should be, in any order, with relax comparison: + | serve._dst | When executing query: """ GO FROM "Tim Duncan" OVER serve YIELD DISTINCT properties(edge) | YIELD COUNT(*) @@ -77,6 +95,17 @@ Feature: Go Sentence | "Boris Diaw" | 2008 | 2012 | "Hornets" | | "Boris Diaw" | 2012 | 2016 | "Spurs" | | "Boris Diaw" | 2016 | 2017 | "Jazz" | + When executing query: + """ + GO FROM "Boris Diaw" OVER serve YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name, 1, 1>2 + """ + Then the result should be, in any order, with relax comparison: + | $^.player.name | serve.start_year | serve.end_year | $$.team.name | 1 | (1>2) | + | "Boris Diaw" | 2003 | 2005 | "Hawks" | 1 | false | + | "Boris Diaw" | 2005 | 2008 | "Suns" | 1 | false | + | "Boris Diaw" | 2008 | 2012 | "Hornets" | 1 | false | + | "Boris Diaw" | 2012 | 2016 | "Spurs" | 1 | false | + | "Boris Diaw" | 2016 | 2017 | "Jazz" | 1 | false | When executing query: """ GO FROM "Rajon Rondo" OVER serve WHERE serve.start_year >= 2013 AND serve.end_year <= 2018 @@ -176,6 +205,12 @@ Feature: Go Sentence Then the result should be, in any order, with relax comparison: | $^.player.name | | "Tony Parker" | + When executing query: + """ + GO FROM 'Tony Parker' OVER like WHERE like._dst IN ['Tim Duncan', 'Danny Green'] AND 1 > 2 YIELD $^.player.name + """ + Then the result should be, in any order, with relax comparison: + | $^.player.name | Scenario: assignment simple When executing query: @@ -1214,6 +1249,11 @@ Feature: Go Sentence GO FROM 'Tim Duncan' OVER like where like.likeness YIELD like._dst """ Then a SemanticError should be raised at runtime: `like.likeness', expected boolean, but was `INT' + When executing query: + """ + GO FROM 'Tim Duncan' OVER like where ($^)-[:like]->($$) YIELD like._dst + """ + Then a SyntaxError should be raised at runtime: syntax error near `)-[:like' Scenario: contain When executing query: @@ -1626,7 +1666,7 @@ Feature: Go Sentence """ GO -1 TO 2 STEPS FROM 'Tim Duncan' OVER serve BIDIRECT YIELD serve._dst """ - Then a SyntaxError should be raised at runtime: syntax error near `-1 TO 2' + Then a SyntaxError should be raised at runtime: syntax error near `-1 TO 2 ' When executing query: """ GO -1 TO -2 STEPS FROM 'Tim Duncan' OVER serve BIDIRECT YIELD serve._dst @@ -1634,9 +1674,9 @@ Feature: Go Sentence Then a SyntaxError should be raised at runtime: syntax error near `-1 TO -2' When executing query: """ - GO -1 TO 2 STEPS FROM 'Tim Duncan' OVER serve BIDIRECT YIELD serve._dst + GO 1 TO -2 STEPS FROM 'Tim Duncan' OVER serve BIDIRECT YIELD serve._dst """ - Then a SyntaxError should be raised at runtime: syntax error near `-1 TO 2 ' + Then a SyntaxError should be raised at runtime: syntax error near `-2 STEPS' Scenario: zero step When executing query: