median
The median*
functions are the aliases for the corresponding quantile*
functions. They calculate median of a numeric data sample.
Functions:
median
— Alias for quantile.medianDeterministic
— Alias for quantileDeterministic.medianExact
— Alias for quantileExact.medianExactWeighted
— Alias for quantileExactWeighted.medianTiming
— Alias for quantileTiming.medianTimingWeighted
— Alias for quantileTimingWeighted.medianTDigest
— Alias for quantileTDigest.medianTDigestWeighted
— Alias for quantileTDigestWeighted.medianBFloat16
— Alias for quantileBFloat16.
Example
Input table:
┌─val─┐
│ 1 │
│ 1 │
│ 2 │
│ 3 │
└─────┘
Query:
SELECT medianDeterministic(val, 1) FROM t;
Result:
┌─medianDeterministic(val, 1)─┐
│ 1.5 │
└─────────────────────────────┘