Different pipes. One standard.

Type to search this site.

Search runs in your browser against a static index built with this site (Pagefind). Nothing you type is sent to a server.

TransformProposedneeds: windowsneeds: processing-time-windows

std:window-processing-time #

Draft. Groups items by arrival time. Non-deterministic.

For example: draft: group whatever arrives within a time span.

A pipe is a data processing step with declared inputs and outputs; standard pipes are built into the runner.

Ports #

std:window-processing-time takes in and produces out.std:window-processing-timeinrecordsoutwindows
std:window-processing-time takes in and produces out.std:window-processing-timeinrecordsoutwindows
Named ports from the latest published contract. Dashed lines are optional ports.
Ports of std:window-processing-time
PortDirectionKindRequiredDescription
ininputrecordsyes
outoutputwindowsyes

Parameters #

Parameters of std:window-processing-time
NameTypeDefaultRequiredDescription
durationMsintegernoneyes Minimum 1.
maxItemsinteger100000no Minimum 1.

When to use it #

  • Try out time-driven window boundaries: a window closes durationMs milliseconds 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. index counts emitted windows from 0; start and end are the positions in the stream of the first and last item in the frame.
  • A window closed by the timer has partial: false and final: false. The window flushed at the end of the stream has partial: true and final: true.
  • No frame is emitted for a time span in which no item arrived.
  • An open window buffers at most maxItems items (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.

Parameters
{
  "durationMs": 60000
}
Input: in
1
2
3
Expected output: out
{"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:

pipeline.yaml
nodes:
  window-processing-time:
    pipe: std:window-processing-time
    inputs:
      in: {from: inputs.in}
    parameters:
      durationMs: 60000

Run 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.

Command
printf '%s\n' 1 2 3 | openflange run std:window-processing-time --param durationMs=60000
Standard output (out)
{"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 windows and processing-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