GraalVM FileTransform

GraalVM FileTransform

Certified

Transform rows with Ruby on GraalVM

Streams rows from from (kestra:// URI, map, or list), lets Ruby mutate row via Polyglot.import, and writes the result as an ION file. Set concurrent to parallelize (order not preserved). Export row = nil to drop a record; use rows array to emit multiples.

yaml
type: io.kestra.plugin.graalvm.ruby.FileTransform
yaml
id: transformRuby
namespace: company.team

tasks:
  - id: download
    type: io.kestra.plugin.core.http.Download
    uri: https://dummyjson.com/carts/1
  - id: jsonToIon
    type: io.kestra.plugin.serdes.json.JsonToIon
    from: "{{outputs.download.uri}}"
  - id: transformRuby
    type: io.kestra.plugin.graalvm.ruby.FileTransform
    from: "{{ outputs.jsonToIon.uri }}"
    script: |
      row = Polyglot.import('row')
      if row[:id] == 55
        # remove un-needed row
        Polyglot.export('row', nil)
      else
        # remove the 'products' column
        row[:products] = nil
        # add a 'totalItems' column
        row[:totalItems] = row[:totalProducts] * row[:totalQuantity]
      end
Properties

Source file containing rows to transform

Accepts a kestra:// internal storage URI, map, or list; rows stream into the script before being rewritten as ION

Script body to execute

Template-rendered source code run by GraalVM in the selected language; flow variables are resolved before execution

Parallel transformations to execute

Number of concurrent workers; ordering is not preserved when set and execution defaults to sequential when null

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

Formaturi

URI of a temporary result file

The file will be serialized as an ION file.

Unitcount

Number of records or entities processed by the Ruby script. This includes both modified and filtered rows from the input file.