summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/window_function/window_function_exec_removable_document.cpp
diff options
context:
space:
mode:
authorTed Tuckman <ted.tuckman@mongodb.com>2021-03-04 16:43:38 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-04 18:01:49 +0000
commitca1bf42db1f3057e55a312cfe95d49150a4c4cd6 (patch)
treec111728553a21e7c9cded494a32c7a8ebff75cdc /src/mongo/db/pipeline/window_function/window_function_exec_removable_document.cpp
parent61f0251c5d0ef38d76ba5e26ce593b3d762e0f62 (diff)
downloadmongo-ca1bf42db1f3057e55a312cfe95d49150a4c4cd6.tar.gz
SERVER-54607 Add support for right unbounded windows in removable document executor
Diffstat (limited to 'src/mongo/db/pipeline/window_function/window_function_exec_removable_document.cpp')
-rw-r--r--src/mongo/db/pipeline/window_function/window_function_exec_removable_document.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_removable_document.cpp b/src/mongo/db/pipeline/window_function/window_function_exec_removable_document.cpp
index 571c06eac30..2a724589360 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_removable_document.cpp
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_removable_document.cpp
@@ -53,7 +53,7 @@ WindowFunctionExecRemovableDocument::WindowFunctionExecRemovableDocument(
stdx::visit(
visit_helper::Overloaded{
[](const WindowBounds::Unbounded&) {
- uasserted(5339801, "Right unbounded windows are not yet supported");
+ // Pass. _upperBound defaults to boost::none which represents no upper bound.
},
[&](const WindowBounds::Current&) { _upperBound = 0; },
[&](const int& upperIndex) { _upperBound = upperIndex; },
@@ -63,7 +63,9 @@ WindowFunctionExecRemovableDocument::WindowFunctionExecRemovableDocument(
void WindowFunctionExecRemovableDocument::initialize() {
int lowerBoundForInit = _lowerBound > 0 ? _lowerBound : 0;
- for (int i = lowerBoundForInit; i <= _upperBound; ++i) {
+ // Run the loop until we hit the out of partition break (right unbounded) or we hit the upper
+ // bound.
+ for (int i = lowerBoundForInit; !_upperBound || i <= _upperBound.get(); ++i) {
// If this is false, we're over the end of the partition.
if (auto doc = (*this->_iter)[i]) {
addValue(_input->evaluate(*doc, nullptr));