diff --git a/src/query/plan/operator.cpp b/src/query/plan/operator.cpp index a091f22a3..e9f9ab313 100644 --- a/src/query/plan/operator.cpp +++ b/src/query/plan/operator.cpp @@ -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, diff --git a/src/query/procedure/mg_procedure_impl.hpp b/src/query/procedure/mg_procedure_impl.hpp index fd0292fe2..6336204f0 100644 --- a/src/query/procedure/mg_procedure_impl.hpp +++ b/src/query/procedure/mg_procedure_impl.hpp @@ -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}; diff --git a/src/query/procedure/module.hpp b/src/query/procedure/module.hpp index 82478257b..41a33eb26 100644 --- a/src/query/procedure/module.hpp +++ b/src/query/procedure/module.hpp @@ -235,6 +235,7 @@ void ConstructArguments(const std::vector &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.