Skip to main content
Version: v1.18.0

min

Aggregate Function

min minimum value of input values

Synopsis

min(...number) -> number

Description

The min aggregate function computes the minimum value of its input.

Examples

Minimum value of simple sequence:

echo '1 2 3 4' | zq -z 'min(this)' -

=>

1

Continuous minimum of simple sequence:

echo '1 2 3 4' | zq -z 'yield min(this)' -

=>

1
1
1
1

Unrecognized types are ignored:

echo '1 2 3 4 "foo"' | zq -z 'min(this)' -

=>

1

Minimum 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 'min(a) by k | sort' -

=>

{k:1,min:1}
{k:2,min:3}