Merge pull request #116 from influxdata/flux/rename-percentile
Rename percentile function to quantilepull/117/head^2
commit
618453e1d7
content/v2.0
reference/flux/functions/built-in/transformations
aggregates
selectors
|
@ -27,7 +27,7 @@ This article describes how to get started with InfluxDB OSS. To get started with
|
||||||
### Download and install InfluxDB v2.0 alpha
|
### Download and install InfluxDB v2.0 alpha
|
||||||
Download InfluxDB v2.0 alpha for macOS.
|
Download InfluxDB v2.0 alpha for macOS.
|
||||||
|
|
||||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.7_darwin_amd64.tar.gz" download>InfluxDB v2.0 alpha (macOS)</a>
|
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.8_darwin_amd64.tar.gz" download>InfluxDB v2.0 alpha (macOS)</a>
|
||||||
|
|
||||||
### Place the executables in your $PATH
|
### Place the executables in your $PATH
|
||||||
Unpackage the downloaded archive and place the `influx` and `influxd` executables in your system `$PATH`.
|
Unpackage the downloaded archive and place the `influx` and `influxd` executables in your system `$PATH`.
|
||||||
|
@ -36,10 +36,10 @@ _**Note:** The following commands are examples. Adjust the file paths to your ow
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Unpackage contents to the current working directory
|
# Unpackage contents to the current working directory
|
||||||
gunzip -c ~/Downloads/influxdb_2.0.0-alpha.7_darwin_amd64.tar.gz | tar xopf -
|
gunzip -c ~/Downloads/influxdb_2.0.0-alpha.8_darwin_amd64.tar.gz | tar xopf -
|
||||||
|
|
||||||
# Copy the influx and influxd binary to your $PATH
|
# Copy the influx and influxd binary to your $PATH
|
||||||
sudo cp influxdb_2.0.0-alpha.7_darwin_amd64/{influx,influxd} /usr/local/bin/
|
sudo cp influxdb_2.0.0-alpha.8_darwin_amd64/{influx,influxd} /usr/local/bin/
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
|
@ -84,8 +84,8 @@ influxd --reporting-disabled
|
||||||
### Download and install InfluxDB v2.0 alpha
|
### Download and install InfluxDB v2.0 alpha
|
||||||
Download the InfluxDB v2.0 alpha package appropriate for your chipset.
|
Download the InfluxDB v2.0 alpha package appropriate for your chipset.
|
||||||
|
|
||||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.7_linux_amd64.tar.gz" download >InfluxDB v2.0 alpha (amd64)</a>
|
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.8_linux_amd64.tar.gz" download >InfluxDB v2.0 alpha (amd64)</a>
|
||||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.7_linux_arm64.tar.gz" download >InfluxDB v2.0 alpha (arm)</a>
|
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.8_linux_arm64.tar.gz" download >InfluxDB v2.0 alpha (arm)</a>
|
||||||
|
|
||||||
### Place the executables in your $PATH
|
### Place the executables in your $PATH
|
||||||
Unpackage the downloaded archive and place the `influx` and `influxd` executables in your system `$PATH`.
|
Unpackage the downloaded archive and place the `influx` and `influxd` executables in your system `$PATH`.
|
||||||
|
@ -94,10 +94,10 @@ _**Note:** The following commands are examples. Adjust the file names, paths, an
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Unpackage contents to the current working directory
|
# Unpackage contents to the current working directory
|
||||||
tar xvzf path/to/influxdb_2.0.0-alpha.7_linux_amd64.tar.gz
|
tar xvzf path/to/influxdb_2.0.0-alpha.8_linux_amd64.tar.gz
|
||||||
|
|
||||||
# Copy the influx and influxd binary to your $PATH
|
# Copy the influx and influxd binary to your $PATH
|
||||||
sudo cp influxdb_2.0.0-alpha.7_linux_amd64/{influx,influxd} /usr/local/bin/
|
sudo cp influxdb_2.0.0-alpha.8_linux_amd64/{influx,influxd} /usr/local/bin/
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
|
|
|
@ -93,7 +93,7 @@ from(bucket: "telegraf/autogen")
|
||||||
r._field == "used_percent")
|
r._field == "used_percent")
|
||||||
|> aggregateWindow(
|
|> aggregateWindow(
|
||||||
every: 5m,
|
every: 5m,
|
||||||
fn: (columns, tables=<-) => tables |> percentile(percentile: 0.99, columns:columns)
|
fn: (columns, tables=<-) => tables |> quantile(q: 0.99, columns:columns)
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
title: median() function
|
title: median() function
|
||||||
description: The `median()` function returns the median `_value` of an input table or all non-null records in the input table with values that fall within the 50th percentile
|
description: >
|
||||||
|
The `median()` function returns the median `_value` of an input table or all non-null records
|
||||||
|
in the input table with values that fall within the `0.5` quantile or 50th percentile.
|
||||||
aliases:
|
aliases:
|
||||||
- /v2.0/reference/flux/functions/transformations/aggregates/median
|
- /v2.0/reference/flux/functions/transformations/aggregates/median
|
||||||
menu:
|
menu:
|
||||||
|
@ -10,9 +12,9 @@ menu:
|
||||||
weight: 501
|
weight: 501
|
||||||
---
|
---
|
||||||
|
|
||||||
The `median()` function is a special application of the [`percentile()` function](/v2.0/reference/flux/functions/built-in/transformations/aggregates/percentile)
|
The `median()` function is a special application of the [`quantile()` function](/v2.0/reference/flux/functions/built-in/transformations/aggregates/quantile)
|
||||||
that returns the median `_value` of an input table or all non-null records in the input table
|
that returns the median `_value` of an input table or all non-null records in the input table
|
||||||
with values that fall within the 50th percentile depending on the [method](#method) used.
|
with values that fall within the `0.5` quantile (50th percentile) depending on the [method](#method) used.
|
||||||
|
|
||||||
_**Function type:** Selector or Aggregate_
|
_**Function type:** Selector or Aggregate_
|
||||||
_**Output data type:** Object_
|
_**Output data type:** Object_
|
||||||
|
@ -23,15 +25,15 @@ median(method: "estimate_tdigest", compression: 0.0)
|
||||||
```
|
```
|
||||||
|
|
||||||
When using the `estimate_tdigest` or `exact_mean` methods, it outputs non-null
|
When using the `estimate_tdigest` or `exact_mean` methods, it outputs non-null
|
||||||
records with values that fall within the 50th percentile.
|
records with values that fall within the `0.5` quantile.
|
||||||
|
|
||||||
When using the `exact_selector` method, it outputs the non-null record with the
|
When using the `exact_selector` method, it outputs the non-null record with the
|
||||||
value that represents the 50th percentile.
|
value that represents the `0.5` quantile.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
The `median()` function can only be used with float value types.
|
The `median()` function can only be used with float value types.
|
||||||
It is a special application of the [`percentile()` function](/v2.0/reference/flux/functions/built-in/transformations/aggregates/percentile) which
|
It is a special application of the [`quantile()` function](/v2.0/reference/flux/functions/built-in/transformations/aggregates/quantile)
|
||||||
uses an approximation implementation that requires floats.
|
which uses an approximation implementation that requires floats.
|
||||||
You can convert your value column to a float column using the [`toFloat()` function](/v2.0/reference/flux/functions/built-in/transformations/type-conversions/tofloat).
|
You can convert your value column to a float column using the [`toFloat()` function](/v2.0/reference/flux/functions/built-in/transformations/type-conversions/tofloat).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
|
@ -46,18 +48,18 @@ The available options are:
|
||||||
|
|
||||||
##### estimate_tdigest
|
##### estimate_tdigest
|
||||||
An aggregate method that uses a [t-digest data structure](https://github.com/tdunning/t-digest)
|
An aggregate method that uses a [t-digest data structure](https://github.com/tdunning/t-digest)
|
||||||
to compute an accurate percentile estimate on large data sources.
|
to compute an accurate quantile estimate on large data sources.
|
||||||
|
|
||||||
##### exact_mean
|
##### exact_mean
|
||||||
An aggregate method that takes the average of the two points closest to the percentile value.
|
An aggregate method that takes the average of the two points closest to the quantile value.
|
||||||
|
|
||||||
##### exact_selector
|
##### exact_selector
|
||||||
A selector method that returns the data point for which at least percentile points are less than.
|
A selector method that returns the data point for which at least `q` points are less than.
|
||||||
|
|
||||||
### compression
|
### compression
|
||||||
Indicates how many centroids to use when compressing the dataset.
|
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.
|
A larger number produces a more accurate result at the cost of increased memory requirements.
|
||||||
Defaults to 1000.
|
Defaults to `1000.0`.
|
||||||
|
|
||||||
_**Data type:** Float_
|
_**Data type:** Float_
|
||||||
|
|
||||||
|
@ -90,8 +92,8 @@ from(bucket: "telegraf/autogen")
|
||||||
## Function definition
|
## Function definition
|
||||||
```js
|
```js
|
||||||
median = (method="estimate_tdigest", compression=0.0, tables=<-) =>
|
median = (method="estimate_tdigest", compression=0.0, tables=<-) =>
|
||||||
percentile(
|
quantile(
|
||||||
percentile:0.5,
|
q:0.5,
|
||||||
method:method,
|
method:method,
|
||||||
compression:compression
|
compression:compression
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,47 +1,48 @@
|
||||||
---
|
---
|
||||||
title: percentile() function
|
title: quantile() function
|
||||||
description: The `percentile()` function outputs non-null records with values that fall within the specified percentile or the non-null record with the value that represents the specified percentile.
|
description: The `quantile()` function outputs non-null records with values that fall within the specified quantile or the non-null record with the value that represents the specified quantile.
|
||||||
aliases:
|
aliases:
|
||||||
- /v2.0/reference/flux/functions/transformations/aggregates/percentile
|
- /v2.0/reference/flux/functions/transformations/aggregates/percentile
|
||||||
|
- /v2.0/reference/flux/functions/built-in/transformations/aggregates/percentile
|
||||||
menu:
|
menu:
|
||||||
v2_0_ref:
|
v2_0_ref:
|
||||||
name: percentile
|
name: quantile
|
||||||
parent: built-in-aggregates
|
parent: built-in-aggregates
|
||||||
weight: 501
|
weight: 501
|
||||||
---
|
---
|
||||||
|
|
||||||
The `percentile()` function returns records from an input table with `_value`s that fall within
|
The `quantile()` function returns records from an input table with `_value`s that fall within
|
||||||
a specified percentile or it returns the record with the `_value` that represents the specified percentile.
|
a specified quantile or it returns the record with the `_value` that represents the specified quantile.
|
||||||
Which it returns depends on the [method](#method) used.
|
Which it returns depends on the [method](#method) used.
|
||||||
|
|
||||||
_**Function type:** Aggregate or Selector_
|
_**Function type:** Aggregate or Selector_
|
||||||
_**Output data type:** Float or Object_
|
_**Output data type:** Float or Object_
|
||||||
|
|
||||||
```js
|
```js
|
||||||
percentile(
|
quantile(
|
||||||
columns: ["_value"],
|
columns: ["_value"],
|
||||||
percentile: 0.99,
|
q: 0.99,
|
||||||
method: "estimate_tdigest",
|
method: "estimate_tdigest",
|
||||||
compression: 1000.0
|
compression: 1000.0
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
When using the `estimate_tdigest` or `exact_mean` methods, it outputs non-null
|
When using the `estimate_tdigest` or `exact_mean` methods, it outputs non-null
|
||||||
records with values that fall within the specified percentile.
|
records with values that fall within the specified quantile.
|
||||||
|
|
||||||
When using the `exact_selector` method, it outputs the non-null record with the
|
When using the `exact_selector` method, it outputs the non-null record with the
|
||||||
value that represents the specified percentile.
|
value that represents the specified quantile.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
### columns
|
### columns
|
||||||
A list of columns on which to compute the percentile.
|
A list of columns on which to compute the quantile.
|
||||||
Defaults to `["_value"]`.
|
Defaults to `["_value"]`.
|
||||||
|
|
||||||
_**Data type:** Array of strings_
|
_**Data type:** Array of strings_
|
||||||
|
|
||||||
### percentile
|
### q
|
||||||
A value between 0 and 1 indicating the desired percentile.
|
A value between 0 and 1 indicating the desired quantile.
|
||||||
|
|
||||||
_**Data type:** Float_
|
_**Data type:** Float_
|
||||||
|
|
||||||
|
@ -54,13 +55,13 @@ The available options are:
|
||||||
|
|
||||||
##### estimate_tdigest
|
##### estimate_tdigest
|
||||||
An aggregate method that uses a [t-digest data structure](https://github.com/tdunning/t-digest)
|
An aggregate method that uses a [t-digest data structure](https://github.com/tdunning/t-digest)
|
||||||
to compute an accurate percentile estimate on large data sources.
|
to compute an accurate quantile estimate on large data sources.
|
||||||
|
|
||||||
##### exact_mean
|
##### exact_mean
|
||||||
An aggregate method that takes the average of the two points closest to the percentile value.
|
An aggregate method that takes the average of the two points closest to the quantile value.
|
||||||
|
|
||||||
##### exact_selector
|
##### exact_selector
|
||||||
A selector method that returns the data point for which at least percentile points are less than.
|
A selector method that returns the data point for which at least `q` points are less than.
|
||||||
|
|
||||||
### compression
|
### compression
|
||||||
Indicates how many centroids to use when compressing the dataset.
|
Indicates how many centroids to use when compressing the dataset.
|
||||||
|
@ -78,8 +79,8 @@ from(bucket: "telegraf/autogen")
|
||||||
|> filter(fn: (r) =>
|
|> filter(fn: (r) =>
|
||||||
r._measurement == "cpu" and
|
r._measurement == "cpu" and
|
||||||
r._field == "usage_system")
|
r._field == "usage_system")
|
||||||
|> percentile(
|
|> quantile(
|
||||||
percentile: 0.99,
|
q: 0.99,
|
||||||
method: "estimate_tdigest",
|
method: "estimate_tdigest",
|
||||||
compression: 1000.0
|
compression: 1000.0
|
||||||
)
|
)
|
||||||
|
@ -92,8 +93,8 @@ from(bucket: "telegraf/autogen")
|
||||||
|> filter(fn: (r) =>
|
|> filter(fn: (r) =>
|
||||||
r._measurement == "cpu" and
|
r._measurement == "cpu" and
|
||||||
r._field == "usage_system")
|
r._field == "usage_system")
|
||||||
|> percentile(
|
|> quantile(
|
||||||
percentile: 0.99,
|
q: 0.99,
|
||||||
method: "exact_selector"
|
method: "exact_selector"
|
||||||
)
|
)
|
||||||
```
|
```
|
|
@ -26,4 +26,4 @@ The following functions can be used as both selectors or aggregates, but they ar
|
||||||
categorized as aggregate functions in this documentation:
|
categorized as aggregate functions in this documentation:
|
||||||
|
|
||||||
- [median](/v2.0/reference/flux/functions/built-in/transformations/aggregates/median)
|
- [median](/v2.0/reference/flux/functions/built-in/transformations/aggregates/median)
|
||||||
- [percentile](/v2.0/reference/flux/functions/built-in/transformations/aggregates/percentile)
|
- [quantile](/v2.0/reference/flux/functions/built-in/transformations/aggregates/quantile)
|
||||||
|
|
Loading…
Reference in New Issue