Merge pull request #116 from influxdata/flux/rename-percentile

Rename percentile function to quantile
pull/117/head^2
Scott Anderson 2019-04-01 11:23:52 -06:00 committed by GitHub
commit 618453e1d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 41 deletions

View File

@ -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 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
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
# 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
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 %}}
@ -84,8 +84,8 @@ influxd --reporting-disabled
### Download and install InfluxDB v2.0 alpha
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.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_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_arm64.tar.gz" download >InfluxDB v2.0 alpha (arm)</a>
### Place the executables in your $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
# 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
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 %}}

View File

@ -93,7 +93,7 @@ from(bucket: "telegraf/autogen")
r._field == "used_percent")
|> aggregateWindow(
every: 5m,
fn: (columns, tables=<-) => tables |> percentile(percentile: 0.99, columns:columns)
fn: (columns, tables=<-) => tables |> quantile(q: 0.99, columns:columns)
)
```

View File

@ -1,6 +1,8 @@
---
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:
- /v2.0/reference/flux/functions/transformations/aggregates/median
menu:
@ -10,9 +12,9 @@ menu:
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
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_
_**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
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
value that represents the 50th percentile.
value that represents the `0.5` quantile.
{{% note %}}
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
uses an approximation implementation that requires floats.
It is a special application of the [`quantile()` function](/v2.0/reference/flux/functions/built-in/transformations/aggregates/quantile)
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).
{{% /note %}}
@ -46,18 +48,18 @@ The available options are:
##### estimate_tdigest
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
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
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
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.
Defaults to `1000.0`.
_**Data type:** Float_
@ -90,8 +92,8 @@ from(bucket: "telegraf/autogen")
## Function definition
```js
median = (method="estimate_tdigest", compression=0.0, tables=<-) =>
percentile(
percentile:0.5,
quantile(
q:0.5,
method:method,
compression:compression
)

View File

@ -1,47 +1,48 @@
---
title: percentile() 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.
title: quantile() function
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:
- /v2.0/reference/flux/functions/transformations/aggregates/percentile
- /v2.0/reference/flux/functions/built-in/transformations/aggregates/percentile
menu:
v2_0_ref:
name: percentile
name: quantile
parent: built-in-aggregates
weight: 501
---
The `percentile()` 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.
The `quantile()` function returns records from an input table with `_value`s 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](#method) used.
_**Function type:** Aggregate or Selector_
_**Output data type:** Float or Object_
```js
percentile(
quantile(
columns: ["_value"],
percentile: 0.99,
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 percentile.
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 percentile.
value that represents the specified quantile.
## Parameters
### columns
A list of columns on which to compute the percentile.
A list of columns on which to compute the quantile.
Defaults to `["_value"]`.
_**Data type:** Array of strings_
### percentile
A value between 0 and 1 indicating the desired percentile.
### q
A value between 0 and 1 indicating the desired quantile.
_**Data type:** Float_
@ -54,13 +55,13 @@ The available options are:
##### estimate_tdigest
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
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
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
Indicates how many centroids to use when compressing the dataset.
@ -78,8 +79,8 @@ from(bucket: "telegraf/autogen")
|> filter(fn: (r) =>
r._measurement == "cpu" and
r._field == "usage_system")
|> percentile(
percentile: 0.99,
|> quantile(
q: 0.99,
method: "estimate_tdigest",
compression: 1000.0
)
@ -92,8 +93,8 @@ from(bucket: "telegraf/autogen")
|> filter(fn: (r) =>
r._measurement == "cpu" and
r._field == "usage_system")
|> percentile(
percentile: 0.99,
|> quantile(
q: 0.99,
method: "exact_selector"
)
```

View File

@ -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:
- [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)