snowflake.snowpark.functions.map_size

snowflake.snowpark.functions.map_size(map_col: Union[snowflake.snowpark.column.Column, str]) Column[source]

Returns the size of the input MAP. Returns None if the input column is not a MAP type.

Parameters:

map_col (ColumnOrName) – The map values.

Returns:

The size of the map.

Return type:

Column

Examples::
>>> from snowflake.snowpark.functions import col
>>> df = session.sql("SELECT {'a': 1, 'b': 2}::MAP(VARCHAR, NUMBER) as MAP_COL")
>>> df.select(map_size(col("MAP_COL")).alias("MAP_SIZE")).collect()
[Row(MAP_SIZE=2)]
Copy