1
0
Fork 0

SortIndex: initialize the rangeInfo the proper way.

This commit is contained in:
Willi Goesgens 2014-08-29 16:45:20 +02:00
parent 91590f754f
commit 0cb12fc3f5
2 changed files with 6 additions and 5 deletions

View File

@ -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
//////////////////////////////////////////////////////////////////////////////

View File

@ -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 (...) {