mirror of https://gitee.com/bigwinds/arangodb
remove unnecessary casts
This commit is contained in:
parent
0ad639d5cc
commit
ba81e7aa82
|
@ -182,8 +182,7 @@ ExecutionNode* CollectNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
}
|
||||
}
|
||||
|
||||
auto c =
|
||||
new CollectNode(plan, _id, _options, groupVariables, aggregateVariables,
|
||||
auto c = std::make_unique<CollectNode>(plan, _id, _options, groupVariables, aggregateVariables,
|
||||
expressionVariable, outVariable, _keepVariables,
|
||||
_variableMap, _count, _isDistinctCommand);
|
||||
|
||||
|
@ -192,9 +191,9 @@ ExecutionNode* CollectNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
c->specialized();
|
||||
}
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief helper struct for finding variables
|
||||
|
|
|
@ -1366,14 +1366,13 @@ ExecutionNode* EnumerateCollectionNode::clone(ExecutionPlan* plan,
|
|||
TRI_ASSERT(outVariable != nullptr);
|
||||
}
|
||||
|
||||
auto c = new EnumerateCollectionNode(plan, _id, _vocbase, _collection,
|
||||
outVariable, _random);
|
||||
auto c = std::make_unique<EnumerateCollectionNode>(plan, _id, _vocbase, _collection, outVariable, _random);
|
||||
|
||||
c->projections(_projections);
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief the cost of an enumerate collection node is a multiple of the cost of
|
||||
|
@ -1438,11 +1437,11 @@ ExecutionNode* EnumerateListNode::clone(ExecutionPlan* plan,
|
|||
inVariable = plan->getAst()->variables()->createVariable(inVariable);
|
||||
}
|
||||
|
||||
auto c = new EnumerateListNode(plan, _id, inVariable, outVariable);
|
||||
auto c = std::make_unique<EnumerateListNode>(plan, _id, inVariable, outVariable);
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief the cost of an enumerate list node
|
||||
|
@ -1590,13 +1589,13 @@ ExecutionNode* CalculationNode::clone(ExecutionPlan* plan,
|
|||
outVariable = plan->getAst()->variables()->createVariable(outVariable);
|
||||
}
|
||||
|
||||
auto c = new CalculationNode(plan, _id, _expression->clone(plan, plan->getAst()),
|
||||
auto c = std::make_unique<CalculationNode>(plan, _id, _expression->clone(plan, plan->getAst()),
|
||||
conditionVariable, outVariable);
|
||||
c->_canRemoveIfThrows = _canRemoveIfThrows;
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief estimateCost
|
||||
|
@ -1672,12 +1671,12 @@ ExecutionNode* SubqueryNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
if (withProperties) {
|
||||
outVariable = plan->getAst()->variables()->createVariable(outVariable);
|
||||
}
|
||||
auto c = new SubqueryNode(
|
||||
auto c = std::make_unique<SubqueryNode>(
|
||||
plan, _id, _subquery->clone(plan, true, withProperties), outVariable);
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief whether or not the subquery is a data-modification operation
|
||||
|
@ -1872,11 +1871,12 @@ ExecutionNode* FilterNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
if (withProperties) {
|
||||
inVariable = plan->getAst()->variables()->createVariable(inVariable);
|
||||
}
|
||||
auto c = new FilterNode(plan, _id, inVariable);
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
auto c = std::make_unique<FilterNode>(plan, _id, inVariable);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief estimateCost
|
||||
|
@ -1930,11 +1930,11 @@ ExecutionNode* ReturnNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
inVariable = plan->getAst()->variables()->createVariable(inVariable);
|
||||
}
|
||||
|
||||
auto c = new ReturnNode(plan, _id, inVariable);
|
||||
auto c = std::make_unique<ReturnNode>(plan, _id, inVariable);
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief estimateCost
|
||||
|
|
|
@ -628,11 +628,11 @@ class SingletonNode : public ExecutionNode {
|
|||
/// @brief clone ExecutionNode recursively
|
||||
ExecutionNode* clone(ExecutionPlan* plan, bool withDependencies,
|
||||
bool withProperties) const override final {
|
||||
auto c = new SingletonNode(plan, _id);
|
||||
auto c = std::make_unique<SingletonNode>(plan, _id);
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief the cost of a singleton is 1
|
||||
|
@ -843,15 +843,15 @@ class LimitNode : public ExecutionNode {
|
|||
/// @brief clone ExecutionNode recursively
|
||||
ExecutionNode* clone(ExecutionPlan* plan, bool withDependencies,
|
||||
bool withProperties) const override final {
|
||||
auto c = new LimitNode(plan, _id, _offset, _limit);
|
||||
auto c = std::make_unique<LimitNode>(plan, _id, _offset, _limit);
|
||||
|
||||
if (_fullCount) {
|
||||
c->setFullCount();
|
||||
}
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief estimateCost
|
||||
|
@ -1281,11 +1281,11 @@ class NoResultsNode : public ExecutionNode {
|
|||
/// @brief clone ExecutionNode recursively
|
||||
ExecutionNode* clone(ExecutionPlan* plan, bool withDependencies,
|
||||
bool withProperties) const override final {
|
||||
auto c = new NoResultsNode(plan, _id);
|
||||
auto c = std::make_unique<NoResultsNode>(plan, _id);
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief the cost of a NoResults is 0
|
||||
|
|
|
@ -239,16 +239,16 @@ ExecutionNode* IndexNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
outVariable = plan->getAst()->variables()->createVariable(outVariable);
|
||||
}
|
||||
|
||||
auto c = new IndexNode(plan, _id, _vocbase, _collection, outVariable,
|
||||
auto c = std::make_unique<IndexNode>(plan, _id, _vocbase, _collection, outVariable,
|
||||
_indexes, _condition->clone(), _options);
|
||||
|
||||
c->projections(_projections);
|
||||
c->needsGatherNodeSort(_needsGatherNodeSort);
|
||||
c->initIndexCoversProjections();
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief destroy the IndexNode
|
||||
|
|
|
@ -133,15 +133,15 @@ ExecutionNode* RemoveNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
inVariable = plan->getAst()->variables()->createVariable(inVariable);
|
||||
}
|
||||
|
||||
auto c = new RemoveNode(plan, _id, _vocbase, _collection, _options,
|
||||
auto c = std::make_unique<RemoveNode>(plan, _id, _vocbase, _collection, _options,
|
||||
inVariable, outVariableOld);
|
||||
if (!_countStats) {
|
||||
c->disableStatistics();
|
||||
}
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
InsertNode::InsertNode(ExecutionPlan* plan, arangodb::velocypack::Slice const& base)
|
||||
|
@ -184,15 +184,15 @@ ExecutionNode* InsertNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
inVariable = plan->getAst()->variables()->createVariable(inVariable);
|
||||
}
|
||||
|
||||
auto c = new InsertNode(plan, _id, _vocbase, _collection, _options,
|
||||
auto c = std::make_unique<InsertNode>(plan, _id, _vocbase, _collection, _options,
|
||||
inVariable, outVariableNew);
|
||||
if (!_countStats) {
|
||||
c->disableStatistics();
|
||||
}
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
UpdateNode::UpdateNode(ExecutionPlan* plan, arangodb::velocypack::Slice const& base)
|
||||
|
@ -251,16 +251,15 @@ ExecutionNode* UpdateNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
inDocVariable = plan->getAst()->variables()->createVariable(inDocVariable);
|
||||
}
|
||||
|
||||
auto c =
|
||||
new UpdateNode(plan, _id, _vocbase, _collection, _options, inDocVariable,
|
||||
auto c = std::make_unique<UpdateNode>(plan, _id, _vocbase, _collection, _options, inDocVariable,
|
||||
inKeyVariable, outVariableOld, outVariableNew);
|
||||
if (!_countStats) {
|
||||
c->disableStatistics();
|
||||
}
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
ReplaceNode::ReplaceNode(ExecutionPlan* plan,
|
||||
|
@ -320,16 +319,15 @@ ExecutionNode* ReplaceNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
inDocVariable = plan->getAst()->variables()->createVariable(inDocVariable);
|
||||
}
|
||||
|
||||
auto c =
|
||||
new ReplaceNode(plan, _id, _vocbase, _collection, _options, inDocVariable,
|
||||
auto c = std::make_unique<ReplaceNode>(plan, _id, _vocbase, _collection, _options, inDocVariable,
|
||||
inKeyVariable, outVariableOld, outVariableNew);
|
||||
if (!_countStats) {
|
||||
c->disableStatistics();
|
||||
}
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
UpsertNode::UpsertNode(ExecutionPlan* plan, arangodb::velocypack::Slice const& base)
|
||||
|
@ -385,14 +383,14 @@ ExecutionNode* UpsertNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
plan->getAst()->variables()->createVariable(updateVariable);
|
||||
}
|
||||
|
||||
auto c = new UpsertNode(plan, _id, _vocbase, _collection, _options,
|
||||
auto c = std::make_unique<UpsertNode>(plan, _id, _vocbase, _collection, _options,
|
||||
inDocVariable, insertVariable, updateVariable,
|
||||
outVariableNew, _isReplace);
|
||||
if (!_countStats) {
|
||||
c->disableStatistics();
|
||||
}
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ ExecutionNode* ShortestPathNode::clone(ExecutionPlan* plan,
|
|||
auto oldOpts = static_cast<ShortestPathOptions*>(options());
|
||||
std::unique_ptr<BaseOptions> tmp =
|
||||
std::make_unique<ShortestPathOptions>(*oldOpts);
|
||||
auto c = new ShortestPathNode(plan, _id, _vocbase, _edgeColls, _vertexColls,
|
||||
auto c = std::make_unique<ShortestPathNode>(plan, _id, _vocbase, _edgeColls, _vertexColls,
|
||||
_directions, _inStartVariable, _startVertexId,
|
||||
_inTargetVariable, _targetVertexId, std::move(tmp));
|
||||
if (usesVertexOutVariable()) {
|
||||
|
@ -304,9 +304,9 @@ ExecutionNode* ShortestPathNode::clone(ExecutionPlan* plan,
|
|||
c->_fromCondition = _fromCondition->clone(_plan->getAst());
|
||||
c->_toCondition = _toCondition->clone(_plan->getAst());
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
double ShortestPathNode::estimateCost(size_t& nrItems) const {
|
||||
|
|
|
@ -56,7 +56,6 @@ class ShortestPathNode : public GraphNode {
|
|||
~ShortestPathNode();
|
||||
|
||||
/// @brief Internal constructor to clone the node.
|
||||
private:
|
||||
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,
|
||||
|
|
|
@ -78,11 +78,11 @@ class SortNode : public ExecutionNode {
|
|||
/// @brief clone ExecutionNode recursively
|
||||
ExecutionNode* clone(ExecutionPlan* plan, bool withDependencies,
|
||||
bool withProperties) const override final {
|
||||
auto c = new SortNode(plan, _id, _elements, _stable);
|
||||
auto c = std::make_unique<SortNode>(plan, _id, _elements, _stable);
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief estimateCost
|
||||
|
|
|
@ -400,7 +400,7 @@ ExecutionNode* TraversalNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
auto oldOpts = static_cast<TraverserOptions*>(options());
|
||||
std::unique_ptr<BaseOptions> tmp =
|
||||
std::make_unique<TraverserOptions>(*oldOpts);
|
||||
auto c = new TraversalNode(plan, _id, _vocbase, _edgeColls, _vertexColls,
|
||||
auto c = std::make_unique<TraversalNode>(plan, _id, _vocbase, _edgeColls, _vertexColls,
|
||||
_inVariable, _vertexId, _directions, std::move(tmp));
|
||||
|
||||
if (usesVertexOutVariable()) {
|
||||
|
@ -472,9 +472,9 @@ ExecutionNode* TraversalNode::clone(ExecutionPlan* plan, bool withDependencies,
|
|||
c->checkConditionsDefined();
|
||||
#endif
|
||||
|
||||
cloneHelper(c, withDependencies, withProperties);
|
||||
cloneHelper(c.get(), withDependencies, withProperties);
|
||||
|
||||
return ExecutionNode::castTo<ExecutionNode*>(c);
|
||||
return c.release();
|
||||
}
|
||||
|
||||
/// @brief the cost of a traversal node
|
||||
|
|
|
@ -89,7 +89,6 @@ class TraversalNode : public GraphNode {
|
|||
~TraversalNode();
|
||||
|
||||
/// @brief Internal constructor to clone the node.
|
||||
private:
|
||||
TraversalNode(ExecutionPlan* plan, size_t id, TRI_vocbase_t* vocbase,
|
||||
std::vector<std::unique_ptr<aql::Collection>> const& edgeColls,
|
||||
std::vector<std::unique_ptr<aql::Collection>> const& vertexColls,
|
||||
|
|
Loading…
Reference in New Issue