Scalar function
Returns NULL for a NULL map.
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.
Returns
- Type: ARRAY<K>
- Possible values: One key per map entry.
- NULL behavior: Returns NULL for a NULL map.
- Shape: Array length equals map entry count.
- Ordering: Underlying map entry order; no key 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
Integer map keys
This example shows the entries in this map; use an explicit sort when your query requires a particular key order.
Last modified on October 15, 2026