Skip to main content

Array and map functions

ARRAY

Creates an array from values.

SIZE

Returns the number of elements in an array.

ELEMENT_AT

Returns an element at a specific index (1-based) or map key.

ARRAY_FLATTEN

Flattens nested arrays into a single array.

ARRAY_SORT

Sorts array elements.

ARRAY_POSITION

Returns the 0-based index of the first occurrence of an element in an array. Returns NULL if the element is not found or if the search value is NULL. Syntax: ARRAY_POSITION(array, value)
ARRAY_POSITION uses 0-based indexing, so the first element is at position 0.

FILTER

Filters elements of an array using a lambda predicate. Returns a new array containing only elements for which the lambda returns true. Syntax: FILTER(array, element -> condition)

TRANSFORM

Applies a function to each element of an array, returning a new array of transformed values. Syntax: TRANSFORM(array, element -> expression)

EXPLODE

Converts an array into multiple rows (use with LATERAL JOIN).

UNNEST

Expands an array into rows (alternative to EXPLODE).

String Functions

Text manipulation

Conditional Functions

IF, COALESCE, NULLIF

All Functions

Browse all function categories

Data Types

ARRAY, MAP, and STRUCT type reference