bigfunctions > get_value
get_value¶
Signature
get_value(key_value_items, search_key)
Description
Return the first value
with a key search_key
from key_value_items
(or return null
if search_key
does not exist in key_value_items
).
Examples
select bigfunctions.eu.get_value([struct('a' as key, 8 as value), struct('b' as key, 9 as value)], 'a')
select bigfunctions.us.get_value([struct('a' as key, 8 as value), struct('b' as key, 9 as value)], 'a')
select bigfunctions.europe_west1.get_value([struct('a' as key, 8 as value), struct('b' as key, 9 as value)], 'a')
+-------+
| value |
+-------+
| 8 |
+-------+
select bigfunctions.eu.get_value([struct('a' as key, 8 as value), struct('b' as key, 9 as value)], 'c')
select bigfunctions.us.get_value([struct('a' as key, 8 as value), struct('b' as key, 9 as value)], 'c')
select bigfunctions.europe_west1.get_value([struct('a' as key, 8 as value), struct('b' as key, 9 as value)], 'c')
+-------+
| value |
+-------+
| null |
+-------+
3. When there are multiple occurences of search_key
, return the first found value
select bigfunctions.eu.get_value([struct('a' as key, 8 as value), struct('a' as key, 9 as value)], 'a')
select bigfunctions.us.get_value([struct('a' as key, 8 as value), struct('a' as key, 9 as value)], 'a')
select bigfunctions.europe_west1.get_value([struct('a' as key, 8 as value), struct('a' as key, 9 as value)], 'a')
+-------+
| value |
+-------+
| 8 |
+-------+