Merge pull request #379 from influxdata/update-aggregatewindow

Added selector info to aggregateWindow
pull/387/head
Scott Anderson 2019-08-07 06:07:04 -06:00 committed by GitHub
commit a342e505c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -10,7 +10,8 @@ menu:
weight: 501
---
The `aggregateWindow()` function applies an aggregate function to fixed windows of time.
The `aggregateWindow()` function applies an aggregate or selector function
(any function with a `column` parameter) to fixed windows of time.
_**Function type:** Aggregate_
@ -25,7 +26,7 @@ aggregateWindow(
)
```
As data is windowed into separate tables and aggregated, the `_time` column is dropped from each group key.
As data is windowed into separate tables and processed, the `_time` column is dropped from each group key.
This function copies the timestamp from a remaining column into the `_time` column.
View the [function definition](#function-definition).
@ -42,7 +43,7 @@ The [aggregate function](/v2.0/reference/flux/functions/built-in/transformations
_**Data type:** Function_
{{% note %}}
Only aggregate functions with a `column` parameter (singular) work with `aggregateWindow()`.
Only aggregate and selector functions with a `column` parameter (singular) work with `aggregateWindow()`.
{{% /note %}}
### column
@ -84,10 +85,10 @@ from(bucket: "example-bucket")
fn: mean
)
```
###### Specifying parameters of the aggregate function
To use `aggregateWindow()` aggregate functions that don't provide defaults for required parameters,
for the `fn` parameter, define an anonymous function with `columns` and `tables` parameters
that pipe-forwards tables into the aggregate function with all required parameters defined:
###### Specify parameters of the aggregate function
To use functions that don't provide defaults for required parameters with `aggregateWindow()`,
define an anonymous function with `column` and `tables` parameters that pipe-forward
tables into the aggregate or selector function with all required parameters defined:
```js
from(bucket: "example-bucket")