mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
58109c1228
|
@ -194,6 +194,7 @@ struct UserVarFinder final : public WalkerWorker<ExecutionNode> {
|
||||||
else if (en->getType() == ExecutionNode::ENUMERATE_COLLECTION ||
|
else if (en->getType() == ExecutionNode::ENUMERATE_COLLECTION ||
|
||||||
en->getType() == ExecutionNode::INDEX ||
|
en->getType() == ExecutionNode::INDEX ||
|
||||||
en->getType() == ExecutionNode::ENUMERATE_LIST ||
|
en->getType() == ExecutionNode::ENUMERATE_LIST ||
|
||||||
|
en->getType() == ExecutionNode::TRAVERSAL ||
|
||||||
en->getType() == ExecutionNode::AGGREGATE) {
|
en->getType() == ExecutionNode::AGGREGATE) {
|
||||||
depth += 1;
|
depth += 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -548,6 +548,7 @@ bool ExecutionNode::isInInnerLoop () const {
|
||||||
|
|
||||||
if (type == ENUMERATE_COLLECTION ||
|
if (type == ENUMERATE_COLLECTION ||
|
||||||
type == INDEX ||
|
type == INDEX ||
|
||||||
|
type == TRAVERSAL ||
|
||||||
type == ENUMERATE_LIST) {
|
type == ENUMERATE_LIST) {
|
||||||
// we are contained in an outer loop
|
// we are contained in an outer loop
|
||||||
return true;
|
return true;
|
||||||
|
@ -1050,8 +1051,7 @@ void ExecutionNode::RegisterPlan::after (ExecutionNode* en) {
|
||||||
nrRegs.emplace_back(registerId);
|
nrRegs.emplace_back(registerId);
|
||||||
|
|
||||||
for (auto& it : vars) {
|
for (auto& it : vars) {
|
||||||
varInfo.emplace(make_pair(it->id,
|
varInfo.emplace(it->id, VarInfo(depth, totalNrRegs));
|
||||||
VarInfo(depth, totalNrRegs)));
|
|
||||||
totalNrRegs++;
|
totalNrRegs++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -154,7 +154,8 @@ int triagens::aql::removeRedundantSortsRule (Optimizer* opt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (current->getType() == EN::ENUMERATE_LIST ||
|
else if (current->getType() == EN::ENUMERATE_LIST ||
|
||||||
current->getType() == EN::ENUMERATE_COLLECTION) {
|
current->getType() == EN::ENUMERATE_COLLECTION ||
|
||||||
|
current->getType() == EN::TRAVERSAL) {
|
||||||
// ok, but we cannot remove two different sorts if one of these node types is between them
|
// ok, but we cannot remove two different sorts if one of these node types is between them
|
||||||
// example: in the following query, the one sort will be optimized away:
|
// example: in the following query, the one sort will be optimized away:
|
||||||
// FOR i IN [ { a: 1 }, { a: 2 } , { a: 3 } ] SORT i.a ASC SORT i.a DESC RETURN i
|
// FOR i IN [ { a: 1 }, { a: 2 } , { a: 3 } ] SORT i.a ASC SORT i.a DESC RETURN i
|
||||||
|
@ -848,6 +849,7 @@ int triagens::aql::removeSortRandRule (Optimizer* opt,
|
||||||
case EN::FILTER:
|
case EN::FILTER:
|
||||||
case EN::SUBQUERY:
|
case EN::SUBQUERY:
|
||||||
case EN::ENUMERATE_LIST:
|
case EN::ENUMERATE_LIST:
|
||||||
|
case EN::TRAVERSAL:
|
||||||
case EN::INDEX: {
|
case EN::INDEX: {
|
||||||
// if we found another SortNode, an AggregateNode, FilterNode, a SubqueryNode,
|
// if we found another SortNode, an AggregateNode, FilterNode, a SubqueryNode,
|
||||||
// an EnumerateListNode or an IndexNode
|
// an EnumerateListNode or an IndexNode
|
||||||
|
@ -1048,6 +1050,7 @@ int triagens::aql::moveCalculationsDownRule (Optimizer* opt,
|
||||||
else if (currentType == EN::INDEX ||
|
else if (currentType == EN::INDEX ||
|
||||||
currentType == EN::ENUMERATE_COLLECTION ||
|
currentType == EN::ENUMERATE_COLLECTION ||
|
||||||
currentType == EN::ENUMERATE_LIST ||
|
currentType == EN::ENUMERATE_LIST ||
|
||||||
|
currentType == EN::TRAVERSAL ||
|
||||||
currentType == EN::AGGREGATE ||
|
currentType == EN::AGGREGATE ||
|
||||||
currentType == EN::NORESULTS) {
|
currentType == EN::NORESULTS) {
|
||||||
// we will not push further down than such nodes
|
// we will not push further down than such nodes
|
||||||
|
@ -1749,7 +1752,7 @@ int triagens::aql::useIndexesRule (Optimizer* opt,
|
||||||
ExecutionPlan* plan,
|
ExecutionPlan* plan,
|
||||||
Optimizer::Rule const* rule) {
|
Optimizer::Rule const* rule) {
|
||||||
|
|
||||||
// These are all the FILTER nodes where we start
|
// These are all the nodes where we start traversing (including all subqueries)
|
||||||
std::vector<ExecutionNode*> nodes(std::move(plan->findEndNodes(true)));
|
std::vector<ExecutionNode*> nodes(std::move(plan->findEndNodes(true)));
|
||||||
|
|
||||||
std::unordered_map<size_t, ExecutionNode*> changes;
|
std::unordered_map<size_t, ExecutionNode*> changes;
|
||||||
|
@ -1966,6 +1969,7 @@ struct SortToIndexNode final : public WalkerWorker<ExecutionNode> {
|
||||||
|
|
||||||
bool before (ExecutionNode* en) override final {
|
bool before (ExecutionNode* en) override final {
|
||||||
switch (en->getType()) {
|
switch (en->getType()) {
|
||||||
|
case EN::TRAVERSAL:
|
||||||
case EN::ENUMERATE_LIST:
|
case EN::ENUMERATE_LIST:
|
||||||
case EN::SUBQUERY:
|
case EN::SUBQUERY:
|
||||||
case EN::FILTER:
|
case EN::FILTER:
|
||||||
|
@ -1994,7 +1998,6 @@ struct SortToIndexNode final : public WalkerWorker<ExecutionNode> {
|
||||||
case EN::REMOTE:
|
case EN::REMOTE:
|
||||||
case EN::ILLEGAL:
|
case EN::ILLEGAL:
|
||||||
case EN::LIMIT: // LIMIT is criterion to stop
|
case EN::LIMIT: // LIMIT is criterion to stop
|
||||||
case EN::TRAVERSAL:
|
|
||||||
return true; // abort.
|
return true; // abort.
|
||||||
|
|
||||||
case EN::SORT: // pulling two sorts together is done elsewhere.
|
case EN::SORT: // pulling two sorts together is done elsewhere.
|
||||||
|
|
Loading…
Reference in New Issue