Skip to content

Tuple

aggregating category: array no `||` new-mode: required resultSize: 1

Packs two or more named fields into a single TUPLE value (or ARRAY<TUPLE> when any input is an ARRAY).

Tuple(:f1, :f2, ...) builds a TUPLE value from the supplied field references, in declared order. The resulting tuple is typically stored in a virtual field and later disassembled with TupleGet — this lets multiple values flow through a single pipeline slot, useful for ||-fallback blocks that must produce more than one named output.

When any input field holds an ARRAY, Tuple broadcasts: it emits one TUPLE per ARRAY element, returning an ARRAY<TUPLE> whose length matches the input array's length. Scalar inputs are repeated across every tuple. Empty input ARRAYs raise a RuntimeMapError so that an enclosing || fallback can try the next block.

Available in new mode only.

Parameters

Nfield Mandatory — accepts: field

Two or more field references in :-notation. Each referenced field must exist in the input set at parse time.

Input type

  • BOOLEAN
  • DATE
  • FLOAT
  • INT
  • STRING
  • ARRAY

Output type

  • TUPLE

An ARRAY<TUPLE> when any input field holds an ARRAY.

Requires

  • At least two field-reference parameters.
  • Every referenced field must be present in the rule's input set at parse time.

Examples

Pair two related concept ids for ||-fallback (test092)

{ :gender => UsagiMap("map3.csv")[] => :gid
  :ethnicity => UsagiMap("eth.csv")[] => :eth
  Tuple(:gid, :eth) => :gtuple
}
|| { ... }
TupleGet(:gtuple, 0) => :gender_concept_id
TupleGet(:gtuple, 1) => :ethnicity_concept_id

Errors

  • Tuple: input has no value (field mapping failed with no default)
    A referenced field has no value at runtime — the enclosing || fallback should pick this up.
  • Tuple: empty ARRAY input, no tuples produced
    A broadcasted ARRAY input was empty.
  • Tuple() requires at least two field parameters in :-notation
    Fewer than two parameters were supplied.
  • Tuple(): field 'X' not found in input
    A named field reference does not match any input field.
  • Tuple() is only available in new mode
    New mode is not enabled in etl.conf.

See also

TupleGet, Use, Selector