8000 GraphNodes now copy the graph when cloned (#11345) · arangodb/arangodb@0685746 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0685746

Browse files
authored
GraphNodes now copy the graph when cloned (#11345)
* GraphNodes now copy the graph when cloned * Fixed compile error on Windows
1 parent 8d17d89 commit 0685746

File tree

8 files changed

+30
-27
lines changed

8 files changed

+30
-27
lines changed

arangod/Aql/GraphNode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,12 @@ GraphNode::GraphNode(ExecutionPlan* plan, size_t id, TRI_vocbase_t* vocbase,
410410
std::vector<std::unique_ptr<Collection>> const& vertexColls,
411411
TRI_edge_direction_e defaultDirection,
412412
std::vector<TRI_edge_direction_e> directions,
413-
std::unique_ptr<BaseOptions> options)
413+
std::unique_ptr<graph::BaseOptions> options, Graph const* graph)
414414
: ExecutionNode(plan, id),
415415
_vocbase(vocbase),
416416
_vertexOutVariable(nullptr),
417417
_edgeOutVariable(nullptr),
418-
_graphObj(nullptr),
418+
_graphObj(graph),
419419
_tmpObjVariable(_plan->getAst()->variables()->createTemporaryVariable()),
420420
_tmpObjVarNode(_plan->getAst()->createNodeReference(_tmpObjVariable)),
421421
_tmpIdNode(_plan->getAst()->createNodeValueString("", 0)),

arangod/Aql/GraphNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class GraphNode : public ExecutionNode {
7474
std::vector<std::unique_ptr<Collection>> const& edgeColls,
7575
std::vector<std::unique_ptr<Collection>> const& vertexColls,
7676
TRI_edge_direction_e defaultDirection, std::vector<TRI_edge_direction_e> directions,
77-
std::unique_ptr<graph::BaseOptions> options);
77+
std::unique_ptr<graph::BaseOptions> options, graph::Graph const* graph);
7878

7979
/// @brief Clone constructor, used for constructors of derived classes.
8080
/// Does not clone recursively, does not clone properties (`other.plan()` is

arangod/Aql/KShortestPathsNode.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ KShortestPathsNode::KShortestPathsNode(
147147
ExecutionPlan* plan, size_t id, TRI_vocbase_t* vocbase,
148148
std::vector<std::unique_ptr<Collection>> const& edgeColls,
149149
std::vector<std::unique_ptr<Collection>> const& vertexColls,
150-
TRI_edge_direction_e defaultDirection,
151-
std::vector<TRI_edge_direction_e> const& directions, Variable const* inStartVariable,
152-
std::string const& startVertexId, Variable const* inTargetVariable,
153-
std::string const& targetVertexId, std::unique_ptr<BaseOptions> options)
150+
TRI_edge_direction_e defaultDirection, std::vector<TRI_edge_direction_e> const& directions,
151+
Variable const* inStartVariable, std::string const& startVertexId,
152+
Variable const* inTargetVariable, std::string const& targetVertexId,
153+
std::unique_ptr<graph::BaseOptions> options, graph::Graph const* graph)
154154
: GraphNode(plan, id, vocbase, edgeColls, vertexColls, defaultDirection,
155-
directions, std::move(options)),
155+
directions, std::move(options), graph),
156156
_pathOutVariable(nullptr),
157157
_inStartVariable(inStartVariable),
158158
_startVertexId(startVertexId),
@@ -316,10 +316,10 @@ ExecutionNode* KShortestPathsNode::clone(ExecutionPlan* plan, bool withDependenc
316316
auto oldOpts = static_cast<ShortestPathOptions*>(options());
317317
std::unique_ptr<BaseOptions> tmp = std::make_unique<ShortestPathOptions>(*oldOpts);
318318
auto c = std::make_unique<KShortestPathsNode>(plan, _id, _vocbase, _edgeColls,
319-
_vertexColls, _defaultDirection,
320-
_directions, _inStartVariable,
321-
_startVertexId, _inTargetVariable,
322-
_targetVertexId, std::move(tmp));
319+
_vertexColls, _defaultDirection, _directions,
320+
_inStartVariable, _startVertexId,
321+
_inTargetVariable, _targetVertexId,
322+
std::move(tmp), _graphObj);
323323

324324
kShortestPathsCloneHelper(*plan, *c, withProperties);
325325

arangod/Aql/KShortestPathsNode.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ class KShortestPathsNode : public virtual GraphNode {
7171
std::vector<TRI_edge_direction_e> const& directions,
7272
Variable const* inStartVariable, std::string const& startVertexId,
7373
Variable const* inTargetVariable, std::string const& targetVertexId,
74-
std::unique_ptr<graph::BaseOptions> options);
74+
std::unique_ptr<graph::BaseOptions> options,
75+
graph::Graph const* graph);
7576

7677
public:
7778
/// @brief return the type of the node

