You are viewing documentation about an older version (1.29.1). View latest version

snowflake.snowpark.functions.map_contains_key¶

snowflake.snowpark.functions.map_contains_key(value: Union[Column, None, bool, int, float, str, bytearray, Decimal, date, datetime, time, bytes, NaTType, float64, list, tuple, dict], col: Union[Column, str])[source]¶

Determines whether the specified MAP contains the specified key.

Parameters:
  • value – The key to find.

  • col – The map to be searched.

Example 1::
>>> df = session.sql("select {'k1': 'v1'} :: MAP(STRING,STRING) as M, 'k1' as V")
>>> df.select(map_contains_key(col("V"), "M")).show()
------------------------------------
|"MAP_CONTAINS_KEY(""V"", ""M"")"  |
------------------------------------
|True                              |
------------------------------------
Copy
Example 2::
>>> df = session.sql("select {'k1': 'v1'} :: MAP(STRING,STRING) as M")
>>> df.select(map_contains_key("k1", "M")).show()
-----------------------------------
|"MAP_CONTAINS_KEY('K1', ""M"")"  |
-----------------------------------
|True                             |
-----------------------------------
Copy