Core Plugins and tasks DeduplicateItems

Core Plugins and tasks DeduplicateItems

Certified

Deduplicate a line-oriented file by key.

Reads the file twice: first to map each key (from expr) to its last occurrence offset, then to write only those last occurrences to a new file. Avoids loading the full file in memory.

Use for ordered “keep-last” semantics; expression can reference columns directly.

yaml
type: io.kestra.plugin.core.storage.DeduplicateItems

Remove duplicate customer emails from a CSV file.

yaml
    id: deduplicate_items
    namespace: company.team

    tasks:
      - id: generate_files
        type: io.kestra.plugin.scripts.shell.Script
        script: |
          cat <<EOF > my_data.csv
          order_id,customer_name,customer_email,product_id,price
          1,Kelly Olsen,kelly@example.com,20,166.89
          2,Miguel Moore,mccarthylee@example.net,14,171.63
          3,Kelly Olsen,kelly@example.com,20,166.89
          4,Jessica White,jessica@example.com,12,50.62
          5,Jessica White,jessica@example.com,12,50.62
          EOF
        outputFiles:
          - "my_data.csv"

      - id: csv_to_ion
        type: io.kestra.plugin.serdes.csv.CsvToIon
        from: "{{ outputs.generate_files.outputFiles['my_data.csv'] }}"

      - id: dedup
        type: io.kestra.plugin.core.storage.DeduplicateItems
        from: "{{ outputs.csv_to_ion.uri }}"
        expr: "{{ customer_email }}"
Properties

The Pebble expression to extract the deduplication key from each item

Headers from the file can be referenced directly e.g. {{ customer_email }}

The file to be deduplicated

Reference (ref) of the pluginDefaults to apply to this task.

The total number of items that was dropped by the task

The number of distinct keys observed by the task

The total number of items that was processed by the task

Formaturi

The deduplicated file URI