arangod/Aql/ShortestPathNode.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ ShortestPathNode::ShortestPathNode(
145145
ExecutionPlan* plan, size_t id, TRI_vocbase_t* vocbase,
146146
std::vector<std::unique_ptr<Collection>> const& edgeColls,
147147
std::vector<std::unique_ptr<Collection>> const& vertexColls,
148-
TRI_edge_direction_e defaultDirection,
149-
std::vector<TRI_edge_direction_e> const& directions, Variable const* inStartVariable,
150-
std::string const& startVertexId, Variable const* inTargetVariable,
151-
std::string const& targetVertexId, std::unique_ptr<BaseOptions> options)
148+
TRI_edge_direction_e defaultDirection, std::vector<TRI_edge_direction_e> const& directions,
149+
Variable const* inStartVariable, std::string const& startVertexId,
150+
Variable const* inTargetVariable, std::string const& targetVertexId,
151+
std::unique_ptr<BaseOptions> options, graph::Graph const* graph)
152152
: GraphNode(plan, id, vocbase, edgeColls, vertexColls, defaultDirection,
153-
directions, std::move(options)),
153+
directions, std::move(options), graph),
154154
_inStartVariable(inStartVariable),
155155
_startVertexId(startVertexId),
156156
_inTargetVariable(inTargetVariable),
@@ -308,10 +308,10 @@ ExecutionNode* ShortestPathNode::clone(ExecutionPlan* plan, bool withDependencie
308308
auto oldOpts = static_cast<ShortestPathOptions*>(options());
309309
std::unique_ptr<BaseOptions> tmp = std::make_unique<ShortestPathOptions>(*oldOpts);
310310
auto c = std::make_unique<ShortestPathNode>(plan, _id, _vocbase, _edgeColls,
311-
_vertexColls, _defaultDirection,
312-
_directions, _inStartVariable,
313-
_startVertexId, _inTargetVariable,
314-
_targetVertexId, std::move(tmp));
311+
_vertexColls, _defaultDirection, _directions,
312+
_inStartVariable, _startVertexId,
313+
_inTargetVariable, _targetVertexId,
314+
std::move(tmp), _graphObj);
315315
shortestPathCloneHelper(*plan, *c, withProperties);
316316

317317
return cloneHelper(std::move(c), withDependencies, withProperties);

arangod/Aql/ShortestPathNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class ShortestPathNode : public virtual GraphNode {
6969
std::vector<TRI_edge_direction_e> const& directions,
7070
Variable const* inStartVariable, std::string const& startVertexId,
7171
Variable const* inTargetVariable, std::string const& targetVertexId,
72-
std::unique_ptr<graph::BaseOptions> options);
72+
std::unique_ptr<graph::BaseOptions> options, graph::Graph const* graph);
7373

7474
public:
7575
/// @brief return the type of the node

arangod/Aql/TraversalNode.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include <velocypack/Iterator.h>
5858
#include <velocypack/velocypack-aliases.h>
5959

60+
using namespace arangodb;
6061
using namespace arangodb::aql;
6162
using namespace arangodb::basics;
6263
using namespace arangodb::graph;
@@ -168,9 +169,10 @@ TraversalNode::TraversalNode(ExecutionPlan* plan, size_t id, TRI_vocbase_t* vocb
168169
Variable const* inVariable, std::string const& vertexId,
169170
TRI_edge_direction_e defaultDirection,
170171
std::vector<TRI_edge_direction_e> const& directions,
171-
std::unique_ptr<BaseOptions> options)
172+
std::unique_ptr<graph::BaseOptions> options,
173+
graph::Graph const* graph)
172174
: GraphNode(plan, id, vocbase, edgeColls, vertexColls, defaultDirec A3E2 tion,
173-
directions, std::move(options)),
175+
directions, std::move(options), graph),
174176
_pathOutVariable(nullptr),
175177
_inVariable(inVariable),
176178
_vertexId(vertexId),
@@ -548,7 +550,7 @@ ExecutionNode* TraversalNode::clone(ExecutionPlan* plan, bool withDependencies,
548550
std::unique_ptr<BaseOptions> tmp = std::make_unique<TraverserOptions>(*oldOpts, true);
549551
auto c = std::make_unique<TraversalNode>(plan, _id, _vocbase, _edgeColls, _vertexColls,
550552
_inVariable, _vertexId, _defaultDirection,
551-
_directions, std::move(tmp));
553+
_directions, std::move(tmp), _graphObj);
552554

553555
traversalCloneHelper(*plan, *c, withProperties);
554556

arangod/Aql/TraversalNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class TraversalNode : public virtual GraphNode {
9292
Variable const* inVariable, std::string const& vertexId,
9393
TRI_edge_direction_e defaultDirection,
9494
std::vector<TRI_edge_direction_e> const& directions,
95-
std::unique_ptr<graph::BaseOptions> options);
95+
std::unique_ptr<graph::BaseOptions> options, graph::Graph const* graph);
9696

9797
protected:
9898
/// @brief Clone constructor, used for constructors of derived classes.

0 commit comments

Comments
 (0)
0