Aggregate
Aggregate records by group
Aggregate
Aggregate records by group
yaml
type: io.kestra.plugin.transform.AggregateExamples
yaml
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
yaml
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
Definitions
io.kestra.plugin.transform.Aggregate-AggregateDefinition
exprstring
typestring
Possible Values
STRINGINTFLOATDECIMALBOOLEANTIMESTAMPLISTSTRUCTfrom *Requiredobject
groupBy *Requiredarray
SubTypestring
onError string
Default
FAILPossible Values
FAILSKIPNULLoutputFormat string
Default
TEXTPossible Values
TEXTBINARYoutputType string
Default
AUTOPossible Values
AUTORECORDSSTORE