Skip to main content

MAP_CONTAINS_VALUE

Description​

Determines whether the given map contains a specific value value

Syntax​

MAP_CONTAINS_VALUE(<map>, <value>)

Parameters​

ParameterDescription
<map>Input map content
<value>The value to be retrieved

Return Value​

Determines whether the given map contains a specific value value, and returns 1 if it exists, otherwise returns 0.

Example​

select map_contains_value(map(null, 1, 2, null), null),map_contains_value(map(1, "100", 0.1, 2), 101);
+-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
| map_contains_value(map(NULL, 1, 2, NULL), NULL) | map_contains_value(map(cast(1 as DECIMALV3(2, 1)), '100', cast(0.1 as DECIMALV3(2, 1)), cast(2 as TEXT)), cast(101 as VARCHAR(3))) |
+-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
| 1 | 0 |
+-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+