From 1a80e197029863b194ac68986fe243a155c7d25f Mon Sep 17 00:00:00 2001 From: Willi Goesgens Date: Fri, 17 Oct 2014 13:36:40 +0200 Subject: [PATCH] Implement the option to enter Subqueries first in the ExecutionBlock Walker too (as in #d2a15253b0805ce2624eac4a44bb66b15c34a21e for the ExecutionNode) --- arangod/Aql/ExecutionBlock.cpp | 16 +++++++++++++++- arangod/Aql/ExecutionNode.cpp | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/arangod/Aql/ExecutionBlock.cpp b/arangod/Aql/ExecutionBlock.cpp index 7fa1a989b6..892cd1d9e8 100644 --- a/arangod/Aql/ExecutionBlock.cpp +++ b/arangod/Aql/ExecutionBlock.cpp @@ -179,6 +179,19 @@ bool ExecutionBlock::walk (WalkerWorker* worker) { return true; } + // Now handle a subquery: + if ((_exeNode->getType() == ExecutionNode::SUBQUERY) && + worker->EnterSubQueryFirst()) { + auto p = static_cast(this); + if (worker->enterSubquery(this, p->getSubquery())) { + bool abort = p->getSubquery()->walk(worker); + worker->leaveSubquery(this, p->getSubquery()); + if (abort) { + return true; + } + } + } + // Now the children in their natural order: for (auto c : _dependencies) { if (c->walk(worker)) { @@ -186,7 +199,8 @@ bool ExecutionBlock::walk (WalkerWorker* worker) { } } // Now handle a subquery: - if (_exeNode->getType() == ExecutionNode::SUBQUERY) { + if ((_exeNode->getType() == ExecutionNode::SUBQUERY) && + ! worker->EnterSubQueryFirst()) { auto p = static_cast(this); if (worker->enterSubquery(this, p->getSubquery())) { bool abort = p->getSubquery()->walk(worker); diff --git a/arangod/Aql/ExecutionNode.cpp b/arangod/Aql/ExecutionNode.cpp index 4cf6d139a3..a5cbcbc399 100644 --- a/arangod/Aql/ExecutionNode.cpp +++ b/arangod/Aql/ExecutionNode.cpp @@ -529,7 +529,7 @@ bool ExecutionNode::walk (WalkerWorker* worker) { } // Now handle a subquery: - if ((getType() == SUBQUERY) && worker->EnterSubQueryFirst()){ + if ((getType() == SUBQUERY) && worker->EnterSubQueryFirst()) { auto p = static_cast(this); if (worker->enterSubquery(this, p->getSubquery())) { bool abort = p->getSubquery()->walk(worker); @@ -550,7 +550,7 @@ bool ExecutionNode::walk (WalkerWorker* worker) { } // Now handle a subquery: - if ((getType() == SUBQUERY) && ! worker->EnterSubQueryFirst()){ + if ((getType() == SUBQUERY) && ! worker->EnterSubQueryFirst()) { auto p = static_cast(this); if (worker->enterSubquery(this, p->getSubquery())) { bool abort = p->getSubquery()->walk(worker);