CARRY(...)
All functions > ARRAY OF ROWS > CARRY(...)
Carries one or more scalar values into each row of an array of rows, adding them as new fields
Syntax
CARRY( expr AS field [, expr AS field ...] INTO array_of_rows )
Notes
- Adds scalar values as new fields to every row in an array of rows
- Each scalar is broadcast (repeated) across all rows
- Field names come from the AS clause or default to the feature name
- Equivalent to ARRAY_MERGE(ZIP(REPEAT(scalar, ARRAY_LENGTH(base)) AS field), base) but more efficient
Related Functions
Examples
FeatureQL
SELECT
f1 := CARRY(99 AS n INTO ARRAY[ROW(1 AS a), ROW(2 AS a)]) -- Broadcast scalars as new row fields on every array element
;Result
| f1 VARCHAR |
|---|
| [{a: 1, n: 99}, {a: 2, n: 99}] |
On this page