From d1cd8773f0f08a3fedc0b39a1c44a7375839c46c Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Fri, 6 Jan 2023 21:18:11 +0800 Subject: [PATCH 01/12] More lookup tests on ngdata --- .../features/lookup/LookupNGDataTest.feature | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 tests/tck/features/lookup/LookupNGDataTest.feature diff --git a/tests/tck/features/lookup/LookupNGDataTest.feature b/tests/tck/features/lookup/LookupNGDataTest.feature new file mode 100644 index 00000000000..51e3c065143 --- /dev/null +++ b/tests/tck/features/lookup/LookupNGDataTest.feature @@ -0,0 +1,86 @@ +# Copyright (c) 2023 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. +Feature: Test lookup on ngdata data + + Background: + Given a graph with space named "ngdata" + + Scenario: lookup on the tag property of double type + When executing query: + """ + LOOKUP ON Label_11 WHERE Label_11.Label_11_5_Double>0 YIELD id(vertex) AS vid + """ + Then the result should be, in any order: + | vid | + | 88 | + | 11 | + | 19 | + | 69 | + | 104 | + | 45 | + | 79 | + | 83 | + | 383 | + | 60 | + | 75 | + | 22 | + | 108 | + | 39 | + | 68 | + | 89 | + | 12 | + | 2 | + | 33 | + | 28 | + | 41 | + | 59 | + | 16 | + | 105 | + | 71 | + | 56 | + | 31 | + | 103 | + | 4 | + | 92 | + | 24 | + | 21 | + | 107 | + | 10 | + | 82 | + | 63 | + | 7 | + | 52 | + | 99 | + | 6 | + | 85 | + | 14 | + | 74 | + | 30 | + | 26 | + | 50 | + | 38 | + | 47 | + | 3 | + | 36 | + | 96 | + | 78 | + | 80 | + | 25 | + | 97 | + | 81 | + | 15 | + | 27 | + | 98 | + | 102 | + | 101 | + | 70 | + | 1 | + | 77 | + | 53 | + When executing query: + """ + LOOKUP ON Label_11 WHERE Label_11.Label_11_5_Double>10 YIELD id(vertex) AS vid + """ + Then the result should be, in any order: + | vid | From 2dc7b71faf70e9d515463a1790ff9268ce99b6e3 Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Fri, 6 Jan 2023 21:30:54 +0800 Subject: [PATCH 02/12] Test edge property of double and geography types --- tests/data/ngdata/config.yaml | 4 +- .../features/lookup/LookupNGDataTest.feature | 86 +++++++------------ 2 files changed, 32 insertions(+), 58 deletions(-) diff --git a/tests/data/ngdata/config.yaml b/tests/data/ngdata/config.yaml index 84c6b6cd37e..0bfc6ab32c1 100644 --- a/tests/data/ngdata/config.yaml +++ b/tests/data/ngdata/config.yaml @@ -33,7 +33,9 @@ schema: |- CREATE TAG INDEX Label_5_index ON Label_5 (Label_5_8_Int); CREATE TAG INDEX Label_8_index ON Label_8 (Label_8_2_Double, Label_8_0_Bool, Label_8_4_String(64), Label_8_7_String(64), Label_8_5_date, Label_8_1_Bool, Label_8_3_Bool, Label_8_6_timestamp); CREATE TAG INDEX Label_11_index ON Label_11 (Label_11_5_Double); - CREATE EDGE INDEX Rel_5_index ON Rel_5 (Rel_5_1_Bool, Rel_5_6_Int, Rel_5_2_String(64)) + CREATE EDGE INDEX Rel_5_index ON Rel_5 (Rel_5_1_Bool, Rel_5_6_Int, Rel_5_2_String(64)); + CREATE EDGE INDEX Rel_0_index ON Rel_0 (Rel_0_3_Double); + CREATE EDGE INDEX Rel_3_index ON Rel_3 (Rel_3_1_geography_point); files: - path: Label_0.csv withHeader: true diff --git a/tests/tck/features/lookup/LookupNGDataTest.feature b/tests/tck/features/lookup/LookupNGDataTest.feature index 51e3c065143..ea527f850d3 100644 --- a/tests/tck/features/lookup/LookupNGDataTest.feature +++ b/tests/tck/features/lookup/LookupNGDataTest.feature @@ -11,7 +11,7 @@ Feature: Test lookup on ngdata data """ LOOKUP ON Label_11 WHERE Label_11.Label_11_5_Double>0 YIELD id(vertex) AS vid """ - Then the result should be, in any order: + Then the result should contain: | vid | | 88 | | 11 | @@ -22,65 +22,37 @@ Feature: Test lookup on ngdata data | 79 | | 83 | | 383 | - | 60 | - | 75 | - | 22 | - | 108 | - | 39 | - | 68 | - | 89 | - | 12 | - | 2 | - | 33 | - | 28 | - | 41 | - | 59 | - | 16 | - | 105 | - | 71 | - | 56 | - | 31 | - | 103 | - | 4 | - | 92 | - | 24 | - | 21 | - | 107 | - | 10 | - | 82 | - | 63 | - | 7 | - | 52 | - | 99 | - | 6 | - | 85 | - | 14 | - | 74 | - | 30 | - | 26 | - | 50 | - | 38 | - | 47 | - | 3 | - | 36 | - | 96 | - | 78 | - | 80 | - | 25 | - | 97 | - | 81 | - | 15 | - | 27 | - | 98 | - | 102 | - | 101 | - | 70 | - | 1 | - | 77 | - | 53 | When executing query: """ LOOKUP ON Label_11 WHERE Label_11.Label_11_5_Double>10 YIELD id(vertex) AS vid """ Then the result should be, in any order: | vid | + + Scenario: lookup on the edge property of double type + When executing query: + """ + LOOKUP ON Rel_0 WHERE Rel_0.Rel_0_3_Double>0 YIELD id(edge) AS eid + """ + Then the result should be, in any order: + | eid | + When executing query: + """ + LOOKUP ON Rel_0 WHERE Rel_0.Rel_0_3_Double>10 YIELD id(edge) AS eid + """ + Then the result should be, in any order: + | eid | + + Scenario: lookup on the edge property of geography type + When executing query: + """ + LOOKUP ON Rel_3 WHERE Rel_3.Rel_3_1_geography_point>0 YIELD id(edge) AS eid + """ + Then the result should be, in any order: + | eid | + When executing query: + """ + LOOKUP ON Rel_3 WHERE Rel_3.Rel_3_1_geography_point>10 YIELD id(edge) AS eid + """ + Then the result should be, in any order: + | eid | From 1ac5900998c3e95a7e5d2ce5a71c0688601b7052 Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Fri, 6 Jan 2023 22:12:05 +0800 Subject: [PATCH 03/12] Restore geography test for lookup --- tests/data/ngdata/config.yaml | 1 - .../features/lookup/LookupNGDataTest.feature | 36 +++++++++---------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/tests/data/ngdata/config.yaml b/tests/data/ngdata/config.yaml index 0bfc6ab32c1..306d13f974e 100644 --- a/tests/data/ngdata/config.yaml +++ b/tests/data/ngdata/config.yaml @@ -35,7 +35,6 @@ schema: |- CREATE TAG INDEX Label_11_index ON Label_11 (Label_11_5_Double); CREATE EDGE INDEX Rel_5_index ON Rel_5 (Rel_5_1_Bool, Rel_5_6_Int, Rel_5_2_String(64)); CREATE EDGE INDEX Rel_0_index ON Rel_0 (Rel_0_3_Double); - CREATE EDGE INDEX Rel_3_index ON Rel_3 (Rel_3_1_geography_point); files: - path: Label_0.csv withHeader: true diff --git a/tests/tck/features/lookup/LookupNGDataTest.feature b/tests/tck/features/lookup/LookupNGDataTest.feature index ea527f850d3..85f7c6f9637 100644 --- a/tests/tck/features/lookup/LookupNGDataTest.feature +++ b/tests/tck/features/lookup/LookupNGDataTest.feature @@ -32,27 +32,23 @@ Feature: Test lookup on ngdata data Scenario: lookup on the edge property of double type When executing query: """ - LOOKUP ON Rel_0 WHERE Rel_0.Rel_0_3_Double>0 YIELD id(edge) AS eid + LOOKUP ON Rel_0 WHERE Rel_0.Rel_0_3_Double>0 yield src(edge) as src, dst(edge) as dst """ - Then the result should be, in any order: - | eid | - When executing query: - """ - LOOKUP ON Rel_0 WHERE Rel_0.Rel_0_3_Double>10 YIELD id(edge) AS eid - """ - Then the result should be, in any order: - | eid | - - Scenario: lookup on the edge property of geography type - When executing query: - """ - LOOKUP ON Rel_3 WHERE Rel_3.Rel_3_1_geography_point>0 YIELD id(edge) AS eid - """ - Then the result should be, in any order: - | eid | + Then the result should contain: + | src | dst | + | 55 | 97 | + | 8 | 36 | + | 95 | 52 | + | 78 | 383 | + | 383 | 72 | + | 59 | 54 | + | 96 | 95 | + | 100 | 43 | + | 25 | 54 | + | 20 | 28 | When executing query: """ - LOOKUP ON Rel_3 WHERE Rel_3.Rel_3_1_geography_point>10 YIELD id(edge) AS eid + LOOKUP ON Rel_0 WHERE Rel_0.Rel_0_3_Double>10 yield src(edge) as src, dst(edge) as dst """ - Then the result should be, in any order: - | eid | + Then the result should contain: + | src | dst | From ab1e22435e3c383fba727c1e05d4fff736e9ec02 Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Sun, 29 Jan 2023 19:07:42 +0800 Subject: [PATCH 04/12] comment back tests --- tests/tck/features/lookup/ByIndex.feature | 35 +++++++++---------- .../features/lookup/ByIndex.intVid.feature | 35 +++++++++---------- .../features/lookup/EdgeIndexFullScan.feature | 10 ++++++ 3 files changed, 42 insertions(+), 38 deletions(-) diff --git a/tests/tck/features/lookup/ByIndex.feature b/tests/tck/features/lookup/ByIndex.feature index b845ec3d249..ea093e3b728 100644 --- a/tests/tck/features/lookup/ByIndex.feature +++ b/tests/tck/features/lookup/ByIndex.feature @@ -586,22 +586,19 @@ Feature: Lookup by index itself | "Tim Duncan" | | "Tony Parker" | Then drop the used space - -# (TODO) Unsupported cases due to the lack of float precision -# When executing query: -# """ -# LOOKUP ON weight -# WHERE weight.WEIGHT > 70.5; -# """ -# Then the result should be, in any order: -# | VertexID | -# | "Tony Parker" | -# When executing query: -# """ -# LOOKUP ON weight -# WHERE weight.WEIGHT <= 80.0; -# """ -# Then the result should be, in any order: -# | VertexID | -# | "Tim Duncan" | -# | "Tony Parker" | + # (TODO) Unsupported cases due to the lack of float precision + When executing query: + """ + LOOKUP ON weight WHERE weight.WEIGHT > 70.5 YIELD id(vertex) as name; + """ + Then the result should be, in any order: + | name | + | "Tony Parker" | + When executing query: + """ + LOOKUP ON weight WHERE weight.WEIGHT <= 80.0 YIELD id(vertex) as name; + """ + Then the result should be, in any order: + | name | + | "Tim Duncan" | + | "Tony Parker" | diff --git a/tests/tck/features/lookup/ByIndex.intVid.feature b/tests/tck/features/lookup/ByIndex.intVid.feature index 32e74287447..291d9307f55 100644 --- a/tests/tck/features/lookup/ByIndex.intVid.feature +++ b/tests/tck/features/lookup/ByIndex.intVid.feature @@ -585,22 +585,19 @@ Feature: Lookup by index itself in integer vid | "Tim Duncan" | | "Tony Parker" | Then drop the used space - -# (TODO) Unsupported cases due to the lack of float precision -# When executing query: -# """ -# LOOKUP ON weight -# WHERE weight.WEIGHT > 70.5; -# """ -# Then the result should be, in any order, and the columns 0 should be hashed: -# | VertexID | -# | "Tony Parker" | -# When executing query: -# """ -# LOOKUP ON weight -# WHERE weight.WEIGHT <= 80.0; -# """ -# Then the result should be, in any order, and the columns 0 should be hashed: -# | VertexID | -# | "Tim Duncan" | -# | "Tony Parker" | + # (TODO) Unsupported cases due to the lack of float precision + When executing query: + """ + LOOKUP ON weight WHERE weight.WEIGHT > 70.5 YIELD id(vertex) as name; + """ + Then the result should be, in any order, and the columns 0 should be hashed: + | name | + | "Tony Parker" | + When executing query: + """ + LOOKUP ON weight WHERE weight.WEIGHT <= 80.0 YIELD id(vertex) as name; + """ + Then the result should be, in any order, and the columns 0 should be hashed: + | name | + | "Tim Duncan" | + | "Tony Parker" | diff --git a/tests/tck/features/lookup/EdgeIndexFullScan.feature b/tests/tck/features/lookup/EdgeIndexFullScan.feature index 96e4d4ed9e5..c8292a7a69a 100644 --- a/tests/tck/features/lookup/EdgeIndexFullScan.feature +++ b/tests/tck/features/lookup/EdgeIndexFullScan.feature @@ -328,6 +328,11 @@ Feature: Lookup edge index full scan LOOKUP ON edge_1 WHERE edge_1.col1_str NOT STARTS WITH "R" YIELD edge_1.col1_str """ Then a SemanticError should be raised at runtime: Expression (edge_1.col1_str NOT STARTS WITH "R") is not supported, please use full-text index as an optimal solution + When profiling query: + """ + LOOKUP ON edge_1 WHERE NOT edge_1.col1_str STARTS WITH "R" YIELD edge_1.col1_str + """ + Then a SemanticError should be raised at runtime: Expression !((edge_1.col1_str STARTS WITH "R")) is not supported Scenario: Edge with relational ENDS/NOT ENDS WITH filter When executing query: @@ -340,3 +345,8 @@ Feature: Lookup edge index full scan LOOKUP ON edge_1 WHERE edge_1.col1_str NOT ENDS WITH toLower("E") YIELD edge_1.col1_str """ Then a SemanticError should be raised at runtime: Expression (edge_1.col1_str NOT ENDS WITH toLower("E")) is not supported, please use full-text index as an optimal solution + When executing query: + """ + LOOKUP ON edge_1 WHERE NOT edge_1.col1_str ENDS WITH toLower("E") YIELD edge_1.col1_str + """ + Then a SemanticError should be raised at runtime: Expression !((edge_1.col1_str ENDS WITH toLower("E"))) is not supported, please use full-text index as an optimal solution From 19f11ff3593ff95c03a88ff2ba57cd783edfb3bc Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Sun, 29 Jan 2023 19:16:24 +0800 Subject: [PATCH 05/12] More lookup test cases --- tests/tck/features/lookup/ByIndex.feature | 2 +- .../features/lookup/ByIndex.intVid.feature | 2 +- .../features/lookup/EdgeIndexFullScan.feature | 4 +- tests/tck/features/lookup/LookUp.feature | 55 ++++++++++++++++++- tests/tck/features/lookup/LookupEdge.feature | 5 +- tests/tck/features/lookup/LookupEdge2.feature | 3 + tests/tck/features/lookup/LookupTag.feature | 5 +- tests/tck/features/lookup/LookupTag2.feature | 5 +- tests/tck/features/lookup/Output.feature | 3 + .../features/lookup/TagIndexFullScan.feature | 13 +++++ tests/tck/features/lookup/WithYield.feature | 14 +++++ .../features/lookup/WithYield.intVid.feature | 14 +++++ 12 files changed, 114 insertions(+), 11 deletions(-) diff --git a/tests/tck/features/lookup/ByIndex.feature b/tests/tck/features/lookup/ByIndex.feature index ea093e3b728..f318db92c93 100644 --- a/tests/tck/features/lookup/ByIndex.feature +++ b/tests/tck/features/lookup/ByIndex.feature @@ -585,7 +585,6 @@ Feature: Lookup by index itself | name | | "Tim Duncan" | | "Tony Parker" | - Then drop the used space # (TODO) Unsupported cases due to the lack of float precision When executing query: """ @@ -602,3 +601,4 @@ Feature: Lookup by index itself | name | | "Tim Duncan" | | "Tony Parker" | + Then drop the used space diff --git a/tests/tck/features/lookup/ByIndex.intVid.feature b/tests/tck/features/lookup/ByIndex.intVid.feature index 291d9307f55..d124cb192d0 100644 --- a/tests/tck/features/lookup/ByIndex.intVid.feature +++ b/tests/tck/features/lookup/ByIndex.intVid.feature @@ -584,7 +584,6 @@ Feature: Lookup by index itself in integer vid | name | | "Tim Duncan" | | "Tony Parker" | - Then drop the used space # (TODO) Unsupported cases due to the lack of float precision When executing query: """ @@ -601,3 +600,4 @@ Feature: Lookup by index itself in integer vid | name | | "Tim Duncan" | | "Tony Parker" | + Then drop the used space diff --git a/tests/tck/features/lookup/EdgeIndexFullScan.feature b/tests/tck/features/lookup/EdgeIndexFullScan.feature index c8292a7a69a..c5d39fd27ac 100644 --- a/tests/tck/features/lookup/EdgeIndexFullScan.feature +++ b/tests/tck/features/lookup/EdgeIndexFullScan.feature @@ -332,7 +332,7 @@ Feature: Lookup edge index full scan """ LOOKUP ON edge_1 WHERE NOT edge_1.col1_str STARTS WITH "R" YIELD edge_1.col1_str """ - Then a SemanticError should be raised at runtime: Expression !((edge_1.col1_str STARTS WITH "R")) is not supported + Then a SemanticError should be raised at runtime: Expression !((edge_1.col1_str STARTS WITH "R")) not supported yet Scenario: Edge with relational ENDS/NOT ENDS WITH filter When executing query: @@ -349,4 +349,4 @@ Feature: Lookup edge index full scan """ LOOKUP ON edge_1 WHERE NOT edge_1.col1_str ENDS WITH toLower("E") YIELD edge_1.col1_str """ - Then a SemanticError should be raised at runtime: Expression !((edge_1.col1_str ENDS WITH toLower("E"))) is not supported, please use full-text index as an optimal solution + Then a SemanticError should be raised at runtime: Expression !((edge_1.col1_str ENDS WITH toLower("E"))) not supported yet diff --git a/tests/tck/features/lookup/LookUp.feature b/tests/tck/features/lookup/LookUp.feature index 5fa339479e4..9ce623191c2 100644 --- a/tests/tck/features/lookup/LookUp.feature +++ b/tests/tck/features/lookup/LookUp.feature @@ -36,12 +36,42 @@ Feature: LookUpTest_Vid_String Then the result should be, in any order: | id | | "200" | + When executing query: + """ + LOOKUP ON lookup_tag_1 + WHERE lookup_tag_1.col2 == 200 AND lookup_tag_1.col3 > 202 + YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + When executing query: + """ + LOOKUP ON lookup_tag_1 + WHERE lookup_tag_1.col2 >= 202 OR lookup_tag_1.col1 < 201 + YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "200" | + | "202" | When executing query: """ LOOKUP ON lookup_tag_2 WHERE lookup_tag_2.col1 == true YIELD id(vertex) as id """ Then the result should be, in any order: | id | + When executing query: + """ + LOOKUP ON lookup_tag_2 WHERE lookup_tag_2.col2 == 0 YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + When executing query: + """ + LOOKUP ON lookup_tag_2 WHERE lookup_tag_2.col3 >= 0 YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | Then drop the used space Scenario: LookupTest EdgeIndexHint @@ -71,6 +101,23 @@ Feature: LookUpTest_Vid_String Then the result should be, in any order: | src | dst | rank | | "200" | "201" | 0 | + When executing query: + """ + LOOKUP ON lookup_edge_1 + WHERE lookup_edge_1.col2 == 201 AND lookup_edge_1.col3 == 200 + YIELD src(edge) as src, dst(Edge) as dst, rank(edge) as rank + """ + Then the result should be, in any order: + | src | dst | rank | + When executing query: + """ + LOOKUP ON lookup_edge_1 + WHERE lookup_edge_1.col2 == 201 OR lookup_edge_1.col3 == 200 + YIELD src(edge) as src, dst(Edge) as dst, rank(edge) as rank + """ + Then the result should be, in any order: + | src | dst | rank | + | "200" | "201" | 0 | When executing query: """ LOOKUP ON lookup_edge_1 WHERE lookup_edge_1.col2 IN [201] and lookup_edge_1.col2>3 YIELD src(edge) as src, dst(Edge) as dst, rank(edge) as rank @@ -82,7 +129,13 @@ Feature: LookUpTest_Vid_String """ LOOKUP ON lookup_edge_2 WHERE lookup_edge_2.col1 == 200 YIELD edge as e """ - Then a SemanticError should be raised at runtime: + Then a SemanticError should be raised at runtime: Column type error : col1 + When executing query: + """ + LOOKUP ON lookup_edge_2 WHERE lookup_edge_2.col1 == false YIELD edge as e + """ + Then the result should be, in any order: + | e | Then drop the used space Scenario: LookupTest VertexConditionScan diff --git a/tests/tck/features/lookup/LookupEdge.feature b/tests/tck/features/lookup/LookupEdge.feature index 4faea198838..54c5e95a721 100644 --- a/tests/tck/features/lookup/LookupEdge.feature +++ b/tests/tck/features/lookup/LookupEdge.feature @@ -1,3 +1,6 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. Feature: Test lookup on edge index Examples: | where_condition | @@ -124,5 +127,3 @@ Feature: Test lookup on edge index | col1 | col2 | lookup_edge_1.col3 | | 201 | 201 | 201 | Then drop the used space - -# TODO(yee): Test bool expression diff --git a/tests/tck/features/lookup/LookupEdge2.feature b/tests/tck/features/lookup/LookupEdge2.feature index 107baefc38b..39a597c3e52 100644 --- a/tests/tck/features/lookup/LookupEdge2.feature +++ b/tests/tck/features/lookup/LookupEdge2.feature @@ -1,3 +1,6 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. Feature: Test lookup on edge index 2 Examples: | vid_type | id_200 | id_201 | id_202 | diff --git a/tests/tck/features/lookup/LookupTag.feature b/tests/tck/features/lookup/LookupTag.feature index 3914c8afba0..7d2e8fba65e 100644 --- a/tests/tck/features/lookup/LookupTag.feature +++ b/tests/tck/features/lookup/LookupTag.feature @@ -1,3 +1,6 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. Feature: Test lookup on tag index Examples: | where_condition | @@ -125,5 +128,3 @@ Feature: Test lookup on tag index | lookup_tag_1.col1 | lookup_tag_1.col2 | lookup_tag_1.col3 | | 201 | 201 | 201 | Then drop the used space - -# TODO(yee): Test bool expression diff --git a/tests/tck/features/lookup/LookupTag2.feature b/tests/tck/features/lookup/LookupTag2.feature index 41866038b3d..4ed54f5dbb6 100644 --- a/tests/tck/features/lookup/LookupTag2.feature +++ b/tests/tck/features/lookup/LookupTag2.feature @@ -1,3 +1,6 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. Feature: Test lookup on tag index 2 Examples: | vid_type | id_200 | id_201 | id_202 | @@ -86,5 +89,3 @@ Feature: Test lookup on tag index 2 | 201 | 201 | | 202 | 202 | Then drop the used space - -# TODO(yee): Test bool expression diff --git a/tests/tck/features/lookup/Output.feature b/tests/tck/features/lookup/Output.feature index 3492f20c2b6..7b32874520a 100644 --- a/tests/tck/features/lookup/Output.feature +++ b/tests/tck/features/lookup/Output.feature @@ -1,3 +1,6 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. Feature: Lookup with output Background: diff --git a/tests/tck/features/lookup/TagIndexFullScan.feature b/tests/tck/features/lookup/TagIndexFullScan.feature index ed8ef34361d..d3c3046844f 100644 --- a/tests/tck/features/lookup/TagIndexFullScan.feature +++ b/tests/tck/features/lookup/TagIndexFullScan.feature @@ -1,3 +1,6 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. Feature: Lookup tag index full scan Background: @@ -297,6 +300,11 @@ Feature: Lookup tag index full scan | 2 | Filter | 4 | {"condition": "(team.name NOT IN [\"Hornets\",\"Jazz\"])"} | | 4 | TagIndexFullScan | 0 | | | 0 | Start | | | + When executing query: + """ + LOOKUP ON team WHERE NOT team.name IN ["Hornets", "Jazz"] YIELD id(vertex) as id + """ + Then a SemanticError should be raised at runtime: Expression !((team.name IN ["Hornets","Jazz"])) not supported yet When profiling query: """ LOOKUP ON player WHERE player.age NOT IN [40 - 1 , 72/2] YIELD id(vertex) as id, player.age @@ -373,6 +381,11 @@ Feature: Lookup tag index full scan LOOKUP ON team WHERE team.name NOT CONTAINS "ABC" YIELD vertex as node """ Then a SemanticError should be raised at runtime: Expression (team.name NOT CONTAINS "ABC") is not supported, please use full-text index as an optimal solution + When executing query: + """ + LOOKUP ON team WHERE NOT team.name CONTAINS "ABC" YIELD vertex as node + """ + Then a SemanticError should be raised at runtime: Expression !((team.name CONTAINS "ABC")) not supported yet Scenario: Tag with relational STARTS WITH filter When profiling query: diff --git a/tests/tck/features/lookup/WithYield.feature b/tests/tck/features/lookup/WithYield.feature index 9292d71d3d7..8049b0bbfdd 100644 --- a/tests/tck/features/lookup/WithYield.feature +++ b/tests/tck/features/lookup/WithYield.feature @@ -1,3 +1,6 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. Feature: Lookup with yield Background: @@ -97,3 +100,14 @@ Feature: Lookup with yield Then the result should be, in any order: | nums | | 6 | + + Scenario: yield constant columns + When executing query: + """ + LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019 + YIELD serve.startYear AS startYear, 1 AS a, 10+1 AS b + """ + Then the result should be, in any order: + | startYear | a | b | + | 2008 | 1 | 11 | + | 2008 | 1 | 11 | diff --git a/tests/tck/features/lookup/WithYield.intVid.feature b/tests/tck/features/lookup/WithYield.intVid.feature index 03d005b7719..6443e819817 100644 --- a/tests/tck/features/lookup/WithYield.intVid.feature +++ b/tests/tck/features/lookup/WithYield.intVid.feature @@ -1,3 +1,6 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. Feature: Lookup with yield in integer vid Background: @@ -98,3 +101,14 @@ Feature: Lookup with yield in integer vid Then the result should be, in any order: | nums | | 2 | + + Scenario: yield constant columns + When executing query: + """ + LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019 + YIELD serve.startYear AS startYear, 1 AS a, 10+1 AS b + """ + Then the result should be, in any order: + | startYear | a | b | + | 2008 | 1 | 11 | + | 2008 | 1 | 11 | From 23a4e68e28e98b044f521164136c0b693f27feec Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Mon, 30 Jan 2023 10:49:58 +0800 Subject: [PATCH 06/12] restore ngdata tests --- tests/data/ngdata/config.yaml | 2 - .../features/lookup/LookupNGDataTest.feature | 54 ------------------- 2 files changed, 56 deletions(-) delete mode 100644 tests/tck/features/lookup/LookupNGDataTest.feature diff --git a/tests/data/ngdata/config.yaml b/tests/data/ngdata/config.yaml index 306d13f974e..5de88ded380 100644 --- a/tests/data/ngdata/config.yaml +++ b/tests/data/ngdata/config.yaml @@ -33,8 +33,6 @@ schema: |- CREATE TAG INDEX Label_5_index ON Label_5 (Label_5_8_Int); CREATE TAG INDEX Label_8_index ON Label_8 (Label_8_2_Double, Label_8_0_Bool, Label_8_4_String(64), Label_8_7_String(64), Label_8_5_date, Label_8_1_Bool, Label_8_3_Bool, Label_8_6_timestamp); CREATE TAG INDEX Label_11_index ON Label_11 (Label_11_5_Double); - CREATE EDGE INDEX Rel_5_index ON Rel_5 (Rel_5_1_Bool, Rel_5_6_Int, Rel_5_2_String(64)); - CREATE EDGE INDEX Rel_0_index ON Rel_0 (Rel_0_3_Double); files: - path: Label_0.csv withHeader: true diff --git a/tests/tck/features/lookup/LookupNGDataTest.feature b/tests/tck/features/lookup/LookupNGDataTest.feature deleted file mode 100644 index 85f7c6f9637..00000000000 --- a/tests/tck/features/lookup/LookupNGDataTest.feature +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2023 vesoft inc. All rights reserved. -# -# This source code is licensed under Apache 2.0 License. -Feature: Test lookup on ngdata data - - Background: - Given a graph with space named "ngdata" - - Scenario: lookup on the tag property of double type - When executing query: - """ - LOOKUP ON Label_11 WHERE Label_11.Label_11_5_Double>0 YIELD id(vertex) AS vid - """ - Then the result should contain: - | vid | - | 88 | - | 11 | - | 19 | - | 69 | - | 104 | - | 45 | - | 79 | - | 83 | - | 383 | - When executing query: - """ - LOOKUP ON Label_11 WHERE Label_11.Label_11_5_Double>10 YIELD id(vertex) AS vid - """ - Then the result should be, in any order: - | vid | - - Scenario: lookup on the edge property of double type - When executing query: - """ - LOOKUP ON Rel_0 WHERE Rel_0.Rel_0_3_Double>0 yield src(edge) as src, dst(edge) as dst - """ - Then the result should contain: - | src | dst | - | 55 | 97 | - | 8 | 36 | - | 95 | 52 | - | 78 | 383 | - | 383 | 72 | - | 59 | 54 | - | 96 | 95 | - | 100 | 43 | - | 25 | 54 | - | 20 | 28 | - When executing query: - """ - LOOKUP ON Rel_0 WHERE Rel_0.Rel_0_3_Double>10 yield src(edge) as src, dst(edge) as dst - """ - Then the result should contain: - | src | dst | From b41d515474a812f3cfc99bf3e8bcc93482fbed81 Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Mon, 30 Jan 2023 10:53:59 +0800 Subject: [PATCH 07/12] drop the used space --- tests/tck/features/geo/GeoBase.feature | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/tck/features/geo/GeoBase.feature b/tests/tck/features/geo/GeoBase.feature index fcd928fbfee..0c7a0640a7e 100644 --- a/tests/tck/features/geo/GeoBase.feature +++ b/tests/tck/features/geo/GeoBase.feature @@ -108,6 +108,7 @@ Feature: Geo base INSERT VERTEX test_3() VALUES "test_103":() """ Then the execution should be successful + And drop the used space Scenario: test geo CURD # Any geo shape(point/linestring/polygon) is allowed to insert to the column geography @@ -770,3 +771,4 @@ Feature: Geo base DROP EDGE any_shape_edge; """ Then the execution should be successful + And drop the used space From 76ccc74d624086d6d1193f1d3ab18eae11c8c6e3 Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Mon, 30 Jan 2023 11:41:03 +0800 Subject: [PATCH 08/12] Fix failed --- tests/data/ngdata/config.yaml | 1 + tests/tck/features/lookup/WithYield.feature | 2 +- tests/tck/features/lookup/WithYield.intVid.feature | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/data/ngdata/config.yaml b/tests/data/ngdata/config.yaml index 5de88ded380..84c6b6cd37e 100644 --- a/tests/data/ngdata/config.yaml +++ b/tests/data/ngdata/config.yaml @@ -33,6 +33,7 @@ schema: |- CREATE TAG INDEX Label_5_index ON Label_5 (Label_5_8_Int); CREATE TAG INDEX Label_8_index ON Label_8 (Label_8_2_Double, Label_8_0_Bool, Label_8_4_String(64), Label_8_7_String(64), Label_8_5_date, Label_8_1_Bool, Label_8_3_Bool, Label_8_6_timestamp); CREATE TAG INDEX Label_11_index ON Label_11 (Label_11_5_Double); + CREATE EDGE INDEX Rel_5_index ON Rel_5 (Rel_5_1_Bool, Rel_5_6_Int, Rel_5_2_String(64)) files: - path: Label_0.csv withHeader: true diff --git a/tests/tck/features/lookup/WithYield.feature b/tests/tck/features/lookup/WithYield.feature index 8049b0bbfdd..0b31f6ad0d5 100644 --- a/tests/tck/features/lookup/WithYield.feature +++ b/tests/tck/features/lookup/WithYield.feature @@ -105,7 +105,7 @@ Feature: Lookup with yield When executing query: """ LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019 - YIELD serve.startYear AS startYear, 1 AS a, 10+1 AS b + YIELD serve.start_year AS startYear, 1 AS a, 10+1 AS b """ Then the result should be, in any order: | startYear | a | b | diff --git a/tests/tck/features/lookup/WithYield.intVid.feature b/tests/tck/features/lookup/WithYield.intVid.feature index 6443e819817..d50ee122caa 100644 --- a/tests/tck/features/lookup/WithYield.intVid.feature +++ b/tests/tck/features/lookup/WithYield.intVid.feature @@ -106,7 +106,7 @@ Feature: Lookup with yield in integer vid When executing query: """ LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019 - YIELD serve.startYear AS startYear, 1 AS a, 10+1 AS b + YIELD serve.start_year AS startYear, 1 AS a, 10+1 AS b """ Then the result should be, in any order: | startYear | a | b | From d84780dc47591f382a1e42611d3eb9cd51165ec6 Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Mon, 30 Jan 2023 13:47:26 +0800 Subject: [PATCH 09/12] refine step --- tests/tck/conftest.py | 2 +- tests/tck/features/user/User.feature | 6 +++--- .../PermissionViaDifferentService.feature | 18 +++++++++--------- .../slowquery/PermissionViaSameService.feature | 12 ++++++------ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/tck/conftest.py b/tests/tck/conftest.py index 322f687414c..8def7f0522b 100644 --- a/tests/tck/conftest.py +++ b/tests/tck/conftest.py @@ -464,7 +464,7 @@ def executing_query_with_retry(query, exec_ctx, request, secs, retryTimes): break -@when(parse("executing query with user {username} with password {password}:\n{query}")) +@when(parse('executing query with user "{username}" and password "{password}":\n{query}')) def executing_query( username, password, conn_pool_to_first_graph_service, query, exec_ctx, request ): diff --git a/tests/tck/features/user/User.feature b/tests/tck/features/user/User.feature index 9c1a6d1f4d5..f2a228c5a81 100644 --- a/tests/tck/features/user/User.feature +++ b/tests/tck/features/user/User.feature @@ -733,7 +733,7 @@ Feature: User & privilege Test """ Then the result should be, in any order, with relax comparison: | role | space | - When executing query with user user1 with password pwd1: + When executing query with user "user1" and password "pwd1": """ DESC USER user1 """ @@ -751,7 +751,7 @@ Feature: User & privilege Test """ Then the result should be, in any order: | role | space | - When executing query with user user1 with password pwd1: + When executing query with user "user1" and password "pwd1": """ DESC USER user2 """ @@ -761,7 +761,7 @@ Feature: User & privilege Test GRANT ROLE GUEST ON user_tmp_space_4 TO user1 """ Then the execution should be successful - When executing query with user user1 with password pwd1: + When executing query with user "user1" and password "pwd1": """ DESC USER root """ diff --git a/tests/tck/slowquery/PermissionViaDifferentService.feature b/tests/tck/slowquery/PermissionViaDifferentService.feature index de27708c250..066edc49152 100644 --- a/tests/tck/slowquery/PermissionViaDifferentService.feature +++ b/tests/tck/slowquery/PermissionViaDifferentService.feature @@ -24,7 +24,7 @@ Feature: Test kill queries permission from different services Then the execution should be successful And wait 10 seconds # Make sure the record exists - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; SHOW QUERIES @@ -35,7 +35,7 @@ Feature: Test kill queries permission from different services | sid | eid | dur | | /\d+/ | /\d+/ | /\d+/ | # Kill failed by user test_permission - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; SHOW QUERIES @@ -46,7 +46,7 @@ Feature: Test kill queries permission from different services """ Then an PermissionError should be raised at runtime: Only GOD role could kill others' queries. # Kill successful by user root - When executing query with user root with password nebula: + When executing query with user "root" and password "nebula": """ USE nba; SHOW QUERIES @@ -65,7 +65,7 @@ Feature: Test kill queries permission from different services """ Then the execution should be successful And wait 5 seconds - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; GO 100002 STEPS FROM "Tim Duncan" OVER like YIELD like._dst @@ -80,7 +80,7 @@ Feature: Test kill queries permission from different services Then the execution should be successful And wait 15 seconds # Make sure the record exists - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; SHOW QUERIES @@ -90,7 +90,7 @@ Feature: Test kill queries permission from different services Then the result should be, in order: | sid | eid | dur | | /\d+/ | /\d+/ | /\d+/ | - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; SHOW QUERIES @@ -109,7 +109,7 @@ Feature: Test kill queries permission from different services """ Then the execution should be successful And wait 5 seconds - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; GO 100003 STEPS FROM "Tim Duncan" OVER like YIELD like._dst @@ -124,7 +124,7 @@ Feature: Test kill queries permission from different services Then the execution should be successful And wait 15 seconds # Make sure the record exists - When executing query with user root with password nebula: + When executing query with user "root" and password "nebula": """ USE nba; SHOW QUERIES @@ -134,7 +134,7 @@ Feature: Test kill queries permission from different services Then the result should be, in order: | sid | eid | dur | | /\d+/ | /\d+/ | /\d+/ | - When executing query with user root with password nebula: + When executing query with user "root" and password "nebula": """ USE nba; SHOW QUERIES diff --git a/tests/tck/slowquery/PermissionViaSameService.feature b/tests/tck/slowquery/PermissionViaSameService.feature index a09e816df51..5b4a66badb0 100644 --- a/tests/tck/slowquery/PermissionViaSameService.feature +++ b/tests/tck/slowquery/PermissionViaSameService.feature @@ -23,7 +23,7 @@ Feature: Test kill queries from same service Then the execution should be successful And wait 10 seconds # Make sure the record exists - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; SHOW QUERIES @@ -33,7 +33,7 @@ Feature: Test kill queries from same service Then the result should be, in order: | sid | eid | dur | | /\d+/ | /\d+/ | /\d+/ | - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; SHOW QUERIES @@ -43,7 +43,7 @@ Feature: Test kill queries from same service | KILL QUERY(session=$-.sid, plan=$-.eid) """ Then an PermissionError should be raised at runtime: Only GOD role could kill others' queries. - When executing query with user root with password nebula: + When executing query with user "root" and password "nebula": """ USE nba; SHOW QUERIES @@ -62,7 +62,7 @@ Feature: Test kill queries from same service """ Then the execution should be successful And wait 5 seconds - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; GO 100002 STEPS FROM "Tim Duncan" OVER like YIELD like._dst @@ -77,7 +77,7 @@ Feature: Test kill queries from same service Then the execution should be successful # Make sure the record exists And wait 15 seconds - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; SHOW QUERIES @@ -87,7 +87,7 @@ Feature: Test kill queries from same service Then the result should be, in order: | sid | eid | dur | | /\d+/ | /\d+/ | /\d+/ | - When executing query with user test_permission with password test: + When executing query with user "test_permission" and password "test": """ USE nba; SHOW QUERIES From 5efef915f9f710c79beda701de8c9193604fbf08 Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Mon, 30 Jan 2023 14:01:01 +0800 Subject: [PATCH 10/12] some variables in where clause of lookup statement --- tests/tck/features/lookup/LookUpLimit.feature | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/tck/features/lookup/LookUpLimit.feature b/tests/tck/features/lookup/LookUpLimit.feature index 684a5979bd7..34d6529b7bc 100644 --- a/tests/tck/features/lookup/LookUpLimit.feature +++ b/tests/tck/features/lookup/LookUpLimit.feature @@ -133,3 +133,35 @@ Feature: Push Limit down IndexScan Rule | 7 | Limit | 8 | | | 8 | EdgeIndexPrefixScan | 9 | {"limit": "3"} | | 9 | Start | | | + + Scenario: some variables in where clause of lookup statement + When executing query: + """ + $var = YIELD true; + LOOKUP ON player WHERE $var==true YIELD id(vertex) as id; + """ + Then a SemanticError should be raised at runtime: Expression ($var==true) not supported yet + When executing query: + """ + $var = YIELD true; + LOOKUP ON player WHERE player.name=='Tim Duncan' AND $var==true YIELD id(vertex) as id; + """ + Then a SemanticError should be raised at runtime: Expression ($var==true) not supported yet + When executing query: + """ + YIELD 'Tim Duncan' AS player_name | + LOOKUP ON player WHERE player.name==$-.player_name YIELD id(vertex) as id; + """ + Then a SemanticError should be raised at runtime: '$-.player_name' is not an evaluable expression + When executing query: + """ + YIELD 'Tim Duncan' AS player_name | + LOOKUP ON player WHERE player.name IN [$-.player_name, 'Tony Parker'] YIELD id(vertex) as id; + """ + Then a SemanticError should be raised at runtime: '[$-.player_name,"Tony Parker"]' is not an evaluable expression + When executing query: + """ + YIELD 'Tim Duncan' AS player_name | + LOOKUP ON player WHERE player.name==player_name YIELD id(vertex) as id; + """ + Then a SemanticError should be raised at runtime: 'player_name' is not an evaluable expression From 8cb94c9463b07feb06484e8570751ae9d00b68d9 Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Mon, 30 Jan 2023 14:04:27 +0800 Subject: [PATCH 11/12] some variabes in yield clause of lookup statement --- tests/tck/features/lookup/LookUpLimit.feature | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/tck/features/lookup/LookUpLimit.feature b/tests/tck/features/lookup/LookUpLimit.feature index 34d6529b7bc..253a02a56b5 100644 --- a/tests/tck/features/lookup/LookUpLimit.feature +++ b/tests/tck/features/lookup/LookUpLimit.feature @@ -165,3 +165,17 @@ Feature: Push Limit down IndexScan Rule LOOKUP ON player WHERE player.name==player_name YIELD id(vertex) as id; """ Then a SemanticError should be raised at runtime: 'player_name' is not an evaluable expression + + Scenario: some variables in yield clause of lookup statement + When executing query: + """ + $var = YIELD true; + LOOKUP ON player WHERE player.name=='Tim Duncan' YIELD id(vertex) as id, $var AS v; + """ + Then a SyntaxError should be raised at runtime: Direct output of variable is prohibited near `$var' + When executing query: + """ + YIELD 'Tim Duncan' AS player_name | + LOOKUP ON player WHERE player.name=='Tim Duncan' YIELD id(vertex) as id, $-.player_name AS pn; + """ + Then a SemanticError should be raised at runtime: unsupported input/variable property expression in yield From 5f8a7936d9d2095315e2a99e45f61ffb9994332c Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Mon, 30 Jan 2023 15:00:34 +0800 Subject: [PATCH 12/12] More yield variable test --- tests/tck/features/lookup/LookUpLimit.feature | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/tck/features/lookup/LookUpLimit.feature b/tests/tck/features/lookup/LookUpLimit.feature index 253a02a56b5..85441e4a8cb 100644 --- a/tests/tck/features/lookup/LookUpLimit.feature +++ b/tests/tck/features/lookup/LookUpLimit.feature @@ -179,3 +179,9 @@ Feature: Push Limit down IndexScan Rule LOOKUP ON player WHERE player.name=='Tim Duncan' YIELD id(vertex) as id, $-.player_name AS pn; """ Then a SemanticError should be raised at runtime: unsupported input/variable property expression in yield + When executing query: + """ + YIELD 'Tim Duncan' AS player_name | + LOOKUP ON player WHERE player.name=='Tim Duncan' YIELD id(vertex) as id, player_name AS pn; + """ + Then a SemanticError should be raised at runtime: Invalid label identifiers: player_name