argAndMax
Calculates the arg and val value for a maximum val value. If there are multiple rows with equal val being the maximum, which of the associated arg and val is returned is not deterministic.
Both parts the arg and the max behave as aggregate functions, they both skip Null during processing and return not Null values if not Null values are available.
The only difference with argMax is that argAndMax returns both argument and value.
Syntax
Arguments
arg— Argument.val— Value.
Returned value
argvalue that corresponds to maximumvalvalue.valmaximumvalvalue
Type: tuple that matches arg, val types respectively.
Example
Input table:
Query:
Result:
Extended example
See also
argAndMax
Introduced in: v1.1
Calculates the arg and val value for a maximum val value.
If there are multiple rows with equal val being the maximum, which of the associated arg and val is returned is not deterministic.
Both parts the arg and the max behave as aggregate functions, they both skip Null during processing and return not Null values if not Null values are available.
The only difference with argMax is that argAndMax returns both argument and value.
See also
Syntax
Arguments
arg— Argument for which to find the maximum value.const Stringval— The maximum value.(U)Int8/16/32/64orFloat*orDateorDateTimeorTuple
Returned value
Returns a tuple containing the arg value that corresponds to maximum val value and the maximum val value. Tuple
Examples
Basic usage
Extended example with NULL handling
Using Tuple in arguments