Skip to content

Commit

Permalink
fixing interactive ci
Browse files Browse the repository at this point in the history
Committed-by: [email protected] from Dev container
  • Loading branch information
zhanglei1949 committed Jan 2, 2025
1 parent eb31561 commit 88a7e22
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 16 deletions.
57 changes: 41 additions & 16 deletions flex/storages/metadata/graph_meta_store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const std::vector<PluginMeta>& get_builtin_plugin_metas() {
count_vertices.type = "cypher";
count_vertices.creation_time = GetCurrentTimeStamp();
count_vertices.update_time = GetCurrentTimeStamp();
count_vertices.params.push_back({"labelName", PropertyType::kString});
count_vertices.returns.push_back({"count", PropertyType::kInt32});
count_vertices.params.push_back({"labelName", PropertyType::kString, true});
count_vertices.returns.push_back({"count", PropertyType::kInt32, false});
builtin_plugins.push_back(count_vertices);

// pagerank
Expand All @@ -80,11 +80,11 @@ const std::vector<PluginMeta>& get_builtin_plugin_metas() {
pagerank.type = "cypher";
pagerank.creation_time = GetCurrentTimeStamp();
pagerank.update_time = GetCurrentTimeStamp();
pagerank.params.push_back({"vertex_label", PropertyType::kString});
pagerank.params.push_back({"edge_label", PropertyType::kString});
pagerank.params.push_back({"damping_factor", PropertyType::kDouble});
pagerank.params.push_back({"max_iterations", PropertyType::kInt32});
pagerank.params.push_back({"epsilon", PropertyType::kDouble});
pagerank.params.push_back({"vertex_label", PropertyType::kString, true});
pagerank.params.push_back({"edge_label", PropertyType::kString, true});
pagerank.params.push_back({"damping_factor", PropertyType::kDouble, false});
pagerank.params.push_back({"max_iterations", PropertyType::kInt32, false});
pagerank.params.push_back({"epsilon", PropertyType::kDouble, false});
pagerank.returns.push_back({"label_name", PropertyType::kString});
pagerank.returns.push_back({"vertex_oid", PropertyType::kInt64});
pagerank.returns.push_back({"pagerank", PropertyType::kDouble});
Expand All @@ -100,9 +100,9 @@ const std::vector<PluginMeta>& get_builtin_plugin_metas() {
k_neighbors.type = "cypher";
k_neighbors.creation_time = GetCurrentTimeStamp();
k_neighbors.update_time = GetCurrentTimeStamp();
k_neighbors.params.push_back({"label_name", PropertyType::kString});
k_neighbors.params.push_back({"oid", PropertyType::kInt64});
k_neighbors.params.push_back({"k", PropertyType::kInt32});
k_neighbors.params.push_back({"label_name", PropertyType::kString, true});
k_neighbors.params.push_back({"oid", PropertyType::kInt64, false});
k_neighbors.params.push_back({"k", PropertyType::kInt32, false});
k_neighbors.returns.push_back({"label_name", PropertyType::kString});
k_neighbors.returns.push_back({"vertex_oid", PropertyType::kInt64});
builtin_plugins.push_back(k_neighbors);
Expand All @@ -119,14 +119,14 @@ const std::vector<PluginMeta>& get_builtin_plugin_metas() {
shortest_path_among_three.creation_time = GetCurrentTimeStamp();
shortest_path_among_three.update_time = GetCurrentTimeStamp();
shortest_path_among_three.params.push_back(
{"label_name1", PropertyType::kString});
shortest_path_among_three.params.push_back({"oid1", PropertyType::kInt64});
{"label_name1", PropertyType::kString, true});
shortest_path_among_three.params.push_back({"oid1", PropertyType::kInt64, false});
shortest_path_among_three.params.push_back(
{"label_name2", PropertyType::kString});
shortest_path_among_three.params.push_back({"oid2", PropertyType::kInt64});
{"label_name2", PropertyType::kString, true});
shortest_path_among_three.params.push_back({"oid2", PropertyType::kInt64, false});
shortest_path_among_three.params.push_back(
{"label_name3", PropertyType::kString});
shortest_path_among_three.params.push_back({"oid3", PropertyType::kInt64});
{"label_name3", PropertyType::kString, true});
shortest_path_among_three.params.push_back({"oid3", PropertyType::kInt64, false});
shortest_path_among_three.returns.push_back(
{"shortest_path_among_three (label name, vertex oid)",
PropertyType::kString});
Expand All @@ -153,6 +153,7 @@ std::string Parameter::ToJson() const {
json.AddMember("name", name, json.GetAllocator());
json.AddMember("type", to_json(type, &json.GetAllocator()),
json.GetAllocator());
json.AddMember("allow_cast", allow_cast, json.GetAllocator());
return rapidjson_stringify(json);
}

Expand Down Expand Up @@ -329,6 +330,7 @@ void PluginMeta::ToJson(rapidjson::Value& json,
rapidjson::Document tempDoc(rapidjson::kObjectType, &allocator);
tempDoc.AddMember("name", param.name, allocator);
tempDoc.AddMember("type", to_json(param.type, &allocator), allocator);
tempDoc.AddMember("allow_cast", param.allow_cast, allocator);
params_json.PushBack(tempDoc, allocator);
}
json.AddMember("params", params_json, allocator);
Expand All @@ -337,6 +339,7 @@ void PluginMeta::ToJson(rapidjson::Value& json,
rapidjson::Document tempDoc(rapidjson::kObjectType, &allocator);
tempDoc.AddMember("name", ret.name, allocator);
tempDoc.AddMember("type", to_json(ret.type, &allocator), allocator);
tempDoc.AddMember("allow_cast", ret.allow_cast, allocator);
returns_json.PushBack(tempDoc, allocator);
}
json.AddMember("returns", returns_json, allocator);
Expand Down Expand Up @@ -370,6 +373,11 @@ void PluginMeta::setParamsFromJsonString(const rapidjson::Value& document) {
Parameter p;
p.name = param["name"].GetString();
p.type = from_json(param["type"]);
if (param.HasMember("allow_cast")) {
p.allow_cast = param["allow_cast"].GetBool();
} else {
p.allow_cast = false;
}
params.push_back(p);
}
} else {
Expand All @@ -384,6 +392,11 @@ void PluginMeta::setReturnsFromJsonString(const rapidjson::Value& value) {
Parameter p;
p.name = ret["name"].GetString();
p.type = from_json(ret["type"]);
if (ret.HasMember("allow_cast")) {
p.allow_cast = ret["allow_cast"].GetBool();
} else {
p.allow_cast = false;
}
returns.push_back(p);
}
} else {
Expand Down Expand Up @@ -814,6 +827,9 @@ CreatePluginMetaRequest CreatePluginMetaRequest::FromJson(
Parameter p;
p.name = param["name"].GetString();
from_json(param["type"], p.type);
if (param.HasMember("allow_cast")) {
p.allow_cast = param["allow_cast"].GetBool();
}
request.params.push_back(p);
}
}
Expand All @@ -822,6 +838,9 @@ CreatePluginMetaRequest CreatePluginMetaRequest::FromJson(
Parameter p;
p.name = ret["name"].GetString();
from_json(ret["type"], p.type);
if (ret.HasMember("allow_cast")) {
p.allow_cast = ret["allow_cast"].GetBool();
}
request.returns.push_back(p);
}
}
Expand Down Expand Up @@ -878,6 +897,9 @@ UpdatePluginMetaRequest UpdatePluginMetaRequest::FromJson(
Parameter p;
p.name = param["name"].GetString();
p.type = from_json(param["type"]);
if (param.HasMember("allow_cast")) {
p.allow_cast = param["allow_cast"].GetBool();
}
request.params->emplace_back(std::move(p));
}
}
Expand All @@ -887,6 +909,9 @@ UpdatePluginMetaRequest UpdatePluginMetaRequest::FromJson(
Parameter p;
p.name = ret["name"].GetString();
p.type = from_json(ret["type"]);
if (ret.HasMember("allow_cast")) {
p.allow_cast = ret["allow_cast"].GetBool();
}
request.returns->emplace_back(std::move(p));
}
}
Expand Down
1 change: 1 addition & 0 deletions flex/storages/metadata/graph_meta_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ using JobId = std::string;
struct Parameter {
std::string name;
PropertyType type;
bool allow_cast{false};

std::string ToJson() const;
};
Expand Down

0 comments on commit 88a7e22

Please sign in to comment.