mirror of https://gitee.com/bigwinds/arangodb
SortIndex: initialize the rangeInfo the proper way.
This commit is contained in:
parent
91590f754f
commit
0cb12fc3f5
|
@ -362,8 +362,8 @@ void Optimizer::setupRules () {
|
|||
registerRule("use-index-range", useIndexRange, 710);
|
||||
|
||||
// try to find sort blocks which are superseeded by indexes
|
||||
//registerRule("use-index-for-sort", useIndexForSort, 720);
|
||||
|
||||
registerRule("use-index-for-sort", useIndexForSort, 720);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// END OF OPTIMISATIONS
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -744,9 +744,6 @@ public:
|
|||
v.push_back(std::make_pair(_sortNodeData[j]->attributevec,
|
||||
_sortNodeData[j]->ASC));
|
||||
rangeInfo.push_back(std::vector<RangeInfo>());
|
||||
|
||||
rangeInfo.at(j).push_back(RangeInfo(variableName,
|
||||
_sortNodeData[j]->attributevec));
|
||||
}
|
||||
return std::make_pair(v, rangeInfo);
|
||||
}
|
||||
|
@ -794,6 +791,7 @@ class sortToIndexNode : public WalkerWorker<ExecutionNode> {
|
|||
|
||||
if (node->MatchesIndex(result.first)) {
|
||||
_sortNode->removeSortNodeFromPlan(_plan);
|
||||
std::cout << "aoeuaoeuao\n";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -805,6 +803,7 @@ class sortToIndexNode : public WalkerWorker<ExecutionNode> {
|
|||
bool handleEnumerateCollectionNode(EnumerateCollectionNode* node, int level) {
|
||||
auto variableName = node->getVariablesSetHere()[0]->name;
|
||||
auto result = _sortNode->getAttrsForVariableName(variableName);
|
||||
std::cout << "1aoeuaoeuao\n";
|
||||
|
||||
if (result.first.size() == 0) {
|
||||
return false; // we didn't find anything replaceable by indice
|
||||
|
@ -828,8 +827,10 @@ class sortToIndexNode : public WalkerWorker<ExecutionNode> {
|
|||
newPlan->replaceNode(newPlan->getNodeById(node->id()), newNode);
|
||||
|
||||
if (idx.fullmatch) { // if the index superseedes the sort, remove it.
|
||||
std::cout << "aoeuaoeuaoeuaoueaoeuaoeuao\n";
|
||||
_sortNode->removeSortNodeFromPlan(newPlan);
|
||||
}
|
||||
std::cout << newPlan->toJson(TRI_UNKNOWN_MEM_ZONE, false).toString()<< "\n";
|
||||
_opt->addPlan(newPlan, level, true);
|
||||
}
|
||||
catch (...) {
|
||||
|
|
Loading…
Reference in New Issue