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

snowflake.snowpark.functions.array_size

snowflake.snowpark.functions.array_size(array: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L5467-L5485)

Returns the size of the input ARRAY.

If the specified column contains a VARIANT value that contains an ARRAY, the size of the ARRAY is returned; otherwise, NULL is returned if the value is not an ARRAY.

Example::
>>> from snowflake.snowpark import Row
>>> df = session.create_dataframe([Row(a=[1, 2, 3])])
>>> df.select(array_size("a").alias("result")).show()
------------
|"RESULT"  |
------------
|3         |
------------
Copy
Language: English