MAP
Descriptionβ
Constructs a Map<K, V>
of a specific type using some set of key-value pairs
Syntaxβ
MAP( <key1> , <value1> [, <key2>,<value2> ... ])
Parametersβ
Parameter | Description |
---|---|
<key> | Constructing the key of the map |
<value> | Constructing the value of the map |
Return Valueβ
Returns a specific type Map<K, V>
constructed from a number of key-value pairs
Exampleβ
select map(1, "100", 0.1, 2),map(1, "100", 0.1, 2)[1];
+---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| map(cast(1 as DECIMALV3(2, 1)), '100', cast(0.1 as DECIMALV3(2, 1)), cast(2 as TEXT)) | element_at(map(cast(1 as DECIMALV3(2, 1)), '100', cast(0.1 as DECIMALV3(2, 1)), cast(2 as TEXT)), cast(1 as DECIMALV3(2, 1))) |
+---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| {1.0:"100", 0.1:"2"} | 100 |
+---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+