1
0
Fork 0

properly handle empty conditions

This commit is contained in:
James 2014-11-22 14:58:34 +00:00
parent 874792d0a8
commit 2704921daf
2 changed files with 15 additions and 4 deletions

View File

@ -795,6 +795,7 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
_plan(plan),
_canThrow(false),
_level(level) {
_rangeInfoMapVec = new RangeInfoMapVec();
_varIds.insert(var->id);
};
@ -815,7 +816,9 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
auto node = static_cast<CalculationNode*>(en);
std::string attr;
Variable const* enumCollVar = nullptr;
_rangeInfoMapVec = buildRangeInfo(node->expression()->node(), enumCollVar, attr);
// there is an implicit AND between FILTER statements
_rangeInfoMapVec = andCombineRangeInfoMapVecs(_rangeInfoMapVec,
buildRangeInfo(node->expression()->node(), enumCollVar, attr));
}
break;
}

View File

@ -504,11 +504,12 @@ RangeInfoMap* triagens::aql::andCombineRangeInfoMaps (RangeInfoMap* lhs, RangeIn
RangeInfoMapVec* triagens::aql::orCombineRangeInfoMapVecs (RangeInfoMapVec* lhs,
RangeInfoMapVec* rhs) {
if (lhs->empty()) {
if (lhs == nullptr || lhs->empty()) {
return rhs; //TODO copy?
}
if (rhs->empty()) {
if (rhs == nullptr || rhs->empty()) {
return lhs; //TODO copy?
}
@ -541,7 +542,14 @@ RangeInfoMapVec* triagens::aql::orCombineRangeInfoMapVecs (RangeInfoMapVec* lhs,
RangeInfoMapVec* triagens::aql::andCombineRangeInfoMapVecs (RangeInfoMapVec* lhs,
RangeInfoMapVec* rhs) {
if (lhs == nullptr || lhs->empty()) { // rhs && impossible to fulfil condition
return nullptr;
}
if (rhs == nullptr || rhs->empty()) {
return nullptr;
}
auto rimv = new RangeInfoMapVec();
for (size_t i = 0; i < lhs->size(); i++) {