Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(interactive): Support specifying vertex/edge properties as null #3956

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions flex/storages/rt_mutable_graph/schema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,12 @@ static Status parse_vertex_properties(YAML::Node node,
std::vector<std::string>& names,
std::vector<StorageStrategy>& strategies,
const std::string& version) {
if (!node || !node.IsSequence()) {
if (!node || node.IsNull()) {
VLOG(10) << "Found no vertex properties specified for vertex: "
<< label_name;
return Status::OK();
}
if (!node.IsSequence()) {
LOG(ERROR) << "Expect properties for " << label_name << " to be a sequence";
return Status(StatusCode::InvalidSchema,
"Expect properties for " + label_name + " to be a sequence");
Expand Down Expand Up @@ -579,7 +584,7 @@ static Status parse_edge_properties(YAML::Node node,
std::vector<PropertyType>& types,
std::vector<std::string>& names,
const std::string& version) {
if (!node) {
if (!node || node.IsNull()) {
VLOG(10) << "Found no edge properties specified for edge: " << label_name;
return Status::OK();
}
Expand Down
77 changes: 76 additions & 1 deletion python/graphscope/gsctl/tests/test_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,48 @@
},
}


modern_graph_with_empty_edge_property = {
"name": "modern_graph",
"description": "This is a test graph",
"schema": {
"vertex_types": [
{
"type_name": "person",
"properties": [
{
"property_name": "id",
"property_type": {"primitive_type": "DT_SIGNED_INT64"},
},
{
"property_name": "name",
"property_type": {"string": {"long_text": ""}},
},
{
"property_name": "age",
"property_type": {"primitive_type": "DT_SIGNED_INT32"},
},
],
"primary_keys": ["id"],
}
],
"edge_types": [
{
"type_name": "knows",
"vertex_type_pair_relations": [
{
"source_vertex": "person",
"destination_vertex": "person",
"relation": "MANY_TO_MANY",
}
],
"primary_keys": [],
}
],
},
}


modern_graph_vertex_only = {
"name": "modern_graph",
"description": "This is a test graph, only contains vertex",
Expand Down Expand Up @@ -383,7 +425,16 @@ def test_suit_case(self):
assert stored_procedure_id == "procedure_name"
delete_graph_by_id(graph_id_2)

def test_start_service_on_vertex_only_graph(self):
def test_corner_case_on_starting_service(self):
original_graph_id = None
status = list_service_status()
for s in status:
if s.status == "Running":
original_graph_id = s.graph_id
assert original_graph_id is not None

# case 1:
# start service on vertex only graph
graph_id = create_graph(modern_graph_vertex_only)
start_service(graph_id)
status = list_service_status()
Expand All @@ -392,6 +443,30 @@ def test_start_service_on_vertex_only_graph(self):
assert s.status == "Running"
else:
assert s.status == "Stopped"
stop_service()
delete_graph_by_id(graph_id)

# case 2:
# start service on graph with empty edge property
graph_id = create_graph(modern_graph_with_empty_edge_property)
start_service(original_graph_id)
status = list_service_status()
for s in status:
if s.graph_id == original_graph_id:
assert s.status == "Running"
else:
assert s.status == "Stopped"
stop_service()
delete_graph_by_id(graph_id)

# switch to original graph
start_service(original_graph_id)
status = list_service_status()
for s in status:
if s.graph_id == original_graph_id:
assert s.status == "Running"
else:
assert s.status == "Stopped"

def teardown_class(self):
disconnect_coordinator()
Loading