All Products
Search
Document Center

MaxCompute:MAP_ENTRIES

Last Updated:Jul 24, 2023

Converts key-value pairs in Map a into a struct array.

Syntax

array<struct<K, V>> map_entries(map<K, V> <a>): 

Parameters

a: required. This parameter specifies a map. K and V in map<K, V> specify the keys and values of a map.

Return value

A struct array is returned. If the input is null, null is returned.

Examples

-- The return value is [{key:1, value:a}, {key:2, value:b}]. 
select map_entries(map(1,  'a',  2,  'b'));

Related functions

MAP_ENTRIES is a complex type function. For more information about the functions that are used to process data of complex data types, such as ARRAY, MAP, STRUCT, and JSON, Complex type functions.