Merge pull request #52 from influxdata/flux-0.18

Flux 0.18
pull/53/head
Scott Anderson 2019-02-08 09:15:57 -07:00 committed by GitHub
commit d0b92fc1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
100 changed files with 1089 additions and 243 deletions

View File

@ -9,7 +9,6 @@ weight: 101
--- ---
Flux's functional syntax allows you to retrieve, transform, process, and output data easily. Flux's functional syntax allows you to retrieve, transform, process, and output data easily.
There is a large library of built-in functions, but you can also create your own There is a large library of built-in and importable functions:
custom functions to perform operations that suit your needs.
{{< children >}} {{< children >}}

View File

@ -0,0 +1,18 @@
---
title: Flux built-in functions
description: >
Built-in functions provide a necessary foundation for working with data using Flux.
They do not require an import statement and are usable without any extra setup.
menu:
v2_0_ref:
name: Built-in
parent: Flux functions
weight: 201
---
Built-in functions provide a necessary foundation for working with data using Flux.
Because these functions are "built-in," they do not require an `import` statement and are usable without any extra setup.
Built-in functions are grouped into the following categories:
{{< children >}}

View File

@ -1,11 +1,14 @@
--- ---
title: Flux input functions title: Flux input functions
description: Flux input functions define sources of data or or display information about data sources. description: Flux input functions define sources of data or or display information about data sources.
aliases:
- /v2.0/reference/flux/functions/inputs
menu: menu:
v2_0_ref: v2_0_ref:
parent: Flux functions parent: Built-in
name: Inputs name: Inputs
weight: 201 identifier: built-in-inputs
weight: 301
--- ---
Flux input functions define sources of data or display information about data sources. Flux input functions define sources of data or display information about data sources.

View File

@ -1,11 +1,13 @@
--- ---
title: buckets() function title: buckets() function
description: The buckets() function returns a list of buckets in the organization. description: The buckets() function returns a list of buckets in the organization.
aliases:
- /v2.0/reference/flux/functions/inputs/buckets
menu: menu:
v2_0_ref: v2_0_ref:
name: buckets name: buckets
parent: Inputs parent: built-in-inputs
weight: 301 weight: 401
--- ---
The `buckets()` function returns a list of buckets in the organization. The `buckets()` function returns a list of buckets in the organization.

View File

@ -1,11 +1,13 @@
--- ---
title: from() function title: from() function
description: The from() function retrieves data from an InfluxDB data source. description: The from() function retrieves data from an InfluxDB data source.
aliases:
- /v2.0/reference/flux/functions/inputs/from
menu: menu:
v2_0_ref: v2_0_ref:
name: from name: from
parent: Inputs parent: built-in-inputs
weight: 301 weight: 401
--- ---
The `from()` function retrieves data from an InfluxDB data source. The `from()` function retrieves data from an InfluxDB data source.

View File

@ -1,11 +1,13 @@
--- ---
title: fromCSV() function title: fromCSV() function
description: The fromCSV() function retrieves data from a CSV data source. description: The fromCSV() function retrieves data from a CSV data source.
aliases:
- /v2.0/reference/flux/functions/inputs/fromcsv
menu: menu:
v2_0_ref: v2_0_ref:
name: fromCSV name: fromCSV
parent: Inputs parent: built-in-inputs
weight: 301 weight: 401
--- ---
The `fromCSV()` function retrieves data from a comma-separated value (CSV) data source. The `fromCSV()` function retrieves data from a comma-separated value (CSV) data source.

View File

@ -1,11 +1,14 @@
--- ---
title: Flux miscellaneous functions title: Flux miscellaneous functions
description: Flux provides miscellaneous functions that serve purposes other than retrieving, transforming, or outputting data. description: Flux provides miscellaneous functions that serve purposes other than retrieving, transforming, or outputting data.
aliases:
- /v2.0/reference/flux/functions/misc
menu: menu:
v2_0_ref: v2_0_ref:
parent: Flux functions parent: Built-in
name: Miscellaneous name: Miscellaneous
weight: 205 identifier: built-in-misc
weight: 305
--- ---
Flux functions primarily retrieve, shape and transform, then output data, however Flux functions primarily retrieve, shape and transform, then output data, however

View File

@ -1,11 +1,13 @@
--- ---
title: intervals() function title: intervals() function
description: The intervals() function generates a set of time intervals over a range of time. description: The intervals() function generates a set of time intervals over a range of time.
aliases:
- /v2.0/reference/flux/functions/misc/intervals
menu: menu:
v2_0_ref: v2_0_ref:
name: intervals name: intervals
parent: Miscellaneous parent: built-in-misc
weight: 301 weight: 401
--- ---
The `intervals()` function generates a set of time intervals over a range of time. The `intervals()` function generates a set of time intervals over a range of time.
@ -16,9 +18,13 @@ The generator is then used to produce the set of intervals.
The set of intervals includes all intervals that intersect with the initial range of time. The set of intervals includes all intervals that intersect with the initial range of time.
{{% note %}} {{% note %}}
The `intervals()` function is designed to be used with the intervals parameter of the [`window()` function](/v2.0/reference/flux/functions/transformations/window). The `intervals()` function is designed to be used with the intervals parameter
of the [`window()` function](/v2.0/reference/flux/functions/transformations/window).
{{% /note %}} {{% /note %}}
By default the end boundary of an interval will align with the Unix epoch (zero time)
modified by the offset of the `location` option.
_**Function type:** Miscellaneous_ _**Function type:** Miscellaneous_
_**Output data type:** Object_ _**Output data type:** Object_
@ -44,9 +50,9 @@ Defaults to the value of the `every` duration.
_**Data type:** Duration_ _**Data type:** Duration_
### offset ### offset
The offset duration relative to the location offset. The duration by which to shift the window boundaries.
It can be negative, indicating that the offset goes backwards in time. It can be negative, indicating that the offset goes backwards in time.
Defaults to `0h`. Defaults to `0`, which will align window end boundaries with the `every` duration.
_**Data type:** Duration_ _**Data type:** Duration_

View File

@ -1,11 +1,13 @@
--- ---
title: linearBins() function title: linearBins() function
description: The linearBins() function generates a list of linearly separated floats. description: The linearBins() function generates a list of linearly separated floats.
aliases:
- /v2.0/reference/flux/functions/misc/linearbins
menu: menu:
v2_0_ref: v2_0_ref:
name: linearBins name: linearBins
parent: Miscellaneous parent: built-in-misc
weight: 301 weight: 401
--- ---
The `linearBins()` function generates a list of linearly separated floats. The `linearBins()` function generates a list of linearly separated floats.

View File

@ -1,11 +1,13 @@
--- ---
title: logarithmicBins() function title: logarithmicBins() function
description: The logarithmicBins() function generates a list of exponentially separated floats. description: The logarithmicBins() function generates a list of exponentially separated floats.
aliases:
- /v2.0/reference/flux/functions/misc/logarithmicbins
menu: menu:
v2_0_ref: v2_0_ref:
name: logarithmicBins name: logarithmicBins
parent: Miscellaneous parent: built-in-misc
weight: 301 weight: 401
--- ---
The `logarithmicBins()` function generates a list of exponentially separated floats. The `logarithmicBins()` function generates a list of exponentially separated floats.

View File

@ -1,11 +1,13 @@
--- ---
title: systemTime() function title: systemTime() function
description: The systemTime() function returns the current system time. description: The systemTime() function returns the current system time.
aliases:
- /v2.0/reference/flux/functions/misc/systemtime
menu: menu:
v2_0_ref: v2_0_ref:
name: systemTime name: systemTime
parent: Miscellaneous parent: built-in-misc
weight: 301 weight: 401
--- ---
The `systemTime()` function returns the current system time. The `systemTime()` function returns the current system time.

View File

