snowflake.snowpark.functions.greatest¶

snowflake.snowpark.functions.greatest(*columns: Union[Column, str]) → Column[source]¶

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