Skip to content

CartesianOf

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

Cartesian product of N input ARRAY values, returning an ARRAY of nested-ARRAY combinations.

CartesianOf consumes every ARRAY-typed pipeline input and produces a single output ARRAY. Each output element is itself an ARRAY holding one element drawn from each input array. The combinations are emitted outer-array-first — the first input is the slowest-changing index.

With one input, CartesianOf returns a deep copy of the input array (identity case). With two or more inputs, the output length is the product of the input lengths. The rule is the new-mode replacement for the legacy Cartesian table rule.

Available in new mode only.

Parameters

No parameters accepted.

Input type

  • ARRAY

Output type

  • ARRAY

An ARRAY whose elements are nested ARRAY values, one per combination.

Requires

  • All pipeline inputs must be ARRAY-typed.
  • At least one pipeline input is required.

Examples

Two-input Cartesian product

:colors, :sizes => CartesianOf() => :combos

Three-input Cartesian product producing nested-ARRAY tuples

:a, :b, :c => CartesianOf() => :combos

Errors

  • `CartesianOf': all inputs must be ARRAY-typed
    A non-ARRAY value reached the rule at runtime.
  • `CartesianOf' requires at least one ARRAY input
    No pipeline inputs were supplied.
  • `CartesianOf' does not accept parameters
    Parameters were supplied — CartesianOf always reads its inputs from the pipeline.
  • `CartesianOf' is only available in new mode
    New mode is not enabled in etl.conf.

See also

Append, Unique, Without, Use, Spawn