@ -1,11 +1,14 @@
--- ---
title: Flux output functions title: Flux output functions
description: Flux output functions yield results or send data to a specified output destination. description: Flux output functions yield results or send data to a specified output destination.
aliases:
- /v2.0/reference/flux/functions/outputs
menu: menu:
v2_0_ref: v2_0_ref:
parent: Flux functions parent: Built-in
name: Outputs name: Outputs
weight: 202 identifier: built-in-outputs
weight: 302
--- ---
Flux output functions yield results or send data to a specified output destination. Flux output functions yield results or send data to a specified output destination.

View File

@ -1,11 +1,13 @@
--- ---
title: to() function title: to() function
description: The to() function writes data to an InfluxDB v2.0 bucket. description: The to() function writes data to an InfluxDB v2.0 bucket.
aliases:
- /v2.0/reference/flux/functions/outputs/to
menu: menu:
v2_0_ref: v2_0_ref:
name: to name: to
parent: Outputs parent: built-in-outputs
weight: 301 weight: 401
--- ---
The `to()` function writes data to an **InfluxDB v2.0** bucket. The `to()` function writes data to an **InfluxDB v2.0** bucket.

View File

@ -1,11 +1,13 @@
--- ---
title: yield() function title: yield() function
description: The yield() function indicates the input tables received should be delivered as a result of the query. description: The yield() function indicates the input tables received should be delivered as a result of the query.
aliases:
- /v2.0/reference/flux/functions/outputs/yield
menu: menu:
v2_0_ref: v2_0_ref:
name: yield name: yield
parent: Outputs parent: built-in-outputs
weight: 301 weight: 401
--- ---
The `yield()` function indicates the input tables received should be delivered as a result of the query. The `yield()` function indicates the input tables received should be delivered as a result of the query.

View File

@ -1,11 +1,14 @@
--- ---
title: Flux transformation functions title: Flux transformation functions
description: Flux transformation functions transform and shape your data in specific ways. description: Flux transformation functions transform and shape your data in specific ways.
aliases:
- /v2.0/reference/flux/functions/transformations
menu: menu:
v2_0_ref: v2_0_ref:
parent: Flux functions parent: Built-in
name: Transformations name: Transformations
weight: 203 identifier: built-in-transformations
weight: 303
--- ---
Flux transformation functions transform or shape your data in specific ways. Flux transformation functions transform or shape your data in specific ways.

View File

@ -1,11 +1,14 @@
--- ---
title: Flux aggregate functions title: Flux aggregate functions
description: Flux aggregate functions take values from an input table and aggregate them in some way. description: Flux aggregate functions take values from an input table and aggregate them in some way.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates
menu: menu:
v2_0_ref: v2_0_ref:
parent: Transformations parent: built-in-transformations
name: Aggregates name: Aggregates
weight: 301 identifier: built-in-aggregates
weight: 401
--- ---
Flux aggregate functions take values from an input table and aggregate them in some way. Flux aggregate functions take values from an input table and aggregate them in some way.

View File

@ -1,11 +1,13 @@
--- ---
title: aggregateWindow() function title: aggregateWindow() function
description: The aggregateWindow() function applies an aggregate function to fixed windows of time. description: The aggregateWindow() function applies an aggregate function to fixed windows of time.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/aggregatewindow
menu: menu:
v2_0_ref: v2_0_ref:
name: aggregateWindow name: aggregateWindow
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `aggregateWindow()` function applies an aggregate function to fixed windows of time. The `aggregateWindow()` function applies an aggregate function to fixed windows of time.

View File

@ -1,11 +1,13 @@
--- ---
title: count() function title: count() function
description: The count() function outputs the number of non-null records in each aggregated column. description: The count() function outputs the number of non-null records in each aggregated column.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/count
menu: menu:
v2_0_ref: v2_0_ref:
name: count name: count
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `count()` function outputs the number of records in each aggregated column. The `count()` function outputs the number of records in each aggregated column.

View File

@ -1,11 +1,13 @@
--- ---
title: cov() function title: cov() function
description: The cov() function computes the covariance between two streams by first joining the streams, then performing the covariance operation. description: The cov() function computes the covariance between two streams by first joining the streams, then performing the covariance operation.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/cov
menu: menu:
v2_0_ref: v2_0_ref:
name: cov name: cov
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `cov()` function computes the covariance between two streams by first joining the streams, The `cov()` function computes the covariance between two streams by first joining the streams,

View File

@ -1,11 +1,13 @@
--- ---
title: covariance() function title: covariance() function
description: The covariance() function computes the covariance between two columns. description: The covariance() function computes the covariance between two columns.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/covariance
menu: menu:
v2_0_ref: v2_0_ref:
name: covariance name: covariance
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `covariance()` function computes the covariance between two columns. The `covariance()` function computes the covariance between two columns.

View File

