Compute node
The Compute node adds derived columns to each row (derive mode) or aggregates rows into groups (group_by mode). It's the "spreadsheet formula bar" of the flow.
When to use
- You need a derived column:
full_name = CONCAT(first, ' ', last),is_active = EQ(status, 'active'),age_bucket = IF(GT(age, 65), 'senior', IF(GT(age, 40), 'adult', 'young')). - You need aggregates over groups: total, count, min, max, avg per group.
- You need window-style behaviours across a source stream (rolling total, cumulative count).
Ports
| Port | Direction | Kind | Notes |
|---|---|---|---|
in | in | data | Rows. |
out | out | data | Rows with derived / aggregated columns. |
error | out | control | Fires on expression eval errors when strict mode is on. |
notify | out | control | Notification policy port. |
Configuration
- Mode.
derive— per-row derived columns via expressions.group_by— aggregate into groups.
- Derived columns (derive). List of
{ name, expr }. Each expression runs once per row viaevalTransformExpr. - Group-by keys (group_by). SchemaFieldMultiSelect over upstream columns.
- Aggregates (group_by). List of
{ op, field, as }. Supported ops:count,sum,avg,min,max,first,last,count_distinct. - Group-by scope.
global(default) — aggregate across every chunk from every source.chunk— aggregate within each chunk.
Configure Action walkthrough
- Pick a mode (
deriveorgroup_by). - Derive mode: add
{ name, expr }rows; the expression editor uses the same MappingExpressionModal as Transform. - Group-by mode: pick the group-by keys with the SchemaFieldMultiSelect chips; add aggregate rows.
Runtime behaviour
- Derive runs per row, streaming.
- Group-by with
globalscope buffers reducer state across chunks and emits ONCE per source stream at the finalize pass (after every source has drained). - Group-by with
chunkscope emits per-chunk. - Group-by state is per-node-per-source; two Sources feeding the same Compute node produce two separate group-by outputs (finalize pass runs per source).
Failure modes
- Expression error on a row. Derived column emits
nullfor that row; the run continues. - Empty group. Emitted with the group key values and null / 0 for the aggregate columns (per op).