UNWRAP

All functions > ARRAY OF ROWS > UNWRAP

Returns the first field values from an array of single-field rows as a simple array.

Signatures

Returns: Simple array of field values

UNWRAP(array: ARRAY<ROW<T>>) → ARRAY<T>
sql
ParameterTypeRequiredDescription
arrayARRAY<ROW<T>>YesArray of single-field rows

Notes

  • Extracts the first field from each row in the array
  • Only works with arrays of rows that have exactly one field
  • Throws error if rows have multiple fields
  • Useful for converting aggregation results to simple arrays

Examples

FeatureQL
SELECT
    f1 := UNWRAP(ARRAY(ROW(1), ROW(2), ROW(3))),  -- Extract field values from array of rows
    f2 := UNWRAP(ARRAY(ROW(ARRAY(1, 2, 3)))),  -- Extract array field values
    f3 := ARRAY(ROW('a'), ROW('b')).UNWRAP(),  -- Method syntax for unwrapping
    f4 := ARRAY(ROW('a')).UNWRAP()  -- Single element unwrap
;
Result
f1 ARRAYf2 ARRAYf3 ARRAYf4 ARRAY
[1, 2, 3][[1, 2, 3]][a, b][a]

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19