diff --git a/tests/tck/features/expression/RelationalExpr.feature b/tests/tck/features/expression/RelationalExpr.feature new file mode 100644 index 0000000000000000000000000000000000000000..ac60fbd3937f98576fd14b1019e7d07ffd7720ef --- /dev/null +++ b/tests/tck/features/expression/RelationalExpr.feature @@ -0,0 +1,197 @@ +# Copyright (c) 2020 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License, +# attached with Common Clause Condition 1.0, found in the LICENSES directory. +Feature: RelationalExpression + + Background: + Given a graph with space named "nba" + + Scenario: RelationalExpression basic + When executing query: + """ + YIELD [1<2, 1<=1, 3>2, 2>=2, 2==2, 3!=2, 4<>3] AS int_test + """ + Then the result should be, in order: + | int_test | + | [true, true, true, true, true, true, true] | + When executing query: + """ + YIELD [1.2<2.4, 1.3<=1.300000001, 3.1>2.9, 2.3>=2.11, 2.0==2.000000009, + 3.3!=2.1, 4.2<>3.001] AS float_test + """ + Then the result should be, in order: + | float_test | + | [true, true, true, true, true, true, true] | + When executing query: + """ + YIELD ["1"<'2', "abc"<="Azz", "true">'x', "null">="NULL", "abcd"<="abcde", + "aaa"!="aaa", "\nx"<>"\nx"] AS str_test + """ + Then the result should be, in order: + | str_test | + | [true, false, false, true, true, false, false] | + When executing query: + """ + YIELD [[1]<[2,3,4.5], [1,"a"]<=[1], [2,3,"s",true]>[3], [2.0000000001,3,"s",true]>=[2], + [1.9999999999,3,"s",true]<>[2,3,"s",true]] AS list_test + """ + Then the result should be, in order: + | list_test | + | [true, false, false, true, false] | + When executing query: + """ + YIELD [1<2.4, 1<=1.300000001, 3>2.9, 2.3>=2, 2==2.000000009, 3.3!=2, 4<>3.001, 4<=[4], + true<>[true,true], 2.0==[1.9999999999999]] AS mixed_test + """ + Then the result should be, in order: + | mixed_test | + | [true, true, true, true, true, true, true, NULL, true, false] | + When executing query: + """ + YIELD ["10"<2.4, '1'<=1.300000001, 3>"2.9", "2.3">=true, true==2.000000009, false!=2, + [1,3]<>3.001] AS non_numeric_test + """ + Then the result should be, in order: + | non_numeric_test | + | [NULL, NULL, NULL, NULL, false, true, true] | + When executing query: + """ + YIELD ["10"<null, null<=1.300000001, 3>null, null>=true, null==null, null!=null, null<>false, + null<[2,3,null], [2,null]==[2,null], [2,null]<>[2,null,1]] AS null_test + """ + Then the result should be, in order: + | null_test | + | [NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, true] | + + Scenario: Using Relational comparison in GO clause + When executing query: + """ + GO FROM "Tony Parker" OVER like + WHERE $$.player.age >= 33.000000000010 OR like.likeness <> 90.0000000000001 + YIELD like._dst AS id, like.likeness AS likeness, $$.player.age AS age + """ + Then the result should be, in any order, with relax comparison: + | id | likeness | age | + | "LaMarcus Aldridge" | 90 | 33 | + | "Manu Ginobili" | 95 | 41 | + | "Tim Duncan" | 95 | 42 | + When executing query: + """ + GO FROM "Tony Parker" OVER like + WHERE $$.player.age >= 33.000000000010 AND like.likeness == 90.0000000000001 + YIELD like._dst AS id, like.likeness AS likeness, $$.player.age AS age + """ + Then the result should be, in any order: + | id | likeness | age | + | "LaMarcus Aldridge" | 90 | 33 | + When executing query: + """ + GO FROM "Tony Parker" OVER like + WHERE $$.player.age >= true OR like.likeness <> null OR $$.player.name<[2,3,4] OR $$.player.name > 23.3 + YIELD like._dst AS id, like.likeness AS likeness, $$.player.age AS age + """ + Then the result should be, in any order, with relax comparison: + | id | likeness | age | + + Scenario: Using Relational comparison in MATCH clause + When executing query: + """ + MATCH p = (n:player)<-[e:like]-(m) + WHERE n.age >= 33 OR n.start_year <= 2010.0 + OR e.likeness <> 90 OR n.nonExistTag <> null + OR e.likeness >= "12" OR n.age <= true + RETURN DISTINCT m.name AS player, m.age AS age + ORDER BY player, age + """ + Then the result should be, in any order, with relax comparison: + | player | age | + | "Amar'e Stoudemire" | 36 | + | "Aron Baynes" | 32 | + | "Ben Simmons" | 22 | + | "Blake Griffin" | 30 | + | "Boris Diaw" | 36 | + | "Carmelo Anthony" | 34 | + | "Chris Paul" | 33 | + | "Damian Lillard" | 28 | + | "Danny Green" | 31 | + | "Dejounte Murray" | 29 | + | "Dirk Nowitzki" | 40 | + | "Dwyane Wade" | 37 | + | "Grant Hill" | 46 | + | "James Harden" | 29 | + | "Jason Kidd" | 45 | + | "Joel Embiid" | 25 | + | "Kyrie Irving" | 26 | + | "LaMarcus Aldridge" | 33 | + | "LeBron James" | 34 | + | "Luka Doncic" | 20 | + | "Manu Ginobili" | 41 | + | "Marc Gasol" | 34 | + | "Marco Belinelli" | 32 | + | "Paul Gasol" | 38 | + | "Paul George" | 28 | + | "Rajon Rondo" | 33 | + | "Ray Allen" | 43 | + | "Rudy Gay" | 32 | + | "Shaquile O'Neal" | 47 | + | "Steve Nash" | 45 | + | "Tiago Splitter" | 34 | + | "Tim Duncan" | 42 | + | "Tony Parker" | 36 | + | "Tracy McGrady" | 39 | + | "Vince Carter" | 42 | + | "Yao Ming" | 38 | + When executing query: + """ + MATCH p = (n:player)<-[e:like]-(m) + WHERE n.age >= 33 OR n.name <= "2010.0" + AND e.likeness <> 90 OR n.nonExistTag <> null + OR e.likeness >= "12" OR n.age <= true + RETURN DISTINCT m.name AS player, m.age AS age + ORDER BY player, age + """ + Then the result should be, in any order, with relax comparison: + | player | age | + | "Amar'e Stoudemire" | 36 | + | "Aron Baynes" | 32 | + | "Blake Griffin" | 30 | + | "Boris Diaw" | 36 | + | "Carmelo Anthony" | 34 | + | "Chris Paul" | 33 | + | "Damian Lillard" | 28 | + | "Danny Green" | 31 | + | "Dejounte Murray" | 29 | + | "Dirk Nowitzki" | 40 | + | "Dwyane Wade" | 37 | + | "Grant Hill" | 46 | + | "Jason Kidd" | 45 | + | "Kyrie Irving" | 26 | + | "LaMarcus Aldridge" | 33 | + | "LeBron James" | 34 | + | "Luka Doncic" | 20 | + | "Manu Ginobili" | 41 | + | "Marc Gasol" | 34 | + | "Marco Belinelli" | 32 | + | "Paul Gasol" | 38 | + | "Rajon Rondo" | 33 | + | "Ray Allen" | 43 | + | "Rudy Gay" | 32 | + | "Shaquile O'Neal" | 47 | + | "Steve Nash" | 45 | + | "Tiago Splitter" | 34 | + | "Tim Duncan" | 42 | + | "Tony Parker" | 36 | + | "Tracy McGrady" | 39 | + | "Vince Carter" | 42 | + | "Yao Ming" | 38 | + When executing query: + """ + MATCH p = (n:player)<-[e:like]-(m) + WHERE n.age >= 33 AND n.name <> "2010.0" + AND e.likeness == 90 AND n.nonExistTag <> null + AND e.likeness >= "12" + RETURN n.name AS player, n.age AS age + """ + Then the result should be, in any order, with relax comparison: + | player | age |