Skip to content

Spawn

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

Expands an ARRAY value into individual rows, fanning the chain out to one row per element.

Spawn(:array) consumes an ARRAY field and emits one row per element of the array. The first element becomes the primary result; the remaining elements become additional results, so downstream rules in the chain run once per element.

This is the new-mode replacement for the legacy multi-sized result fan-out: Spawn lets you defer fan-out from the producer (UsagiMap()[], Use()[N], …) to a later, explicit step that operates on an ARRAY collected up to that point. Available in new mode only.

Parameters

1array Mandatory — accepts: field

Field reference to an ARRAY-typed input. Each element of the array becomes one row in the downstream chain.

Input type

  • ARRAY

Output type

The element type of the input ARRAY. The rule reports ARRAY from aggregateType() purely to bypass the parse-time type check; elements are typed at runtime.

Requires

  • Exactly one parameter, a field reference to an ARRAY field.
  • The ARRAY must contain at least one element at runtime — empty arrays raise a runtime error.

Examples

Expand a collected ARRAY into one row per element

:codes => UsagiMap("file.csv")[] => :concept_array
Spawn(:concept_array)

Errors

  • `Spawn': input must be ARRAY-typed
    The referenced field does not hold an ARRAY value at runtime.
  • `Spawn': empty array - no rows to produce
    The ARRAY had zero elements when the rule fired.
  • Spawn: input:f' must be of ARRAY type`
    The referenced field is not declared ARRAY.
  • `Spawn' is only available in new mode
    New mode is not enabled in etl.conf.

See also

Use, CartesianOf, Unique, At, Size