mirror of https://gitee.com/bigwinds/arangodb
bugfixes and leaks fixed.
This commit is contained in:
parent
3f646034c8
commit
4b5e42c52a
|
@ -463,23 +463,20 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
|
||||||
auto idx = idxs.at(i);
|
auto idx = idxs.at(i);
|
||||||
if (idx->_type == TRI_IDX_TYPE_HASH_INDEX && equality) {
|
if (idx->_type == TRI_IDX_TYPE_HASH_INDEX && equality) {
|
||||||
for (size_t j = 0; j < idx->_fields._length; j++) {
|
for (size_t j = 0; j < idx->_fields._length; j++) {
|
||||||
auto range = map->find(std::string(idx->_fields._buffer[j]))->second;
|
auto range = map->find(std::string(idx->_fields._buffer[j]));
|
||||||
rangeInfo.at(0).push_back(range);
|
rangeInfo.at(0).push_back(range->second);
|
||||||
//TODO should copy rangeInfo here
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx->_type == TRI_IDX_TYPE_SKIPLIST_INDEX) {
|
if (idx->_type == TRI_IDX_TYPE_SKIPLIST_INDEX) {
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
auto range = map->find(std::string(idx->_fields._buffer[0]))->second;
|
auto range = map->find(std::string(idx->_fields._buffer[0]));
|
||||||
//TODO should copy rangeInfo here
|
rangeInfo.at(0).push_back(range->second);
|
||||||
rangeInfo.at(0).push_back(range);
|
equality = range->second->is1ValueRangeInfo();
|
||||||
equality = range->is1ValueRangeInfo();
|
|
||||||
while (++j < prefixes.at(i) && equality){
|
while (++j < prefixes.at(i) && equality){
|
||||||
range = map->find(std::string(idx->_fields._buffer[j]))->second;
|
range = map->find(std::string(idx->_fields._buffer[j]));
|
||||||
//TODO should copy rangeInfo here
|
rangeInfo.at(0).push_back(range->second);
|
||||||
rangeInfo.at(0).push_back(range);
|
equality = equality && range->second->is1ValueRangeInfo();
|
||||||
equality = equality && range->is1ValueRangeInfo();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,6 +530,7 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
|
||||||
attr.append(attributeName);
|
attr.append(attributeName);
|
||||||
attr.push_back('.');
|
attr.push_back('.');
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->type == NODE_TYPE_OPERATOR_BINARY_EQ) {
|
if (node->type == NODE_TYPE_OPERATOR_BINARY_EQ) {
|
||||||
|
@ -559,6 +557,9 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
|
||||||
new RangeInfoBound(val, true), new RangeInfoBound(val, true));
|
new RangeInfoBound(val, true), new RangeInfoBound(val, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
attr = "";
|
||||||
|
enumCollVar = "";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(node->type == NODE_TYPE_OPERATOR_BINARY_LT ||
|
if(node->type == NODE_TYPE_OPERATOR_BINARY_LT ||
|
||||||
|
@ -613,11 +614,12 @@ class FilterToEnumCollFinder : public WalkerWorker<ExecutionNode> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->type == NODE_TYPE_OPERATOR_BINARY_AND) {
|
if (node->type == NODE_TYPE_OPERATOR_BINARY_AND) {
|
||||||
attr = "";
|
|
||||||
buildRangeInfo(node->getMember(0), enumCollVar, attr);
|
buildRangeInfo(node->getMember(0), enumCollVar, attr);
|
||||||
attr = "";
|
|
||||||
buildRangeInfo(node->getMember(1), enumCollVar, attr);
|
buildRangeInfo(node->getMember(1), enumCollVar, attr);
|
||||||
}
|
}
|
||||||
|
attr = "";
|
||||||
|
enumCollVar = "";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ namespace triagens {
|
||||||
_bound = Json(TRI_UNKNOWN_MEM_ZONE, bound->toJson(TRI_UNKNOWN_MEM_ZONE, true));
|
_bound = Json(TRI_UNKNOWN_MEM_ZONE, bound->toJson(TRI_UNKNOWN_MEM_ZONE, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
RangeInfoBound (basics::Json const& json) :
|
RangeInfoBound (basics::Json const& json)
|
||||||
_bound(Json(TRI_UNKNOWN_MEM_ZONE,
|
: _bound(Json(TRI_UNKNOWN_MEM_ZONE,
|
||||||
basics::JsonHelper::checkAndGetArrayValue(json.json(), "bound"),
|
basics::JsonHelper::checkAndGetArrayValue(json.json(), "bound"),
|
||||||
basics::Json::NOFREE).copy()),
|
basics::Json::NOFREE).copy()),
|
||||||
_include(basics::JsonHelper::checkAndGetBooleanValue(json.json(), "include")) {
|
_include(basics::JsonHelper::checkAndGetBooleanValue(json.json(), "include")) {
|
||||||
|
@ -64,7 +64,10 @@ namespace triagens {
|
||||||
|
|
||||||
~RangeInfoBound(){}
|
~RangeInfoBound(){}
|
||||||
|
|
||||||
RangeInfoBound ( RangeInfoBound const& copy ) = delete;
|
RangeInfoBound ( RangeInfoBound const& copy )
|
||||||
|
: _bound(copy._bound.copy()), _include(copy._include){
|
||||||
|
}
|
||||||
|
|
||||||
RangeInfoBound& operator= ( RangeInfoBound const& copy ) = delete;
|
RangeInfoBound& operator= ( RangeInfoBound const& copy ) = delete;
|
||||||
|
|
||||||
Json toJson () const {
|
Json toJson () const {
|
||||||
|
@ -138,10 +141,12 @@ namespace triagens {
|
||||||
else {
|
else {
|
||||||
_high = nullptr;
|
_high = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RangeInfo( const RangeInfo& copy ) = delete;
|
RangeInfo( RangeInfo const& copy )
|
||||||
|
: _var(copy._var), _attr(copy._attr), _low(copy._low),
|
||||||
|
_high(copy._high), _valid(copy._valid){}
|
||||||
|
|
||||||
RangeInfo& operator= ( RangeInfo const& copy ) = delete;
|
RangeInfo& operator= ( RangeInfo const& copy ) = delete;
|
||||||
|
|
||||||
~RangeInfo(){
|
~RangeInfo(){
|
||||||
|
@ -177,36 +182,6 @@ namespace triagens {
|
||||||
&& _low->_include && _high->_include;
|
&& _low->_include && _high->_include;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*TRI_index_operator_t* toIndexOperator (TRI_shaper_t* shaper) {
|
|
||||||
|
|
||||||
// lower bound
|
|
||||||
TRI_index_operator_t* left = nullptr;
|
|
||||||
if(_low != nullptr){
|
|
||||||
left = _low->toIndexOperator(false, shaper);
|
|
||||||
}
|
|
||||||
|
|
||||||
// upper bound
|
|
||||||
TRI_index_operator_t* right = nullptr;
|
|
||||||
if(_high != nullptr){
|
|
||||||
right = _high->toIndexOperator(true, shaper);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRI_index_operator_t* out = nullptr;
|
|
||||||
if (left != nullptr) {
|
|
||||||
if (right != nullptr) {
|
|
||||||
out = TRI_CreateIndexOperator(TRI_AND_INDEX_OPERATOR, left, right,
|
|
||||||
NULL, shaper, NULL, 2, NULL);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
out = left;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (right != nullptr) {
|
|
||||||
out = right;
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
std::string _var;
|
std::string _var;
|
||||||
std::string _attr;
|
std::string _attr;
|
||||||
RangeInfoBound const* _low;
|
RangeInfoBound const* _low;
|
||||||
|
@ -228,7 +203,13 @@ namespace triagens {
|
||||||
|
|
||||||
RangesInfo () : _ranges(){}
|
RangesInfo () : _ranges(){}
|
||||||
|
|
||||||
~RangesInfo(){}
|
~RangesInfo(){
|
||||||
|
for (auto x: _ranges) {
|
||||||
|
for (auto y: x.second) {
|
||||||
|
delete y.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// find the range info for variable <var> and attributes <name>
|
// find the range info for variable <var> and attributes <name>
|
||||||
RangeInfo* find (std::string var, std::string name) const {
|
RangeInfo* find (std::string var, std::string name) const {
|
||||||
|
@ -287,7 +268,6 @@ namespace triagens {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef std::vector<std::vector<RangeInfo*>> RangeInfoVec;
|
typedef std::vector<std::vector<RangeInfo*>> RangeInfoVec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue