GREATEST
Returns the greatest value from the list of arguments.
Syntax
Arguments
VALUE
VALUE
Type: double
, bigint
, string
, timestamp
, date
, array
A value of any of the above types, provided that all values are of the same type.
Returns
Type: same as input
The largest of the provided values.
When the input values are arrays, the greatest element between all the arrays is returned.
If any of the input values are null
, the result is null
as well.
Examples
Transformation job example
SQL
Query result
greatest_example1 | greatest_example2 | greatest_example3 |
---|---|---|
744.7 | z | null |
Example with arrays
SQL
Query result
greatest_example1 | greatest_example2 | greatest_example3 |
---|---|---|
3.0 | 3.0 | null |
Note that greatest_example3
evaluates to null
since the array containing only null
is considered a null value.
In arrays containing null and non-null values, Upsolver ignores the null values when working with the array. For example, greatest_example2
evaluates to 3.0
instead of null
.
Last updated