mirror of https://gitee.com/bigwinds/arangodb
SortIndex: fix the way we register our results to the framework
This commit is contained in:
parent
cd29afd88f
commit
3b93d0847d
|
@ -658,7 +658,6 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
|
||||||
int triagens::aql::useIndexRange (Optimizer* opt,
|
int triagens::aql::useIndexRange (Optimizer* opt,
|
||||||
ExecutionPlan* plan,
|
ExecutionPlan* plan,
|
||||||
Optimizer::Rule const* rule) {
|
Optimizer::Rule const* rule) {
|
||||||
opt->addPlan(plan, rule->level, false);
|
|
||||||
|
|
||||||
std::vector<ExecutionNode*> nodes
|
std::vector<ExecutionNode*> nodes
|
||||||
= plan->findNodesOfType(triagens::aql::ExecutionNode::FILTER, true);
|
= plan->findNodesOfType(triagens::aql::ExecutionNode::FILTER, true);
|
||||||
|
@ -670,6 +669,7 @@ int triagens::aql::useIndexRange (Optimizer* opt,
|
||||||
FilterToEnumCollFinder finder(opt, plan, invars[0], rule->level);
|
FilterToEnumCollFinder finder(opt, plan, invars[0], rule->level);
|
||||||
nn->walk(&finder);
|
nn->walk(&finder);
|
||||||
}
|
}
|
||||||
|
opt->addPlan(plan, rule->level, false);
|
||||||
|
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -806,6 +806,9 @@ class sortToIndexNode : public WalkerWorker<ExecutionNode> {
|
||||||
int _level;
|
int _level;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
bool planModified;
|
||||||
|
|
||||||
|
|
||||||
sortToIndexNode (Optimizer* opt,
|
sortToIndexNode (Optimizer* opt,
|
||||||
ExecutionPlan* plan,
|
ExecutionPlan* plan,
|
||||||
sortAnalysis* Node,
|
sortAnalysis* Node,
|
||||||
|
@ -814,6 +817,7 @@ class sortToIndexNode : public WalkerWorker<ExecutionNode> {
|
||||||
_plan(plan),
|
_plan(plan),
|
||||||
_sortNode(Node),
|
_sortNode(Node),
|
||||||
_level(level) {
|
_level(level) {
|
||||||
|
planModified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -826,6 +830,7 @@ class sortToIndexNode : public WalkerWorker<ExecutionNode> {
|
||||||
|
|
||||||
if (node->MatchesIndex(result.first)) {
|
if (node->MatchesIndex(result.first)) {
|
||||||
_sortNode->removeSortNodeFromPlan(_plan);
|
_sortNode->removeSortNodeFromPlan(_plan);
|
||||||
|
planModified = true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -839,7 +844,7 @@ class sortToIndexNode : public WalkerWorker<ExecutionNode> {
|
||||||
auto result = _sortNode->getAttrsForVariableName(variableName);
|
auto result = _sortNode->getAttrsForVariableName(variableName);
|
||||||
|
|
||||||
if (result.first.size() == 0) {
|
if (result.first.size() == 0) {
|
||||||
return false; // we didn't find anything replaceable by indice
|
return true; // we didn't find anything replaceable by indice
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto idx: node->getIndicesOrdered(result.first)) {
|
for (auto idx: node->getIndicesOrdered(result.first)) {
|
||||||
|
@ -921,6 +926,7 @@ class sortToIndexNode : public WalkerWorker<ExecutionNode> {
|
||||||
int triagens::aql::useIndexForSort (Optimizer* opt,
|
int triagens::aql::useIndexForSort (Optimizer* opt,
|
||||||
ExecutionPlan* plan,
|
ExecutionPlan* plan,
|
||||||
Optimizer::Rule const* rule) {
|
Optimizer::Rule const* rule) {
|
||||||
|
bool planModified = false;
|
||||||
std::vector<ExecutionNode*> nodes
|
std::vector<ExecutionNode*> nodes
|
||||||
= plan->findNodesOfType(triagens::aql::ExecutionNode::SORT, true);
|
= plan->findNodesOfType(triagens::aql::ExecutionNode::SORT, true);
|
||||||
for (auto n : nodes) {
|
for (auto n : nodes) {
|
||||||
|
@ -929,10 +935,13 @@ int triagens::aql::useIndexForSort (Optimizer* opt,
|
||||||
if (node.isAnalyzeable()) {
|
if (node.isAnalyzeable()) {
|
||||||
sortToIndexNode finder(opt, plan, &node, rule->level);
|
sortToIndexNode finder(opt, plan, &node, rule->level);
|
||||||
thisSortNode->walk(&finder);/// todo auf der dependency anfangen
|
thisSortNode->walk(&finder);/// todo auf der dependency anfangen
|
||||||
|
if (finder.planModified) {
|
||||||
|
planModified = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
opt->addPlan(plan, rule->level, false);
|
opt->addPlan(plan, rule->level, planModified);
|
||||||
|
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue