mirror of https://gitee.com/bigwinds/arangodb
Fixed a bug with reset of new skiplist index iterator
This commit is contained in:
parent
6713ec39dc
commit
63bad694c5
|
@ -258,9 +258,9 @@ bool SkiplistLookupBuilder::next() {
|
|||
SkiplistInLookupBuilder::SkiplistInLookupBuilder(
|
||||
Transaction* trx,
|
||||
std::vector<std::vector<arangodb::aql::AstNode const*>>& ops,
|
||||
arangodb::aql::Variable const* var, bool reverse) : BaseSkiplistLookupBuilder(trx), _dataBuilder(trx) {
|
||||
arangodb::aql::Variable const* var, bool reverse) : BaseSkiplistLookupBuilder(trx), _dataBuilder(trx), _done(false) {
|
||||
TRI_ASSERT(!ops.empty()); // We certainly do not need IN here
|
||||
VPackBuilder tmp;
|
||||
TransactionBuilderLeaser tmp(trx);
|
||||
std::set<VPackSlice, arangodb::basics::VelocyPackHelper::VPackSorted<true>>
|
||||
unique_set(
|
||||
(arangodb::basics::VelocyPackHelper::VPackSorted<true>(reverse)));
|
||||
|
@ -293,10 +293,10 @@ SkiplistInLookupBuilder::SkiplistInLookupBuilder(
|
|||
} else {
|
||||
// Case: x.a IN value
|
||||
TRI_ASSERT(value->numMembers() > 0);
|
||||
tmp.clear();
|
||||
tmp->clear();
|
||||
unique_set.clear();
|
||||
value->toVelocyPackValue(tmp);
|
||||
for (auto const& it : VPackArrayIterator(tmp.slice())) {
|
||||
value->toVelocyPackValue(*(tmp.get()));
|
||||
for (auto const& it : VPackArrayIterator(tmp->slice())) {
|
||||
unique_set.emplace(it);
|
||||
}
|
||||
_inPositions.emplace_back(i, 0, unique_set.size());
|
||||
|
@ -366,10 +366,10 @@ SkiplistInLookupBuilder::SkiplistInLookupBuilder(
|
|||
TRI_ASSERT(upper == nullptr);
|
||||
TRI_ASSERT(lower == nullptr);
|
||||
TRI_ASSERT(value->numMembers() > 0);
|
||||
tmp.clear();
|
||||
tmp->clear();
|
||||
unique_set.clear();
|
||||
value->toVelocyPackValue(tmp);
|
||||
for (auto const& it : VPackArrayIterator(tmp.slice())) {
|
||||
value->toVelocyPackValue(*(tmp.get()));
|
||||
for (auto const& it : VPackArrayIterator(tmp->slice())) {
|
||||
unique_set.emplace(it);
|
||||
}
|
||||
_inPositions.emplace_back(ops.size() - 1, 0, unique_set.size());
|
||||
|
@ -380,6 +380,7 @@ SkiplistInLookupBuilder::SkiplistInLookupBuilder(
|
|||
_dataBuilder->close();
|
||||
_isEquality = true;
|
||||
_dataBuilder->close();
|
||||
|
||||
buildSearchValues();
|
||||
return;
|
||||
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_EQ:
|
||||
|
@ -388,6 +389,7 @@ SkiplistInLookupBuilder::SkiplistInLookupBuilder(
|
|||
value->toVelocyPackValue(*(_dataBuilder.get()));
|
||||
_isEquality = true;
|
||||
_dataBuilder->close();
|
||||
|
||||
buildSearchValues();
|
||||
return;
|
||||
default:
|
||||
|
@ -408,11 +410,12 @@ SkiplistInLookupBuilder::SkiplistInLookupBuilder(
|
|||
}
|
||||
_dataBuilder->close();
|
||||
_dataBuilder->close();
|
||||
|
||||
buildSearchValues();
|
||||
}
|
||||
|
||||
bool SkiplistInLookupBuilder::next() {
|
||||
if (!forwardInPosition()) {
|
||||
if (_done || !forwardInPosition()) {
|
||||
return false;
|
||||
}
|
||||
buildSearchValues();
|
||||
|
@ -431,6 +434,7 @@ bool SkiplistInLookupBuilder::forwardInPosition() {
|
|||
it->current = 0;
|
||||
it++;
|
||||
}
|
||||
_done = true;
|
||||
// If we get here all positions are reset to 0.
|
||||
// We are done, no further combination
|
||||
return false;
|
||||
|
|
|
@ -137,6 +137,8 @@ class SkiplistInLookupBuilder : public BaseSkiplistLookupBuilder {
|
|||
/// values. (field, inPosition, maxPosition)
|
||||
std::list<PosStruct> _inPositions;
|
||||
|
||||
bool _done;
|
||||
|
||||
public:
|
||||
SkiplistInLookupBuilder(
|
||||
Transaction* trx,
|
||||
|
|
Loading…
Reference in New Issue