All Products
Search
Document Center

MaxCompute:MAP_VALUES

Last Updated:Mar 26, 2026

Returns all values in a MAP as an array.

Syntax

array<V> map_values(map<K, V> <a>)

Parameters

a: required. A MAP value. K and V in map<K, V> represent the key type and value type of the map.

Return value

Returns a value of the ARRAY type. The array contains all values from the map. If the input map is null, null is returned.

Examples

The following example uses the t_table_map table, which has these columns and data:

c1 (BIGINT)t_map (MAP<STRING, BIGINT>)
1000{k11:86, k21:15}
1001{k12:97, k22:2}
1002{k13:99, k23:1}
-- Return all values in the t_map column as an array.
SELECT c1, map_values(t_map) FROM t_table_map;

Output:

+------+----------+
| c1   | _c1      |
+------+----------+
| 1000 | [86, 15] |
| 1001 | [97, 2]  |
| 1002 | [99, 1]  |
+------+----------+

Related functions

MAP_VALUES is a complex type function. For functions that process complex type data such as ARRAY, MAP, STRUCT, and JSON, see Complex type functions.