Returns a map that consists of the keys in a struct array and an array containing all values.
Syntax
smultimap_from_entries(array<struct<K, V>>)Parameters
array<struct<K, V>>: a struct array that consists of key-value pairs.
Return value
A map that consists of keys in a struct array and an array containing all values is returned. The map is in the map<K, array<V>> format.
Each key in the returned map can be associated with multiple values, and the associated values are in the same array.
If the array is null, null is returned.
If the number of fields in the struct array is not 2 or the keys contain null values, an error is returned.
Examples
SELECT multimap_from_entries(array(struct(1, 'a'),
struct(2, 'b'),
struct(1, 'c')));The following result is returned:
{1 : ['a', 'c'], 2: ['b']}Related functions
MULTIMAP_ FROM_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, see Complex type functions.