8000 Let the Modification Executor also produce data, even if no FullCount… · arangodb/arangodb@b1c6af5 · GitHub
[go: up one dir, main page]

Skip to content

Commit b1c6af5

Browse files
committed
Let the Modification Executor also produce data, even if no FullCount is used.
1 parent e28c231 commit b1c6af5

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

arangod/Aql/ModificationExecutor.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ template <typename FetcherType, typename ModifierType>
201201
doCollect(input, output.numRowsLeft());
202202
upstreamState = input.upstreamState();
203203
}
204-
205204
if (_modifier.nrOfOperations() > 0) {
206205
_modifier.transact();
207206

@@ -234,7 +233,10 @@ template <typename FetcherType, typename ModifierType>
234233

235234
// only produce at most output.numRowsLeft() many results
236235
ExecutorState upstreamState = input.upstreamState();
237-
while (input.hasDataRow() && call.needSkipMore()) {
236+
// These executors need to be executed on HARD LIMIT 0.
237+
// If we do a fullCount or not.
238+
while (input.hasDataRow() &&
239+
(call.getOffset() > 0 || (call.getLimit() == 0 && call.hasHardLimit()))) {
238240
_modifier.reset();
239241
size_t toSkip = call.getOffset();
240242
if (call.getLimit() == 0 && call.hasHardLimit()) {
@@ -266,8 +268,10 @@ template <typename FetcherType, typename ModifierType>
266268
stats.addWritesExecuted(_modifier.nrOfWritesExecuted());
267269
stats.addWritesIgnored(_modifier.nrOfWritesIgnored());
268270
}
269-
270-
call.didSkip(_modifier.nrOfOperations());
271+
if (call.needSkipMore()) {
272+
// We only need to report skip, if we actually skip.
273+
call.didSkip(_modifier.nrOfOperations());
274+
}
271275
}
272276
}
273277

arangod/Aql/SkipResult.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ auto SkipResult::didSkip(size_t skipped) -> void {
4545
_skipped.back() += skipped;
4646
}
4747

48+
auto SkipResult::didSkipSubquery(size_t skipped, size_t depth) -> void {
49+
TRI_ASSERT(!_skipped.empty());
50+
TRI_ASSERT(_skipped.size() > depth + 1);
51+
size_t index = _skipped.size() - depth - 2;
52+
size_t& localSkip = _skipped.at(index);
53+
localSkip += skipped;
54+
}
55+
4856
auto SkipResult::nothingSkipped() const noexcept -> bool {
4957
TRI_ASSERT(!_skipped.empty());
5058
return std::all_of(_skipped.begin(), _skipped.end(),

arangod/Aql/SkipResult.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class SkipResult {
5252

5353
auto didSkip(size_t skipped) -> void;
5454

55+
auto didSkipSubquery(size_t skipped, size_t depth) -> void;
56+
5557
auto nothingSkipped() const noexcept -> bool;
5658

5759
auto toVelocyPack(arangodb::velocypack::Builder& builder) const noexcept -> void;

0 commit comments

Comments
 (0)
0