8000 GraphNodes now copy the graph when cloned by goedderz · Pull Request #11345 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
GraphNodes now copy the graph when cloned
  • Loading branch information
goedderz committed Mar 27, 2020
commit f14a9256cb0f6ab7d9643b9cd21e92f9b9923d23
4 changes: 2 additions & 2 deletions arangod/Aql/GraphNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,12 @@ GraphNode::GraphNode(ExecutionPlan* plan, size_t id, TRI_vocbase_t* vocbase,
std::vector<std::unique_ptr<Collection>> const& vertexColls,
TRI_edge_direction_e defaultDirection,
std::vector<TRI_edge_direction_e> directions,
std::unique_ptr<BaseOptions> options)
std::unique_ptr<graph::BaseOptions> options, Graph const* graph)
: ExecutionNode(plan, id),
_vocbase(vocbase),
_vertexOutVariable(nullptr),
_edgeOutVariable(nullptr),
_graphObj(nullptr),
_graphObj(graph),
_tmpObjVariable(_plan->getAst()->variables()->createTemporaryVariable()),
_tmpObjVarNode(_plan->getAst()->createNodeReference(_tmpObjVariable)),
_tmpIdNode(_plan->getAst()->createNodeValueString("", 0)),
Expand Down
2 changes: 1 addition & 1 deletion arangod/Aql/GraphNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class GraphNode : public ExecutionNode {
std::vector<std::unique_ptr<Collection>> const& edgeColls,
std::vector<std::unique_ptr<Collection>> const& vertexColls,
TRI_edge_direction_e defaultDirection, std::vector<TRI_edge_direction_e> directions,
std::unique_ptr<graph::BaseOptions> options);
std::unique_ptr<graph::BaseOptions> options, graph::Graph const* graph);

/// @brief Clone constructor, used for constructors of derived classes.
/// Does not clone recursively, does not clone properties (`other.plan()` is
Expand Down
18 changes: 9 additions & 9 deletions arangod/Aql/KShortestPathsNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ KShortestPathsNode::KShortestPathsNode(
ExecutionPlan* plan, size_t id, TRI_vocbase_t* vocbase,
std::vector<std::unique_ptr<Collection>> const& edgeColls,
std::vector<std::unique_ptr<Collection>> const& vertexColls,
TRI_edge_direction_e defaultDirection,
std::vector<TRI_edge_direction_e> const& directions, Variable const* inStartVariable,
std::string const& startVertexId, Variable const* inTargetVariable,
std::string const& targetVertexId, std::unique_ptr<BaseOptions> options)
TRI_edge_direction_e defaultDirection, std::vector<TRI_edge_direction_e> const& directions,
Variable const* inStartVariable, std::string const& startVertexId,
Variable const* inTargetVariable, std::string const& targetVertexId,
std::unique_ptr<graph::BaseOptions> options, graph::Graph const* graph)
: GraphNode(plan, id, vocbase, edgeColls, vertexColls, defaultDirection,
directions, std::move(options)),
directions, std::move(options), graph),
_pathOutVariable(nullptr),
_inStartVariable(inStartVariable),
_startVertexId(startVertexId),
Expand Down Expand Up @@ -316,10 +316,10 @@ ExecutionNode* KShortestPathsNode::clone(ExecutionPlan* plan, bool withDependenc
auto oldOpts = static_cast<ShortestPathOptions*>(options());
std::unique_ptr<BaseOptions> tmp = std::make_unique<ShortestPathOptions>(*oldOpts);
auto c = std::make_unique<KShortestPathsNode>(plan, _id, _vocbase, _edgeColls,
_vertexColls, _defaultDirection,
_directions, _inStartVariable,
_startVertexId, _inTargetVariable,
_targetVertexId, std::move(tmp));
_vertexColls, _defaultDirection, _directions,
_inStartVariable, _startVertexId,
_inTargetVariable, _targetVertexId,
std::move(tmp), _graphObj);

kShortestPathsCloneHelper(*plan, *c, withProperties);

Expand Down
3 changes: 2 additions & 1 deletion arangod/Aql/KShortestPathsNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class KShortestPathsNode : public virtual GraphNode {
std::vector<TRI_edge_direction_e> const& directions,
Variable const* inStartVariable, std::string const& startVertexId,
Variable const* inTargetVariable, std::string const& targetVertexId,
std::unique_ptr<graph::BaseOptions> options);
std::unique_ptr<graph::BaseOptions> options,
graph::Graph const* graph);

