
Transform Aggregate
CertifiedAggregate records by group
Transform Aggregate
Aggregate records by group
Group records by one or more fields and compute typed summary values such as counts, sums, minimums, maximums, first, or last values.
type: io.kestra.plugin.transform.AggregateExamples
Aggregate totals
id: aggregate_totals_records
namespace: company.team
tasks:
- id: normalize
type: io.kestra.plugin.core.output.OutputValues
values:
records:
- customer_id: c1
country: FR
total_spent: 10
- customer_id: c1
country: FR
total_spent: 5
- id: aggregate
type: io.kestra.plugin.transform.Aggregate
from: "{{ outputs.normalize.values.records }}"
groupBy:
- customer_id
- country
aggregates:
order_count:
expr: count()
type: INT
total_spent:
expr: sum(total_spent)
type: DECIMAL
onError: FAIL
Aggregate with stored output
id: aggregate_totals
namespace: company.team
tasks:
- id: fetch
type: io.kestra.plugin.core.output.OutputValues
values:
records:
- customer_id: "c1"
country: "FR"
total_spent: 10
- customer_id: "c1"
country: "FR"
total_spent: 5
- id: aggregate
type: io.kestra.plugin.transform.Aggregate
from: "{{ outputs.fetch.values.records }}"
outputType: STORE
groupBy:
- customer_id
- country
aggregates:
order_count:
expr: count()
type: INT
total_spent:
expr: sum(total_spent)
type: DECIMAL
Properties
aggregates *Requiredobject
Aggregate definitions
Output fields to compute for each group. Each value can be a shorthand expression string or an object with expr and optional type.
from *Requiredobject
Input records
Ion list or struct to transform, or a storage URI pointing to an Ion file.
groupBy *Requiredarray
Group by
Fields to group on.
onError string
FAILFAILSKIPNULLOn error behavior
FAIL stops the task on aggregate errors, SKIP drops failing input records, and NULL sets failing aggregate outputs to null.
outputFormat string
TEXTTEXTBINARYOutput format
Experimental: TEXT or BINARY. Only transform tasks can read binary Ion. Use TEXT as the final step.
outputType string
AUTOAUTORECORDSSTOREOutput type
AUTO stores to internal storage when the input is a storage URI; otherwise it returns records.
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
Outputs
records array
Aggregated records
JSON-safe records when output mode is RECORDS or AUTO resolves to RECORDS.
uri string
Stored Ion file URI
URI to the stored Ion file when output mode is STORE or AUTO resolves to STORE.