add possibility to send graph, ignore it

This commit is contained in:
antoniofilipovic
2022-07-27 11:46:46 +02:00
parent 78c459de1a
commit 8fb770568f
3 changed files with 10 additions and 0 deletions

View File

@@ -3739,6 +3739,13 @@ void CallCustomProcedure(const std::string_view fully_qualified_procedure_name,
for (auto *expression : args) {
args_list.emplace_back(expression->Accept(*evaluator));
}
const query::Graph *subgraph;
if (!args_list.empty() && args_list.front().type() == TypedValue::Type::Graph) {
subgraph = &args_list.front().ValueGraph();
args_list.erase(args_list.begin());
}
// if we have graph at first element, it is okay to have 1+ element here
procedure::ConstructArguments(args_list, proc, fully_qualified_procedure_name, proc_args, graph);
if (memory_limit) {
SPDLOG_INFO("Running '{}' with memory limit of {}", fully_qualified_procedure_name,

View File

@@ -577,6 +577,8 @@ struct mgp_graph {
// `ctx` field is out of place here.
memgraph::query::ExecutionContext *ctx;
// memgraph:::query::Graph *subraph;
static mgp_graph WritableGraph(memgraph::query::DbAccessor &acc, memgraph::storage::View view,
memgraph::query::ExecutionContext &ctx) {
return mgp_graph{&acc, view, &ctx};

View File

@@ -235,6 +235,7 @@ void ConstructArguments(const std::vector<TypedValue> &args, const TCall &callab
throw QueryRuntimeException("'{}' argument named '{}' at position {} must be of type {}.", fully_qualified_name,
name, i, type->GetPresentableName());
}
// why do we move graph here?
args_list.elems.emplace_back(std::move(arg), &graph);
}
// Fill missing optional arguments with their default values.