Ports #
| Port | Direction | Kind | Required | Description |
|---|---|---|---|---|
in | input | records | yes | |
out | output | windows | yes |
Parameters #
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
durationMs | integer | none | yes | Minimum 1. |
maxItems | integer | 100000 | no | Minimum 1. |
When to use it #
- Try out time-driven window boundaries: a window closes
durationMsmilliseconds after its first item arrived, or at the end of the stream. - In an experiment with a live stream: pass on what has arrived one second after the first item of each window (
durationMs: 1000).
When to use something else
- Do not build on it: results depend on arrival times and cannot be reproduced, and the contract may change or be removed without a deprecation period. For anything you need to repeat, use the record-count windows of
std:window.
How it works #
A draft, on purpose #
std:window counts records, so its windows depend only on the order of the items. This pipe uses the clock of the runner instead: a window closes durationMs milliseconds after its first item arrived, or at the end of the stream. Which items share a window therefore depends on when they happened to arrive. The specification says so plainly — the pipe is inherently non-deterministic, its results are not reproducible, and its contract may change or be removed without a deprecation period. It exists so that window framing can be exercised with time-driven boundaries.
What the draft specifies #
- There is a single partition,
null.indexcounts emitted windows from 0;startandendare the positions in the stream of the first and last item in the frame. - A window closed by the timer has
partial: falseandfinal: false. The window flushed at the end of the stream haspartial: trueandfinal: true. - No frame is emitted for a time span in which no item arrived.
- An open window buffers at most
maxItemsitems (default 100000). Reaching the bound closes the window early, as a full window.
The frames have the same shape as those of std:window; the window guide describes them. Event-time windows, watermarks, allowed lateness and session windows are deferred and not part of v0.1.
A tested example #
Nothing here is invented: this is the test “a short stream ends in one final window” from the pipe's own portable test file, which every conformant runner must pass.
{
"durationMs": 60000
}1
2
3{"window":{"index":0,"partition":null,"start":0,"end":2,"final":true,"partial":true},"items":[1,2,3]}The same step as a node of a pipeline.yaml:
nodes:
window-processing-time:
pipe: std:window-processing-time
inputs:
in: {from: inputs.in}
parameters:
durationMs: 60000Run it #
The pipe runs on its own from a shell. The input is the test input above. The quickstart shows how to get the openflange command.
printf '%s\n' 1 2 3 | openflange run std:window-processing-time --param durationMs=60000{"window":{"index":0,"partition":null,"start":0,"end":2,"final":true,"partial":true},"items":[1,2,3]}Executed with openflange 0.0.1 (go1.27.1 linux/amd64), built from commit 11cf8cc of the reference implementation; the output shown is what it printed, and it matches the test.
Notes from the manifest #
The pipe's manifest, OPENFLANGE.md, carries these notes.
Part of the OpenFlange standard library (std, version 0.1).
Draft / proposed. Processing-time semantics are not settled in v0.1 and may change or be removed without a deprecation period. This pipe is not deterministic: window contents depend on when items arrive, so results are not reproducible. It needs the runner capabilities
windowsandprocessing-time-windows.
Groups items by the wall-clock time at which the runner receives them. A
window opens when its first item arrives and closes durationMs milliseconds
later, when it holds maxItems items, or at end of stream — whichever comes
first.
Frames: there is a single partition (partition: null); index counts
emitted windows from 0; start/end are the stream ordinals of the first
and last item in the frame. A window closed by the timer or by maxItems has
partial: false, final: false; the window flushed at end of stream has
partial: true, final: true. No frame is emitted for a period in which no
item arrived.
There is no event time, no watermark, no lateness handling and no
partitioning. State is bounded by maxItems items.
Reference #
- Maturity
- Proposed
- Needs the runner capability
windows,processing-time-windows- Processing scope
record- Manifest version
0.1.0
- Normative definition: std:window-processing-time (proposed, draft) in the standard library specification
- Manifest and tests: std/0.1/window-processing-time in the specification repository