Documentation

quantile() function

Flux 0.24.0+

The quantile() function returns records from an input table with _values that fall within a specified quantile or it returns the record with the _value that represents the specified quantile. Which it returns depends on the method used. quantile() supports columns with float values.

quantile() behaves like an aggregate function or a selector function depending on the method used.

quantile(
  column: "_value",
  q: 0.99,
  method: "estimate_tdigest",
  compression: 1000.0
)

When using the estimate_tdigest or exact_mean methods, it outputs non-null records with values that fall within the specified quantile.

When using the exact_selector method, it outputs the non-null record with the value that represents the specified quantile.

Parameters

column

Column to use to compute the quantile. Default is "_value".

q

(Required) Value between 0 and 1 indicating the desired quantile.

method

Computation method. Default is estimate_tdigest.

The available options are:

estimate_tdigest

An aggregate method that uses a t-digest data structure to compute an accurate quantile estimate on large data sources.

exact_mean

An aggregate method that takes the average of the two points closest to the quantile value.

exact_selector

A selector method that returns the data point for which at least q points are less than.

compression

Number of centroids to use when compressing the dataset. A larger number produces a more accurate result at the cost of increased memory requirements. Default is 1000.0.

tables

Input data. Default is piped-forward data (<-).

Examples

The following examples use data provided by the sampledata package to show how quantile() transforms data.

Quantile as an aggregate

import "sampledata"

sampledata.float()
  |> quantile(
    q: 0.99,
    method: "estimate_tdigest",
    compression: 1000.0
  )

View input and output

Quantile as a selector

import "sampledata"

sampledata.float()
  |> quantile(
    q: 0.5,
    method: "exact_selector"
  )

View input and output


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.