Scalar function
Returns NULL for a NULL map. NULL values are retained inside non-NULL entry structs.
Syntax
Scalar
Arguments
Type notation used below:
- K is the map key type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT.
- V is the map value type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT.
Returns
- Type: ARRAY<STRUCT<key: K, value: V>>
- Possible values: One key/value struct per entry.
- NULL behavior: Returns NULL for a NULL map. NULL values are retained inside non-NULL entry structs.
- Shape: Each array element has fields key and value; key is non-NULL and value follows map value nullability.
- Ordering: Underlying map entry order; no sorting is performed.
Properties
Usage notes
- INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.
- For ARRAY-valued keys or values, construct the input map with MAP_FROM_ARRAYS. The ordinary two-argument MAP constructor can interpret ARRAY arguments as parallel key/value lists.
Examples
Typical behavior
An entry with a NULL value
Last modified on October 15, 2026