- Categories:
MAP_PICK¶
Returns a new MAP containing the specified key-value pairs from an existing MAP.
To identify the key-value pairs to include in the new map, pass in the keys as arguments, or pass in an array containing the keys.
If a specified key isn’t present in the input map, the key is ignored.
Syntax¶
Arguments¶
mapThe input map.
key1,key2One or more keys that identify the key-value pairs to be included in the returned map.
arrayAn array of keys that identify the key-value pairs to be included in the returned map. You can specify a semi-structured ARRAY or a structured ARRAY.
Returns¶
Returns a new MAP containing some of the key-value pairs from an existing MAP.
Examples¶
Create a new map that contains two of the three key-value pairs from an existing map:
In the previous example, the keys are passed as arguments to MAP_PICK. You can also use an array to specify the keys:
Create a temporary table that contains MAP values:
Query the table to show the data:
Using the keys in the keep_keys column, return new MAP values from the MAP values in
the attrs column: