Aggregates groups of rows into a single row
The step calculates group fields for each row, and aggregates values per group.
The mode to use:
- one aggregate row per group generates one summary row per group
- keep all rows, add rolling aggregate to each row passes through all input rows immediately, attaches partial aggregate
- keep all rows, add complete aggregate to each row caches each group’s input rows and outputs them once the group is complete - attaches full group aggregate value to each row
Defines the grouping of rows.
Evaluated for each input row
- Data type of the grouping field. Values are implicitly cast to this type.
- Name of the grouping field.
- Value of the grouping field.
This step can optimize row output and memory consumption if it is guaranteed that incoming rows are sorted by group fields.
Evaluated once when step initializes
Defines aggregated fields for each group.
- Type of the field. Final aggregated value is cast to this type.
- Name of the field.
- Evaluated once when step initializes
You can specify an aggregator in the following ways:
- Use one of the aggregators available in the morph context menu.
- Supply a function
(a, x) -> anythat receives the current aggregate value as
a, and the subject to aggregate as
x. The function returns the new aggregate value. When invoked for the first time per group,
- Supply a dict with the following keys:
init(optional) initial aggregation state.
nilis implied if omitted.
(a, x) -> anythat receives the current aggregation state
aand the subject to aggregate as
xand returns the new aggregation state.
(a) -> anythat receives the current aggregation state and returns the aggregation value to place in the aggregation field.
(a) -> ais implied if omitted.
- Evaluated for each input row
The subject to aggregate.
|dict||Current grouping variables.|