experimental.quantile() function
The experimental.quantile()
function is subject to change at any time.
By using this function, you accept the risks of experimental functions.
The experimental.quantile()
function outputs non-null records with values in
the _value
column that fall within the specified quantile or represent the specified quantile.
Which it returns depends on the method used.
The _value
column must contain float values.
experimental.quantile()
behaves like an aggregate function
or a selector function depending on
the method
used.
import "experimental"
experimental.quantile(
q: 0.99,
method: "estimate_tdigest",
compression: 1000.0,
)
When using the estimate_tdigest
or exact_mean
methods, the function 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
q
A value between 0 and 1 thats specifies the quantile.
method
Computation method.
Default is estimate_tdigest
.
Available options:
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
Indicates how many centroids to use when compressing the dataset.
A larger number produces a more accurate result at the cost of increased memory requirements.
Defaults to 1000.0
.
tables
Input data.
Default is piped-forward data (<-
).
Examples
Quantile as an aggregate
import "experimental"
from(bucket: "example-bucket")
|> range(start: -5m)
|> filter(fn: (r) => r._measurement == "example-measurement" and r._field == "example-field")
|> experimental.quantile(q: 0.99, method: "estimate_tdigest", compression: 1000.0)
Quantile as a selector
import "experimental"
from(bucket: "example-bucket")
|> range(start: -5m)
|> filter(fn: (r) => r._measurement == "example-measurement" and r._field == "example-field")
|> experimental.quantile(q: 0.99, method: "exact_selector")
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
InfluxDB Cloud customers can contact InfluxData Support.