mirror of https://gitee.com/bigwinds/arangodb
fixed cloning of RangeInfos
This commit is contained in:
parent
1f69d82a8a
commit
2f80c76f69
|
@ -1139,10 +1139,6 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
|
||||||
if (node->type == NODE_TYPE_OPERATOR_BINARY_EQ) {
|
if (node->type == NODE_TYPE_OPERATOR_BINARY_EQ) {
|
||||||
auto lhs = node->getMember(0);
|
auto lhs = node->getMember(0);
|
||||||
auto rhs = node->getMember(1);
|
auto rhs = node->getMember(1);
|
||||||
if (rhs->type != NODE_TYPE_ATTRIBUTE_ACCESS) {
|
|
||||||
lhs = node->getMember(1);
|
|
||||||
rhs = node->getMember(0);
|
|
||||||
}
|
|
||||||
if (rhs->type == NODE_TYPE_ATTRIBUTE_ACCESS) {
|
if (rhs->type == NODE_TYPE_ATTRIBUTE_ACCESS) {
|
||||||
buildRangeInfo(rhs, enumCollVar, attr, isOrCondition);
|
buildRangeInfo(rhs, enumCollVar, attr, isOrCondition);
|
||||||
if (enumCollVar != nullptr) {
|
if (enumCollVar != nullptr) {
|
||||||
|
@ -1163,6 +1159,26 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lhs->type == NODE_TYPE_ATTRIBUTE_ACCESS) {
|
||||||
|
buildRangeInfo(lhs, enumCollVar, attr, isOrCondition);
|
||||||
|
if (enumCollVar != nullptr) {
|
||||||
|
std::unordered_set<Variable*> varsUsed
|
||||||
|
= Ast::getReferencedVariables(rhs);
|
||||||
|
if (varsUsed.find(const_cast<Variable*>(enumCollVar))
|
||||||
|
== varsUsed.end()) {
|
||||||
|
// Found a multiple attribute access of a variable and an
|
||||||
|
// expression which does not involve that variable:
|
||||||
|
insert(enumCollVar->name,
|
||||||
|
attr.substr(0, attr.size() - 1),
|
||||||
|
RangeInfoBound(rhs, true),
|
||||||
|
RangeInfoBound(rhs, true),
|
||||||
|
true,
|
||||||
|
isOrCondition);
|
||||||
|
enumCollVar = nullptr;
|
||||||
|
attr.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -465,7 +465,7 @@ void RangeInfoMapVec::insertDistributeAndIntoOr (std::vector<RangeInfo> ranges)
|
||||||
for (size_t j = 1; j < ranges.size(); j++) {
|
for (size_t j = 1; j < ranges.size(); j++) {
|
||||||
RangeInfoMap* rim = sample->clone();
|
RangeInfoMap* rim = sample->clone();
|
||||||
rim->insert(ranges[j]); // here we intersect with any existing values
|
rim->insert(ranges[j]); // here we intersect with any existing values
|
||||||
_rangeInfoMapVec.push_back(rim);
|
_rangeInfoMapVec.emplace_back(rim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ void RangeInfoMapVec::insertDistributeAndIntoOr (std::vector<RangeInfo> ranges)
|
||||||
for (auto x: ranges) {
|
for (auto x: ranges) {
|
||||||
RangeInfoMap* rim = new RangeInfoMap();
|
RangeInfoMap* rim = new RangeInfoMap();
|
||||||
rim->insert(x);
|
rim->insert(x);
|
||||||
_rangeInfoMapVec.push_back(rim);
|
_rangeInfoMapVec.emplace_back(rim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -529,8 +529,24 @@ namespace triagens {
|
||||||
}
|
}
|
||||||
|
|
||||||
RangeInfo clone () {
|
RangeInfo clone () {
|
||||||
//TODO improve this
|
RangeInfo copy(_var, _attr);
|
||||||
return RangeInfo(this->toJson());
|
|
||||||
|
copy._lowConst.assign(_lowConst);
|
||||||
|
copy._highConst.assign(_highConst);
|
||||||
|
|
||||||
|
for (auto x: _lows) {
|
||||||
|
copy._lows.emplace_back(x);
|
||||||
|
}
|
||||||
|
for (auto x: _highs) {
|
||||||
|
copy._highs.emplace_back(x);
|
||||||
|
}
|
||||||
|
copy._valid = _valid;
|
||||||
|
copy._defined = _defined;
|
||||||
|
copy._equality = _equality;
|
||||||
|
|
||||||
|
return copy;
|
||||||
|
//FIXME the following should work but doesn't!!
|
||||||
|
//return RangeInfo(this->toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue