Skip to main content

Reshape node

Transform

The Reshape node changes the row shape between tall and wide forms. Two modes: pivot (turn distinct values into new columns; one output row per group) and unpivot (turn columns into multiple rows).

When to use

  • Source rows come in a long-format (key, month, value) and downstream expects one row per key with a column per month (pivot).
  • Source rows come in a wide format (key, jan, feb, mar, ...) and downstream expects one row per (key, month) pair (unpivot).

Ports

PortDirectionKindNotes
inindataRows.
outoutdataReshaped rows.
erroroutcontrolFires on validation errors.
notifyoutcontrolNotification policy port.

Configuration

  • Mode. pivot or unpivot.
  • Pivot (mode: pivot).
    • identityKeys — SchemaFieldMultiSelect. One output row per distinct combination.
    • nameColumn — the column whose distinct values become new column names.
    • valueColumn — the column whose values fill the new columns.
  • Unpivot (mode: unpivot).
    • valueColumns — SchemaFieldMultiSelect. Columns to melt into rows.
    • nameColumn — output column that holds the melted column name.
    • valueColumn — output column that holds the melted value.

Runtime behaviour

  • Pivot buffers state per identityKeys group across chunks and emits at the finalize pass (per source stream).
  • Unpivot streams — one input row becomes N output rows, where N is valueColumns.length.

Failure modes

  • Duplicate nameColumn values within a group. The later value overwrites the earlier one.
  • Non-string nameColumn values. Coerced to string; treat carefully with types.