Skip to content
Snippets Groups Projects
Unverified Commit aa1abf8c authored by laura-ding's avatar laura-ding Committed by GitHub
Browse files

[testcase] Move mutate test to tck and add int vid test of mutate (#526)

* move 2.0 mutate test to tck

* add comment

* remove wrong file

* rebase upstream
parent 1162b3f0
No related branches found
No related tags found
No related merge requests found
Showing
with 3549 additions and 1678 deletions
......@@ -47,6 +47,8 @@ protected:
Status handleErrorCode(nebula::storage::cpp2::ErrorCode code, PartitionID partId) const {
switch (code) {
case storage::cpp2::ErrorCode::E_KEY_NOT_FOUND:
return Status::Error("Storage Error: Vertex or edge not found.");
case storage::cpp2::ErrorCode::E_DATA_TYPE_MISMATCH: {
std::string error = "Storage Error: The data type does not meet the requirements. "
"Use the correct type of data.";
......
......@@ -815,6 +815,9 @@ function_call_expression
: LABEL L_PAREN opt_argument_list R_PAREN {
$$ = new FunctionCallExpression($1, $3);
}
| KW_TIMESTAMP L_PAREN opt_argument_list R_PAREN {
$$ = new FunctionCallExpression(new std::string("timestamp"), $3);
}
| KW_DATE L_PAREN opt_argument_list R_PAREN {
$$ = new FunctionCallExpression(new std::string("date"), $3);
}
......
# --coding:utf-8--
#
# 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.
import time
from tests.common.nebula_test_suite import NebulaTestSuite
class TestDeleteEdges(NebulaTestSuite):
@classmethod
def prepare(self):
resp = self.execute('CREATE SPACE TestDeleteEdges(partition_num=1, replica_factor=1);'
'USE TestDeleteEdges;'
'CREATE TAG person(name string, age int);'
'CREATE EDGE friend(intimacy int);'
'CREATE EDGE schoolmate(likeness int);'
'CREATE EDGE transfer(money int);')
self.check_resp_succeeded(resp)
time.sleep(self.delay)
@classmethod
def cleanup(self):
resp = self.execute('DROP SPACE TestDeleteEdges;')
self.check_resp_succeeded(resp)
def test_delete_edge(self):
resp = self.execute('INSERT VERTEX person(name, age) VALUES '
'"Zhangsan":("Zhangsan", 22), "Lisi":("Lisi", 23),'
'"Jack":("Jack", 18), "Rose":("Rose", 19);')
self.check_resp_succeeded(resp)
resp = self.execute('INSERT EDGE friend(intimacy) VALUES '
'"Zhangsan"->"Lisi"@15:(90), '
'"Zhangsan"->"Jack"@12:(50),'
'"Jack"->"Rose"@13:(100);')
self.check_resp_succeeded(resp)
resp = self.execute('INSERT EDGE schoolmate(likeness) VALUES '
'"Zhangsan"->"Jack":(60),'
'"Lisi"->"Rose":(70);')
self.check_resp_succeeded(resp)
resp = self.execute('INSERT EDGE transfer(money) VALUES '
'"Zhangsan"->"Lisi"@1561013236:(33),'
'"Zhangsan"->"Lisi"@1561013237:(77)')
self.check_resp_succeeded(resp)
resp = self.execute('GO FROM "Zhangsan", "Jack" OVER friend '
'YIELD $^.person.name, friend.intimacy, friend._dst')
self.check_resp_succeeded(resp)
expect_result = [["Zhangsan", 90, "Lisi"], ["Zhangsan", 50, "Jack"], ["Jack", 100, "Rose"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Zhangsan", "Lisi" OVER schoolmate '
'YIELD $^.person.name, schoolmate.likeness, schoolmate._dst')
self.check_resp_succeeded(resp)
expect_result = [["Zhangsan", 60, "Jack"], ["Lisi", 70, "Rose"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Zhangsan" OVER transfer YIELD $^.person.name,'
'transfer._rank, transfer.money, transfer._dst')
self.check_resp_succeeded(resp)
expect_result = [["Zhangsan", 1561013236, 33, "Lisi"], ["Zhangsan", 1561013237, 77, "Lisi"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('DELETE EDGE friend "Zhangsan"->"Lisi"@15, "Jack"->"Rose"@13')
self.check_resp_succeeded(resp)
resp = self.execute('DELETE EDGE schoolmate "Lisi"->"Rose"')
self.check_resp_succeeded(resp)
resp = self.execute('DELETE EDGE transfer "Zhangsan"->"Lisi"@1561013237')
self.check_resp_succeeded(resp)
# check
resp = self.execute('GO FROM "Zhangsan", "Jack" OVER friend '
'YIELD $^.person.name, friend.intimacy, friend._dst')
self.check_resp_succeeded(resp)
expect_result = [["Zhangsan", 50, "Jack"]]
self.check_result(resp, expect_result)
resp = self.execute('GO FROM "Zhangsan", "Lisi" OVER schoolmate '
'YIELD $^.person.name, schoolmate.likeness, schoolmate._dst')
self.check_resp_succeeded(resp)
expect_result = [["Zhangsan", 60, "Jack"]]
self.check_result(resp, expect_result)
resp = self.execute('GO FROM "Zhangsan", "Jack" OVER transfer '
'YIELD $^.person.name, transfer._rank, transfer.money, transfer._dst')
self.check_resp_succeeded(resp)
expect_result = [["Zhangsan", 1561013236, 33, "Lisi"]]
self.check_result(resp, expect_result)
# delete non-existing edges and a same edge
resp = self.execute('DELETE EDGE friend "Zhangsan"->"Rose", "1008"->"1009"@17,'
'"Zhangsan"->"Lisi"@15')
self.check_resp_succeeded(resp)
resp = self.execute('GO FROM "Zhangsan","Jack" OVER friend '
'YIELD $^.person.name, friend.intimacy, friend._dst')
self.check_resp_succeeded(resp)
expect_result = [["Zhangsan", 50, "Jack"]]
self.check_result(resp, expect_result)
# --coding:utf-8--
# 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.
from tests.common.nebula_test_suite import NebulaTestSuite
class TestDeleteEdges2(NebulaTestSuite):
@classmethod
def prepare(self):
self.load_data()
def test_delete_with_pipe_wrong_vid_type(self):
resp = self.execute('GO FROM "Boris Diaw" OVER like YIELD like._type as id | DELETE EDGE like $-.id->$-.id')
self.check_resp_failed(resp)
def test_delete_with_pipe(self):
resp = self.execute('GO FROM "Boris Diaw" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["Tony Parker"], ["Tim Duncan"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Boris Diaw" OVER like YIELD '
'like._src as src, like._dst as dst, like._rank as rank'
' | DELETE EDGE like $-.src->$-.dst @ $-.rank')
self.check_resp_succeeded(resp)
# check result
resp = self.execute('GO FROM "Boris Diaw" OVER like')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
def test_delete_with_var(self):
resp = self.execute('GO FROM "Russell Westbrook" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["Paul George"], ["James Harden"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('$var = GO FROM "Russell Westbrook" OVER like YIELD '
'like._src as src, like._dst as dst, like._rank as rank;'
' DELETE EDGE like $var.src -> $var.dst @ $var.rank')
self.check_resp_succeeded(resp)
# check result
resp = self.execute('GO FROM "Russell Westbrook" OVER like')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
# --coding:utf-8--
#
# 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.
import time
import pytest
from tests.common.nebula_test_suite import NebulaTestSuite, T_NULL, T_EMPTY
class TestDeleteVertices(NebulaTestSuite):
@classmethod
def prepare(self):
self.load_data()
@classmethod
def cleanup(self):
query = 'DROP SPACE IF EXISTS deletenoedges_space'
resp = self.execute(query)
self.check_resp_succeeded(resp)
def test_delete_one_vertex(self):
resp = self.execute('GO FROM "Boris Diaw" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["Tony Parker"], ["Tim Duncan"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Tony Parker" OVER like REVERSELY')
self.check_resp_succeeded(resp)
expect_result = [["LaMarcus Aldridge"],
["Boris Diaw"],
["Dejounte Murray"],
["Marco Belinelli"],
["Tim Duncan"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute(' FETCH PROP ON player "Tony Parker" YIELD player.name, player.age')
self.check_resp_succeeded(resp)
expect_result = [["Tony Parker", "Tony Parker", 36]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('FETCH PROP ON serve "Tony Parker"->"Spurs" '
'YIELD serve.start_year, serve.end_year')
self.check_resp_succeeded(resp)
expect_result = [['Tony Parker', 'Spurs', 0, 1999, 2018]]
self.check_out_of_order_result(resp, expect_result)
# delete vertex
resp = self.execute('DELETE VERTEX "Tony Parker"')
self.check_resp_succeeded(resp)
# check
resp = self.execute('FETCH PROP ON player "Tony Parker" YIELD player.name, player.age')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('FETCH PROP ON serve "Tony Parker"->"Spurs" '
'YIELD serve.start_year, serve.end_year')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Boris Diaw" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["Tim Duncan"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Tony Parker" OVER like REVERSELY')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
def test_delete_multi_vertices(self):
resp = self.execute('GO FROM "Chris Paul" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["LeBron James"], ["Dwyane Wade"], ["Carmelo Anthony"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('DELETE VERTEX "LeBron James", "Dwyane Wade", "Carmelo Anthony"')
self.check_resp_succeeded(resp)
# check result
resp = self.execute('GO FROM "Chris Paul" OVER like')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
@pytest.mark.skip(reason="does not support int vid")
def test_delete_with_hash(self):
resp = self.execute('GO FROM hash("Tracy McGrady") OVER like')
self.check_resp_succeeded(resp)
expect_result = [[6293765385213992205], [-2308681984240312228], [-3212290852619976819]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM hash("Grant Hill") OVER like REVERSELY')
self.check_resp_succeeded(resp)
expect_result = [[4823234394086728974]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('FETCH PROP ON player hash("Grant Hill") YIELD player.name, player.age')
self.check_resp_succeeded(resp)
expect_result = [[6293765385213992205, "Grant Hill", 46]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('FETCH PROP ON serve hash("Grant Hill")->hash("Pistons") '
'YIELD serve.start_year, serve.end_year')
self.check_resp_succeeded(resp)
expect_result = [6293765385213992205, -2742277443392542725, 0, 1994, 2000]
self.check_out_of_order_result(resp, expect_result)
# delete vertex
resp = self.execute('DELETE VERTEX hash("Grant Hill")')
self.check_resp_succeeded(resp)
# check again
resp = self.execute('GO FROM hash("Tracy McGrady") OVER like')
self.check_resp_succeeded(resp)
expect_result = [["LKobe Bryant"], ["Rudy Gay"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM hash("Grant Hill") OVER like REVERSELY')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('FETCH PROP ON player hash("Grant Hill") YIELD player.name, player.age')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
# delete not exist vertex
resp = self.execute('DELETE VERTEX hash("Non-existing Vertex")')
self.check_resp_succeeded(resp)
# insert a vertex without edges
resp = self.execute('INSERT VERTEX player(name, age) VALUES hash("A Loner"): ("A Loner", 0)')
self.check_resp_succeeded(resp)
# delete a vertex without edges
resp = self.execute('DELETE VERTEX hash("A Loner")')
self.check_resp_succeeded(resp)
resp = self.execute('FETCH PROP ON player hash("A Loner") YIELD player.name, player.age')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
@pytest.mark.skip(reason="does not support uuid")
def test_delete_with_uuid(self):
resp = self.execute('FETCH PROP ON player UUID("Grant Hill") YIELD player.name, player.age')
self.check_resp_succeeded(resp)
expect_result = [["Grant Hill", 46]]
self.check_result(resp, expect_result, {0})
resp = self.execute('FETCH PROP ON serve UUID("Grant Hill")->UUID("Pistons") '
'YIELD serve.start_year, serve.end_year')
self.check_resp_succeeded(resp)
expect_result = [1994, 2000]
self.check_out_of_order_result(resp, expect_result)
# delete vertex
resp = self.execute('DELETE VERTEX UUID("Grant Hill")')
self.check_resp_succeeded(resp)
resp = self.execute('FETCH PROP ON player UUID("Grant Hill") YIELD player.name, player.age')
self.check_resp_succeeded(resp)
expect_result = []
self.check_result(resp, expect_result, {0})
resp = self.execute('FETCH PROP ON serve UUID("Grant Hill")->UUID("Pistons") '
'YIELD serve.start_year, serve.end_year')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
# delete not exist vertex
resp = self.execute('DELETE VERTEX UUID("Non-existing Vertex")')
self.check_resp_succeeded(resp)
# insert a vertex without edges
resp = self.execute('INSERT VERTEX player(name, age) VALUES UUID("A Loner"): ("A Loner", 0)')
self.check_resp_succeeded(resp)
# delete a vertex without edges
resp = self.execute('DELETE VERTEX UUID("A Loner")')
self.check_resp_succeeded(resp)
resp = self.execute('FETCH PROP ON player UUID("A Loner") YIELD player.name, player.age')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
def test_delete_with_no_edge(self):
resp = self.execute('create space deletenoedges_space;'
'use deletenoedges_space;'
'CREATE TAG person(name string, age int);')
self.check_resp_succeeded(resp)
time.sleep(self.delay)
resp = self.execute('INSERT VERTEX person(name, age) VALUES "101":("Tony Parker", 36)')
self.check_resp_succeeded(resp)
resp = self.execute('DELETE VERTEX "101"')
self.check_resp_succeeded(resp)
resp = self.execute('FETCH PROP ON person "101" yield person.name, person.age')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
# --coding:utf-8--
# 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.
import time
from tests.common.nebula_test_suite import NebulaTestSuite
class TestDeleteVertices(NebulaTestSuite):
@classmethod
def prepare(self):
self.load_data()
@classmethod
def cleanup(self):
pass
def test_delete_with_pipe_wrong_vid_type(self):
resp = self.execute('GO FROM "Boris Diaw" OVER like YIELD like._type as id | DELETE VERTEX $-.id')
self.check_resp_failed(resp)
def test_delete_with_pipe(self):
resp = self.execute('GO FROM "Boris Diaw" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["Tony Parker"], ["Tim Duncan"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Tony Parker" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["LaMarcus Aldridge"],
["Manu Ginobili"],
["Tim Duncan"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Tim Duncan" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["Tony Parker"],
["Manu Ginobili"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Boris Diaw" OVER like YIELD like._dst as id | DELETE VERTEX $-.id')
self.check_resp_succeeded(resp)
# check result
resp = self.execute('GO FROM "Boris Diaw" OVER like')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Tony Parker" OVER like')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Tim Duncan" OVER like')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
def test_delete_with_var(self):
resp = self.execute('GO FROM "Russell Westbrook" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["Paul George"], ["James Harden"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Paul George" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["Russell Westbrook"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "James Harden" OVER like')
self.check_resp_succeeded(resp)
expect_result = [["Russell Westbrook"]]
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('$var = GO FROM "Russell Westbrook" OVER like YIELD like._dst as id; DELETE VERTEX $var.id')
self.check_resp_succeeded(resp)
# check result
resp = self.execute('GO FROM "Russell Westbrook" OVER like')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Paul George" OVER like')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
resp = self.execute('GO FROM "Russell Westbrook" OVER like')
self.check_resp_succeeded(resp)
expect_result = []
self.check_out_of_order_result(resp, expect_result)
This diff is collapsed.
This diff is collapsed.
# 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.
@delete_e_int
Feature: Delete int vid of edge
Background: Prepare space
Given an empty graph
And create a space with following options:
| partition_num | 9 |
| 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);
CREATE EDGE IF NOT EXISTS schoolmate(likeness int);
CREATE EDGE IF NOT EXISTS transfer(money int);
"""
And wait 3 seconds
Scenario: delete edges
When executing query:
"""
INSERT VERTEX person(name, age) VALUES
hash("Zhangsan"):("Zhangsan", 22),
hash("Lisi"):("Lisi", 23),
hash("Jack"):("Jack", 18),
hash("Rose"):("Rose", 19);
INSERT EDGE friend(intimacy) VALUES
hash("Zhangsan")->hash("Lisi")@15:(90),
hash("Zhangsan")->hash("Jack")@12:(50),
hash("Jack")->hash("Rose")@13:(100);
INSERT EDGE schoolmate(likeness) VALUES
hash("Zhangsan")->hash("Jack"):(60),
hash("Lisi")->hash("Rose"):(70);
INSERT EDGE transfer(money) VALUES
hash("Zhangsan")->hash("Lisi")@1561013236:(33),
hash("Zhangsan")->hash("Lisi")@1561013237:(77);
"""
Then the execution should be successful
# before get result by go
When executing query:
"""
GO FROM hash("Zhangsan"), hash("Jack") OVER friend
YIELD $^.person.name, friend.intimacy, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._dst |
| "Zhangsan" | 90 | hash("Lisi") |
| "Zhangsan" | 50 | hash("Jack") |
| "Jack" | 100 | hash("Rose") |
# before delete edge to check value by go
When executing query:
"""
GO FROM hash("Zhangsan"), hash("Lisi") OVER schoolmate
YIELD $^.person.name, schoolmate.likeness, schoolmate._dst
"""
Then the result should be, in any order:
| $^.person.name | schoolmate.likeness | schoolmate._dst |
| "Zhangsan" | 60 | hash("Jack") |
| "Lisi" | 70 | hash("Rose") |
# before delete edge to check value by go
When executing query:
"""
GO FROM hash("Zhangsan") OVER transfer
YIELD $^.person.name,transfer._rank, transfer.money, transfer._dst
"""
Then the result should be, in any order:
| $^.person.name | transfer._rank | transfer.money | transfer._dst |
| "Zhangsan" | 1561013236 | 33 | hash("Lisi") |
| "Zhangsan" | 1561013237 | 77 | hash("Lisi") |
# delete edge friend
When executing query:
"""
DELETE EDGE friend hash("Zhangsan")->hash("Lisi")@15, hash("Jack")->hash("Rose")@13;
"""
Then the execution should be successful
# delete edge schoolmate
When executing query:
"""
DELETE EDGE schoolmate hash("Lisi")->hash("Rose")
"""
Then the execution should be successful
# delete edge transfer
When executing query:
"""
DELETE EDGE transfer hash("Zhangsan")->hash("Lisi")@1561013237
"""
Then the execution should be successful
# after delete edge to check value by go
When executing query:
"""
GO FROM hash("Zhangsan"), hash("Jack") OVER friend
YIELD $^.person.name, friend.intimacy, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._dst |
| "Zhangsan" | 50 | hash("Jack") |
# after delete edge to check value by go
When executing query:
"""
GO FROM hash("Zhangsan"), hash("Lisi") OVER schoolmate
YIELD $^.person.name, schoolmate.likeness, schoolmate._dst
"""
Then the result should be, in any order:
| $^.person.name | schoolmate.likeness | schoolmate._dst |
| "Zhangsan" | 60 | hash("Jack") |
# after delete edge to check value by go
When executing query:
"""
GO FROM hash("Zhangsan") OVER transfer
YIELD $^.person.name,transfer._rank, transfer.money, transfer._dst
"""
Then the result should be, in any order:
| $^.person.name | transfer._rank | transfer.money | transfer._dst |
| "Zhangsan" | 1561013236 | 33 | hash("Lisi") |
# delete non-existing edges and a same edge
When executing query:
"""
DELETE EDGE friend hash("Zhangsan")->hash("Rose"), hash("1008")->hash("1009")@17,hash("Zhangsan")->hash("Lisi")@15
"""
Then the execution should be successful
# check value by go
When executing query:
"""
GO FROM hash("Zhangsan"),hash("Jack") OVER friend
YIELD $^.person.name, friend.intimacy, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._dst |
| "Zhangsan" | 50 | hash("Jack") |
Then drop the used space
# 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.
@delete_e_string
Feature: Delete string vid of edge
Scenario: delete edges
Given an empty graph
And create a space with following options:
| partition_num | 9 |
| 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);
CREATE EDGE IF NOT EXISTS schoolmate(likeness int);
CREATE EDGE IF NOT EXISTS transfer(money int);
"""
And wait 3 seconds
When executing query:
"""
INSERT VERTEX person(name, age) VALUES
"Zhangsan":("Zhangsan", 22),
"Lisi":("Lisi", 23),
"Jack":("Jack", 18),
"Rose":("Rose", 19);
INSERT EDGE friend(intimacy) VALUES
"Zhangsan"->"Lisi"@15:(90),
"Zhangsan"->"Jack"@12:(50),
"Jack"->"Rose"@13:(100);
INSERT EDGE schoolmate(likeness) VALUES
"Zhangsan"->"Jack":(60),
"Lisi"->"Rose":(70);
INSERT EDGE transfer(money) VALUES
"Zhangsan"->"Lisi"@1561013236:(33),
"Zhangsan"->"Lisi"@1561013237:(77);
"""
Then the execution should be successful
# before get result by go
When executing query:
"""
GO FROM "Zhangsan", "Jack" OVER friend
YIELD $^.person.name, friend.intimacy, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._dst |
| "Zhangsan" | 90 | "Lisi" |
| "Zhangsan" | 50 | "Jack" |
| "Jack" | 100 | "Rose" |
# before delete edge to check value by go
When executing query:
"""
GO FROM "Zhangsan", "Lisi" OVER schoolmate
YIELD $^.person.name, schoolmate.likeness, schoolmate._dst
"""
Then the result should be, in any order:
| $^.person.name | schoolmate.likeness | schoolmate._dst |
| "Zhangsan" | 60 | "Jack" |
| "Lisi" | 70 | "Rose" |
# before delete edge to check value by go
When executing query:
"""
GO FROM "Zhangsan" OVER transfer
YIELD $^.person.name,transfer._rank, transfer.money, transfer._dst
"""
Then the result should be, in any order:
| $^.person.name | transfer._rank | transfer.money | transfer._dst |
| "Zhangsan" | 1561013236 | 33 | "Lisi" |
| "Zhangsan" | 1561013237 | 77 | "Lisi" |
# delete edge friend
When executing query:
"""
DELETE EDGE friend "Zhangsan"->"Lisi"@15, "Jack"->"Rose"@13;
"""
Then the execution should be successful
# delete edge schoolmate
When executing query:
"""
DELETE EDGE schoolmate "Lisi"->"Rose"
"""
Then the execution should be successful
# delete edge transfer
When executing query:
"""
DELETE EDGE transfer "Zhangsan"->"Lisi"@1561013237
"""
Then the execution should be successful
# after delete edge to check value by go
When executing query:
"""
GO FROM "Zhangsan", "Jack" OVER friend
YIELD $^.person.name, friend.intimacy, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._dst |
| "Zhangsan" | 50 | "Jack" |
# after delete edge to check value by go
When executing query:
"""
GO FROM "Zhangsan", "Lisi" OVER schoolmate
YIELD $^.person.name, schoolmate.likeness, schoolmate._dst
"""
Then the result should be, in any order:
| $^.person.name | schoolmate.likeness | schoolmate._dst |
| "Zhangsan" | 60 | "Jack" |
# after delete edge to check value by go
When executing query:
"""
GO FROM "Zhangsan" OVER transfer
YIELD $^.person.name,transfer._rank, transfer.money, transfer._dst
"""
Then the result should be, in any order:
| $^.person.name | transfer._rank | transfer.money | transfer._dst |
| "Zhangsan" | 1561013236 | 33 | "Lisi" |
# delete non-existing edges and a same edge
When executing query:
"""
DELETE EDGE friend "Zhangsan"->"Rose", "1008"->"1009"@17,"Zhangsan"->"Lisi"@15
"""
Then the execution should be successful
# check value by go
When executing query:
"""
GO FROM "Zhangsan", "Jack" OVER friend
YIELD $^.person.name, friend.intimacy, friend._dst
"""
Then the result should be, in any order:
| $^.person.name | friend.intimacy | friend._dst |
| "Zhangsan" | 50 | "Jack" |
Then drop the used space
Scenario: delete edges for 2.0 syntax
Given load "nba" csv data to a new space
# test delete with pipe wrong vid type
When executing query:
"""
GO FROM "Boris Diaw" OVER like YIELD like._type as id | DELETE EDGE like $-.id->$-.id
"""
Then a ExecutionError should be raised at runtime: Wrong srcId type `INT`, value
# delete with pipe, get result by go
When executing query:
"""
GO FROM "Boris Diaw" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Tony Parker" |
| "Tim Duncan" |
When executing query:
"""
GO FROM "Boris Diaw" OVER like
YIELD like._src as src, like._dst as dst, like._rank as rank
| DELETE EDGE like $-.src->$-.dst @ $-.rank
"""
Then the execution should be successful
When executing query:
"""
GO FROM "Boris Diaw" OVER like
"""
Then the result should be, in any order:
| like._dst |
# delete with var, get result by go
When executing query:
"""
GO FROM "Russell Westbrook" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Paul George" |
| "James Harden" |
When executing query:
"""
$var = GO FROM "Russell Westbrook" OVER like YIELD
like._src as src, like._dst as dst, like._rank as rank;
DELETE EDGE like $var.src -> $var.dst @ $var.rank
"""
Then the execution should be successful
When executing query:
"""
GO FROM "Russell Westbrook" OVER like
"""
Then the result should be, in any order:
| like._dst |
# 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.
@delete_v_int
Feature: Delete int vid of vertex
Background: Prepare space
Given load "nba_int_vid" csv data to a new space
Scenario: delete int vid vertex
# get vertex info
When executing query:
"""
GO FROM hash("Boris Diaw") OVER like
"""
Then the result should be, in any order:
| like._dst |
| hash("Tony Parker") |
| hash("Tim Duncan") |
When executing query:
"""
GO FROM hash("Tony Parker") OVER like REVERSELY
"""
Then the result should be, in any order:
| like._dst |
| hash("LaMarcus Aldridge") |
| hash("Boris Diaw") |
| hash("Dejounte Murray") |
| hash("Marco Belinelli") |
| hash("Tim Duncan") |
# get value by fetch
When executing query:
"""
FETCH PROP ON player hash("Tony Parker") YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
| hash("Tony Parker") | "Tony Parker" | 36 |
# check value by fetch
When executing query:
"""
FETCH PROP ON serve hash("Tony Parker")->hash("Spurs") YIELD serve.start_year, serve.end_year
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year |
| hash('Tony Parker') | hash('Spurs') | 0 | 1999 | 2018 |
# delete one vertex
When executing query:
"""
DELETE VERTEX hash("Tony Parker");
"""
Then the execution should be successful
# after delete to check value by fetch
When executing query:
"""
FETCH PROP ON player hash("Tony Parker") YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
# check value by fetch
When executing query:
"""
FETCH PROP ON serve hash("Tony Parker")->hash("Spurs") YIELD serve.start_year, serve.end_year
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year |
# after delete to check value by go
When executing query:
"""
GO FROM hash("Boris Diaw") OVER like
"""
Then the result should be, in any order:
| like._dst |
| hash("Tim Duncan") |
# after delete to check value by go
When executing query:
"""
GO FROM hash("Tony Parker") OVER like REVERSELY
"""
Then the result should be, in any order:
| like._dst |
# before delete multi vertexes to check value by go
When executing query:
"""
GO FROM hash("Chris Paul") OVER like
"""
Then the result should be, in any order:
| like._dst |
| hash("LeBron James") |
| hash("Dwyane Wade") |
| hash("Carmelo Anthony") |
# delete multi vertexes
When executing query:
"""
DELETE VERTEX hash("LeBron James"), hash("Dwyane Wade"), hash("Carmelo Anthony");
"""
Then the execution should be successful
# after delete multi vertexes to check value by go
When executing query:
"""
FETCH PROP ON player hash("Tony Parker") YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
# before delete hash id vertex to check value by go
When executing query:
"""
GO FROM hash("Tracy McGrady") OVER like
"""
Then the result should be, in any order:
| like._dst |
| 6293765385213992205 |
| -2308681984240312228 |
| -3212290852619976819 |
# before delete hash id vertex to check value by go
When executing query:
"""
GO FROM hash("Grant Hill") OVER like REVERSELY
"""
Then the result should be, in any order:
| like._dst |
| 4823234394086728974 |
# before delete hash id vertex to check value by fetch
When executing query:
"""
FETCH PROP ON player hash("Grant Hill") YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
| 6293765385213992205 | "Grant Hill" | 46 |
# before delete hash id vertex to check value by fetch
When executing query:
"""
FETCH PROP ON serve hash("Grant Hill")->hash("Pistons") YIELD serve.start_year, serve.end_year
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year |
| 6293765385213992205 | -2742277443392542725 | 0 | 1994 | 2000 |
# delete hash id vertex
When executing query:
"""
DELETE VERTEX hash("Grant Hill")
"""
Then the execution should be successful
# after delete hash id vertex to check value by go
When executing query:
"""
GO FROM hash("Tracy McGrady") OVER like
"""
Then the result should be, in any order:
| like._dst |
| hash("Kobe Bryant") |
| hash("Rudy Gay") |
# after delete hash id vertex to check value by go
When executing query:
"""
GO FROM hash("Grant Hill") OVER like REVERSELY
"""
Then the result should be, in any order:
| like._dst |
# after delete hash id vertex to check value by fetch
When executing query:
"""
FETCH PROP ON player hash("Grant Hill") YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
# delete not existed vertex
When executing query:
"""
DELETE VERTEX hash("Non-existing Vertex")
"""
Then the execution should be successful
# delete a vertex without edges
When executing query:
"""
INSERT VERTEX player(name, age) VALUES hash("A Loner"): ("A Loner", 0);
DELETE VERTEX hash("A Loner");
"""
Then the execution should be successful
# check delete a vertex without edges
When executing query:
"""
FETCH PROP ON player hash("A Loner") YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
# delete with no edge
When executing query:
"""
DELETE VERTEX hash("Nobody")
"""
Then the execution should be successful
# check delete with no edge
When executing query:
"""
FETCH PROP ON player hash("Nobody") YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
Then drop the used space
# 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.
@delete_v_string
Feature: Delete string vid of vertex
Scenario: delete string vertex
Given load "nba" csv data to a new space
# get vertex info
When executing query:
"""
GO FROM "Boris Diaw" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Tony Parker" |
| "Tim Duncan" |
When executing query:
"""
GO FROM "Tony Parker" OVER like REVERSELY
"""
Then the result should be, in any order:
| like._dst |
| "LaMarcus Aldridge" |
| "Boris Diaw" |
| "Dejounte Murray" |
| "Marco Belinelli" |
| "Tim Duncan" |
# get value by fetch
When executing query:
"""
FETCH PROP ON player "Tony Parker" YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
| "Tony Parker" | "Tony Parker" | 36 |
# check value by fetch
When executing query:
"""
FETCH PROP ON serve "Tony Parker"->"Spurs" YIELD serve.start_year, serve.end_year
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year |
| "Tony Parker" | "Spurs" | 0 | 1999 | 2018 |
# delete one vertex
When executing query:
"""
DELETE VERTEX "Tony Parker";
"""
Then the execution should be successful
# after delete to check value by fetch
When executing query:
"""
FETCH PROP ON player "Tony Parker" YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
# check value by fetch
When executing query:
"""
FETCH PROP ON serve "Tony Parker"->"Spurs" YIELD serve.start_year, serve.end_year
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year |
# after delete to check value by go
When executing query:
"""
GO FROM "Boris Diaw" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Tim Duncan" |
# after delete to check value by go
When executing query:
"""
GO FROM "Tony Parker" OVER like REVERSELY
"""
Then the result should be, in any order:
| like._dst |
# before delete multi vertexes to check value by go
When executing query:
"""
GO FROM "Chris Paul" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "LeBron James" |
| "Dwyane Wade" |
| "Carmelo Anthony" |
# delete multi vertexes
When executing query:
"""
DELETE VERTEX "LeBron James", "Dwyane Wade", "Carmelo Anthony";
"""
Then the execution should be successful
# after delete multi vertexes to check value by go
When executing query:
"""
FETCH PROP ON player "Tony Parker" YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
# before delete hash id vertex to check value by go
When executing query:
"""
GO FROM "Tracy McGrady" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Kobe Bryant" |
| "Grant Hill" |
| -"Rudy Gay" |
# before delete hash id vertex to check value by go
When executing query:
"""
GO FROM "Grant Hill" OVER like REVERSELY
"""
Then the result should be, in any order:
| like._dst |
| "Tracy McGrady" |
# before delete hash id vertex to check value by fetch
When executing query:
"""
FETCH PROP ON player "Grant Hill" YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
| "Grant Hill" | "Grant Hill" | 46 |
# before delete hash id vertex to check value by fetch
When executing query:
"""
FETCH PROP ON serve "Grant Hill"->"Pistons" YIELD serve.start_year, serve.end_year
"""
Then the result should be, in any order:
| serve._src | serve._dst | serve._rank | serve.start_year | serve.end_year |
| "Grant Hill" | "Pistons" | 0 | 1994 | 2000 |
# delete hash id vertex
When executing query:
"""
DELETE VERTEX "Grant Hill"
"""
Then the execution should be successful
# after delete hash id vertex to check value by go
When executing query:
"""
GO FROM "Tracy McGrady" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Kobe Bryant" |
| "Rudy Gay" |
# after delete hash id vertex to check value by go
When executing query:
"""
GO FROM "Grant Hill" OVER like REVERSELY
"""
Then the result should be, in any order:
| like._dst |
# after delete hash id vertex to check value by fetch
When executing query:
"""
FETCH PROP ON player "Grant Hill" YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
# delete not existed vertex
When executing query:
"""
DELETE VERTEX "Non-existing Vertex"
"""
Then the execution should be successful
# delete a vertex without edges
When executing query:
"""
INSERT VERTEX player(name, age) VALUES "A Loner": ("A Loner", 0);
DELETE VERTEX "A Loner";
"""
Then the execution should be successful
# check delete a vertex without edges
When executing query:
"""
FETCH PROP ON player "A Loner" YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
# delete with no edge
When executing query:
"""
DELETE VERTEX "Nobody"
"""
Then the execution should be successful
# check delete with no edge
When executing query:
"""
FETCH PROP ON player "Nobody" YIELD player.name, player.age
"""
Then the result should be, in any order:
| VertexID | player.name | player.age |
Then drop the used space
Scenario: delete vertex by pipe
Given load "nba" csv data to a new space
# test delete with pipe wrong vid type
When executing query:
"""
GO FROM "Boris Diaw" OVER like YIELD like._type as id | DELETE VERTEX $-.id
"""
Then a SemanticError should be raised at runtime: The vid should be string type, but input is `INT'
# delete with pipe, get result by go
When executing query:
"""
GO FROM "Boris Diaw" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Tony Parker" |
| "Tim Duncan" |
When executing query:
"""
GO FROM "Tony Parker" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "LaMarcus Aldridge" |
| "Manu Ginobili" |
| "Tim Duncan" |
When executing query:
"""
GO FROM "Tim Duncan" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Tony Parker" |
| "Manu Ginobili" |
When executing query:
"""
GO FROM "Boris Diaw" OVER like YIELD like._dst as id | DELETE VERTEX $-.id
"""
Then the execution should be successful
When executing query:
"""
GO FROM "Boris Diaw" OVER like
"""
Then the result should be, in any order:
| like._dst |
When executing query:
"""
GO FROM "Tony Parker" OVER like
"""
Then the result should be, in any order:
| like._dst |
When executing query:
"""
GO FROM "Tim Duncan" OVER like
"""
Then the result should be, in any order:
| like._dst |
# delete with var, get result by go
When executing query:
"""
GO FROM "Russell Westbrook" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Paul George" |
| "James Harden" |
When executing query:
"""
GO FROM "Paul George" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Russell Westbrook" |
When executing query:
"""
GO FROM "James Harden" OVER like
"""
Then the result should be, in any order:
| like._dst |
| "Russell Westbrook" |
When executing query:
"""
$var = GO FROM "Russell Westbrook" OVER like YIELD like._dst as id; DELETE VERTEX $var.id
"""
Then the execution should be successful
When executing query:
"""
GO FROM "Russell Westbrook" OVER like
"""
Then the result should be, in any order:
| like._dst |
When executing query:
"""
GO FROM "Paul George" OVER like
"""
Then the result should be, in any order:
| like._dst |
When executing query:
"""
GO FROM "Russell Westbrook" OVER like
"""
Then the result should be, in any order:
| like._dst |
Then drop the used space
# 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.
@insert_int
Feature: Insert int vid of vertex and edge
Background: Prepare space
Given an empty graph
And create a space with following options:
| partition_num | 9 |
| replica_factor | 1 |
| vid_type | int |
And having executed:
"""
CREATE TAG IF NOT EXISTS person(name string, age int);
CREATE TAG IF NOT EXISTS personWithDefault(name string DEFAULT "",
age int DEFAULT 18, isMarried bool DEFAULT false,
BMI double DEFAULT 18.5, department string DEFAULT "engineering",
birthday timestamp DEFAULT timestamp("2020-01-10T10:00:00"));
CREATE TAG IF NOT EXISTS student(grade string, number int);
CREATE TAG IF NOT EXISTS studentWithDefault(grade string DEFAULT "one", number int);
CREATE TAG IF NOT EXISTS employee(name int);
CREATE TAG IF NOT EXISTS interest(name string);
CREATE TAG IF NOT EXISTS school(name string, create_time timestamp);
CREATE EDGE IF NOT EXISTS schoolmate(likeness int, nickname string);
CREATE EDGE IF NOT EXISTS schoolmateWithDefault(likeness int DEFAULT 80);
CREATE EDGE IF NOT EXISTS study(start_time timestamp, end_time timestamp);
"""
And wait 3 seconds
Scenario: insert vertex and edge test
# insert vertex wrong type value
When executing query:
"""
INSERT VERTEX person(name, age) VALUES hash("Tom"):("Tom", "2");
"""
Then a ExecutionError should be raised at runtime:
# insert vertex wrong num of value
When executing query:
"""
INSERT VERTEX person(name) VALUES hash("Tom"):("Tom", 2);
"""
Then a SemanticError should be raised at runtime:
# insert vertex wrong field
When executing query:
"""
INSERT VERTEX person(Name, age) VALUES hash("Tom"):("Tom", 3);
"""
Then a SemanticError should be raised at runtime:
# insert vertex wrong type
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES hash("Laura")->hash("Amber"):("87", "");
"""
Then a ExecutionError should be raised at runtime:
# insert edge wrong number of value
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES hash("Laura")->hash("Amber"):("hello", "87", "");
"""
Then a SemanticError should be raised at runtime:
# insert edge wrong num of prop
When executing query:
"""
INSERT EDGE schoolmate(likeness) VALUES hash("Laura")->hash("Amber"):("hello", "87", "");
"""
Then a SemanticError should be raised at runtime:
# insert edge wrong field name
When executing query:
"""
INSERT EDGE schoolmate(like, HH) VALUES hash("Laura")->hash("Amber"):(88);
"""
Then a SemanticError should be raised at runtime:
# insert edge invalid timestamp
When executing query:
"""
INSERT EDGE study(start_time, end_time) VALUES
hash("Laura")->hash("sun_school"):(timestamp("2300-01-01T10:00:00"), now()+3600*24*365*3);
"""
Then a ExecutionError should be raised at runtime:
Scenario: insert vertex unordered order prop vertex succeeded
# insert vertex succeeded
When executing query:
"""
INSERT VERTEX person(name, age) VALUES hash("Tom"):("Tom", 22)
"""
Then the execution should be successful
When executing query:
"""
INSERT VERTEX person(age, name) VALUES hash("Conan"):(10, "Conan")
"""
Then the execution should be successful
# check vertex result with fetch
When executing query:
"""
FETCH PROP ON person hash("Conan")
"""
Then the result should be, in any order:
| VertexID | person.name | person.age |
| hash('Conan') | "Conan" | 10 |
# # insert vertex with uuid
# When executing query:
# """
# INSERT VERTEX person(name, age) VALUES uuid("Tom"):("Tom", 22)
# """
# Then the execution should be successful
# insert vertex with string timestamp succeeded
When executing query:
"""
INSERT VERTEX school(name, create_time) VALUES
hash("sun_school"):("sun_school", timestamp("2010-01-01T10:00:00"))
"""
Then the execution should be successful
# insert edge succeeded
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES hash("Tom")->hash("Lucy"):(85, "Lily")
"""
Then the execution should be successful
# insert edge with unordered prop edge
When executing query:
"""
INSERT EDGE schoolmate(nickname, likeness) VALUES hash("Tom")->hash("Bob"):("Superman", 87)
"""
Then the execution should be successful
# check edge result with fetch
When executing query:
"""
FETCH PROP ON schoolmate hash("Tom")->hash("Bob")
"""
Then the result should be, in any order:
| schoolmate._src | schoolmate._dst | schoolmate._rank | schoolmate.likeness | schoolmate.nickname |
| hash('Tom') | hash('Bob') | 0 | 87 | "Superman" |
# insert edge with timestamp succeed
When executing query:
"""
INSERT EDGE study(start_time, end_time) VALUES
hash("Laura")->hash("sun_school"):(timestamp("2019-01-01T10:00:00"), now()+3600*24*365*3)
"""
Then the execution should be successful
# check edge result with go
When executing query:
"""
GO FROM hash("Laura") OVER study
YIELD $$.school.name, study._dst, $$.school.create_time, (string)study.start_time
"""
Then the result should be, in any order:
| $$.school.name | study._dst | $$.school.create_time | (STRING)study.start_time |
| "sun_school" | hash("sun_school") | 1262340000 | "1546336800" |
# check edge result with fetch
When executing query:
"""
FETCH PROP ON school hash("sun_school")
"""
Then the result should be, in any order:
| VertexID | school.name | school.create_time |
| hash("sun_school") | "sun_school" | 1262340000 |
# insert one vertex multi tags
When executing query:
"""
INSERT VERTEX person(name, age), student(grade, number)
VALUES hash("Lucy"):("Lucy", 8, "three", 20190901001)
"""
Then the execution should be successful
# insert one vertex multi tags with unordered order prop
When executing query:
"""
INSERT VERTEX person(age, name),student(number, grade)
VALUES hash("Bob"):(9, "Bob", 20191106001, "four")
"""
Then the execution should be successful
# check person tag result with fetch
When executing query:
"""
FETCH PROP ON person hash("Bob")
"""
Then the result should be, in any order:
| VertexID | person.name | person.age |
| hash('Bob') | 'Bob' | 9 |
# check student tag result with fetch
When executing query:
"""
FETCH PROP ON student hash("Bob")
"""
Then the result should be, in any order:
| VertexID | student.grade | student.number |
| hash('Bob') | 'four' | 20191106001 |
# insert multi vertex multi tags
When executing query:
"""
INSERT VERTEX person(name, age),student(grade, number)
VALUES hash("Laura"):("Laura", 8, "three", 20190901008),hash("Amber"):("Amber", 9, "four", 20180901003)
"""
Then the execution should be successful
# insert multi vertex one tag
When executing query:
"""
INSERT VERTEX person(name, age) VALUES hash("Kitty"):("Kitty", 8), hash("Peter"):("Peter", 9)
"""
Then the execution should be successful
# insert multi edges
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname)
VALUES hash("Tom")->hash("Kitty"):(81, "Kitty"), hash("Tom")->hash("Peter"):(83, "Kitty")
"""
Then the execution should be successful
# check edge result with go
When executing query:
"""
GO FROM hash("Tom") OVER schoolmate YIELD $^.person.name, schoolmate.likeness, $$.person.name
"""
Then the result should be, in any order:
| $^.person.name | schoolmate.likeness | $$.person.name |
| 'Tom' | 85 | 'Lucy' |
| 'Tom' | 81 | 'Kitty' |
| 'Tom' | 83 | 'Peter' |
| 'Tom' | 87 | 'Bob' |
# insert multi tag
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname)
VALUES hash("Lucy")->hash("Laura"):(90, "Laura"), hash("Lucy")->hash("Amber"):(95, "Amber")
"""
Then the execution should be successful
# insert with edge
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES hash("Laura")->hash("Aero"):(90, "Aero")
"""
Then the execution should be successful
# get multi tag through go
When executing query:
"""
GO FROM hash("Lucy") OVER schoolmate
YIELD schoolmate.likeness, $$.person.name,$$.student.grade, $$.student.number
"""
Then the result should be, in any order:
| schoolmate.likeness | $$.person.name | $$.student.grade | $$.student.number |
| 90 | 'Laura' | 'three' | 20190901008 |
| 95 | 'Amber' | 'four' | 20180901003 |
# test multi sentences multi tags succeeded
When executing query:
"""
INSERT VERTEX person(name, age) VALUES hash("Aero"):("Aero", 8);
INSERT VERTEX student(grade, number) VALUES hash("Aero"):("four", 20190901003);
INSERT EDGE schoolmate(likeness, nickname) VALUES hash("Laura")->hash("Aero"):(90, "Aero")
"""
Then the execution should be successful
# get result through go
When executing query:
"""
GO FROM hash("Laura") OVER schoolmate YIELD $$.student.number, $$.person.name
"""
Then the result should be, in any order:
| $$.student.number | $$.person.name |
| 20190901003 | 'Aero' |
# test same prop name diff type
When executing query:
"""
INSERT VERTEX person(name, age), employee(name) VALUES
hash("Joy"):("Joy", 18, 123),
hash("Petter"):("Petter", 19, 456);
INSERT EDGE schoolmate(likeness, nickname) VALUES
hash("Joy")->hash("Petter"):(90, "Petter");
"""
Then the execution should be successful
# get result through go
When executing query:
"""
GO FROM hash("Joy") OVER schoolmate
YIELD $^.person.name,schoolmate.likeness, $$.person.name, $$.person.age,$$.employee.name
"""
Then the result should be, in any order:
| $^.person.name | schoolmate.likeness | $$.person.name | $$.person.age | $$.employee.name |
| 'Joy' | 90 | 'Petter' | 19 | 456 |
# test same prop name same type diff type
When executing query:
"""
INSERT VERTEX person(name, age),interest(name) VALUES hash("Bob"):("Bob", 19, "basketball");
INSERT EDGE schoolmate(likeness, nickname) VALUES hash("Petter")->hash("Bob"):(90, "Bob");
"""
Then the execution should be successful
# get result through go
When executing query:
"""
GO FROM hash("Petter") OVER schoolmate
YIELD $^.person.name, $^.employee.name,schoolmate.likeness, $$.person.name,$$.interest.name, $$.person.age
"""
Then the result should be, in any order:
| $^.person.name | $^.employee.name | schoolmate.likeness | $$.person.name | $$.interest.name | $$.person.age |
| 'Petter' | 456 | 90 | 'Bob' | 'basketball' | 19 |
# insert vertex using name and age default value
When executing query:
"""
INSERT VERTEX personWithDefault() VALUES 111:();
"""
Then the execution should be successful
# insert vertex lack of the column value
When executing query:
"""
INSERT VERTEX personWithDefault(age, isMarried, BMI) VALUES hash("Tom"):(18, false);
"""
Then a SemanticError should be raised at runtime:
# insert column doesn't match value count
When executing query:
"""
INSERT VERTEX studentWithDefault(grade, number) VALUES hash("Tom"):("one", 111, "");
"""
Then a SemanticError should be raised at runtime:
# insert vertex using age default value
When executing query:
"""
INSERT VERTEX personWithDefault(name) VALUES hash("Tom"):("Tom")
"""
Then the execution should be successful
# insert vertex with BMI default value
When executing query:
"""
INSERT VERTEX personWithDefault(name, age) VALUES hash("Tom"):("Tom", 20)
"""
Then the execution should be successful
# insert vertices multi tags with default value
When executing query:
"""
INSERT VERTEX personWithDefault(name, BMI), studentWithDefault(number) VALUES
hash("Laura"):("Laura", 21.5, 20190901008),hash("Amber"):("Amber", 22.5, 20180901003)
"""
Then the execution should be successful
# multi vertices one tag with default value
When executing query:
"""
INSERT VERTEX personWithDefault(name) VALUES hash("Kitty"):("Kitty"), hash("Peter"):("Peter")
"""
Then the execution should be successful
# insert edge lack of the column value
When executing query:
"""
INSERT EDGE schoolmateWithDefault(likeness) VALUES hash("Tom")->hash("Lucy"):()
"""
Then a SemanticError should be raised at runtime:
# insert edge column count doesn't match value count
When executing query:
"""
INSERT EDGE schoolmateWithDefault(likeness) VALUES hash("Tom")->hash("Lucy"):(60, "")
"""
Then a SemanticError should be raised at runtime:
# insert edge with all default value
When executing query:
"""
INSERT EDGE schoolmateWithDefault() VALUES hash("Tom")->hash("Lucy"):()
"""
Then the execution should be successful
# insert edge with unknown filed name
When executing query:
"""
INSERT EDGE schoolmateWithDefault(likeness, redundant) VALUES hash("Tom")->hash("Lucy"):(90, 0)
"""
Then a SemanticError should be raised at runtime:
# insert multi edges with default value
When executing query:
"""
INSERT EDGE schoolmateWithDefault() VALUES
hash("Tom")->hash("Kitty"):(),
hash("Tom")->hash("Peter"):(),
hash("Lucy")->hash("Laura"):(),
hash("Lucy")->hash("Amber"):()
"""
Then the execution should be successful
# get result through go
When executing query:
"""
GO FROM hash("Tom") OVER schoolmateWithDefault
YIELD $^.person.name, schoolmateWithDefault.likeness, $$.person.name
"""
Then the result should be, in any order:
| $^.person.name | schoolmateWithDefault.likeness | $$.person.name |
| 'Tom' | 80 | 'Kitty' |
| 'Tom' | 80 | 'Peter' |
| 'Tom' | 80 | 'Lucy' |
# get result through go
When executing query:
"""
GO FROM hash("Lucy") OVER schoolmateWithDefault
YIELD schoolmateWithDefault.likeness,
$$.personWithDefault.name,
$$.personWithDefault.birthday,
$$.personWithDefault.department,
$$.studentWithDefault.grade,
$$.studentWithDefault.number
"""
Then the result should be, in any order:
| schoolmateWithDefault.likeness | $$.personWithDefault.name | $$.personWithDefault.birthday | $$.personWithDefault.department | $$.studentWithDefault.grade | $$.studentWithDefault.number |
| 80 | 'Laura' | 1578650400 | 'engineering' | 'one' | 20190901008 |
| 80 | 'Amber' | 1578650400 | 'engineering' | 'one' | 20180901003 |
# insert multi version vertex
When executing query:
"""
INSERT VERTEX person(name, age) VALUES hash("Tony"):("Tony", 18), hash("Mack"):("Mack", 19);
INSERT VERTEX person(name, age) VALUES hash("Mack"):("Mack", 20);
INSERT VERTEX person(name, age) VALUES hash("Mack"):("Mack", 21)
"""
Then the execution should be successful
# insert multi version edge
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES hash("Tony")->hash("Mack")@1:(1, "");
INSERT EDGE schoolmate(likeness, nickname) VALUES hash("Tony")->hash("Mack")@1:(2, "");
INSERT EDGE schoolmate(likeness, nickname) VALUES hash("Tony")->hash("Mack")@1:(3, "");
"""
Then the execution should be successful
# get multi version result through go
When executing query:
"""
GO FROM hash("Tony") OVER schoolmate YIELD $$.person.name, $$.person.age, schoolmate.likeness
"""
Then the result should be, in any order:
| $$.person.name | $$.person.age | schoolmate.likeness |
| 'Mack' | 21 | 3 |
# insert multi version edge
# When executing query:
# """
# INSERT VERTEX person(name, age) VALUES uuid("Tony"):("Tony", 18), uuid("Mack"):("Mack", 19);
# INSERT VERTEX person(name, age) VALUES uuid("Mack"):("Mack", 20);
# INSERT VERTEX person(name, age) VALUES uuid("Mack"):("Mack", 21)
# """
# Then the execution should be successful
# insert multi version edge with uuid
# When executing query:
# """
# INSERT EDGE schoolmate(likeness, nickname) VALUES uuid("Tony")->uuid("Mack")@1:(1, "");
# INSERT EDGE schoolmate(likeness, nickname) VALUES uuid("Tony")->uuid("Mack")@1:(2, "");
# INSERT EDGE schoolmate(likeness, nickname) VALUES uuid("Tony")->uuid("Mack")@1:(3, "");
# """
# Then the execution should be successful
# get multi version result through go
# When executing query:
# """
# GO FROM uuid("Tony") OVER schoolmate YIELD $$.person.name, $$.person.age, schoolmate.likeness
# """
# Then the result should be, in any order:
# |$$.person.name| $$.person.age| schoolmate.likeness|
# |'Mack' | 21 | 3 |
Then drop the used space
# 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.
@insert_string
Feature: Insert string vid of vertex and edge
Scenario: insert vertex and edge test
Given an empty graph
And create a space with following options:
| partition_num | 9 |
| replica_factor | 1 |
| vid_type | FIXED_STRING(20) |
And having executed:
"""
CREATE TAG IF NOT EXISTS person(name string, age int);
CREATE TAG IF NOT EXISTS personWithDefault(name string DEFAULT "",
age int DEFAULT 18, isMarried bool DEFAULT false,
BMI double DEFAULT 18.5, department string DEFAULT "engineering",
birthday timestamp DEFAULT timestamp("2020-01-10T10:00:00"));
CREATE TAG IF NOT EXISTS student(grade string, number int);
CREATE TAG IF NOT EXISTS studentWithDefault(grade string DEFAULT "one", number int);
CREATE TAG IF NOT EXISTS employee(name int);
CREATE TAG IF NOT EXISTS interest(name string);
CREATE TAG IF NOT EXISTS school(name string, create_time timestamp);
CREATE EDGE IF NOT EXISTS schoolmate(likeness int, nickname string);
CREATE EDGE IF NOT EXISTS schoolmateWithDefault(likeness int DEFAULT 80);
CREATE EDGE IF NOT EXISTS study(start_time timestamp, end_time timestamp);
"""
And wait 3 seconds
# insert vertex wrong type value
When executing query:
"""
INSERT VERTEX person(name, age) VALUES "Tom":("Tom", "2");
"""
Then a ExecutionError should be raised at runtime:
# insert vertex wrong num of value
When executing query:
"""
INSERT VERTEX person(name) VALUES "Tom":("Tom", 2);
"""
Then a SemanticError should be raised at runtime:
# insert vertex wrong field
When executing query:
"""
INSERT VERTEX person(Name, age) VALUES "Tom":("Tom", 3);
"""
Then a SemanticError should be raised at runtime:
# insert vertex wrong type
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES "Laura"->"Amber":("87", "");
"""
Then a ExecutionError should be raised at runtime:
# insert edge wrong number of value
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES
"Laura"->"Amber":("hello", "87", "");
"""
Then a SemanticError should be raised at runtime:
# insert edge wrong num of prop
When executing query:
"""
INSERT EDGE schoolmate(likeness) VALUES "Laura"->"Amber":("hello", "87", "");
"""
Then a SemanticError should be raised at runtime:
# insert edge wrong field name
When executing query:
"""
INSERT EDGE schoolmate(like, HH) VALUES "Laura"->"Amber":(88);
"""
Then a SemanticError should be raised at runtime:
# insert edge invalid timestamp
When executing query:
"""
INSERT EDGE study(start_time, end_time) VALUES
"Laura"->"sun_school":(timestamp("2300-01-01T10:00:00"), now()+3600*24*365*3);
"""
Then a ExecutionError should be raised at runtime:
# insert vertex succeeded
When executing query:
"""
INSERT VERTEX person(name, age) VALUES "Tom":("Tom", 22)
"""
Then the execution should be successful
# insert vertex unordered order prop vertex succeeded
When executing query:
"""
INSERT VERTEX person(age, name) VALUES "Conan":(10, "Conan")
"""
Then the execution should be successful
# check vertex result with fetch
When executing query:
"""
FETCH PROP ON person "Conan"
"""
Then the result should be, in any order:
| VertexID | person.name | person.age |
| 'Conan' | 'Conan' | 10 |
# insert vertex with string timestamp succeeded
When executing query:
"""
INSERT VERTEX school(name, create_time) VALUES
"sun_school":("sun_school", timestamp("2010-01-01T10:00:00"))
"""
Then the execution should be successful
# insert edge succeeded
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES "Tom"->"Lucy":(85, "Lily")
"""
Then the execution should be successful
# insert edge with unordered prop edge
When executing query:
"""
INSERT EDGE schoolmate(nickname, likeness) VALUES "Tom"->"Bob":("Superman", 87)
"""
Then the execution should be successful
# check edge result with fetch
When executing query:
"""
FETCH PROP ON schoolmate "Tom"->"Bob"
"""
Then the result should be, in any order:
| schoolmate._src | schoolmate._dst | schoolmate._rank | schoolmate.likeness | schoolmate.nickname |
| 'Tom' | 'Bob' | 0 | 87 | 'Superman' |
# insert edge with timestamp succeed
When executing query:
"""
INSERT EDGE study(start_time, end_time) VALUES
"Laura"->"sun_school":(timestamp("2019-01-01T10:00:00"), now()+3600*24*365*3)
"""
Then the execution should be successful
# check edge result with go
When executing query:
"""
GO FROM "Laura" OVER study
YIELD $$.school.name, study._dst, $$.school.create_time, (string)study.start_time
"""
Then the result should be, in any order:
| $$.school.name | study._dst | $$.school.create_time | (STRING)study.start_time |
| "sun_school" | "sun_school" | 1262340000 | "1546336800" |
# check edge result with fetch
When executing query:
"""
FETCH PROP ON school "sun_school"
"""
Then the result should be, in any order:
| VertexID | school.name | school.create_time |
| "sun_school" | "sun_school" | 1262340000 |
# insert one vertex multi tags
When executing query:
"""
INSERT VERTEX person(name, age), student(grade, number) VALUES
"Lucy":("Lucy", 8, "three", 20190901001)
"""
Then the execution should be successful
# insert one vertex multi tags with unordered order prop
When executing query:
"""
INSERT VERTEX person(age, name),student(number, grade) VALUES
"Bob":(9, "Bob", 20191106001, "four")
"""
Then the execution should be successful
# check person tag result with fetch
When executing query:
"""
FETCH PROP ON person "Bob"
"""
Then the result should be, in any order:
| VertexID | person.name | person.age |
| 'Bob' | 'Bob' | 9 |
# check student tag result with fetch
When executing query:
"""
FETCH PROP ON student "Bob"
"""
Then the result should be, in any order:
| VertexID | student.grade | student.number |
| 'Bob' | 'four' | 20191106001 |
# insert multi vertex multi tags
When executing query:
"""
INSERT VERTEX person(name, age),student(grade, number) VALUES
"Laura":("Laura", 8, "three", 20190901008),"Amber":("Amber", 9, "four", 20180901003)
"""
Then the execution should be successful
# insert multi vertex one tag
When executing query:
"""
INSERT VERTEX person(name, age) VALUES
"Kitty":("Kitty", 8), "Peter":("Peter", 9)
"""
Then the execution should be successful
# insert multi edges
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES
"Tom"->"Kitty":(81, "Kitty"), "Tom"->"Peter":(83, "Kitty")
"""
Then the execution should be successful
# check edge result with go
When executing query:
"""
GO FROM "Tom" OVER schoolmate
YIELD $^.person.name, schoolmate.likeness, $$.person.name
"""
Then the result should be, in any order:
| $^.person.name | schoolmate.likeness | $$.person.name |
| 'Tom' | 85 | 'Lucy' |
| 'Tom' | 81 | 'Kitty' |
| 'Tom' | 83 | 'Peter' |
| 'Tom' | 87 | 'Bob' |
# insert multi tag
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES
"Lucy"->"Laura":(90, "Laura"), "Lucy"->"Amber":(95, "Amber")
"""
Then the execution should be successful
# insert with edge
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES
"Laura"->"Aero":(90, "Aero")
"""
Then the execution should be successful
# get multi tag through go
When executing query:
"""
GO FROM "Lucy" OVER schoolmate
YIELD schoolmate.likeness, $$.person.name,$$.student.grade, $$.student.number
"""
Then the result should be, in any order:
| schoolmate.likeness | $$.person.name | $$.student.grade | $$.student.number |
| 90 | 'Laura' | 'three' | 20190901008 |
| 95 | 'Amber' | 'four' | 20180901003 |
# test multi sentences multi tags succeeded
When executing query:
"""
INSERT VERTEX person(name, age) VALUES
"Aero":("Aero", 8);INSERT VERTEX student(grade, number)
VALUES "Aero":("four", 20190901003);
INSERT EDGE schoolmate(likeness, nickname)
VALUES "Laura"->"Aero":(90, "Aero")
"""
Then the execution should be successful
# get result through go
When executing query:
"""
GO FROM "Laura" OVER schoolmate YIELD $$.student.number, $$.person.name
"""
Then the result should be, in any order:
| $$.student.number | $$.person.name |
| 20190901003 | 'Aero' |
# test same prop name diff type
When executing query:
"""
INSERT VERTEX person(name, age), employee(name) VALUES
"Joy":("Joy", 18, 123), "Petter":("Petter", 19, 456);
INSERT EDGE schoolmate(likeness, nickname) VALUES "Joy"->"Petter":(90, "Petter");
"""
Then the execution should be successful
# get result through go
When executing query:
"""
GO FROM "Joy" OVER schoolmate
YIELD $^.person.name,schoolmate.likeness, $$.person.name, $$.person.age,$$.employee.name
"""
Then the result should be, in any order:
| $^.person.name | schoolmate.likeness | $$.person.name | $$.person.age | $$.employee.name |
| 'Joy' | 90 | 'Petter' | 19 | 456 |
# test same prop name same type diff type
When executing query:
"""
INSERT VERTEX person(name, age),interest(name) VALUES "Bob":("Bob", 19, "basketball");
INSERT EDGE schoolmate(likeness, nickname) VALUES "Petter"->"Bob":(90, "Bob");
"""
Then the execution should be successful
# get result through go
When executing query:
"""
GO FROM "Petter" OVER schoolmate
YIELD $^.person.name,
$^.employee.name,schoolmate.likeness,
$$.person.name,
$$.interest.name,
$$.person.age
"""
Then the result should be, in any order:
| $^.person.name | $^.employee.name | schoolmate.likeness | $$.person.name | $$.interest.name | $$.person.age |
| 'Petter' | 456 | 90 | 'Bob' | 'basketball' | 19 |
# insert vertex using name and age default value
When executing query:
"""
INSERT VERTEX personWithDefault() VALUES "111":();
"""
Then the execution should be successful
# insert vertex lack of the column value
When executing query:
"""
INSERT VERTEX personWithDefault(age, isMarried, BMI) VALUES "Tom":(18, false);
"""
Then a SemanticError should be raised at runtime:
# insert column doesn't match value count
When executing query:
"""
INSERT VERTEX studentWithDefault(grade, number) VALUES "Tom":("one", 111, "");
"""
Then a SemanticError should be raised at runtime:
# insert vertex using age default value
When executing query:
"""
INSERT VERTEX personWithDefault(name) VALUES "Tom":("Tom")
"""
Then the execution should be successful
# insert vertex with BMI default value
When executing query:
"""
INSERT VERTEX personWithDefault(name, age) VALUES "Tom":("Tom", 20)
"""
Then the execution should be successful
# insert vertices multi tags with default value
When executing query:
"""
INSERT VERTEX personWithDefault(name, BMI),
studentWithDefault(number) VALUES
"Laura":("Laura", 21.5, 20190901008),
"Amber":("Amber", 22.5, 20180901003)
"""
Then the execution should be successful
# multi vertices one tag with default value
When executing query:
"""
INSERT VERTEX personWithDefault(name) VALUES
"Kitty":("Kitty"), "Peter":("Peter")
"""
Then the execution should be successful
# insert edge lack of the column value
When executing query:
"""
INSERT EDGE schoolmateWithDefault(likeness) VALUES "Tom"->"Lucy":()
"""
Then a SemanticError should be raised at runtime:
# insert edge column count doesn't match value count
When executing query:
"""
INSERT EDGE schoolmateWithDefault(likeness) VALUES "Tom"->"Lucy":(60, "")
"""
Then a SemanticError should be raised at runtime:
# insert edge with all default value
When executing query:
"""
INSERT EDGE schoolmateWithDefault() VALUES "Tom"->"Lucy":()
"""
Then the execution should be successful
# insert edge with unknown filed name
When executing query:
"""
INSERT EDGE schoolmateWithDefault(likeness, redundant) VALUES "Tom"->"Lucy":(90, 0)
"""
Then a SemanticError should be raised at runtime:
# insert multi edges with default value
When executing query:
"""
INSERT EDGE schoolmateWithDefault() VALUES
"Tom"->"Kitty":(), "Tom"->"Peter":(), "Lucy"->"Laura":(), "Lucy"->"Amber":()
"""
Then the execution should be successful
# get result through go
When executing query:
"""
GO FROM "Tom" OVER schoolmateWithDefault
YIELD $^.person.name, schoolmateWithDefault.likeness, $$.person.name
"""
Then the result should be, in any order:
| $^.person.name | schoolmateWithDefault.likeness | $$.person.name |
| 'Tom' | 80 | 'Kitty' |
| 'Tom' | 80 | 'Peter' |
| 'Tom' | 80 | 'Lucy' |
# get result through go
When executing query:
"""
GO FROM "Lucy" OVER schoolmateWithDefault
YIELD schoolmateWithDefault.likeness,
$$.personWithDefault.name,
$$.personWithDefault.birthday,
$$.personWithDefault.department,
$$.studentWithDefault.grade,
$$.studentWithDefault.number
"""
Then the result should be, in any order:
| schoolmateWithDefault.likeness | $$.personWithDefault.name | $$.personWithDefault.birthday | $$.personWithDefault.department | $$.studentWithDefault.grade | $$.studentWithDefault.number |
| 80 | 'Laura' | 1578650400 | 'engineering' | 'one' | 20190901008 |
| 80 | 'Amber' | 1578650400 | 'engineering' | 'one' | 20180901003 |
# insert multi version vertex
When executing query:
"""
INSERT VERTEX person(name, age) VALUES "Tony":("Tony", 18), "Mack":("Mack", 19);
INSERT VERTEX person(name, age) VALUES "Mack":("Mack", 20);
INSERT VERTEX person(name, age) VALUES "Mack":("Mack", 21)
"""
Then the execution should be successful
# insert multi version edge
When executing query:
"""
INSERT EDGE schoolmate(likeness, nickname) VALUES "Tony"->"Mack"@1:(1, "");
INSERT EDGE schoolmate(likeness, nickname) VALUES "Tony"->"Mack"@1:(2, "");
INSERT EDGE schoolmate(likeness, nickname) VALUES "Tony"->"Mack"@1:(3, "");
"""
Then the execution should be successful
# get multi version result through go
When executing query:
"""
GO FROM "Tony" OVER schoolmate YIELD $$.person.name, $$.person.age, schoolmate.likeness
"""
Then the result should be, in any order:
| $$.person.name | $$.person.age | schoolmate.likeness |
| 'Mack' | 21 | 3 |
Then drop the used space
Scenario: insert vertex and edge test by the 2.0 new type
Given an empty graph
And create a space with following options:
| partition_num | 9 |
| replica_factor | 1 |
| vid_type | FIXED_STRING(10) |
And having executed:
"""
CREATE TAG student(name string NOT NULL, age int);
CREATE TAG course(name fixed_string(5) NOT NULL, introduce string DEFAULT NULL);
"""
And wait 3 seconds
# test insert out of range id size
When executing query:
"""
INSERT VERTEX student(name, age) VALUES "12345678901":("Tom", 2)
"""
Then a ExecutionError should be raised at runtime: Storage Error: The VID must be a 64-bit interger or a string.
# test insert not null prop
When executing query:
"""
INSERT VERTEX student(name, age) VALUES "Tom":(NULL, 12)
"""
Then a ExecutionError should be raised at runtime: Storage Error: The not null field cannot be null.
When executing query:
"""
INSERT VERTEX student(name, age) VALUES "Tom":(NULL, 12)
"""
Then a ExecutionError should be raised at runtime: Storage Error: The not null field cannot be null.
# test insert with fixed_string
When executing query:
"""
INSERT VERTEX course(name) VALUES "Math":("Math")
"""
Then the execution should be successful
# out of fixed_string's size
When executing query:
"""
INSERT VERTEX course(name) VALUES "English":("English")
"""
Then the execution should be successful
# check result
When executing query:
"""
FETCH PROP ON course "English"
"""
Then the result should be, in any order:
| VertexID | course.name | course.introduce |
| 'English' | 'Engli' | NULL |
# test insert with empty str vid
When executing query:
"""
INSERT VERTEX student(name, age) VALUES "":("Tom", 12)
"""
Then the execution should be successful
# check result
When executing query:
"""
FETCH PROP ON student ""
"""
Then the result should be, in any order:
| VertexID | student.name | student.age |
| '' | 'Tom' | 12 |
Then drop the used space
This diff is collapsed.
This diff is collapsed.
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment