ELEMENT_AT_KEY
All functions > ARRAY > ELEMENT_AT_KEY
Returns one element at the given key from the given index, array or array of rows.
Syntax
ELEMENT_AT_KEY(index: INDEX, key: K, base: ARRAY<ROW<T>>) → ROW<T>
sql
Type Parameters:
K
: Any hashable typeT
: Any type
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
index | INDEX | Yes | Index to look up position from |
key | K | Yes | Key to look up in the index |
base | ARRAY<ROW<T>> | Yes | Array or array of rows to extract element from |
Returns
ROW - Single element at the position indicated by index[key]
Notes
- Uses index to map key to array position
- Looks up key in index to find position
- Returns element at that position from base array
- Returns NULL if key not found in index
- Useful for efficient lookups with pre-computed indexes