1
0
Fork 0

simplification of fullcount code (#5074)

This commit is contained in:
Jan 2018-04-10 17:25:08 +02:00 committed by GitHub
parent 5decb66d01
commit d500a503b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 11 deletions

View File

@ -349,10 +349,7 @@ int LimitBlock::getOrSkipSome(size_t atLeast, size_t atMost, bool skipping,
if (_state == 0) {
if (_fullCount) {
// properly initialize fullcount value, which has a default of -1
if (_engine->_stats.fullCount == -1) {
_engine->_stats.fullCount = 0;
}
_engine->_stats.fullCount = 0;
}
if (_offset > 0) {
@ -405,13 +402,11 @@ int LimitBlock::getOrSkipSome(size_t atLeast, size_t atMost, bool skipping,
while (true) {
skipped = 0;
AqlItemBlock* ignore = nullptr;
ExecutionBlock::getOrSkipSome(atLeast, atMost, skipping, ignore,
skipped);
ExecutionBlock::getOrSkipSome(atLeast, atMost, skipping, ignore, skipped);
if (ignore != nullptr) {
_engine->_stats.fullCount += static_cast<int64_t>(ignore->size());
delete ignore;
}
TRI_ASSERT(ignore == nullptr || ignore->size() == skipped);
_engine->_stats.fullCount += skipped;
delete ignore;
if (skipped == 0) {
break;

View File

@ -834,7 +834,7 @@ class LimitNode : public ExecutionNode {
_fullCount(false) {}
LimitNode(ExecutionPlan* plan, size_t id, size_t limit)
: ExecutionNode(plan, id), _offset(0), _limit(limit), _fullCount(false) {}
: LimitNode(plan, id, 0, limit) {}
LimitNode(ExecutionPlan*, arangodb::velocypack::Slice const& base);

View File

@ -92,5 +92,7 @@ ExecutionStats::ExecutionStats(VPackSlice const& slice)
// note: fullCount is an optional attribute!
if (slice.hasKey("fullCount")) {
fullCount = slice.get("fullCount").getNumber<int64_t>();
} else {
fullCount = 0;
}
}