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
TRANSFORMis lowered toTRANSFORM_U/TRANSFORM_C/TRANSFORM_L/TRANSFORM_Afrom theMETHODproperty (default:UNNEST→TRANSFORM_U) USINGcarries the body;KEYis a FEATURE expression naming the aggregation key when inference cannot infer it — preferFEATURE 'NAME'over a bare identifierIMPORTbrings extra features into the subquery scope (typicallyARRAY(FEATURE 'f1', FEATURE 'f2', ...)— quoted names; bare identifiers afterFEATUREare not valid syntax)METHODis 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}] |
On this page