ARRAY_ENUMERATE()
All functions > ARRAY > ARRAY_ENUMERATE()
Returns an array of rows pairing each 1-based position with the corresponding element.
Signatures
Returns: Array of index/value rows
ARRAY_ENUMERATE(array: ARRAY<T>) → ARRAY<ROW(index BIGINT, value T)> sql
| Parameter | Type | Required | Description |
|---|---|---|---|
array | ARRAY<T> | Yes | Input array |
Notes
- Index positions start at 1 for the first element
- Preserves element order from the input array
- Output rows use field names
indexandvalue
See also
Examples
FeatureQL
SELECT
f1 := ARRAY_ENUMERATE(ARRAY[10, 20, 30]) -- Pairs index with value
;Result
| f1 VARCHAR |
|---|
| [{index: 1, value: 10}, {index: 2, value: 20}, {index: 3, value: 30}] |
On this page