Interface AggregateFunction<ACC>

Type Parameters:
ACC - the accumulator type
All Known Subinterfaces:
AggregateFunction.OfBoolean<ACC>, AggregateFunction.OfDouble<ACC>, AggregateFunction.OfLong<ACC>

public interface AggregateFunction<ACC>
Incremental fold over one window. The pipeline opens an accumulator with the window's bounds, prior sample and quality filter, adds samples in timestamp order, closes it with the first sample after the window when one is known, and finishes it into cells. A fold that reads no window, and every raw or event-driven fold, receives AggregateFunction.Window.unbounded(QualityLevelFilter).

A fold answers its whole window, edges included: an aggregate that depends on the signal at the window's start or end reads it from its AggregateFunction.Window and close(ACC, AggregateFunction.PriorSample). The pipeline owns the grid, the watermarks, the stamp of a cell with no stated quality, and the fill of a window with no cell.

Single-threaded per key; add and close may mutate the accumulator in place or return a fresh one.

  • Method Details

    • id

    • traits

      default AggregateFunction.Traits traits()
      Read once per key: how the fold treats quality and what it needs from its window.
    • open

      The accumulator of one window. A fold that reads no window ignores the argument.
    • add

      ACC add(ACC acc, long tsMs, @Nullable Object value, @Nullable QualityCode quality)
      One sample, in timestamp order. Returns the accumulator to keep: the same one, or a fresh one. A quality-gated fold sees only the samples the query's filter admits; the others see every sample with its quality.
    • addRow

      default ACC addRow(ACC acc, long tsMs, @Nullable Object value, @Nullable QualityCode quality)
      Adds an engine's answer for the window of a fold that reads its edges, after the stored samples at its edges and at the last one's time, so the row does not displace the edges that bound the window. The default adds it as a sample.
    • close

      default ACC close(ACC acc, AggregateFunction.PriorSample next)
      acc closed at its window end by next, the first sample at or after the end, of any quality. A window never given one has no sample after it. The default ignores next.
    • finish

      Zero or more cells for the closed window, in emission order: a multi-value aggregate ( min_max) emits one cell per value at the same window. A cell with a null quality is stamped by the pipeline from the qualities it gated; a stated quality is the fold's own answer. No cells means the window has no value and goes to the fill.