Aggregate Aggregate
Aggregate Certified

Aggregate records by group

yaml
type: io.kestra.plugin.transform.Aggregate
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
Definitions
exprstring
typestring
Possible Values
STRINGINTFLOATDECIMALBOOLEANTIMESTAMPLISTSTRUCT
SubTypestring
DefaultFAIL
Possible Values
FAILSKIPNULL
DefaultTEXT
Possible Values
TEXTBINARY
DefaultAUTO
Possible Values
AUTORECORDSSTORE