max_val()

max_val(digest TDigest) RETURNS DOUBLE PRECISION

Get the maximum value from a tdigest. This does not work with percentile_agg or uddsketch based estimators. This is provided in order to save space when both a maximum and a percentile estimate are required as part of continuous aggregates. You can calculate a single percentile estimator by extracting the max_val from the percentile estimator, without needing to specify a separate max aggregate.

Required arguments

NameTypeDescription
digestTDigestThe digest to extract the max value from

Returns

ColumnTypeDescription
max_valDOUBLE PRECISIONThe maximum value entered into the t-digest.

Sample usage

SELECT max_val(tdigest(100, data))
FROM generate_series(1, 100) data;
max_val
---------
     100

Found an issue on this page?

Report an issue!

Related Content