1
0
Fork 0

Merge branch 'aql2' of https://github.com/triAGENS/ArangoDB into aql2

This commit is contained in:
Jan Steemann 2014-08-01 11:21:17 +02:00
commit af9dbdba85
6 changed files with 310 additions and 313 deletions

View File

@ -43,7 +43,7 @@ int ExecutionBlock::bind (std::map<std::string, struct TRI_json_s*>* params) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief functionality to walk an execution plan recursively /// @brief functionality to walk an execution block recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ExecutionBlock::walk (WalkerWorker* worker) { void ExecutionBlock::walk (WalkerWorker* worker) {
@ -60,7 +60,7 @@ void ExecutionBlock::walk (WalkerWorker* worker) {
(*it)->walk(worker); (*it)->walk(worker);
} }
// Now handle a subquery: // Now handle a subquery:
if (_exePlan->getType() == ExecutionPlan::SUBQUERY) { if (_exePlan->getType() == ExecutionNode::SUBQUERY) {
// auto p = static_cast<SubqueryBlock*>(this); // auto p = static_cast<SubqueryBlock*>(this);
if (worker->enterSubquery(this, nullptr)) { ; // p->_subquery if (worker->enterSubquery(this, nullptr)) { ; // p->_subquery
// p->_subquery->walk(worker); // p->_subquery->walk(worker);
@ -75,26 +75,26 @@ void ExecutionBlock::walk (WalkerWorker* worker) {
// --SECTION-- factory for instanciation of plans // --SECTION-- factory for instanciation of plans
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
ExecutionBlock* ExecutionBlock::instanciatePlan (ExecutionPlan const* ep) { ExecutionBlock* ExecutionBlock::instanciatePlan (ExecutionNode const* ep) {
ExecutionBlock* eb; ExecutionBlock* eb;
switch (ep->getType()) { switch (ep->getType()) {
case ExecutionPlan::SINGLETON: { case ExecutionNode::SINGLETON: {
eb = new SingletonBlock(static_cast<SingletonPlan const*>(ep)); eb = new SingletonBlock(static_cast<SingletonNode const*>(ep));
break; break;
} }
case ExecutionPlan::ENUMERATE_COLLECTION: { case ExecutionNode::ENUMERATE_COLLECTION: {
eb = new EnumerateCollectionBlock(static_cast<EnumerateCollectionPlan const*>(ep)); eb = new EnumerateCollectionBlock(static_cast<EnumerateCollectionNode const*>(ep));
break; break;
} }
case ExecutionPlan::ROOT: { case ExecutionNode::ROOT: {
eb = new RootBlock(static_cast<RootPlan const*>(ep)); eb = new RootBlock(static_cast<RootNode const*>(ep));
break; break;
} }
default: { default: {
THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED); THROW_ARANGO_EXCEPTION(TRI_ERROR_NOT_IMPLEMENTED);
} }
} }
vector<ExecutionPlan*> deps = ep->getDependencies(); vector<ExecutionNode*> deps = ep->getDependencies();
for (auto it = deps.begin(); it != deps.end();++it) { for (auto it = deps.begin(); it != deps.end();++it) {
eb->addDependency(instanciatePlan(*it)); eb->addDependency(instanciatePlan(*it));
} }

View File

@ -48,7 +48,7 @@ namespace triagens {
class ExecutionBlock { class ExecutionBlock {
public: public:
ExecutionBlock (ExecutionPlan const* ep) ExecutionBlock (ExecutionNode const* ep)
: _exePlan(ep), _done(false), _depth(0) { } : _exePlan(ep), _done(false), _depth(0) { }
virtual ~ExecutionBlock (); virtual ~ExecutionBlock ();
@ -100,7 +100,7 @@ namespace triagens {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief functionality to walk an execution plan recursively /// @brief functionality to walk an execution block recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class WalkerWorker { class WalkerWorker {
@ -187,49 +187,49 @@ namespace triagens {
} }
virtual void after (ExecutionBlock *eb) { virtual void after (ExecutionBlock *eb) {
switch (eb->getPlan()->getType()) { switch (eb->getPlanNode()->getType()) {
case ExecutionPlan::ENUMERATE_COLLECTION: { case ExecutionNode::ENUMERATE_COLLECTION: {
depth++; depth++;
nrVarsHere.push_back(1); nrVarsHere.push_back(1);
nrVars.push_back(1 + nrVars.back()); nrVars.push_back(1 + nrVars.back());
auto ep = static_cast<EnumerateCollectionPlan const*>(eb->getPlan()); auto ep = static_cast<EnumerateCollectionNode const*>(eb->getPlanNode());
varInfo.insert(make_pair(ep->_outVariable->id, varInfo.insert(make_pair(ep->_outVariable->id,
VarInfo(depth, totalNrVars))); VarInfo(depth, totalNrVars)));
totalNrVars++; totalNrVars++;
break; break;
} }
case ExecutionPlan::ENUMERATE_LIST: { case ExecutionNode::ENUMERATE_LIST: {
depth++; depth++;
nrVarsHere.push_back(1); nrVarsHere.push_back(1);
nrVars.push_back(1 + nrVars.back()); nrVars.push_back(1 + nrVars.back());
auto ep = static_cast<EnumerateListPlan const*>(eb->getPlan()); auto ep = static_cast<EnumerateListNode const*>(eb->getPlanNode());
varInfo.insert(make_pair(ep->_outVariable->id, varInfo.insert(make_pair(ep->_outVariable->id,
VarInfo(depth, totalNrVars))); VarInfo(depth, totalNrVars)));
totalNrVars++; totalNrVars++;
break; break;
} }
case ExecutionPlan::CALCULATION: { case ExecutionNode::CALCULATION: {
nrVarsHere[depth]++; nrVarsHere[depth]++;
nrVars[depth]++; nrVars[depth]++;
auto ep = static_cast<CalculationPlan const*>(eb->getPlan()); auto ep = static_cast<CalculationNode const*>(eb->getPlanNode());
varInfo.insert(make_pair(ep->_outVariable->id, varInfo.insert(make_pair(ep->_outVariable->id,
VarInfo(depth, totalNrVars))); VarInfo(depth, totalNrVars)));
totalNrVars++; totalNrVars++;
break; break;
} }
case ExecutionPlan::PROJECTION: { case ExecutionNode::PROJECTION: {
nrVarsHere[depth]++; nrVarsHere[depth]++;
nrVars[depth]++; nrVars[depth]++;
auto ep = static_cast<ProjectionPlan const*>(eb->getPlan()); auto ep = static_cast<ProjectionNode const*>(eb->getPlanNode());
varInfo.insert(make_pair(ep->_outVariable->id, varInfo.insert(make_pair(ep->_outVariable->id,
VarInfo(depth, totalNrVars))); VarInfo(depth, totalNrVars)));
totalNrVars++; totalNrVars++;
break; break;
} }
case ExecutionPlan::SUBQUERY: { case ExecutionNode::SUBQUERY: {
nrVarsHere[depth]++; nrVarsHere[depth]++;
nrVars[depth]++; nrVars[depth]++;
auto ep = static_cast<SubqueryPlan const*>(eb->getPlan()); auto ep = static_cast<SubqueryNode const*>(eb->getPlanNode());
varInfo.insert(make_pair(ep->_outVariable->id, varInfo.insert(make_pair(ep->_outVariable->id,
VarInfo(depth, totalNrVars))); VarInfo(depth, totalNrVars)));
totalNrVars++; totalNrVars++;
@ -441,16 +441,16 @@ namespace triagens {
return 0; return 0;
} }
ExecutionPlan const* getPlan () { ExecutionNode const* getPlanNode () {
return _exePlan; return _exePlan;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief our corresponding ExecutionPlan node /// @brief our corresponding ExecutionNode node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
protected: protected:
ExecutionPlan const* _exePlan; ExecutionNode const* _exePlan;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief our dependent nodes /// @brief our dependent nodes
@ -489,11 +489,11 @@ namespace triagens {
std::shared_ptr<VarOverview> _varOverview; std::shared_ptr<VarOverview> _varOverview;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief a static factory for ExecutionBlocks from ExecutionPlans /// @brief a static factory for ExecutionBlocks from ExecutionNodes
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
public: public:
static ExecutionBlock* instanciatePlan (ExecutionPlan const* ep); static ExecutionBlock* instanciatePlan (ExecutionNode const* ep);
}; };
@ -509,7 +509,7 @@ namespace triagens {
/// @brief constructor /// @brief constructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
SingletonBlock (SingletonPlan const* ep) SingletonBlock (SingletonNode const* ep)
: ExecutionBlock(ep) { : ExecutionBlock(ep) {
} }
@ -588,7 +588,7 @@ namespace triagens {
/// @brief constructor /// @brief constructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
EnumerateCollectionBlock (EnumerateCollectionPlan const* ep) EnumerateCollectionBlock (EnumerateCollectionNode const* ep)
: ExecutionBlock(ep), _posInAllDocs(0) { : ExecutionBlock(ep), _posInAllDocs(0) {
} }
@ -618,7 +618,7 @@ namespace triagens {
return res; return res;
} }
auto p = reinterpret_cast<EnumerateCollectionPlan const*>(_exePlan); auto p = reinterpret_cast<EnumerateCollectionNode const*>(_exePlan);
V8ReadTransaction trx(p->_vocbase, p->_collname); V8ReadTransaction trx(p->_vocbase, p->_collname);
@ -793,7 +793,7 @@ namespace triagens {
public: public:
RootBlock (RootPlan const* ep) RootBlock (RootNode const* ep)
: ExecutionBlock(ep) { : ExecutionBlock(ep) {
} }
@ -811,7 +811,7 @@ namespace triagens {
// Let's steal the actual result and throw away the vars: // Let's steal the actual result and throw away the vars:
AqlItemBlock* stripped = new AqlItemBlock(1, 1); AqlItemBlock* stripped = new AqlItemBlock(1, 1);
auto ep = static_cast<RootPlan const*>(getPlan()); auto ep = static_cast<RootNode const*>(getPlanNode());
auto it = _varOverview->varInfo.find(ep->_inVariable->id); auto it = _varOverview->varInfo.find(ep->_inVariable->id);
TRI_ASSERT(it != _varOverview->varInfo.end()); TRI_ASSERT(it != _varOverview->varInfo.end());
unsigned int index = it->second.index; unsigned int index = it->second.index;
@ -829,7 +829,7 @@ namespace triagens {
} }
// Let's steal the actual result and throw away the vars: // Let's steal the actual result and throw away the vars:
auto ep = static_cast<RootPlan const*>(getPlan()); auto ep = static_cast<RootNode const*>(getPlanNode());
auto it = _varOverview->varInfo.find(ep->_inVariable->id); auto it = _varOverview->varInfo.find(ep->_inVariable->id);
TRI_ASSERT(it != _varOverview->varInfo.end()); TRI_ASSERT(it != _varOverview->varInfo.end());
unsigned int index = it->second.index; unsigned int index = it->second.index;

View File

@ -31,15 +31,15 @@ using namespace triagens::basics;
using namespace triagens::aql; using namespace triagens::aql;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of ExecutionPlan // --SECTION-- methods of ExecutionNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, export an ExecutionPlan to JSON /// @brief toJson, export an ExecutionNode to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Json ExecutionPlan::toJson (TRI_memory_zone_t* zone) { Json ExecutionNode::toJson (TRI_memory_zone_t* zone) {
std::map<ExecutionPlan*, int> indexTab; std::map<ExecutionNode*, int> indexTab;
Json json; Json json;
Json nodes; Json nodes;
try { try {
@ -58,7 +58,7 @@ Json ExecutionPlan::toJson (TRI_memory_zone_t* zone) {
/// @brief toJsonHelper, for a generic node /// @brief toJsonHelper, for a generic node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Json ExecutionPlan::toJsonHelperGeneric (std::map<ExecutionPlan*, int>& indexTab, Json ExecutionNode::toJsonHelperGeneric (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
auto iter = indexTab.find(this); auto iter = indexTab.find(this);
@ -98,7 +98,7 @@ static void someSpaces (std::string& st, int nr) {
} }
} }
void ExecutionPlan::appendAsString (std::string& st, int indent) { void ExecutionNode::appendAsString (std::string& st, int indent) {
someSpaces(st, indent); someSpaces(st, indent);
st.push_back('<'); st.push_back('<');
st.append(getTypeString()); st.append(getTypeString());
@ -121,7 +121,7 @@ void ExecutionPlan::appendAsString (std::string& st, int indent) {
/// @brief functionality to walk an execution plan recursively /// @brief functionality to walk an execution plan recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ExecutionPlan::walk (WalkerWorker& worker) { void ExecutionNode::walk (WalkerWorker& worker) {
worker.before(this); worker.before(this);
for (auto it = _dependencies.begin(); for (auto it = _dependencies.begin();
it != _dependencies.end(); it != _dependencies.end();
@ -129,7 +129,7 @@ void ExecutionPlan::walk (WalkerWorker& worker) {
(*it)->walk(worker); (*it)->walk(worker);
} }
if (getType() == SUBQUERY) { if (getType() == SUBQUERY) {
auto p = static_cast<SubqueryPlan*>(this); auto p = static_cast<SubqueryNode*>(this);
worker.enterSubquery(this, p->getSubquery()); worker.enterSubquery(this, p->getSubquery());
p->getSubquery()->walk(worker); p->getSubquery()->walk(worker);
worker.leaveSubquery(this, p->getSubquery()); worker.leaveSubquery(this, p->getSubquery());
@ -138,18 +138,18 @@ void ExecutionPlan::walk (WalkerWorker& worker) {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of SingletonPlan // --SECTION-- methods of SingletonNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for SingletonPlan /// @brief toJson, for SingletonNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void SingletonPlan::toJsonHelper ( void SingletonNode::toJsonHelper (
std::map<ExecutionPlan*, int>& indexTab, std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }
@ -161,17 +161,17 @@ void SingletonPlan::toJsonHelper (
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of EnumerateCollectionPlan // --SECTION-- methods of EnumerateCollectionNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for EnumerateCollectionPlan /// @brief toJson, for EnumerateCollectionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void EnumerateCollectionPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, void EnumerateCollectionNode::toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }
@ -188,17 +188,17 @@ void EnumerateCollectionPlan::toJsonHelper (std::map<ExecutionPlan*, int>& index
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of EnumerateListPlan // --SECTION-- methods of EnumerateListNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for EnumerateListPlan /// @brief toJson, for EnumerateListNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void EnumerateListPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, void EnumerateListNode::toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }
@ -212,17 +212,17 @@ void EnumerateListPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab,
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of LimitPlan // --SECTION-- methods of LimitNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for LimitPlan /// @brief toJson, for LimitNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void LimitPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, void LimitNode::toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }
@ -237,17 +237,17 @@ void LimitPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab,
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of CalculationPlan // --SECTION-- methods of CalculationNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for CalculationPlan /// @brief toJson, for CalculationNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CalculationPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, void CalculationNode::toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }
@ -262,17 +262,17 @@ void CalculationPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab,
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of SubqueryPlan // --SECTION-- methods of SubqueryNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for SubqueryPlan /// @brief toJson, for SubqueryNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void SubqueryPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, void SubqueryNode::toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }
@ -286,17 +286,17 @@ void SubqueryPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab,
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of ProjectionPlan // --SECTION-- methods of ProjectionNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for ProjectionPlan /// @brief toJson, for ProjectionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ProjectionPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, void ProjectionNode::toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }
@ -316,17 +316,17 @@ void ProjectionPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab,
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of FilterPlan // --SECTION-- methods of FilterNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for FilterPlan /// @brief toJson, for FilterNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void FilterPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, void FilterNode::toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }
@ -340,17 +340,17 @@ void FilterPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab,
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of SortPlan // --SECTION-- methods of SortNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for SortPlan /// @brief toJson, for SortNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void SortPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, void SortNode::toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }
@ -370,17 +370,17 @@ void SortPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab,
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of AggregateOnUnSortedPlan // --SECTION-- methods of AggregateOnUnSortedNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for AggregateOnUnSortedPlan /// @brief toJson, for AggregateOnUnSortedNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void AggregateOnUnsortedPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, void AggregateOnUnsortedNode::toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }
@ -406,17 +406,17 @@ void AggregateOnUnsortedPlan::toJsonHelper (std::map<ExecutionPlan*, int>& index
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- methods of RootPlan // --SECTION-- methods of RootNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief toJson, for RootPlan /// @brief toJson, for RootNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void RootPlan::toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, void RootNode::toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone) { TRI_memory_zone_t* zone) {
Json json(ExecutionPlan::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method Json json(ExecutionNode::toJsonHelperGeneric(indexTab, nodes, zone)); // call base class method
if (json.isEmpty()) { if (json.isEmpty()) {
return; return;
} }

View File

@ -25,8 +25,8 @@
/// @author Copyright 2014, triagens GmbH, Cologne, Germany /// @author Copyright 2014, triagens GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGODB_AQL_EXECUTION_PLAN_H #ifndef ARANGODB_AQL_EXECUTION_Plan_H
#define ARANGODB_AQL_EXECUTION_PLAN_H 1 #define ARANGODB_AQL_EXECUTION_Plan_H 1
#include <Basics/Common.h> #include <Basics/Common.h>
@ -44,10 +44,10 @@ namespace triagens {
class ExecutionBlock; class ExecutionBlock;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class ExecutionPlan, abstract base class of all execution plans /// @brief class ExecutionNode, abstract base class of all execution Nodes
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class ExecutionPlan { class ExecutionNode {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief node type /// @brief node type
@ -93,14 +93,14 @@ namespace triagens {
/// @brief default constructor /// @brief default constructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan () { ExecutionNode () {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief constructor with one dependency /// @brief constructor with one dependency
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan (ExecutionPlan* ep) { ExecutionNode (ExecutionNode* ep) {
_dependencies.push_back(ep); _dependencies.push_back(ep);
} }
@ -108,10 +108,7 @@ namespace triagens {
/// @brief destructor, free dependencies /// @brief destructor, free dependencies
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ~ExecutionPlan () { virtual ~ExecutionNode () {
for (auto i = _dependencies.begin(); i != _dependencies.end(); ++i) {
delete *i;
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -127,14 +124,14 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("ExecutionPlan (abstract)"); return std::string("ExecutionNode (abstract)");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief add a dependency /// @brief add a dependency
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void addDependency (ExecutionPlan* ep) { void addDependency (ExecutionNode* ep) {
_dependencies.push_back(ep); _dependencies.push_back(ep);
} }
@ -142,7 +139,7 @@ namespace triagens {
/// @brief get all dependencies /// @brief get all dependencies
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
vector<ExecutionPlan*> getDependencies () const { vector<ExecutionNode*> getDependencies () const {
return _dependencies; return _dependencies;
} }
@ -151,7 +148,7 @@ namespace triagens {
/// removed, please note that this does not delete ep! /// removed, please note that this does not delete ep!
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool removeDependency (ExecutionPlan* ep) { bool removeDependency (ExecutionNode* ep) {
auto it = _dependencies.begin(); auto it = _dependencies.begin();
while (it != _dependencies.end()) { while (it != _dependencies.end()) {
if (*it == ep) { if (*it == ep) {
@ -167,7 +164,7 @@ namespace triagens {
/// @brief access the pos-th dependency /// @brief access the pos-th dependency
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* operator[] (size_t pos) const { ExecutionNode* operator[] (size_t pos) const {
if (pos > _dependencies.size()) { if (pos > _dependencies.size()) {
return nullptr; return nullptr;
} }
@ -177,16 +174,16 @@ namespace triagens {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively, this makes the class abstract /// @brief clone execution Node recursively, this makes the class abstract
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const = 0; // make class abstract virtual ExecutionNode* clone () const = 0; // make class abstract
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief helper for cloning, use virtual clone methods for dependencies /// @brief helper for cloning, use virtual clone methods for dependencies
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void cloneDependencies (ExecutionPlan* theClone) const { void cloneDependencies (ExecutionNode* theClone) const {
auto it = _dependencies.begin(); auto it = _dependencies.begin();
while (it != _dependencies.end()) { while (it != _dependencies.end()) {
theClone->_dependencies.push_back((*it)->clone()); theClone->_dependencies.push_back((*it)->clone());
@ -209,11 +206,11 @@ namespace triagens {
protected: protected:
triagens::basics::Json toJsonHelperGeneric ( triagens::basics::Json toJsonHelperGeneric (
std::map<ExecutionPlan*, int>& indexTab, std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone); TRI_memory_zone_t* zone);
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE) = 0; TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE) = 0;
@ -234,12 +231,12 @@ namespace triagens {
public: public:
WalkerWorker () {}; WalkerWorker () {};
virtual ~WalkerWorker () {}; virtual ~WalkerWorker () {};
virtual void before (ExecutionPlan* eb) {}; virtual void before (ExecutionNode* eb) {};
virtual void after (ExecutionPlan* eb) {}; virtual void after (ExecutionNode* eb) {};
virtual void enterSubquery (ExecutionPlan* super, virtual void enterSubquery (ExecutionNode* super,
ExecutionPlan* sub) {}; ExecutionNode* sub) {};
virtual void leaveSubquery (ExecutionPlan* super, virtual void leaveSubquery (ExecutionNode* super,
ExecutionPlan* sub) {}; ExecutionNode* sub) {};
}; };
void walk (WalkerWorker& worker); void walk (WalkerWorker& worker);
@ -254,19 +251,19 @@ namespace triagens {
protected: protected:
std::vector<ExecutionPlan*> _dependencies; std::vector<ExecutionNode*> _dependencies;
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class SingletonPlan // --SECTION-- class SingletonNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class SingletonPlan, derived from ExecutionPlan /// @brief class SingletonNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class SingletonPlan : public ExecutionPlan { class SingletonNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class SingletonBlock; friend class SingletonBlock;
@ -277,7 +274,7 @@ namespace triagens {
public: public:
SingletonPlan () : ExecutionPlan() { SingletonNode () : ExecutionNode() {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -293,38 +290,38 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("SingletonPlan"); return std::string("SingletonNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new SingletonPlan(); auto c = new SingletonNode();
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class EnumerateCollectionPlan // --SECTION-- class EnumerateCollectionNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class EnumerateCollectionPlan, derived from ExecutionPlan /// @brief class EnumerateCollectionNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class EnumerateCollectionPlan : public ExecutionPlan { class EnumerateCollectionNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class EnumerateCollectionBlock; friend class EnumerateCollectionBlock;
@ -335,10 +332,10 @@ namespace triagens {
public: public:
EnumerateCollectionPlan (TRI_vocbase_t* vocbase, EnumerateCollectionNode (TRI_vocbase_t* vocbase,
std::string collname, std::string collname,
Variable const* outVariable) Variable const* outVariable)
: ExecutionPlan(), _vocbase(vocbase), _collname(collname), : ExecutionNode(), _vocbase(vocbase), _collname(collname),
_outVariable(outVariable) { _outVariable(outVariable) {
TRI_ASSERT(_vocbase != nullptr); TRI_ASSERT(_vocbase != nullptr);
@ -358,25 +355,25 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("EnumerateCollectionPlan"); return std::string("EnumerateCollectionNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new EnumerateCollectionPlan(_vocbase, _collname, _outVariable); auto c = new EnumerateCollectionNode(_vocbase, _collname, _outVariable);
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -406,14 +403,14 @@ namespace triagens {
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class EnumerateListPlan // --SECTION-- class EnumerateListNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class EnumerateListPlan, derived from ExecutionPlan /// @brief class EnumerateListNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class EnumerateListPlan : public ExecutionPlan { class EnumerateListNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class EnumerateListBlock; friend class EnumerateListBlock;
@ -424,9 +421,9 @@ namespace triagens {
public: public:
EnumerateListPlan (Variable const* inVariable, EnumerateListNode (Variable const* inVariable,
Variable const* outVariable) Variable const* outVariable)
: ExecutionPlan(), _inVariable(inVariable), _outVariable(outVariable) { : ExecutionNode(), _inVariable(inVariable), _outVariable(outVariable) {
TRI_ASSERT(_inVariable != nullptr); TRI_ASSERT(_inVariable != nullptr);
TRI_ASSERT(_outVariable != nullptr); TRI_ASSERT(_outVariable != nullptr);
@ -445,25 +442,25 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("EnumerateListPlan"); return std::string("EnumerateListNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new EnumerateListPlan(_inVariable, _outVariable); auto c = new EnumerateListNode(_inVariable, _outVariable);
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -488,14 +485,14 @@ namespace triagens {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class LimitPlan // --SECTION-- class LimitNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class LimitPlan, derived from ExecutionPlan /// @brief class LimitNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class LimitPlan : public ExecutionPlan { class LimitNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class LimitBlock; friend class LimitBlock;
@ -506,12 +503,12 @@ namespace triagens {
public: public:
LimitPlan (size_t o, size_t l) LimitNode (size_t o, size_t l)
: ExecutionPlan(), _offset(o), _limit(l) { : ExecutionNode(), _offset(o), _limit(l) {
} }
LimitPlan (size_t l) LimitNode (size_t l)
: ExecutionPlan(), _offset(0), _limit(l) { : ExecutionNode(), _offset(0), _limit(l) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -527,25 +524,25 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("LimitPlan"); return std::string("LimitNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new LimitPlan(_offset, _limit); auto c = new LimitNode(_offset, _limit);
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -560,14 +557,14 @@ namespace triagens {
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class ProjectionPlan // --SECTION-- class ProjectionNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class ProjectionPlan, derived from ExecutionPlan /// @brief class ProjectionNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class ProjectionPlan : public ExecutionPlan { class ProjectionNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class ProjectionBlock; friend class ProjectionBlock;
@ -578,10 +575,10 @@ namespace triagens {
public: public:
ProjectionPlan (Variable const* inVariable, ProjectionNode (Variable const* inVariable,
Variable const* outVariable, Variable const* outVariable,
std::vector<std::string> keepAttributes) std::vector<std::string> keepAttributes)
: ExecutionPlan(), _inVariable(inVariable), _outVariable(outVariable), : ExecutionNode(), _inVariable(inVariable), _outVariable(outVariable),
_keepAttributes(keepAttributes) { _keepAttributes(keepAttributes) {
TRI_ASSERT(inVariable != nullptr); TRI_ASSERT(inVariable != nullptr);
@ -601,25 +598,25 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("ProjectionPlan"); return std::string("ProjectionNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new ProjectionPlan(_inVariable, _outVariable, _keepAttributes); auto c = new ProjectionNode(_inVariable, _outVariable, _keepAttributes);
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -649,14 +646,14 @@ namespace triagens {
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class CalculationPlan // --SECTION-- class CalculationNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class CalculationPlan, derived from ExecutionPlan /// @brief class CalculationNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class CalculationPlan : public ExecutionPlan { class CalculationNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class CalculationBlock; friend class CalculationBlock;
@ -667,8 +664,8 @@ namespace triagens {
/// @brief constructor /// @brief constructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
CalculationPlan (Expression* expr, Variable const* outVariable) CalculationNode (Expression* expr, Variable const* outVariable)
: ExecutionPlan(), _expression(expr), _outVariable(outVariable) { : ExecutionNode(), _expression(expr), _outVariable(outVariable) {
TRI_ASSERT(_expression != nullptr); TRI_ASSERT(_expression != nullptr);
TRI_ASSERT(_outVariable != nullptr); TRI_ASSERT(_outVariable != nullptr);
@ -678,7 +675,7 @@ namespace triagens {
/// @brief destructor /// @brief destructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
~CalculationPlan () { ~CalculationNode () {
if (_expression != nullptr) { if (_expression != nullptr) {
delete _expression; delete _expression;
} }
@ -697,25 +694,25 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("CalculationPlan"); return std::string("CalculationNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new CalculationPlan(_expression->clone(), _outVariable); auto c = new CalculationNode(_expression->clone(), _outVariable);
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -747,14 +744,14 @@ namespace triagens {
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class SubqueryPlan // --SECTION-- class SubqueryNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class SubqueryPlan, derived from ExecutionPlan /// @brief class SubqueryNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class SubqueryPlan : public ExecutionPlan { class SubqueryNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class SubqueryBlock; friend class SubqueryBlock;
@ -765,8 +762,8 @@ namespace triagens {
public: public:
SubqueryPlan (ExecutionPlan* subquery, Variable const* outVariable) SubqueryNode (ExecutionNode* subquery, Variable const* outVariable)
: ExecutionPlan(), _subquery(subquery), _outVariable(outVariable) { : ExecutionNode(), _subquery(subquery), _outVariable(outVariable) {
TRI_ASSERT(_subquery != nullptr); TRI_ASSERT(_subquery != nullptr);
TRI_ASSERT(_outVariable != nullptr); TRI_ASSERT(_outVariable != nullptr);
@ -785,32 +782,32 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("SubqueryPlan"); return std::string("SubqueryNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new SubqueryPlan(_subquery->clone(), _outVariable); auto c = new SubqueryNode(_subquery->clone(), _outVariable);
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief getter for subquery /// @brief getter for subquery
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* getSubquery () { ExecutionNode* getSubquery () {
return _subquery; return _subquery;
} }
@ -824,7 +821,7 @@ namespace triagens {
/// @brief we need to have an expression and where to write the result /// @brief we need to have an expression and where to write the result
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* _subquery; ExecutionNode* _subquery;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief variable to write to /// @brief variable to write to
@ -835,14 +832,14 @@ namespace triagens {
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class FilterPlan // --SECTION-- class FilterNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class FilterPlan, derived from ExecutionPlan /// @brief class FilterNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class FilterPlan : public ExecutionPlan { class FilterNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class FilterBlock; friend class FilterBlock;
@ -853,8 +850,8 @@ namespace triagens {
public: public:
FilterPlan (Variable const* inVariable) FilterNode (Variable const* inVariable)
: ExecutionPlan(), _inVariable(inVariable) { : ExecutionNode(), _inVariable(inVariable) {
TRI_ASSERT(_inVariable != nullptr); TRI_ASSERT(_inVariable != nullptr);
} }
@ -872,25 +869,25 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("FilterPlan"); return std::string("FilterNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new FilterPlan(_inVariable); auto c = new FilterNode(_inVariable);
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -908,14 +905,14 @@ namespace triagens {
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class SortPlan // --SECTION-- class SortNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class SortPlan, derived from ExecutionPlan /// @brief class SortNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class SortPlan : public ExecutionPlan { class SortNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class SortBlock; friend class SortBlock;
@ -926,8 +923,8 @@ namespace triagens {
public: public:
SortPlan (std::vector<std::pair<Variable const*, bool>> elements) SortNode (std::vector<std::pair<Variable const*, bool>> elements)
: ExecutionPlan(), _elements(elements) { : ExecutionNode(), _elements(elements) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -943,25 +940,25 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("SortPlan"); return std::string("SortNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new SortPlan(_elements); auto c = new SortNode(_elements);
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -981,14 +978,14 @@ namespace triagens {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class AggregateOnUnsortedPlan // --SECTION-- class AggregateOnUnsortedNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class AggregateOnUnsortedPlan, derived from ExecutionPlan /// @brief class AggregateOnUnsortedNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class AggregateOnUnsortedPlan : public ExecutionPlan { class AggregateOnUnsortedNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class AggregateOnUnsortedBlock; friend class AggregateOnUnsortedBlock;
@ -999,9 +996,9 @@ namespace triagens {
public: public:
AggregateOnUnsortedPlan (std::vector<std::pair<Variable const*, Variable const*>> aggregateVariables, AggregateOnUnsortedNode (std::vector<std::pair<Variable const*, Variable const*>> aggregateVariables,
Variable const* outVariable) Variable const* outVariable)
: ExecutionPlan(), _aggregateVariables(aggregateVariables), _outVariable(outVariable) { : ExecutionNode(), _aggregateVariables(aggregateVariables), _outVariable(outVariable) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1017,25 +1014,25 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("AggregateOnUnsortedPlan"); return std::string("AggregateOnUnsortedNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new AggregateOnUnsortedPlan(_aggregateVariables, _outVariable); auto c = new AggregateOnUnsortedNode(_aggregateVariables, _outVariable);
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1060,14 +1057,14 @@ namespace triagens {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class RootPlan // --SECTION-- class RootNode
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief class RootPlan, derived from ExecutionPlan /// @brief class RootNode, derived from ExecutionNode
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class RootPlan : public ExecutionPlan { class RootNode : public ExecutionNode {
friend class ExecutionBlock; friend class ExecutionBlock;
friend class RootBlock; friend class RootBlock;
@ -1078,8 +1075,8 @@ namespace triagens {
public: public:
RootPlan (Variable const* inVariable) RootNode (Variable const* inVariable)
: ExecutionPlan(), _inVariable(inVariable) { : ExecutionNode(), _inVariable(inVariable) {
TRI_ASSERT(_inVariable != nullptr); TRI_ASSERT(_inVariable != nullptr);
} }
@ -1097,25 +1094,25 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual std::string getTypeString () const { virtual std::string getTypeString () const {
return std::string("RootPlan"); return std::string("RootNode");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief export to JSON /// @brief export to JSON
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void toJsonHelper (std::map<ExecutionPlan*, int>& indexTab, virtual void toJsonHelper (std::map<ExecutionNode*, int>& indexTab,
triagens::basics::Json& nodes, triagens::basics::Json& nodes,
TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief clone execution plan recursively /// @brief clone ExecutionNode recursively
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual ExecutionPlan* clone () const { virtual ExecutionNode* clone () const {
auto c = new RootPlan(_inVariable); auto c = new RootNode(_inVariable);
cloneDependencies(c); cloneDependencies(c);
return static_cast<ExecutionPlan*>(c); return static_cast<ExecutionNode*>(c);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -64,14 +64,14 @@ PlanGenerator::~PlanGenerator () {
/// @brief create an initial execution plan from an abstract syntax tree /// @brief create an initial execution plan from an abstract syntax tree
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromAst (Ast const* ast) { ExecutionNode* PlanGenerator::fromAst (Ast const* ast) {
TRI_ASSERT(ast != nullptr); TRI_ASSERT(ast != nullptr);
auto root = ast->root(); auto root = ast->root();
TRI_ASSERT(root != nullptr); TRI_ASSERT(root != nullptr);
TRI_ASSERT(root->type == NODE_TYPE_ROOT); TRI_ASSERT(root->type == NODE_TYPE_ROOT);
ExecutionPlan* plan = fromNode(ast, root); ExecutionNode* plan = fromNode(ast, root);
return plan; return plan;
} }
@ -84,7 +84,7 @@ ExecutionPlan* PlanGenerator::fromAst (Ast const* ast) {
/// @brief creates a calculation node for an arbitrary expression /// @brief creates a calculation node for an arbitrary expression
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
CalculationPlan* PlanGenerator::createTemporaryCalculation (Ast const* ast, CalculationNode* PlanGenerator::createTemporaryCalculation (Ast const* ast,
AstNode const* expression) { AstNode const* expression) {
// generate a temporary variable // generate a temporary variable
auto out = ast->variables()->createTemporaryVariable(); auto out = ast->variables()->createTemporaryVariable();
@ -94,7 +94,7 @@ CalculationPlan* PlanGenerator::createTemporaryCalculation (Ast const* ast,
auto expr = new Expression(ast->query()->executor(), const_cast<AstNode*>(expression)); auto expr = new Expression(ast->query()->executor(), const_cast<AstNode*>(expression));
try { try {
return new CalculationPlan(expr, out); return new CalculationNode(expr, out);
} }
catch (...) { catch (...) {
// prevent memleak // prevent memleak
@ -108,8 +108,8 @@ CalculationPlan* PlanGenerator::createTemporaryCalculation (Ast const* ast,
/// @brief adds "previous" as dependency to "plan", returns "plan" /// @brief adds "previous" as dependency to "plan", returns "plan"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::addDependency (ExecutionPlan* previous, ExecutionNode* PlanGenerator::addDependency (ExecutionNode* previous,
ExecutionPlan* plan) { ExecutionNode* plan) {
TRI_ASSERT(previous != nullptr); TRI_ASSERT(previous != nullptr);
TRI_ASSERT(plan != nullptr); TRI_ASSERT(plan != nullptr);
@ -128,8 +128,8 @@ ExecutionPlan* PlanGenerator::addDependency (ExecutionPlan* previous,
/// @brief create an execution plan element from an AST FOR node /// @brief create an execution plan element from an AST FOR node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeFor (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeFor (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_FOR); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_FOR);
TRI_ASSERT(node->numMembers() == 2); TRI_ASSERT(node->numMembers() == 2);
@ -142,26 +142,26 @@ ExecutionPlan* PlanGenerator::fromNodeFor (Ast const* ast,
auto v = static_cast<Variable*>(variable->getData()); auto v = static_cast<Variable*>(variable->getData());
TRI_ASSERT(v != nullptr); TRI_ASSERT(v != nullptr);
ExecutionPlan* plan = nullptr; ExecutionNode* plan = nullptr;
// peek at second operand // peek at second operand
if (expression->type == NODE_TYPE_COLLECTION) { if (expression->type == NODE_TYPE_COLLECTION) {
// second operand is a collection // second operand is a collection
char const* collectionName = expression->getStringValue(); char const* collectionName = expression->getStringValue();
plan = new EnumerateCollectionPlan(ast->query()->vocbase(), std::string(collectionName), v); plan = new EnumerateCollectionNode(ast->query()->vocbase(), std::string(collectionName), v);
} }
else if (expression->type == NODE_TYPE_REFERENCE) { else if (expression->type == NODE_TYPE_REFERENCE) {
// second operand is already a variable // second operand is already a variable
auto inVariable = static_cast<Variable*>(variable->getData()); auto inVariable = static_cast<Variable*>(variable->getData());
TRI_ASSERT(inVariable != nullptr); TRI_ASSERT(inVariable != nullptr);
plan = new EnumerateListPlan(inVariable, v); plan = new EnumerateListNode(inVariable, v);
} }
else { else {
// second operand is some misc. expression // second operand is some misc. expression
auto calc = createTemporaryCalculation(ast, expression); auto calc = createTemporaryCalculation(ast, expression);
try { try {
plan = new EnumerateListPlan(calc->outVariable(), v); plan = new EnumerateListNode(calc->outVariable(), v);
plan->addDependency(calc); plan->addDependency(calc);
} }
catch (...) { catch (...) {
@ -179,28 +179,28 @@ ExecutionPlan* PlanGenerator::fromNodeFor (Ast const* ast,
/// @brief create an execution plan element from an AST FILTER node /// @brief create an execution plan element from an AST FILTER node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeFilter (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeFilter (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_FILTER); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_FILTER);
TRI_ASSERT(node->numMembers() == 1); TRI_ASSERT(node->numMembers() == 1);
auto expression = node->getMember(0); auto expression = node->getMember(0);
ExecutionPlan* plan = nullptr; ExecutionNode* plan = nullptr;
if (expression->type == NODE_TYPE_REFERENCE) { if (expression->type == NODE_TYPE_REFERENCE) {
// operand is already a variable // operand is already a variable
auto v = static_cast<Variable*>(expression->getData()); auto v = static_cast<Variable*>(expression->getData());
TRI_ASSERT(v != nullptr); TRI_ASSERT(v != nullptr);
plan = new FilterPlan(v); plan = new FilterNode(v);
} }
else { else {
// operand is some misc expression // operand is some misc expression
auto calc = createTemporaryCalculation(ast, expression); auto calc = createTemporaryCalculation(ast, expression);
try { try {
plan = new FilterPlan(calc->outVariable()); plan = new FilterNode(calc->outVariable());
plan->addDependency(calc); plan->addDependency(calc);
} }
catch (...) { catch (...) {
@ -216,8 +216,8 @@ ExecutionPlan* PlanGenerator::fromNodeFilter (Ast const* ast,
/// @brief create an execution plan element from an AST LET node /// @brief create an execution plan element from an AST LET node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeLet (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeLet (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_LET); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_LET);
TRI_ASSERT(node->numMembers() == 2); TRI_ASSERT(node->numMembers() == 2);
@ -227,7 +227,7 @@ ExecutionPlan* PlanGenerator::fromNodeLet (Ast const* ast,
auto v = static_cast<Variable*>(variable->getData()); auto v = static_cast<Variable*>(variable->getData());
ExecutionPlan* plan = nullptr; ExecutionNode* plan = nullptr;
if (expression->type == NODE_TYPE_SUBQUERY) { if (expression->type == NODE_TYPE_SUBQUERY) {
// TODO: node might be a subquery. this is currently NOT handled // TODO: node might be a subquery. this is currently NOT handled
@ -238,7 +238,7 @@ ExecutionPlan* PlanGenerator::fromNodeLet (Ast const* ast,
auto expr = new Expression(ast->query()->executor(), const_cast<AstNode*>(expression)); auto expr = new Expression(ast->query()->executor(), const_cast<AstNode*>(expression));
try { try {
plan = new CalculationPlan(expr, v); plan = new CalculationNode(expr, v);
} }
catch (...) { catch (...) {
// prevent memleak // prevent memleak
@ -254,8 +254,8 @@ ExecutionPlan* PlanGenerator::fromNodeLet (Ast const* ast,
/// @brief create an execution plan element from an AST SORT node /// @brief create an execution plan element from an AST SORT node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeSort (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeSort (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_SORT); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_SORT);
TRI_ASSERT(node->numMembers() == 1); TRI_ASSERT(node->numMembers() == 1);
@ -264,7 +264,7 @@ ExecutionPlan* PlanGenerator::fromNodeSort (Ast const* ast,
TRI_ASSERT(list->type == NODE_TYPE_LIST); TRI_ASSERT(list->type == NODE_TYPE_LIST);
std::vector<std::pair<Variable const*, bool>> elements; std::vector<std::pair<Variable const*, bool>> elements;
std::vector<CalculationPlan*> temp; std::vector<CalculationNode*> temp;
try { try {
size_t const n = list->numMembers(); size_t const n = list->numMembers();
@ -306,7 +306,7 @@ ExecutionPlan* PlanGenerator::fromNodeSort (Ast const* ast,
previous = (*it); previous = (*it);
} }
auto plan = new SortPlan(elements); auto plan = new SortNode(elements);
return addDependency(previous, plan); return addDependency(previous, plan);
} }
@ -315,8 +315,8 @@ ExecutionPlan* PlanGenerator::fromNodeSort (Ast const* ast,
/// @brief create an execution plan element from an AST COLLECT node /// @brief create an execution plan element from an AST COLLECT node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeCollect (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeCollect (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_COLLECT); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_COLLECT);
size_t const n = node->numMembers(); size_t const n = node->numMembers();
@ -333,8 +333,8 @@ ExecutionPlan* PlanGenerator::fromNodeCollect (Ast const* ast,
/// @brief create an execution plan element from an AST LIMIT node /// @brief create an execution plan element from an AST LIMIT node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeLimit (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeLimit (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_LIMIT); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_LIMIT);
TRI_ASSERT(node->numMembers() == 2); TRI_ASSERT(node->numMembers() == 2);
@ -345,7 +345,7 @@ ExecutionPlan* PlanGenerator::fromNodeLimit (Ast const* ast,
TRI_ASSERT(offset->type == NODE_TYPE_VALUE); TRI_ASSERT(offset->type == NODE_TYPE_VALUE);
TRI_ASSERT(count->type == NODE_TYPE_VALUE); TRI_ASSERT(count->type == NODE_TYPE_VALUE);
auto plan = new LimitPlan(static_cast<size_t>(offset->getIntValue()), static_cast<size_t>(count->getIntValue())); auto plan = new LimitNode(static_cast<size_t>(offset->getIntValue()), static_cast<size_t>(count->getIntValue()));
return addDependency(previous, plan); return addDependency(previous, plan);
} }
@ -354,28 +354,28 @@ ExecutionPlan* PlanGenerator::fromNodeLimit (Ast const* ast,
/// @brief create an execution plan element from an AST RETURN node /// @brief create an execution plan element from an AST RETURN node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeReturn (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeReturn (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_RETURN); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_RETURN);
TRI_ASSERT(node->numMembers() == 1); TRI_ASSERT(node->numMembers() == 1);
auto expression = node->getMember(0); auto expression = node->getMember(0);
ExecutionPlan* plan = nullptr; ExecutionNode* plan = nullptr;
if (expression->type == NODE_TYPE_REFERENCE) { if (expression->type == NODE_TYPE_REFERENCE) {
// operand is already a variable // operand is already a variable
auto v = static_cast<Variable*>(expression->getData()); auto v = static_cast<Variable*>(expression->getData());
TRI_ASSERT(v != nullptr); TRI_ASSERT(v != nullptr);
plan = new RootPlan(v); plan = new RootNode(v);
} }
else { else {
// operand is some misc expression // operand is some misc expression
auto calc = createTemporaryCalculation(ast, expression); auto calc = createTemporaryCalculation(ast, expression);
try { try {
plan = new RootPlan(calc->outVariable()); plan = new RootNode(calc->outVariable());
plan->addDependency(calc); plan->addDependency(calc);
} }
catch (...) { catch (...) {
@ -391,8 +391,8 @@ ExecutionPlan* PlanGenerator::fromNodeReturn (Ast const* ast,
/// @brief create an execution plan element from an AST REMOVE node /// @brief create an execution plan element from an AST REMOVE node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeRemove (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeRemove (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_REMOVE); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_REMOVE);
@ -406,8 +406,8 @@ ExecutionPlan* PlanGenerator::fromNodeRemove (Ast const* ast,
/// @brief create an execution plan element from an AST INSERT node /// @brief create an execution plan element from an AST INSERT node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeInsert (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeInsert (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_INSERT); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_INSERT);
@ -421,8 +421,8 @@ ExecutionPlan* PlanGenerator::fromNodeInsert (Ast const* ast,
/// @brief create an execution plan element from an AST UPDATE node /// @brief create an execution plan element from an AST UPDATE node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeUpdate (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeUpdate (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_UPDATE); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_UPDATE);
@ -436,8 +436,8 @@ ExecutionPlan* PlanGenerator::fromNodeUpdate (Ast const* ast,
/// @brief create an execution plan element from an AST REPLACE node /// @brief create an execution plan element from an AST REPLACE node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNodeReplace (Ast const* ast, ExecutionNode* PlanGenerator::fromNodeReplace (Ast const* ast,
ExecutionPlan* previous, ExecutionNode* previous,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_REPLACE); TRI_ASSERT(node != nullptr && node->type == NODE_TYPE_REPLACE);
@ -451,11 +451,11 @@ ExecutionPlan* PlanGenerator::fromNodeReplace (Ast const* ast,
/// @brief create an execution plan from an abstract syntax tree node /// @brief create an execution plan from an abstract syntax tree node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* PlanGenerator::fromNode (Ast const* ast, ExecutionNode* PlanGenerator::fromNode (Ast const* ast,
AstNode const* node) { AstNode const* node) {
TRI_ASSERT(node != nullptr); TRI_ASSERT(node != nullptr);
ExecutionPlan* plan = new SingletonPlan(); ExecutionNode* plan = new SingletonNode();
try { try {
size_t const n = node->numMembers(); size_t const n = node->numMembers();

View File

@ -37,8 +37,8 @@ namespace triagens {
class Ast; class Ast;
struct AstNode; struct AstNode;
class CalculationPlan; class CalculationNode;
class ExecutionPlan; class ExecutionNode;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class PlanGenerator // --SECTION-- class PlanGenerator
@ -74,7 +74,7 @@ namespace triagens {
/// @brief create an initial execution plan from an abstract syntax tree /// @brief create an initial execution plan from an abstract syntax tree
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromAst (Ast const*); ExecutionNode* fromAst (Ast const*);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- private methods // --SECTION-- private methods
@ -86,109 +86,109 @@ namespace triagens {
/// @brief creates a calculation node for an arbitrary expression /// @brief creates a calculation node for an arbitrary expression
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
CalculationPlan* createTemporaryCalculation (Ast const*, CalculationNode* createTemporaryCalculation (Ast const*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief adds "previous" as dependency to "plan", returns "plan" /// @brief adds "previous" as dependency to "plan", returns "plan"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* addDependency (ExecutionPlan*, ExecutionNode* addDependency (ExecutionNode*,
ExecutionPlan*); ExecutionNode*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST FOR node /// @brief create an execution plan element from an AST FOR node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeFor (Ast const*, ExecutionNode* fromNodeFor (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST FILTER node /// @brief create an execution plan element from an AST FILTER node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeFilter (Ast const*, ExecutionNode* fromNodeFilter (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST LET node /// @brief create an execution plan element from an AST LET node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeLet (Ast const*, ExecutionNode* fromNodeLet (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST SORT node /// @brief create an execution plan element from an AST SORT node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeSort (Ast const*, ExecutionNode* fromNodeSort (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST COLLECT node /// @brief create an execution plan element from an AST COLLECT node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeCollect (Ast const*, ExecutionNode* fromNodeCollect (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST LIMIT node /// @brief create an execution plan element from an AST LIMIT node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeLimit (Ast const*, ExecutionNode* fromNodeLimit (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST RETURN node /// @brief create an execution plan element from an AST RETURN node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeReturn (Ast const*, ExecutionNode* fromNodeReturn (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST REMOVE node /// @brief create an execution plan element from an AST REMOVE node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeRemove (Ast const*, ExecutionNode* fromNodeRemove (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST INSERT node /// @brief create an execution plan element from an AST INSERT node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeInsert (Ast const*, ExecutionNode* fromNodeInsert (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST UPDATE node /// @brief create an execution plan element from an AST UPDATE node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeUpdate (Ast const*, ExecutionNode* fromNodeUpdate (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan element from an AST REPLACE node /// @brief create an execution plan element from an AST REPLACE node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNodeReplace (Ast const*, ExecutionNode* fromNodeReplace (Ast const*,
ExecutionPlan*, ExecutionNode*,
AstNode const*); AstNode const*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief create an execution plan from an abstract syntax tree node /// @brief create an execution plan from an abstract syntax tree node
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ExecutionPlan* fromNode (Ast const*, ExecutionNode* fromNode (Ast const*,
AstNode const*); AstNode const*);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------