Data FlowData Flow
DataFlow
  • User Manual
  • Developer Manual
  • Examples
  • API Reference
Overview
Getting Started
Pipeline Authoring
    Pipeline Spec OverviewConnections
    Sources
    Transforms
      TransformsTransform step: filterTransform step: selectTransform step: renameTransform step: castTransform step: deriveTransform step: aggregateTransform step: add_timestampTransform step: forward_fillTransform step: gap_fill
    Destinations
    Execution Settings
Execution
Deployment
Troubleshooting
Examples
Transforms

Transform step: aggregate

Groups rows and computes aggregations, optionally with windows and managed state.

Used inside a transform's steps list as type: aggregate. See Transforms for the full model.

Group-and-aggregate. Expression grammar varies by execution mode: • Stateless batch and streaming windowed (state.window set): any Spark SQL aggregate expression (e.g. sum(price * qty), stddev(value), corr(a, b), collect_set(...)) - Catalyst plans them. • Managed batch state (state.enabled: true, batch mode) and streaming running totals (no state.window): only single-function primitives over one column - sum(col), avg(col), count(col), count(*), min(col), max(col). Compound expressions must be precomputed with a 'derive' step upstream. Managed batch state persists per-group partials so re-runs merge across input batches; avg(col) is stored as paired sum + count partials.

Fields

FieldTypeDefaultNotes
name (required)string--
typeaggregate--
group_byarray of string--
columns (required)array of object--
columns[].name (required)string--
columns[].expr (required)string--
stateobject-Managed cross-batch state for the aggregate step. Storage is configured at deployment time and is not exposed here.
state.enabledboolean-Defaults to true. Set false to opt out of managed state for this step.
state.late_arrivalobject-Out-of-order tolerance. Set when records may arrive after their event time.
state.late_arrival.column (required)string-Input column that carries the event time, e.g. 'ts'.
state.late_arrival.max_latency (required)string-Maximum delay after 'column' the engine will accept before treating a record as too late, e.g. '10 minutes', '1 hour', '1 day'. Used as the watermark grace in streaming.
state.windowobject-Optional event-time window for streaming aggregate. When set, the streaming-native aggregate runs as groupBy(window(event_time, ...), keys).agg(...). When omitted, streaming aggregate runs as a running-totals aggregate via flatMapGroupsWithState. Ignored for batch.
state.window.type (required)tumbling or session--
state.window.durationstring-Window length for tumbling windows, e.g. '5 minutes', '1 hour'.
state.window.idle_timeoutstring-Idle duration that closes a session window, e.g. '10 minutes'. The session ends when no event arrives for this long after the previous one.

Required: name, columns.

Minimal example

A aggregate step inside a transform:

Code
transforms: - name: enrich_orders from: builds.base_orders steps: - name: aggregate_step type: aggregate columns: - name: <name> expr: amount * 1.15

Related pages

  • Transforms
  • Connections
  • Pipeline Spec Overview
  • API Reference
Suggest edit
Last modified on November 26, 2026
Transform step: deriveTransform step: add_timestamp
On this page
  • Fields
  • Minimal example
  • Related pages
YAML