diff --git a/tests/tck/features/delete/DeleteEdge.IntVid.feature b/tests/tck/features/delete/DeleteEdge.IntVid.feature index 87794b5ded5..f676ea0ef85 100644 --- a/tests/tck/features/delete/DeleteEdge.IntVid.feature +++ b/tests/tck/features/delete/DeleteEdge.IntVid.feature @@ -135,6 +135,78 @@ Feature: Delete int vid of edge | "Zhangsan" | 50 | "Jack" | Then drop the used space + Scenario: delete edges delete the edge with rank 0 by default + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | int | + And having executed: + """ + CREATE TAG IF NOT EXISTS person(name string, age int); + CREATE EDGE IF NOT EXISTS friend(intimacy int); + """ + And having executed: + """ + INSERT VERTEX + person(name, age) + VALUES + hash("Zhangsan"):("Zhangsan", 22), + hash("Lisi"):("Lisi", 23); + INSERT EDGE + friend(intimacy) + VALUES + hash("Zhangsan")->hash("Lisi"):(1), + hash("Zhangsan")->hash("Lisi")@15:(2), + hash("Zhangsan")->hash("Lisi")@25:(3), + hash("Zhangsan")->hash("Lisi")@35:(4); + """ + # before delete get result by go + When executing query: + """ + GO FROM hash("Zhangsan") OVER friend + YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst + """ + Then the result should be, in any order: + | $^.person.name | friend.intimacy | friend._rank | friend._dst | + | "Zhangsan" | 1 | 0 | hash("Lisi") | + | "Zhangsan" | 2 | 15 | hash("Lisi") | + | "Zhangsan" | 3 | 25 | hash("Lisi") | + | "Zhangsan" | 4 | 35 | hash("Lisi") | + # delete edge friend, by default only the edge with rank of 0 will be deleted + When executing query: + """ + DELETE EDGE friend hash("Zhangsan")->hash("Lisi"); + """ + Then the execution should be successful + # check result + When executing query: + """ + GO FROM hash("Zhangsan") OVER friend + YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst + """ + Then the result should be, in any order: + | $^.person.name | friend.intimacy | friend._rank | friend._dst | + | "Zhangsan" | 2 | 15 | hash("Lisi") | + | "Zhangsan" | 3 | 25 | hash("Lisi") | + | "Zhangsan" | 4 | 35 | hash("Lisi") | + # delete all edges with different ranks + When executing query: + """ + GO FROM hash("Zhangsan") OVER friend YIELD id($^) AS src, friend._rank AS rank, friend._dst AS dst + | DELETE EDGE friend $-.src -> $-.dst @ $-.rank; + """ + Then the execution should be successful + # check result + When executing query: + """ + GO FROM hash("Zhangsan") OVER friend + YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst + """ + Then the result should be, in any order: + | $^.person.name | friend.intimacy | friend._rank | friend._dst | + Then drop the used space + Scenario: delete edges use pipe Given load "nba_int_vid" csv data to a new space # test delete with pipe wrong vid type diff --git a/tests/tck/features/delete/DeleteEdge.feature b/tests/tck/features/delete/DeleteEdge.feature index abf06a7a343..adb9a5c755c 100644 --- a/tests/tck/features/delete/DeleteEdge.feature +++ b/tests/tck/features/delete/DeleteEdge.feature @@ -135,6 +135,78 @@ Feature: Delete string vid of edge | "Zhangsan" | 50 | "Jack" | Then drop the used space + Scenario: delete edges delete the edge with rank 0 by default + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(20) | + And having executed: + """ + CREATE TAG IF NOT EXISTS person(name string, age int); + CREATE EDGE IF NOT EXISTS friend(intimacy int); + """ + And having executed: + """ + INSERT VERTEX + person(name, age) + VALUES + "Zhangsan":("Zhangsan", 22), + "Lisi":("Lisi", 23); + INSERT EDGE + friend(intimacy) + VALUES + "Zhangsan"->"Lisi":(1), + "Zhangsan"->"Lisi"@15:(2), + "Zhangsan"->"Lisi"@25:(3), + "Zhangsan"->"Lisi"@35:(4); + """ + # before delete get result by go + When executing query: + """ + GO FROM "Zhangsan" OVER friend + YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst + """ + Then the result should be, in any order: + | $^.person.name | friend.intimacy | friend._rank | friend._dst | + | "Zhangsan" | 1 | 0 | "Lisi" | + | "Zhangsan" | 2 | 15 | "Lisi" | + | "Zhangsan" | 3 | 25 | "Lisi" | + | "Zhangsan" | 4 | 35 | "Lisi" | + # delete edge friend, by default only the edge with rank of 0 will be deleted + When executing query: + """ + DELETE EDGE friend "Zhangsan"->"Lisi"; + """ + Then the execution should be successful + # check result + When executing query: + """ + GO FROM "Zhangsan" OVER friend + YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst + """ + Then the result should be, in any order: + | $^.person.name | friend.intimacy | friend._rank | friend._dst | + | "Zhangsan" | 2 | 15 | "Lisi" | + | "Zhangsan" | 3 | 25 | "Lisi" | + | "Zhangsan" | 4 | 35 | "Lisi" | + # delete all edges with different ranks + When executing query: + """ + GO FROM "Zhangsan" OVER friend YIELD id($^) AS src, friend._rank AS rank, friend._dst AS dst + | DELETE EDGE friend $-.src -> $-.dst @ $-.rank; + """ + Then the execution should be successful + # check result + When executing query: + """ + GO FROM "Zhangsan" OVER friend + YIELD $^.person.name, friend.intimacy, friend._rank, friend._dst + """ + Then the result should be, in any order: + | $^.person.name | friend.intimacy | friend._rank | friend._dst | + Then drop the used space + Scenario: delete edges use pipe Given load "nba" csv data to a new space # test delete with pipe wrong vid type diff --git a/tests/tck/features/delete/DeleteTag.IntVid.feature b/tests/tck/features/delete/DeleteTag.IntVid.feature index 1bf23a2d956..11b106c7db9 100644 --- a/tests/tck/features/delete/DeleteTag.IntVid.feature +++ b/tests/tck/features/delete/DeleteTag.IntVid.feature @@ -200,6 +200,7 @@ Feature: Delete int vid of tag """ Then the execution should be successful # after delete tag + # the output has one row because the vertex has multiple tags When executing query: """ FETCH PROP ON player hash("Tim Duncan") YIELD player.name, player.age diff --git a/tests/tck/features/delete/DeleteTag.feature b/tests/tck/features/delete/DeleteTag.feature index 7a4fe136e94..3afecefa036 100644 --- a/tests/tck/features/delete/DeleteTag.feature +++ b/tests/tck/features/delete/DeleteTag.feature @@ -134,7 +134,7 @@ Feature: Delete string vid of tag Then the result should be, in any order: | id | | "Tim Duncan" | - # delete one tag + # delete all tag When executing query: """ DELETE TAG * FROM "Tim Duncan"; @@ -200,6 +200,7 @@ Feature: Delete string vid of tag """ Then the execution should be successful # after delete tag + # the output has one row because the vertex has multiple tags When executing query: """ FETCH PROP ON player "Tim Duncan" YIELD player.name, player.age diff --git a/tests/tck/features/delete/DeleteVertex.feature b/tests/tck/features/delete/DeleteVertex.feature index 58703d63a86..8cc9864d39d 100644 --- a/tests/tck/features/delete/DeleteVertex.feature +++ b/tests/tck/features/delete/DeleteVertex.feature @@ -108,7 +108,7 @@ Feature: Delete string vid of vertex | like._dst | | "Kobe Bryant" | | "Grant Hill" | - | -"Rudy Gay" | + | "Rudy Gay" | # before delete hash id vertex to check value by go When executing query: """ diff --git a/tests/tck/features/insert/Insert.IntVid.feature b/tests/tck/features/insert/Insert.IntVid.feature index 34635dd3798..2ba6e2075db 100644 --- a/tests/tck/features/insert/Insert.IntVid.feature +++ b/tests/tck/features/insert/Insert.IntVid.feature @@ -236,6 +236,34 @@ Feature: Insert int vid of vertex and edge VALUES hash("Laura"):("Laura", 8, "three", 20190901008),hash("Amber"):("Amber", 9, "four", 20180901003) """ Then the execution should be successful + When executing query: + """ + FETCH PROP ON person hash("Laura") YIELD person.name, person.age + """ + Then the result should be, in any order: + | person.name | person.age | + | 'Laura' | 8 | + When executing query: + """ + FETCH PROP ON student hash("Laura") YIELD student.grade, student.number + """ + Then the result should be, in any order: + | student.grade | student.number | + | 'three' | 20190901008 | + When executing query: + """ + FETCH PROP ON person hash("Amber") YIELD person.name, person.age + """ + Then the result should be, in any order: + | person.name | person.age | + | 'Amber' | 9 | + When executing query: + """ + FETCH PROP ON student hash("Amber") YIELD student.grade, student.number + """ + Then the result should be, in any order: + | student.grade | student.number | + | 'four' | 20180901003 | # insert multi vertex one tag When executing query: """ @@ -586,3 +614,15 @@ Feature: Insert int vid of vertex and edge | src | dst | | 300 | 400 | Then drop the used space + + Scenario: insert vertex with non existent tag + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(10) | + When try to execute query: + """ + INSERT VERTEX invalid_vertex VALUES "non_existed_tag":() + """ + Then a SemanticError should be raised at runtime: No schema found diff --git a/tests/tck/features/insert/Insert.feature b/tests/tck/features/insert/Insert.feature index 746922951d5..2a3785cec9f 100644 --- a/tests/tck/features/insert/Insert.feature +++ b/tests/tck/features/insert/Insert.feature @@ -95,7 +95,7 @@ Feature: Insert string vid of vertex and edge INSERT EDGE schoolmate(likeness, nickname) VALUES "Tom"->"Lucy":(85, "Lily") """ Then the execution should be successful - # insert vertex wrong type + # insert edge wrong type When executing query: """ INSERT EDGE schoolmate(likeness, nickname) VALUES "Laura"->"Amber":("87", ""); @@ -224,6 +224,34 @@ Feature: Insert string vid of vertex and edge "Amber":("Amber", 9, "four", 20180901003); """ Then the execution should be successful + When executing query: + """ + FETCH PROP ON person "Laura" YIELD person.name, person.age + """ + Then the result should be, in any order: + | person.name | person.age | + | 'Laura' | 8 | + When executing query: + """ + FETCH PROP ON student "Laura" YIELD student.grade, student.number + """ + Then the result should be, in any order: + | student.grade | student.number | + | 'three' | 20190901008 | + When executing query: + """ + FETCH PROP ON person "Amber" YIELD person.name, person.age + """ + Then the result should be, in any order: + | person.name | person.age | + | 'Amber' | 9 | + When executing query: + """ + FETCH PROP ON student "Amber" YIELD student.grade, student.number + """ + Then the result should be, in any order: + | student.grade | student.number | + | 'four' | 20180901003 | # insert multi vertex one tag When executing query: """ @@ -506,6 +534,22 @@ Feature: Insert string vid of vertex and edge Then the result should be, in any order, with relax comparison: | node | | ('English') | + # insert Chinese character + # if the Chinese character is out of the fixed_string's size, it will be truncated, + # and no invalid char should be inserted + When executing query: + """ + INSERT VERTEX course(name) VALUES "Chinese":("中文字符") + """ + Then the execution should be successful + # check result + When executing query: + """ + FETCH PROP ON course "Chinese" YIELD vertex as node + """ + Then the result should be, in any order, with relax comparison: + | node | + | ('Chinese') | # check result When executing query: """ @@ -523,6 +567,7 @@ Feature: Insert string vid of vertex and edge | course.name | course.introduce | | 'Engli' | NULL | | 'Math' | NULL | + | '中' | NULL | When executing query: """ LOOKUP ON student YIELD student.name, student.age @@ -630,3 +675,15 @@ Feature: Insert string vid of vertex and edge """ Then a ExecutionError should be raised at runtime: Storage Error: The VID must be a 64-bit integer or a string fitting space vertex id length limit. Then drop the used space + + Scenario: insert vertex with non existent tag + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(10) | + When try to execute query: + """ + INSERT VERTEX invalid_vertex VALUES "non_existed_tag":() + """ + Then a SemanticError should be raised at runtime: No schema found diff --git a/tests/tck/features/insert/InsertEdgeOnDiffParts.feature b/tests/tck/features/insert/InsertEdgeOnDiffParts.feature index 9c33e3f058e..d1079a47700 100644 --- a/tests/tck/features/insert/InsertEdgeOnDiffParts.feature +++ b/tests/tck/features/insert/InsertEdgeOnDiffParts.feature @@ -1,7 +1,7 @@ # Copyright (c) 2021 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. -Feature: Insert vertex and edge with if not exists +Feature: Insert edge on different parts Scenario: insert edge with default value Given an empty graph