1
0
Fork 0

do not push sort beyond limit, collect etc.

This commit is contained in:
Jan Steemann 2014-09-08 10:31:44 +02:00
parent c02f304cc3
commit 478007089a
1 changed files with 25 additions and 12 deletions

View File

@ -70,21 +70,34 @@ int triagens::aql::removeRedundantSorts (Optimizer* opt,
auto other = static_cast<SortNode*>(current)->getSortInformation(plan); auto other = static_cast<SortNode*>(current)->getSortInformation(plan);
switch (sortInfo.isCoveredBy(other)) { switch (sortInfo.isCoveredBy(other)) {
case SortInformation::unequal: case SortInformation::unequal:
break; break;
case SortInformation::otherSupersedes:
toUnlink.insert(current); case SortInformation::otherSupersedes:
break; toUnlink.insert(current);
case SortInformation::weSupersede: break;
case SortInformation::allEqual:
// the sort at the start of the pipeline makes the sort at the end case SortInformation::weSupersede:
// superfluous, so we'll remove it case SortInformation::allEqual:
toUnlink.insert(n); // the sort at the start of the pipeline makes the sort at the end
break; // superfluous, so we'll remove it
toUnlink.insert(n);
break;
} }
} }
else if (current->getType() == triagens::aql::ExecutionNode::CALCULATION ||
current->getType() == triagens::aql::ExecutionNode::FILTER ||
current->getType() == triagens::aql::ExecutionNode::ENUMERATE_COLLECTION ||
current->getType() == triagens::aql::ExecutionNode::ENUMERATE_LIST) {
// ok
}
else {
// abort at all other type of nodes. we cannot push a sort beyond them
break;
}
auto deps = current->getDependencies(); auto deps = current->getDependencies();
if (deps.size() != 1) { if (deps.size() != 1) {
// node either has no or more than one dependency. we don't know what to do and must abort // node either has no or more than one dependency. we don't know what to do and must abort
// note: this will also handle Singleton nodes // note: this will also handle Singleton nodes