public:
/// @brief return the type of the node
Expand Down
18 changes: 9 additions & 9 deletions arangod/Aql/ShortestPathNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ ShortestPathNode::ShortestPathNode(
ExecutionPlan* plan, size_t id, TRI_vocbase_t* vocbase,
std::vector<std::unique_ptr<Collection>> const& edgeColls,
std::vector<std::unique_ptr<Collection>> const& vertexColls,
TRI_edge_direction_e defaultDirection,
std::vector<TRI_edge_direction_e> const& directions, Variable const* inStartVariable,
std::string const& startVertexId, Variable const* inTargetVariable,
std::string const& targetVertexId, std::unique_ptr<BaseOptions> options)
TRI_edge_direction_e defaultDirection, std::vector<TRI_edge_direction_e> const& directions,
Variable const* inStartVariable, std::string const& startVertexId,
Variable const* inTargetVariable, std::string const& targetVertexId,
std::unique_ptr<BaseOptions> options, graph::Graph const* graph)
: GraphNode(plan, id, vocbase, edgeColls, vertexColls, defaultDirection,
directions, std::move(options)),
directions, std::move(options), graph),
_inStartVariable(inStartVariable),
_startVertexId(startVertexId),
_inTargetVariable(inTargetVariable),
Expand Down Expand Up @@ -308,10 +308,10 @@ ExecutionNode* ShortestPathNode::clone(ExecutionPlan* plan, bool withDependencie
auto oldOpts = static_cast<ShortestPathOptions*>(options());
std::unique_ptr<BaseOptions> tmp = std::make_unique<ShortestPathOptions>(*oldOpts);
auto c = std::make_unique<ShortestPathNode>(plan, _id, _vocbase, _edgeColls,
_vertexColls, _defaultDirection,
_directions, _inStartVariable,
_startVertexId, _inTargetVariable,
_targetVertexId, std::move(tmp));
_vertexColls, _defaultDirection, _directions,
_inStartVariable, _startVertexId,
_inTargetVariable, _targetVertexId,
std::move(tmp), _graphObj);
shortestPathCloneHelper(*plan, *c, withProperties);

return cloneHelper(std::move(c), withDependencies, withProperties);
Expand Down
2 changes: 1 addition & 1 deletion arangod/Aql/ShortestPathNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ShortestPathNode : public virtual GraphNode {
std::vector<TRI_edge_direction_e> const& directions,
Variable const* inStartVariable, std::string const& startVertexId,
Variable const* inTargetVariable, std::string const& targetVertexId,
std::unique_ptr<graph::BaseOptions> options);
std::unique_ptr<graph::BaseOptions> options, graph::Graph const* graph);

public:
/// @brief return the type of the node
Expand Down
7 changes: 4 additions & 3 deletions arangod/Aql/TraversalNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ TraversalNode::TraversalNode(ExecutionPlan* plan, size_t id, TRI_vocbase_t* vocb
Variable const* inVariable, std::string const& vertexId,
TRI_edge_direction_e defaultDirection,
std::vector<TRI_edge_direction_e> const& directions,
std::unique_ptr<BaseOptions> options)
std::unique_ptr<graph::BaseOptions> options,
graph::Graph const* graph)
: GraphNode(plan, id, vocbase, edgeColls, vertexColls, defaultDirection,
directions, std::move(options)),
directions, std::move(options), graph),
_pathOutVariable(nullptr),
_inVariable(inVariable),
_vertexId(vertexId),
Expand Down Expand Up @@ -548,7 +549,7 @@ ExecutionNode* TraversalNode::clone(ExecutionPlan* plan, bool withDependencies,
std::unique_ptr<BaseOptions> tmp = std::make_unique<TraverserOptions>(*oldOpts, true);
auto c = std::make_unique<TraversalNode>(plan, _id, _vocbase, _edgeColls, _vertexColls,
_inVariable, _vertexId, _defaultDirection,
_directions, std::move(tmp));
_directions, std::move(tmp), _graphObj);

traversalCloneHelper(*plan, *c, withProperties);

Expand Down
2 changes: 1 addition & 1 deletion arangod/Aql/TraversalNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class TraversalNode : public virtual GraphNode {
Variable const* inVariable, std::string const& vertexId,
TRI_edge_direction_e defaultDirection,
std::vector<TRI_edge_direction_e> const& directions,
std::unique_ptr<graph::BaseOptions> options);
std::unique_ptr<graph::BaseOptions> options, graph::Graph const* graph);

protected:
/// @brief Clone constructor, used for constructors of derived classes.
Expand Down
0