$tumblingWindow
On this page
Definition
The $tumblingWindow
stage specifies a
tumbling window for aggregation of data.
Atlas Stream Processing windows are stateful, can be recovered if interrupted,
and have mechanisms for processing late-arriving data. You must apply
all other aggregation queries to your streaming data within this
window stage.
$tumblingWindow
A
$tumblingWindow
pipeline stage has the following prototype form:{ "$tumblingWindow": { "interval": { "size": <int>, "unit": "<unit-of-time>" }, "pipeline" : [ <aggregation-stage-array> ], "offset": { "offsetFromUtc": <int>, "unit": "<unit-of-time>" }, "idleTimeout": { "size": <int>, "unit": "<unit-of-time>" }, "allowedLateness": { size: <int>, unit: "<unit-of-time>" } } }
Syntax
The $tumblingWindow
stage takes a document with the following
fields:
Field | Type | Necessity | Description |
---|---|---|---|
interval | document | Required | Document specifying the interval of a hopping window as a combination of a size and a unit of time where:
For example, a |
pipeline | array | Required | Nested aggregation pipeline evaluated against the messages
within the window. |
offset | document | Optional | Document specifying a time offset for window boundaries relative
to UTC. The document is a combination of the size field
For example, an |
idleTimeout | document | Optional | Document specifying how long to wait before closing windows if
If you set For example, consider a 12:00 pm to 1:00 pm window and
|
allowedLateness | document | Optional | Document that specifies how long to keep
windows generated from the
source open to accept late-arriving data after processing
documents for window end time. If omitted, defaults to 3
seconds. |
Behavior
Atlas Stream Processing supports only one window stage per pipeline.
When you apply the $group
stage to your window stage,
a single group key
has a limit of 100 megabytes of RAM.
Support for certain aggregation stages might be limited or unavailable within windows. To learn more, see Supported Aggregation Pipeline Stages.
In the event of a service interruption, you can resume the internal pipeline of a window from its state at the point of interruption. To learn more, see Checkpoints.