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

snowflake.snowpark.functions.array_agg

snowflake.snowpark.functions.array_agg(col: Union[Column, str], is_distinct: bool = False) Column[source]

Returns the input values, pivoted into an ARRAY. If the input is empty, an empty ARRAY is returned.

Example::
>>> df = session.create_dataframe([[1], [2], [3], [1]], schema=["a"])
>>> df.select(array_agg("a", True).alias("result")).show()
------------
|"RESULT"  |
------------
|[         |
|  1,      |
|  2,      |
|  3       |
|]         |
------------
Copy