From 133d39c4b48dd2e49c94932d9797a7bef19b0f5a Mon Sep 17 00:00:00 2001 From: Qinyi Ding Date: Tue, 29 Sep 2026 23:22:07 -0700 Subject: [PATCH] [DOC-13285] Explain collect_list alias and example Clarify existing API behavior without changing executable code. Generated with [Snowflake CoCo](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code) Co-authored-by: Snowflake CoCo --- src/snowflake/snowpark/functions.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/snowflake/snowpark/functions.py b/src/snowflake/snowpark/functions.py index f55eba8c1d..ae5e159355 100644 --- a/src/snowflake/snowpark/functions.py +++ b/src/snowflake/snowpark/functions.py @@ -7018,6 +7018,18 @@ def array_agg( |] | ------------ + + ``collect_list`` is an alias of ``array_agg`` with the same arguments and + behavior. The two names share this documentation, which is why the example + above uses ``array_agg``. By default, duplicates are retained. + + This example produces an array containing ``[1, 2, 2]``: + + Example using the alias:: + + >>> from snowflake.snowpark.functions import collect_list + >>> df = session.create_dataframe([[2], [1], [2]], schema=["a"]) + >>> result = df.select(collect_list("a").within_group("a").alias("values")).collect() """ ast = build_function_expr("array_agg", [col, is_distinct]) if _emit_ast else None c = _to_col_if_str(col, "array_agg")