@ -1,11 +1,13 @@
--- ---
title: derivative() function title: derivative() function
description: The derivative() function computes the rate of change per unit of time between subsequent non-null records. description: The derivative() function computes the rate of change per unit of time between subsequent non-null records.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/derivative
menu: menu:
v2_0_ref: v2_0_ref:
name: derivative name: derivative
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `derivative()` function computes the rate of change per [`unit`](#unit) of time between subsequent non-null records. The `derivative()` function computes the rate of change per [`unit`](#unit) of time between subsequent non-null records.

View File

@ -1,11 +1,13 @@
--- ---
title: difference() function title: difference() function
description: The difference() function computes the difference between subsequent non-null records. description: The difference() function computes the difference between subsequent non-null records.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/difference
menu: menu:
v2_0_ref: v2_0_ref:
name: difference name: difference
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `difference()` function computes the difference between subsequent records. The `difference()` function computes the difference between subsequent records.

View File

@ -1,11 +1,13 @@
--- ---
title: histogramQuantile() function title: histogramQuantile() function
description: The `histogramQuantile()` function approximates a quantile given a histogram that approximates the cumulative distribution of the dataset. description: The `histogramQuantile()` function approximates a quantile given a histogram that approximates the cumulative distribution of the dataset.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/histogramquantile
menu: menu:
v2_0_ref: v2_0_ref:
name: histogramQuantile name: histogramQuantile
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `histogramQuantile()` function approximates a quantile given a histogram that The `histogramQuantile()` function approximates a quantile given a histogram that

View File

@ -1,11 +1,13 @@
--- ---
title: increase() function title: increase() function
description: The increase() function calculates the total non-negative difference between values in a table. description: The increase() function calculates the total non-negative difference between values in a table.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/increase
menu: menu:
v2_0_ref: v2_0_ref:
name: increase name: increase
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `increase()` function calculates the total non-negative difference between values in a table. The `increase()` function calculates the total non-negative difference between values in a table.

View File

@ -1,11 +1,13 @@
--- ---
title: integral() function title: integral() function
description: The integral() function computes the area under the curve per unit of time of subsequent non-null records. description: The integral() function computes the area under the curve per unit of time of subsequent non-null records.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/integral
menu: menu:
v2_0_ref: v2_0_ref:
name: integral name: integral
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `integral()` function computes the area under the curve per [`unit`](#unit) of time of subsequent non-null records. The `integral()` function computes the area under the curve per [`unit`](#unit) of time of subsequent non-null records.

View File

@ -1,11 +1,13 @@
--- ---
title: mean() function title: mean() function
description: The mean() function computes the mean or average of non-null records in the input table. description: The mean() function computes the mean or average of non-null records in the input table.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/mean
menu: menu:
v2_0_ref: v2_0_ref:
name: mean name: mean
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `mean()` function computes the mean or average of non-null records in the input table. The `mean()` function computes the mean or average of non-null records in the input table.

View File

@ -1,11 +1,13 @@
--- ---
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 50th percentile
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/median
menu: menu:
v2_0_ref: v2_0_ref:
name: median name: median
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `median()` function is a special application of the [`percentile()` function](/v2.0/reference/flux/functions/transformations/aggregates/percentile) The `median()` function is a special application of the [`percentile()` function](/v2.0/reference/flux/functions/transformations/aggregates/percentile)

View File

@ -1,11 +1,13 @@
--- ---
title: pearsonr() function title: pearsonr() function
description: The pearsonr() function computes the Pearson R correlation coefficient between two streams by first joining the streams, then performing the covariance operation normalized to compute R. description: The pearsonr() function computes the Pearson R correlation coefficient between two streams by first joining the streams, then performing the covariance operation normalized to compute R.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/pearsonr
menu: menu:
v2_0_ref: v2_0_ref:
name: pearsonr name: pearsonr
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `pearsonr()` function computes the Pearson R correlation coefficient between two streams The `pearsonr()` function computes the Pearson R correlation coefficient between two streams

View File

@ -1,11 +1,13 @@
--- ---
title: percentile() function 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. 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.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/percentile
menu: menu:
v2_0_ref: v2_0_ref:
name: percentile name: percentile
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `percentile()` function returns records from an input table with `_value`s that fall within The `percentile()` function returns records from an input table with `_value`s that fall within

View File

@ -1,11 +1,13 @@
--- ---
title: skew() function title: skew() function
description: The skew() function outputs the skew of non-null records as a float. description: The skew() function outputs the skew of non-null records as a float.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/skew
menu: menu:
v2_0_ref: v2_0_ref:
name: skew name: skew
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `skew()` function outputs the skew of non-null records as a float. The `skew()` function outputs the skew of non-null records as a float.

View File

@ -1,11 +1,13 @@
--- ---
title: spread() function title: spread() function
description: The spread() function outputs the difference between the minimum and maximum values in each specified column. description: The spread() function outputs the difference between the minimum and maximum values in each specified column.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/spread
menu: menu:
v2_0_ref: v2_0_ref:
name: spread name: spread
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `spread()` function outputs the difference between the minimum and maximum values in each specified column. The `spread()` function outputs the difference between the minimum and maximum values in each specified column.

View File

@ -1,11 +1,13 @@
--- ---
title: stddev() function title: stddev() function
description: The stddev() function computes the standard deviation of non-null records in specified columns. description: The stddev() function computes the standard deviation of non-null records in specified columns.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/stddev
menu: menu:
v2_0_ref: v2_0_ref:
name: stddev name: stddev
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `stddev()` function computes the standard deviation of non-null records in specified columns. The `stddev()` function computes the standard deviation of non-null records in specified columns.

View File

@ -1,11 +1,13 @@
--- ---
title: sum() function title: sum() function
description: The sum() function computes the sum of non-null records in specified columns. description: The sum() function computes the sum of non-null records in specified columns.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/sum
menu: menu:
v2_0_ref: v2_0_ref:
name: sum name: sum
parent: Aggregates parent: built-in-aggregates
weight: 401 weight: 501
--- ---
The `sum()` function computes the sum of non-null records in specified columns. The `sum()` function computes the sum of non-null records in specified columns.

View File

@ -3,12 +3,14 @@ title: columns() function
description: > description: >
The columns() function lists the column labels of input tables. The columns() function lists the column labels of input tables.
For each input table, it outputs a table with the same group key columns, For each input table, it outputs a table with the same group key columns,
plus a new column containing the labels of the input table's columns. plus a new column containing the labels of the input table's columns.
aliases:
- /v2.0/reference/flux/functions/transformations/columns
menu: menu:
v2_0_ref: v2_0_ref:
name: columns name: columns
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `columns()` function lists the column labels of input tables. The `columns()` function lists the column labels of input tables.

View File

@ -1,11 +1,13 @@
--- ---
title: cumulativeSum() function title: cumulativeSum() function
description: The cumulativeSum() function computes a running sum for non-null records in the table. description: The cumulativeSum() function computes a running sum for non-null records in the table.
aliases:
- /v2.0/reference/flux/functions/transformations/cumulativesum
menu: menu:
v2_0_ref: v2_0_ref:
name: cumulativeSum name: cumulativeSum
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `cumulativeSum()` function computes a running sum for non-null records in the table. The `cumulativeSum()` function computes a running sum for non-null records in the table.

View File

@ -1,11 +1,13 @@
--- ---
title: drop() function title: drop() function
description: The drop() function removes specified columns from a table. description: The drop() function removes specified columns from a table.
aliases:
- /v2.0/reference/flux/functions/transformations/drop
menu: menu:
v2_0_ref: v2_0_ref:
name: drop name: drop
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `drop()` function removes specified columns from a table. The `drop()` function removes specified columns from a table.

View File

@ -1,11 +1,13 @@
--- ---
title: duplicate() function title: duplicate() function
description: The duplicate() function duplicates a specified column in a table. description: The duplicate() function duplicates a specified column in a table.
aliases:
- /v2.0/reference/flux/functions/transformations/duplicate
menu: menu:
v2_0_ref: v2_0_ref:
name: duplicate name: duplicate
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `duplicate()` function duplicates a specified column in a table. The `duplicate()` function duplicates a specified column in a table.

View File

@ -1,11 +1,13 @@
--- ---
title: fill() function title: fill() function
description: The fill() function replaces all null values in an input stream and replace them with a non-null value. description: The fill() function replaces all null values in an input stream and replace them with a non-null value.
aliases:
- /v2.0/reference/flux/functions/transformations/fill
menu: menu:
v2_0_ref: v2_0_ref:
name: fill name: fill
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `fill()` function replaces all null values in an input stream with a non-null value. The `fill()` function replaces all null values in an input stream with a non-null value.

View File

@ -1,11 +1,13 @@
--- ---
title: filter() function title: filter() function
description: The filter() function filters data based on conditions defined in a predicate function (fn). description: The filter() function filters data based on conditions defined in a predicate function (fn).
aliases:
- /v2.0/reference/flux/functions/transformations/filter
menu: menu:
v2_0_ref: v2_0_ref:
name: filter name: filter
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `filter()` function filters data based on conditions defined in a predicate function ([`fn`](#fn)). The `filter()` function filters data based on conditions defined in a predicate function ([`fn`](#fn)).

View File

@ -1,11 +1,13 @@
--- ---
title: group() function title: group() function
description: The group() function groups records based on their values for specific columns. description: The group() function groups records based on their values for specific columns.
aliases:
- /v2.0/reference/flux/functions/transformations/group
menu: menu:
v2_0_ref: v2_0_ref:
name: group name: group
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `group()` function groups records based on their values for specific columns. The `group()` function groups records based on their values for specific columns.

View File

@ -1,11 +1,13 @@
--- ---
title: histogram() function title: histogram() function
description: The histogram() function approximates the cumulative distribution of a dataset by counting data frequencies for a list of bins. description: The histogram() function approximates the cumulative distribution of a dataset by counting data frequencies for a list of bins.
aliases:
- /v2.0/reference/flux/functions/transformations/histogram
menu: menu:
v2_0_ref: v2_0_ref:
name: histogram name: histogram
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `histogram()` function approximates the cumulative distribution of a dataset by counting data frequencies for a list of bins. The `histogram()` function approximates the cumulative distribution of a dataset by counting data frequencies for a list of bins.

View File

@ -1,11 +1,13 @@
--- ---
title: join() function title: join() function
description: The join() function merges two or more input streams whose values are equal on a set of common columns into a single output stream. description: The join() function merges two or more input streams whose values are equal on a set of common columns into a single output stream.
aliases:
- /v2.0/reference/flux/functions/transformations/join
menu: menu:
v2_0_ref: v2_0_ref:
name: join name: join
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `join()` function merges two or more input streams whose values are equal on The `join()` function merges two or more input streams whose values are equal on

View File

@ -1,11 +1,13 @@
--- ---
title: keep() function title: keep() function
description: The keep() function returns a table containing only the specified columns. description: The keep() function returns a table containing only the specified columns.
aliases:
- /v2.0/reference/flux/functions/transformations/keep
menu: menu:
v2_0_ref: v2_0_ref:
name: keep name: keep
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `keep()` function returns a table containing only the specified columns, ignoring all others. The `keep()` function returns a table containing only the specified columns, ignoring all others.

View File

@ -3,12 +3,14 @@ title: keys() function
description: > description: >
The keys() function outputs the group key of input tables. The keys() function outputs the group key of input tables.
For each input table, it outputs a table with the same group key columns, plus a For each input table, it outputs a table with the same group key columns, plus a
_value column containing the labels of the input table's group key. _value column containing the labels of the input table's group key.
aliases:
- /v2.0/reference/flux/functions/transformations/keys
menu: menu:
v2_0_ref: v2_0_ref:
name: keys name: keys
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `keys()` function outputs the group key of input tables. The `keys()` function outputs the group key of input tables.

View File

@ -1,11 +1,13 @@
--- ---
title: keyValues() function title: keyValues() function
description: The keyValues() function returns a table with the input table's group key plus two columns, _key and _value, that correspond to unique column + value pairs from the input table. description: The keyValues() function returns a table with the input table's group key plus two columns, _key and _value, that correspond to unique column + value pairs from the input table.
aliases:
- /v2.0/reference/flux/functions/transformations/keyvalues
menu: menu:
v2_0_ref: v2_0_ref:
name: keyValues name: keyValues
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `keyValues()` function returns a table with the input table's group key plus two columns, The `keyValues()` function returns a table with the input table's group key plus two columns,

View File

@ -1,11 +1,13 @@
--- ---
title: limit() function title: limit() function
description: The limit() function limits the number of records in output tables to a fixed number (n). description: The limit() function limits the number of records in output tables to a fixed number (n).
aliases:
- /v2.0/reference/flux/functions/transformations/limit
menu: menu:
v2_0_ref: v2_0_ref:
name: limit name: limit
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `limit()` function limits the number of records in output tables to a fixed number ([`n`](#n)). The `limit()` function limits the number of records in output tables to a fixed number ([`n`](#n)).

View File

@ -1,11 +1,13 @@
--- ---
title: map() function title: map() function
description: The map() function applies a function to each record in the input tables. description: The map() function applies a function to each record in the input tables.
aliases:
- /v2.0/reference/flux/functions/transformations/map
menu: menu:
v2_0_ref: v2_0_ref:
name: map name: map
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `map()` function applies a function to each record in the input tables. The `map()` function applies a function to each record in the input tables.

View File

@ -1,11 +1,13 @@
--- ---
title: pivot() function title: pivot() function
description: The pivot() function collects values stored vertically (column-wise) in a table and aligns them horizontally (row-wise) into logical sets. description: The pivot() function collects values stored vertically (column-wise) in a table and aligns them horizontally (row-wise) into logical sets.
aliases:
- /v2.0/reference/flux/functions/transformations/pivot
menu: menu:
v2_0_ref: v2_0_ref:
name: pivot name: pivot
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `pivot()` function collects values stored vertically (column-wise) in a table The `pivot()` function collects values stored vertically (column-wise) in a table

View File

@ -1,11 +1,13 @@
--- ---
title: range() function title: range() function
description: The range() function filters records based on time bounds. description: The range() function filters records based on time bounds.
aliases:
- /v2.0/reference/flux/functions/transformations/range
menu: menu:
v2_0_ref: v2_0_ref:
name: range name: range
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `range()` function filters records based on time bounds. The `range()` function filters records based on time bounds.

View File

@ -1,11 +1,13 @@
--- ---
title: rename() function title: rename() function
description: The rename() function renames specified columns in a table. description: The rename() function renames specified columns in a table.
aliases:
- /v2.0/reference/flux/functions/transformations/rename
menu: menu:
v2_0_ref: v2_0_ref:
name: rename name: rename
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `rename()` function renames specified columns in a table. The `rename()` function renames specified columns in a table.

View File

@ -1,11 +1,14 @@
--- ---
title: Flux selector functions title: Flux selector functions
description: Flux selector functions return one or more records based on function logic. description: Flux selector functions return one or more records based on function logic.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors
menu: menu:
v2_0_ref: v2_0_ref:
parent: Transformations parent: built-in-transformations
name: Selectors name: Selectors
weight: 301 identifier: built-in-selectors
weight: 401
--- ---
Flux selector functions return one or more records based on function logic. Flux selector functions return one or more records based on function logic.

View File

@ -1,11 +1,13 @@
--- ---
title: bottom() function title: bottom() function
description: The bottom() function sorts a table by columns and keeps only the bottom n records. description: The bottom() function sorts a table by columns and keeps only the bottom n records.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/bottom
menu: menu:
v2_0_ref: v2_0_ref:
name: bottom name: bottom
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `bottom()` function sorts a table by columns and keeps only the bottom `n` records. The `bottom()` function sorts a table by columns and keeps only the bottom `n` records.

View File

@ -1,11 +1,13 @@
--- ---
title: distinct() function title: distinct() function
description: The distinct() function returns the unique values for a given column. description: The distinct() function returns the unique values for a given column.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/distinct
menu: menu:
v2_0_ref: v2_0_ref:
name: distinct name: distinct
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `distinct()` function returns the unique values for a given column. The `distinct()` function returns the unique values for a given column.

View File

@ -1,11 +1,13 @@
--- ---
title: first() function title: first() function
description: The first() function selects the first non-null record from an input table. description: The first() function selects the first non-null record from an input table.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/first
menu: menu:
v2_0_ref: v2_0_ref:
name: first name: first
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `first()` function selects the first non-null record from an input table. The `first()` function selects the first non-null record from an input table.

View File

@ -1,11 +1,13 @@
--- ---
title: highestAverage() function title: highestAverage() function
description: The highestAverage() function returns the top 'n' records from all groups using the average of each group. description: The highestAverage() function returns the top 'n' records from all groups using the average of each group.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/highestaverage
menu: menu:
v2_0_ref: v2_0_ref:
name: highestAverage name: highestAverage
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `highestAverage()` function returns the top `n` records from all groups using the average of each group. The `highestAverage()` function returns the top `n` records from all groups using the average of each group.

View File

@ -1,11 +1,13 @@
--- ---
title: highestCurrent() function title: highestCurrent() function
description: The highestCurrent() function returns the top 'n' records from all groups using the last value of each group. description: The highestCurrent() function returns the top 'n' records from all groups using the last value of each group.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/highestcurrent
menu: menu:
v2_0_ref: v2_0_ref:
name: highestCurrent name: highestCurrent
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `highestCurrent()` function returns the top `n` records from all groups using the last value of each group. The `highestCurrent()` function returns the top `n` records from all groups using the last value of each group.

View File

@ -1,11 +1,13 @@
--- ---
title: highestMax() function title: highestMax() function
description: The highestMax() function returns the top 'n' records from all groups using the maximum of each group. description: The highestMax() function returns the top 'n' records from all groups using the maximum of each group.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/highestmax
menu: menu:
v2_0_ref: v2_0_ref:
name: highestMax name: highestMax
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `highestMax()` function returns the top `n` records from all groups using the maximum of each group. The `highestMax()` function returns the top `n` records from all groups using the maximum of each group.

View File

@ -1,11 +1,13 @@
--- ---
title: last() function title: last() function
description: The last() function selects the last non-null record from an input table. description: The last() function selects the last non-null record from an input table.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/last
menu: menu:
v2_0_ref: v2_0_ref:
name: last name: last
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `last()` function selects the last non-null record from an input table. The `last()` function selects the last non-null record from an input table.

View File

@ -1,11 +1,13 @@
--- ---
title: lowestAverage() function title: lowestAverage() function
description: The lowestAverage() function returns the bottom 'n' records from all groups using the average of each group. description: The lowestAverage() function returns the bottom 'n' records from all groups using the average of each group.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/lowestaverage
menu: menu:
v2_0_ref: v2_0_ref:
name: lowestAverage name: lowestAverage
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `lowestAverage()` function returns the bottom `n` records from all groups using the average of each group. The `lowestAverage()` function returns the bottom `n` records from all groups using the average of each group.

View File

@ -1,11 +1,13 @@
--- ---
title: lowestCurrent() function title: lowestCurrent() function
description: The lowestCurrent() function returns the bottom 'n' records from all groups using the last value of each group. description: The lowestCurrent() function returns the bottom 'n' records from all groups using the last value of each group.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/lowestcurrent
menu: menu:
v2_0_ref: v2_0_ref:
name: lowestCurrent name: lowestCurrent
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `lowestCurrent()` function returns the bottom `n` records from all groups using the last value of each group. The `lowestCurrent()` function returns the bottom `n` records from all groups using the last value of each group.

View File

@ -1,11 +1,13 @@
--- ---
title: lowestMin() function title: lowestMin() function
description: The lowestMin() function returns the bottom 'n' records from all groups using the minimum of each group. description: The lowestMin() function returns the bottom 'n' records from all groups using the minimum of each group.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/lowestmin
menu: menu:
v2_0_ref: v2_0_ref:
name: lowestMin name: lowestMin
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `lowestMin()` function returns the bottom `n` records from all groups using the minimum of each group. The `lowestMin()` function returns the bottom `n` records from all groups using the minimum of each group.

View File

@ -1,11 +1,13 @@
--- ---
title: max() function title: max() function
description: The max() function selects record with the highest _value from the input table. description: The max() function selects record with the highest _value from the input table.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/max
menu: menu:
v2_0_ref: v2_0_ref:
name: max name: max
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `max()` function selects record with the highest `_value` from the input table. The `max()` function selects record with the highest `_value` from the input table.

View File

@ -1,11 +1,13 @@
--- ---
title: min() function title: min() function
description: The min() function selects record with the lowest _value from the input table. description: The min() function selects record with the lowest _value from the input table.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/min
menu: menu:
v2_0_ref: v2_0_ref:
name: min name: min
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `min()` function selects record with the lowest `_value` from the input table. The `min()` function selects record with the lowest `_value` from the input table.

View File

@ -1,11 +1,13 @@
--- ---
title: sample() function title: sample() function
description: The sample() function selects a subset of the records from the input table. description: The sample() function selects a subset of the records from the input table.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/sample
menu: menu:
v2_0_ref: v2_0_ref:
name: sample name: sample
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `sample()` function selects a subset of the records from the input table. The `sample()` function selects a subset of the records from the input table.

View File

@ -1,11 +1,13 @@
--- ---
title: top() function title: top() function
description: The top() function sorts a table by columns and keeps only the top n records. description: The top() function sorts a table by columns and keeps only the top n records.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/top
menu: menu:
v2_0_ref: v2_0_ref:
name: top name: top
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `top()` function sorts a table by columns and keeps only the top `n` records. The `top()` function sorts a table by columns and keeps only the top `n` records.

View File

@ -1,11 +1,13 @@
--- ---
title: unique() function title: unique() function
description: The unique() function returns all records containing unique values in a specified column. description: The unique() function returns all records containing unique values in a specified column.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors/unique
menu: menu:
v2_0_ref: v2_0_ref:
name: unique name: unique
parent: Selectors parent: built-in-selectors
weight: 401 weight: 501
--- ---
The `unique()` function returns all records containing unique values in a specified column. The `unique()` function returns all records containing unique values in a specified column.

View File

@ -1,11 +1,13 @@
--- ---
title: set() function title: set() function
description: The set() function assigns a static value to each record in the input table. description: The set() function assigns a static value to each record in the input table.
aliases:
- /v2.0/reference/flux/functions/transformations/set
menu: menu:
v2_0_ref: v2_0_ref:
name: set name: set
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `set()` function assigns a static value to each record in the input table. The `set()` function assigns a static value to each record in the input table.

View File

@ -1,11 +1,13 @@
--- ---
title: shift() function title: shift() function
description: The shift() function adds a fixed duration to time columns. description: The shift() function adds a fixed duration to time columns.
aliases:
- /v2.0/reference/flux/functions/transformations/shift
menu: menu:
v2_0_ref: v2_0_ref:
name: shift name: shift
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `shift()` function adds a fixed duration to time columns. The `shift()` function adds a fixed duration to time columns.

View File

@ -1,11 +1,13 @@
--- ---
title: sort() function title: sort() function
description: The sort() function orders the records within each table. description: The sort() function orders the records within each table.
aliases:
- /v2.0/reference/flux/functions/transformations/sort
menu: menu:
v2_0_ref: v2_0_ref:
name: sort name: sort
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `sort()` function orders the records within each table. The `sort()` function orders the records within each table.

View File

@ -1,11 +1,13 @@
--- ---
title: stateCount() function title: stateCount() function
description: The stateCount() function computes the number of consecutive records in a given state. description: The stateCount() function computes the number of consecutive records in a given state.
aliases:
- /v2.0/reference/flux/functions/transformations/statecount
menu: menu:
v2_0_ref: v2_0_ref:
name: stateCount name: stateCount
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `stateCount()` function computes the number of consecutive records in a given state. The `stateCount()` function computes the number of consecutive records in a given state.

View File

@ -1,11 +1,13 @@
--- ---
title: stateDuration() function title: stateDuration() function
description: The stateDuration() function computes the duration of a given state. description: The stateDuration() function computes the duration of a given state.
aliases:
- /v2.0/reference/flux/functions/transformations/stateduration
menu: menu:
v2_0_ref: v2_0_ref:
name: stateDuration name: stateDuration
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `stateDuration()` function computes the duration of a given state. The `stateDuration()` function computes the duration of a given state.

View File

@ -1,11 +1,14 @@
--- ---
title: Flux type conversion functions title: Flux type conversion functions
description: Flux type conversion functions convert columns of the input table into a specific data type. description: Flux type conversion functions convert columns of the input table into a specific data type.
aliases:
- /v2.0/reference/flux/functions/transformations/type-conversions
menu: menu:
v2_0_ref: v2_0_ref:
parent: Transformations parent: built-in-transformations
name: Type conversions name: Type conversions
weight: 301 identifier: built-in-type-conversions
weight: 401
--- ---
Flux type conversion functions convert columns of the input table into a specific data type. Flux type conversion functions convert columns of the input table into a specific data type.

View File

@ -1,11 +1,13 @@
--- ---
title: toBool() function title: toBool() function
description: The toBool() function converts a value to a boolean. description: The toBool() function converts a value to a boolean.
aliases:
- /v2.0/reference/flux/functions/transformations/type-conversions/tobool
menu: menu:
v2_0_ref: v2_0_ref:
name: toBool name: toBool
parent: Type conversions parent: built-in-type-conversions
weight: 401 weight: 501
--- ---
The `toBool()` function converts a value to a boolean. The `toBool()` function converts a value to a boolean.

View File

@ -1,11 +1,13 @@
--- ---
title: toDuration() function title: toDuration() function
description: The toDuration() function converts a value to a duration. description: The toDuration() function converts a value to a duration.
aliases:
- /v2.0/reference/flux/functions/transformations/type-conversions/toduration
menu: menu:
v2_0_ref: v2_0_ref:
name: toDuration name: toDuration
parent: Type conversions parent: built-in-type-conversions
weight: 401 weight: 501
--- ---
The `toDuration()` function converts a value to a duration. The `toDuration()` function converts a value to a duration.

View File

@ -1,11 +1,13 @@
--- ---
title: toFloat() function title: toFloat() function
description: The toFloat() function converts a value to a float. description: The toFloat() function converts a value to a float.
aliases:
- /v2.0/reference/flux/functions/transformations/type-conversions/tofloat
menu: menu:
v2_0_ref: v2_0_ref:
name: toFloat name: toFloat
parent: Type conversions parent: built-in-type-conversions
weight: 401 weight: 501
--- ---
The `toFloat()` function converts a value to a float. The `toFloat()` function converts a value to a float.

View File

@ -1,11 +1,13 @@
--- ---
title: toInt() function title: toInt() function
description: The toInt() function converts a value to an integer. description: The toInt() function converts a value to an integer.
aliases:
- /v2.0/reference/flux/functions/transformations/type-conversions/toint
menu: menu:
v2_0_ref: v2_0_ref:
name: toInt name: toInt
parent: Type conversions parent: built-in-type-conversions
weight: 401 weight: 501
--- ---
The `toInt()` function converts a value to an integer. The `toInt()` function converts a value to an integer.

View File

@ -1,11 +1,13 @@
--- ---
title: toString() function title: toString() function
description: The toString() function converts a value to a string. description: The toString() function converts a value to a string.
aliases:
- /v2.0/reference/flux/functions/transformations/type-conversions/tostring
menu: menu:
v2_0_ref: v2_0_ref:
name: toString name: toString
parent: Type conversions parent: built-in-type-conversions
weight: 401 weight: 501
--- ---
The `toString()` function converts a value to a string. The `toString()` function converts a value to a string.

View File

@ -1,11 +1,13 @@
--- ---
title: toTime() function title: toTime() function
description: The toTime() function converts a value to a time. description: The toTime() function converts a value to a time.
aliases:
- /v2.0/reference/flux/functions/transformations/type-conversions/totime
menu: menu:
v2_0_ref: v2_0_ref:
name: toTime name: toTime
parent: Type conversions parent: built-in-type-conversions
weight: 401 weight: 501
--- ---
The `toTime()` function converts a value to a time. The `toTime()` function converts a value to a time.

View File

@ -1,11 +1,13 @@
--- ---
title: toUInt() function title: toUInt() function
description: The toUInt() function converts a value to an uinteger. description: The toUInt() function converts a value to an uinteger.
aliases:
- /v2.0/reference/flux/functions/transformations/type-conversions/touint
menu: menu:
v2_0_ref: v2_0_ref:
name: toUInt name: toUInt
parent: Type conversions parent: built-in-type-conversions
weight: 401 weight: 501
--- ---
The `toUInt()` function converts a value to an UInteger. The `toUInt()` function converts a value to an UInteger.

View File

@ -1,11 +1,13 @@
--- ---
title: union() function title: union() function
description: The union() function concatenates two or more input streams into a single output stream. description: The union() function concatenates two or more input streams into a single output stream.
aliases:
- /v2.0/reference/flux/functions/transformations/union
menu: menu:
v2_0_ref: v2_0_ref:
name: union name: union
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `union()` function concatenates two or more input streams into a single output stream. The `union()` function concatenates two or more input streams into a single output stream.

View File

@ -1,11 +1,13 @@
--- ---
title: window() function title: window() function
description: The window() function groups records based on a time value. description: The window() function groups records based on a time value.
aliases:
- /v2.0/reference/flux/functions/transformations/window
menu: menu:
v2_0_ref: v2_0_ref:
name: window name: window
parent: Transformations parent: built-in-transformations
weight: 301 weight: 401
--- ---
The `window()` function groups records based on a time value. The `window()` function groups records based on a time value.
@ -14,6 +16,9 @@ Those columns are added to the group key of the output tables.
A single input record will be placed into zero or more output tables, depending on the specific windowing function. A single input record will be placed into zero or more output tables, depending on the specific windowing function.
By default the start boundary of a window will align with the Unix epoch (zero time)
modified by the offset of the `location` option.
_**Function type:** Transformation_ _**Function type:** Transformation_
_**Output data type:** Object_ _**Output data type:** Object_
@ -21,10 +26,11 @@ _**Output data type:** Object_
window( window(
every: 5m, every: 5m,
period: 5m, period: 5m,
start: 12h, offset: 12h,
timeColumn: "_time", timeColumn: "_time",
startColumn: "_start", startColumn: "_start",
stopColumn: "_stop" stopColumn: "_stop",
createEmpty: false
) )
// OR // OR
@ -33,7 +39,8 @@ window(
intervals: intervals(every: 5m, period: 5m, offset: 12h), intervals: intervals(every: 5m, period: 5m, offset: 12h),
timeColumn: "_time", timeColumn: "_time",
startColumn: "_start", startColumn: "_start",
stopColumn: "_stop" stopColumn: "_stop",
createEmpty: false
) )
``` ```
@ -57,10 +64,10 @@ Defaults to `every` value.
_**Data type:** Duration_ _**Data type:** Duration_
### start ### offset
The start window time relative to the [`location`](/v2.0/reference/flux/language/options/#location) offset. Offset is the duration by which to shift the window boundaries.
It can be negative, indicating that the start goes backwards in time. It can be negative, indicating that the offset goes backwards in time.
The default aligns the window boundaries with `now`. Defaults to 0, which will align window end boundaries with the `every` duration.
_**Data type:** Duration_ _**Data type:** Duration_
@ -96,6 +103,10 @@ Defaults to `"_stop"`.
_**Data type:** String_ _**Data type:** String_
### createEmpty
Specifies whether empty tables should be created.
Defaults to `false`.
## Examples ## Examples
#### Window data into 10 minute intervals #### Window data into 10 minute intervals

View File

@ -0,0 +1,22 @@
---
title: Flux InfluxDB v1 functions
description: >
InfluxDB v1 Flux functions provide tools for managing data from an InfluxDB v1.x
database or structured using the InfluxDB v1 data structure.
To use them, import the "influxdata/influxdb/v1" package.
menu:
v2_0_ref:
name: InfluxDB v1
parent: Flux functions
weight: 202
---
InfluxDB v1 Flux functions provide tools for managing data from an InfluxDB v1.x
database or structured using the InfluxDB v1 data structure.
To use them, import the `influxdata/influxdb/v1` package:
```js
import "influxdata/influxdb/v1"
```
{{< children type="functions" show="pages" >}}

View File

@ -0,0 +1,48 @@
---
title: v1.fieldsAsCols() function
description: The v1.fieldsAsCols() function is pivots a table and automatically aligns fields within each input table that have the same timestamp.
aliases:
- /v2.0/reference/flux/functions/inputs/fromrows
- /v2.0/reference/flux/functions/transformations/influxfieldsascols
menu:
v2_0_ref:
name: v1.fieldsAsCols
parent: InfluxDB v1
weight: 301
---
The `v1.fieldsAsCols()` function is a special application of the `pivot()` function that
automatically aligns fields within each input table that have the same timestamp.
_**Function type:** Transformation_
```js
import "influxdata/influxdb/v1"
v1.fieldsAsCols()
```
## Examples
```js
import "influxdata/influxdb/v1"
from(bucket:"telegraf/autogen")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "cpu")
|> v1.fieldsAsCols()
|> keep(columns: ["_time", "cpu", "usage_idle", "usage_user"])
```
## Function definition
```js
fieldsAsCols = (tables=<-) =>
tables
|> pivot(
rowKey:["_time"],
columnKey: ["_field"],
valueColumn: "_value"
)
```
_**Used functions:**
[pivot()](/v2.0/reference/flux/functions/built-in/transformations/pivot)_

View File

@ -0,0 +1,34 @@
---
title: v1.measurements() function
description: The v1.measurements() function returns a list of measurements in a specific bucket.
menu:
v2_0_ref:
name: v1.measurements
parent: InfluxDB v1
weight: 301
---
The `v1.measurements()` function returns a list of measurements in a specific bucket.
The return value is always a single table with a single column, `_value`.
```js
import "influxdata/influxdb/v1"
v1.measurements(bucket: "example-bucket")
```
## Parameters
### bucket
The bucket from which to list measurements.
_**Data type:** String_
## Function definition
```js
measurements = (bucket) =>
tagValues(bucket: bucket, tag: "_measurement")
```
_**Used functions:**
[tagValues()](/v2.0/reference/flux/functions/influxdb-v1/tagvalues)_

View File

@ -0,0 +1,44 @@
---
title: v1.measurementTagKeys() function
description: The v1.measurementTagKeys() function returns a list of tag keys for a specific measurement.
menu:
v2_0_ref:
name: v1.measurementTagKeys
parent: InfluxDB v1
weight: 301
---
The `v1.measurementTagKeys()` function returns a list of tag keys for a specific measurement.
The return value is always a single table with a single column, `_value`.
```js
import "influxdata/influxdb/v1"
v1.measurementTagKeys(
bucket: "example-bucket",
measurement: "cpu"
)
```
## Parameters
### bucket
The bucket from which to return tag keys for a specific measurement.
_**Data type:** String_
### measurement
The measurement from which to return tag keys.
_**Data type:** String_
## Function definition
```js
measurementTagKeys = (bucket, measurement) =>
tagKeys(
bucket: bucket,
predicate: (r) => r._measurement == measurement)
```
_**Used functions:**
[tagKeys()](/v2.0/reference/flux/functions/influxdb-v1/tagkeys)_

View File

@ -0,0 +1,55 @@
---
title: v1.measurementTagValues() function
description: The v1.measurementTagValues() function returns a list of tag values for a specific measurement.
menu:
v2_0_ref:
name: v1.measurementTagValues
parent: InfluxDB v1
weight: 301
---
The `v1.measurementTagValues()` function returns a list of tag values for a specific measurement.
The return value is always a single table with a single column, `_value`.
```js
import "influxdata/influxdb/v1"
v1.measurementTagValues(
bucket: "example-bucket",
measurement: "cpu",
tag: "host"
)
```
## Parameters
### bucket
The bucket from which to return tag values for a specific measurement.
_**Data type:** String_
### measurement
The measurement from which to return tag values.
_**Data type:** String_
### tag
The tag from which to return all unique values.
_**Data type:** String_
## Function definition
```js
measurementTagValues = (bucket, measurement, tag) =>
tagValues(
bucket: bucket,
tag: tag,
predicate: (r) => r._measurement == measurement
)
```
_**Used functions:**
[tagValues()](/v2.0/reference/flux/functions/influxdb-v1/tagvalues)_

View File

@ -0,0 +1,70 @@
---
title: v1.tagKeys() function
description: The v1.tagKeys() function returns a list of tag keys for all series that match the predicate.
menu:
v2_0_ref:
name: v1.tagKeys
parent: InfluxDB v1
weight: 301
---
The `v1.tagKeys()` function returns a list of tag keys for all series that match the [`predicate`](#predicate).
The return value is always a single table with a single column, `_value`.
```js
import "influxdata/influxdb/v1"
v1.tagKeys(
bucket: "example-bucket",
predicate: (r) => true,
start: -30d
)
```
## Parameters
### bucket
The bucket from which to list tag keys.
_**Data type:** String_
### predicate
The predicate function that filters tag keys.
_Defaults to `(r) => true`._
_**Data type:** Function_
### start
Specifies the oldest time to be included in the results.
_Defaults to `-30d`._
Relative start times are defined using negative durations.
Negative durations are relative to now.
Absolute start times are defined using timestamps.
_**Data type:** Duration_
## Examples
```js
import "influxdata/influxdb/v1"
v1.tagKeys(bucket: "my-bucket")
```
## Function definition
```js
tagKeys = (bucket, predicate=(r) => true, start=-30d) =>
from(bucket: bucket)
|> range(start: start)
|> filter(fn: predicate)
|> keys()
|> keep(columns: ["_value"])
```
_**Used functions:**
[from](/v2.0/reference/flux/functions/built-in/inputs/from/),
[range](/v2.0/reference/flux/functions/built-in/transformations/range/),
[filter](/v2.0/reference/flux/functions/built-in/transformations/filter/),
[keys](/v2.0/reference/flux/functions/built-in/transformations/keys/),
[keep](/v2.0/reference/flux/functions/built-in/transformations/keep/)_

View File

@ -0,0 +1,81 @@
---
title: v1.tagValues() function
description: placeholder
menu:
v2_0_ref:
name: v1.tagValues
parent: InfluxDB v1
weight: 301
---
The `v1.tagValues()` function returns a list unique values for a given tag.
The return value is always a single table with a single column, `_value`.
```js
import "influxdata/influxdb/v1"
v1.tagValues(
bucket: "example-bucket",
tag: "host",
predicate: (r) => true,
start: -30d
)
```
## Parameters
### bucket
The bucket from which to list tag values.
_**Data type:** String_
### tag
The tag for which to return unique values.
_**Data type:** String_
### predicate
The predicate function that filters tag values.
_Defaults to `(r) => true`._
_**Data type:** Function_
### start
Specifies the oldest time to be included in the results.
_Defaults to `-30d`._
Relative start times are defined using negative durations.
Negative durations are relative to now.
Absolute start times are defined using timestamps.
_**Data type:** Duration_
## Examples
```js
import "influxdata/influxdb/v1"
v1.tagKeys(
bucket: "my-bucket",
tag: "host",
)
```
## Function definition
```js
tagValues = (bucket, tag, predicate=(r) => true, start=-30d) =>
from(bucket: bucket)
|> range(start: start)
|> filter(fn: predicate)
|> group(columns: [tag])
|> distinct(column: tag)
|> keep(columns: ["_value"])
```
_**Used functions:**
[from](/v2.0/reference/flux/functions/built-in/inputs/from/),
[range](/v2.0/reference/flux/functions/built-in/transformations/range/),
[filter](/v2.0/reference/flux/functions/built-in/transformations/filter/),
[group](/v2.0/reference/flux/functions/built-in/transformations/group/),
[distinct](/v2.0/reference/flux/functions/built-in/transformations/selectors/distinct/),
[keep](/v2.0/reference/flux/functions/built-in/transformations/keep/)_

View File

@ -0,0 +1,20 @@
---
title: Flux string functions
description: >
String functions provide tools for manipulating strings in Flux.
To use them, import the "strings" package.
menu:
v2_0_ref:
name: Strings
parent: Flux functions
weight: 203
---
String functions provide tools for manipulating strings in Flux.
To use them, import the `strings` package:
```js
import "strings"
```
{{< children type="functions" show="pages" >}}

View File

@ -0,0 +1,38 @@
---
title: strings.title() function
description: The strings.title() function converts a string to title case.
menu:
v2_0_ref:
name: strings.title
parent: Strings
weight: 301
---
The `strings.title()` function converts a string to title case.
_**Output data type:** String_
```js
import "strings"
strings.title(v: "a flux of foxes")
// returns "A Flux Of Foxes"
```
## Paramters
### v
The string value to convert.
_**Data type:** String_
## Examples
###### Convert all values of a column to title case
```js
import "strings"
data
|> map(fn:(r) => strings.title(v: r.pageTitle))
```

View File

@ -0,0 +1,38 @@
---
title: strings.toLower() function
description: The strings.toLower() function converts a string to lower case.
menu:
v2_0_ref:
name: strings.toLower
parent: Strings
weight: 301
---
The `strings.toLower()` function converts a string to lower case.
_**Output data type:** String_
```js
import "strings"
strings.toLower(v: "KOALA")
// returns "koala"
```
## Paramters
### v
The string value to convert.
_**Data type:** String_
## Examples
###### Convert all values of a column to lower case
```js
import "strings"
data
|> map(fn:(r) => strings.toLower(v: r.exclamation))
```

View File

@ -0,0 +1,38 @@
---
title: strings.toUpper() function
description: The strings.toUpper() function converts a string to upper case.
menu:
v2_0_ref:
name: strings.toUpper
parent: Strings
weight: 301
---
The `strings.toUpper()` function converts a string to upper case.
_**Output data type:** String_
```js
import "strings"
strings.toUpper(v: "koala")
// returns "KOALA"
```
## Paramters
### v
The string value to convert.
_**Data type:** String_
## Examples
###### Convert all values of a column to upper case
```js
import "strings"
data
|> map(fn:(r) => strings.toUpper(v: r.envVars))
```

View File

@ -0,0 +1,47 @@
---
title: strings.trim() function
description: >
The strings.trim() function removes leading and trailing characters specified
in the cutset from a string.
menu:
v2_0_ref:
name: strings.trim
parent: Strings
weight: 301
---
The `strings.trim()` function removes leading and trailing characters specified
in the [`cutset`](#cutset) from a string.
_**Output data type:** String_
```js
import "strings"
strings.trim(v: ".abc.", cutset: ".")
// returns "abc"
```
## Paramters
### v
The string value from which to trim characters.
_**Data type:** String_
### cutset
The leading and trailing characters to trim from the string value.
Only characters that match the `cutset` string exactly are trimmed.
_**Data type:** String_
## Examples
###### Trim leading and trailing periods from all values in a column
```js
import "strings"
data
|> map(fn:(r) => strings.trim(v: r.variables, cutset: "."))
```

View File

@ -0,0 +1,38 @@
---
title: strings.trimSpace() function
description: The strings.trimSpace() function removes leading and trailing spaces from a string.
menu:
v2_0_ref:
name: strings.trimSpace
parent: Strings
weight: 301
---
The `strings.trimSpace()` function removes leading and trailing spaces from a string.
_**Output data type:** String_
```js
import "strings"
strings.trimSpace(v: " abc ")
// returns "abc"
```
## Paramters
### v
The string value from which to trim spaces.
_**Data type:** String_
## Examples
###### Trim leading and trailing spaces from all values in a column
```js
import "strings"
data
|> map(fn:(r) => strings.trimSpace(v: r.userInput))
```

View File

@ -0,0 +1,19 @@
---
title: Flux testing functions
description: >
Flux testing functions test piped-forward data in specific ways and return errors if the tests fail.
menu:
v2_0_ref:
name: Testing
parent: Flux functions
weight: 204
---
Flux testing functions test piped-forward data in specific ways and return errors if the tests fail.
To use them, import the `testing` package:
```js
import "testing"
```
{{< children type="functions" show="pages" >}}

View File

@ -0,0 +1,41 @@
---
title: testing.assertEmpty() function
description: The testing.assertEmpty() function tests if an input stream is empty.
menu:
v2_0_ref:
name: testing.assertEmpty
parent: Testing
weight: 301
---
The `testing.assertEmpty()` function tests if an input stream is empty.
If not empty, the function returns an error.
_**Function type:** Test_
```js
import "testing"
testing.assertEmpty()
```
_The `testing.assertEmpty()` function can be used to perform in-line tests in a query._
## Examples
#### Check if there is a difference between streams
This example uses the [`diff()` function](/flux/v0.x/functions/tests/diff)
which outputs the diff for the two streams.
The `.testing.assertEmpty()` function checks to see if the diff is empty.
```js
import "testing"
got = from(bucket: "telegraf/autogen")
|> range(start: -15m)
want = from(bucket: "backup_telegraf/autogen")
|> range(start: -15m)
got
|> diff(want: want)
|> testing.assertEmpty()
```

View File

@ -1,43 +1,45 @@
--- ---
title: assertEquals() function title: testing.assertEquals() function
description: The assertEquals() function tests whether two streams have identical data. description: The testing.assertEquals() function tests whether two streams have identical data.
aliases:
- /v2.0/reference/flux/functions/tests/assertequals
menu: menu:
v2_0_ref: v2_0_ref:
name: assertEquals name: testing.assertEquals
parent: Tests parent: Testing
weight: 301 weight: 301
--- ---
The `assertEquals()` function tests whether two streams have identical data. The `testing.assertEquals()` function tests whether two streams have identical data.
If equal, the function outputs the tested data stream unchanged. If equal, the function outputs the tested data stream unchanged.
If unequal, the function outputs an error. If unequal, the function returns an error.
_**Function type:** Test_
```js ```js
assertEquals( import "testing"
testing.assertEquals(
name: "streamEquality", name: "streamEquality",
got: got, got: got,
want: want want: want
) )
``` ```
_The `assertEquals()` function can be used to perform in-line tests in a query._ _The `testing.assertEquals()` function can be used to perform in-line tests in a query._
## Parameters ## Parameters
## name ### name
Unique name given to the assertion. Unique name given to the assertion.
_**Data type:** String_ _**Data type:** String_
## got ### got
The stream containing data to test. The stream containing data to test.
Defaults to data piped-forward from another function (`<-`). Defaults to piped-forward data (`<-`).
_**Data type:** Object_ _**Data type:** Object_
## want ### want
The stream that contains the expected data to test against. The stream that contains the expected data to test against.
_**Data type:** Object_ _**Data type:** Object_
@ -47,21 +49,25 @@ _**Data type:** Object_
##### Assert of separate streams ##### Assert of separate streams
```js ```js
import "testing"
want = from(bucket: "backup-telegraf/autogen") want = from(bucket: "backup-telegraf/autogen")
|> range(start: -5m) |> range(start: -5m)
got = from(bucket: "telegraf/autogen") got = from(bucket: "telegraf/autogen")
|> range(start: -5m) |> range(start: -5m)
assertEquals(got: got, want: want) testing.assertEquals(got: got, want: want)
``` ```
##### Inline assertion ##### Inline assertion
```js ```js
import "testing"
want = from(bucket: "backup-telegraf/autogen") want = from(bucket: "backup-telegraf/autogen")
|> range(start: -5m) |> range(start: -5m)
from(bucket: "telegraf/autogen") from(bucket: "telegraf/autogen")
|> range(start: -5m) |> range(start: -5m)
|> assertEquals(want: want) |> testing.assertEquals(want: want)
``` ```

View File

@ -0,0 +1,66 @@
---
title: testing.diff() function
description: The testing.diff() function produces a diff between two streams.
menu:
v2_0_ref:
name: testing.diff
parent: Testing
weight: 301
---
The `testing.diff()` function produces a diff between two streams.
_**Function type:** Test_
```js
import "testing"
testing.diff(got: stream2, want: stream1)
```
It matches tables from each stream with the same group keys.
For each matched table, it produces a diff.
Any added or removed rows are added to the table as a row.
An additional string column with the name `diff` is created and contains a `-` if the
row was present in the `got` table and not in the `want` table or `+` if the opposite is true.
The diff function is guaranteed to emit at least one row if the tables are
different and no rows if the tables are the same. _The exact diff produced may change._
_The `testing.diff()` function can be used to perform in-line diffs in a query._
## Parameters
### got
The stream containing data to test.
_Defaults to piped-forward data (`<-`)._
_**Data type:** Object_
### want
The stream that contains the expected data to test against.
_**Data type:** Object_
## Examples
##### Diff separate streams
```js
import "testing"
want = from(bucket: "backup-telegraf/autogen")
|> range(start: -5m)
got = from(bucket: "telegraf/autogen")
|> range(start: -5m)
testing.diff(got: got, want: want)
```
##### Inline diff
```js
import "testing"
want = from(bucket: "backup-telegraf/autogen") |> range(start: -5m)
from(bucket: "telegraf/autogen")
|> range(start: -5m)
|> testing.diff(want: want)
```

View File

@ -1,14 +0,0 @@
---
title: Flux testing functions
description: Flux testing functions test piped-forward data in specific ways and return errors if the tests fail.
menu:
v2_0_ref:
name: Tests
parent: Flux functions
weight: 205
---
Flux testing functions test piped-forward data in specific ways and return errors if the tests fail.
The following testing functions are available:
{{< children type="functions" >}}

View File

@ -1,40 +0,0 @@
---
title: influxFieldsAsCols() function
description: The influxFieldsAsCols() function is pivots a table and automatically aligns fields within each input table that have the same timestamp.
aliases:
- /v2.0/reference/flux/functions/inputs/fromrows
menu:
v2_0_ref:
name: influxFieldsAsCols
parent: Transformations
weight: 301
---
The `influxFieldsAsCols()` function is a special application of the `pivot()` function that
automatically aligns fields within each input table that have the same timestamp.
_**Function type:** Transformation_
```js
influxFieldsAsCols()
```
## Examples
```js
from(bucket:"telegraf/autogen")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "cpu")
|> influxFieldsAsCols()
|> keep(columns: ["_time", "cpu", "usage_idle", "usage_user"])
```
## Function definition
```js
influxFieldsAsCols = (tables=<-) =>
tables
|> pivot(
rowKey:["_time"],
columnKey: ["_field"],
valueColumn: "_value"
)
```