mirror of https://gitee.com/bigwinds/arangodb
properly handle empty conditions
This commit is contained in:
parent
874792d0a8
commit
2704921daf
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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++) {
|
||||
|
|
Loading…
Reference in New Issue