summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/window_function/window_function_exec.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/window_function/window_function_exec.h')
-rw-r--r--src/mongo/db/pipeline/window_function/window_function_exec.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec.h b/src/mongo/db/pipeline/window_function/window_function_exec.h
index 4dfcbdd8356..5217be555d8 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec.h
+++ b/src/mongo/db/pipeline/window_function/window_function_exec.h
@@ -32,6 +32,7 @@
#include <queue>
#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source_set_window_fields.h"
#include "mongo/db/pipeline/expression.h"
#include "mongo/db/pipeline/window_function/partition_iterator.h"
#include "mongo/db/pipeline/window_function/window_bounds.h"
@@ -39,6 +40,8 @@
namespace mongo {
+struct WindowFunctionStatement;
+
/**
* An interface for an executor class capable of evaluating a function over a given window
* definition. The function must expose an accumulate-type interface and potentially a remove
@@ -49,7 +52,14 @@ namespace mongo {
*/
class WindowFunctionExec {
public:
- WindowFunctionExec(PartitionIterator* iter) : _iter(iter){};
+ /**
+ * Creates an appropriate WindowFunctionExec that is capable of evaluating the window function
+ * over the given bounds, both found within the WindowFunctionStatement.
+ */
+ static std::unique_ptr<WindowFunctionExec> create(PartitionIterator* iter,
+ const WindowFunctionStatement& functionStmt);
+
+ virtual ~WindowFunctionExec() = default;
/**
* Retrieve the next value computed by the window function.
@@ -62,6 +72,8 @@ public:
virtual void reset() = 0;
protected:
+ WindowFunctionExec(PartitionIterator* iter) : _iter(iter){};
+
PartitionIterator* _iter;
};