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

snowflake.snowpark.functions.greatest

snowflake.snowpark.functions.greatest(*columns: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L6929-L6942)

Returns the largest value from a list of expressions. If any of the argument values is NULL, the result is NULL. GREATEST supports all data types, including VARIANT.

Examples:

>>> df = session.create_dataframe([[1, 2, 3], [2, 4, -1], [3, 6, None]], schema=["a", "b", "c"])
>>> df.select(greatest(df["a"], df["b"], df["c"]).alias("greatest")).collect()
[Row(GREATEST=3), Row(GREATEST=4), Row(GREATEST=None)]
Copy
Language: English