Skip to main content
Version: Next

max

Aggregate Function

max maximum value of input values

Synopsis

max(number) -> number

Description

The max aggregate function computes the maximum value of its input.

Examples

Maximum value of simple sequence:

echo '1 2 3 4' | super -z -c 'max(this)' -

=>

4

Continuous maximum of simple sequence:

echo '1 2 3 4' | super -z -c 'yield max(this)' -

=>

1
2
3
4

Unrecognized types are ignored:

echo '1 2 3 4 "foo"' | super -z -c 'max(this)' -

=>

4

Maximum value within buckets grouped by key:

echo '{a:1,k:1} {a:2,k:1} {a:3,k:2} {a:4,k:2}' |
super -z -c 'max(a) by k |> sort' -

=>

{k:1,max:2}
{k:2,max:4}