8000 Fixed constrained sort #2 · arangodb/arangodb@19613c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 19613c5

Browse files
committed
Fixed constrained sort #2
1 parent 90ec0c3 commit 19613c5

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

arangod/Aql/SortingGatherExecutor.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ auto SortingGatherExecutor::produceRows(typename Fetcher::DataRange& input,
346346
}
347347
}
348348

349+
// produceRows should not be called again when the limit is reached;
350+
// the downstream limit should see to that.
351+
TRI_ASSERT(!limitReached());
352+
349353
while (!isDone(input) && !output.isFull() && !limitReached()) {
350354
TRI_ASSERT(!maySkip());
351355
auto row = nextRow(input);
@@ -360,10 +364,17 @@ auto SortingGatherExecutor::produceRows(typename Fetcher::DataRange& input,
360364
}
361365
}
362366

363-
if (isDone(input)) {
364-
return {ExecutorState::DONE, NoStats{}, AqlCallSet{}};
365-
}
366-
return {ExecutorState::HASMORE, NoStats{}, AqlCallSet{}};
367+
auto const state = std::invoke([&]() {
368+
if (isDone(input)) {
369+
return ExecutorState::DONE;
370+
} else if (limitReached() && !output.getClientCall().needsFullCount()) {
371+
return ExecutorState::DONE;
372+
} else {
373+
return Exec 5DD7 utorState::HASMORE;
374+
}
375+
});
376+
377+
return {state, NoStats{}, AqlCallSet{}};
367378
}
368379

369380
auto SortingGatherExecutor::skipRowsRange(typename Fetcher::DataRange& input, AqlCall& call)

0 commit comments

Comments
 (0)
0