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' | zq -z 'max(this)' -
=>
4
Continuous maximum of simple sequence:
echo '1 2 3 4' | zq -z 'yield max(this)' -
=>
1
2
3
4
Unrecognized types are ignored:
echo '1 2 3 4 "foo"' | zq -z '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}' |
zq -z 'max(a) by k | sort' -
=>
{k:1,max:2}
{k:2,max:4}