TRANSFORM

All functions > ARRAY OF ROWS > TRANSFORM

Transforms an array of rows using a subquery with optional METHOD

Syntax

TRANSFORM(
  array_of_rows
  USING ( query )
  [ WITH ( KEY = expr, METHOD = expr, IMPORT = expr ) ]
)

Notes

  • User-facing TRANSFORM is lowered to TRANSFORM_U / TRANSFORM_C / TRANSFORM_L / TRANSFORM_A from the METHOD property (default: UNNESTTRANSFORM_U)
  • USING carries the body; KEY is a FEATURE expression naming the aggregation key when inference cannot infer it — prefer FEATURE 'NAME' over a bare identifier
  • IMPORT brings extra features into the subquery scope (typically ARRAY(FEATURE 'f1', FEATURE 'f2', ...) — quoted names; bare identifiers after FEATURE are not valid syntax)
  • METHOD is a VARCHAR literal naming the strategy ('UNNEST', 'CORRELATED', 'LAMBDA', 'ARRAY'); bare identifiers are feature references, not method names

Related Functions

Examples

FeatureQL
SELECT
    f1 := TRANSFORM(ZIP(ARRAY[1, 2, 3] AS value) USING (SELECT sum(value) FILTER (WHERE value > 1) as sum_value)) -- Default UNNEST transformation
;
Result
f1 VARCHAR
[{sum_value: 5}]

Last update at: 2026/05/26 17:22:09