ZIP_FUNC
All functions > ARRAY_OF_ROWS > ZIP_FUNC
Combines multiple arrays into a single array of structured rows with named fields.
Syntax
ZIP_FUNC(arrays: ARRAY<T1>, ARRAY<T2>, ...) → ARRAY<ROW<...>>
sql
Type Parameters:
T1, T2, ...
: Any types - each array can have different element types
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
arrays | ARRAY<T1>, ARRAY<T2>, ... | Yes | Multiple arrays to zip together |
field_names | ANY | Yes | Optional field names for the resulting rows |
Returns
Array(Row(...)) - Array of rows with fields from each input array
Notes
- Combines arrays element-by-element into rows
- Uses longest array length, pads shorter arrays with NULL
- Can specify custom field names with AS clause
- Default field names are field_1, field_2, etc.
- Generic type: (Array(T1), Array(T2), ...) → Array(Row(field_1: T1, field_2: T2, ...))