snowflake.snowpark.functions.array_size¶

snowflake.snowpark.functions.array_size(array: Union[Column, str]) → Column[source]¶

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