snowflake.snowpark.functions.size

snowflake.snowpark.functions.size(col: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L6772-L6815)

Returns the size of the input ARRAY, OBJECT or MAP. Returns NULL if the input column does not match any of these types.

Parameters:

col – A Column object or column name that determines the values.

Example::
>>> df = session.create_dataframe([([1,2,3], {'a': 1, 'b': 2}, 3)], ['col1', 'col2', 'col3'])
>>> df.select(size(df.col1), size(df.col2), size(df.col3)).show()
----------------------------------------------------------
|"SIZE(""COL1"")"  |"SIZE(""COL2"")"  |"SIZE(""COL3"")"  |
----------------------------------------------------------
|3                 |2                 |NULL              |
----------------------------------------------------------
Copy
Language: English