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/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 diff --git a/tests/tck/features/lookup/ByIndex.feature b/tests/tck/features/lookup/ByIndex.feature index b845ec3d249..f318db92c93 100644 --- a/tests/tck/features/lookup/ByIndex.feature +++ b/tests/tck/features/lookup/ByIndex.feature @@ -585,23 +585,20 @@ Feature: Lookup by index itself | name | | "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" | 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" | diff --git a/tests/tck/features/lookup/ByIndex.intVid.feature b/tests/tck/features/lookup/ByIndex.intVid.feature index 32e74287447..d124cb192d0 100644 --- a/tests/tck/features/lookup/ByIndex.intVid.feature +++ b/tests/tck/features/lookup/ByIndex.intVid.feature @@ -584,23 +584,20 @@ Feature: Lookup by index itself in integer vid | name | | "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" | 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" | diff --git a/tests/tck/features/lookup/EdgeIndexFullScan.feature b/tests/tck/features/lookup/EdgeIndexFullScan.feature index 96e4d4ed9e5..c5d39fd27ac 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")) not supported yet 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"))) 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/LookUpLimit.feature b/tests/tck/features/lookup/LookUpLimit.feature index 684a5979bd7..85441e4a8cb 100644 --- a/tests/tck/features/lookup/LookUpLimit.feature +++ b/tests/tck/features/lookup/LookUpLimit.feature @@ -133,3 +133,55 @@ 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 + + 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 + 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 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..0b31f6ad0d5 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.start_year 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..d50ee122caa 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.start_year 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/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