snowflake.snowpark.functions.greatest

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

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