clarify matching parameter note
parent
3268ef9759
commit
463b0375c9
|
@ -32,15 +32,17 @@ View the [function definition](#function-definition).
|
|||
## Parameters
|
||||
|
||||
{{% note %}}
|
||||
Make sure `fn` parameter names match the parameter names specified below. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
|
||||
Make sure `fn` parameter names match each parameter name specified below. To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-model/#match-parameter-names).
|
||||
{{% /note %}}
|
||||
|
||||
### every
|
||||
|
||||
The duration of windows.
|
||||
|
||||
_**Data type:** Duration_
|
||||
|
||||
### fn
|
||||
|
||||
The [aggregate function](/v2.0/reference/flux/functions/built-in/transformations/aggregates) used in the operation.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
@ -50,24 +52,28 @@ Only aggregate functions with a `column` parameter (singular) work with `aggrega
|
|||
{{% /note %}}
|
||||
|
||||
### column
|
||||
|
||||
The column on which to operate.
|
||||
Defaults to `"_value"`.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### timeSrc
|
||||
|
||||
The time column from which time is copied for the aggregate record.
|
||||
Defaults to `"_stop"`.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### timeDst
|
||||
|
||||
The "time destination" column to which time is copied for the aggregate record.
|
||||
Defaults to `"_time"`.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### createEmpty
|
||||
|
||||
For windows without data, this will create an empty window and fill
|
||||
it with a `null` aggregate value.
|
||||
Defaults to `true`.
|
||||
|
@ -77,6 +83,7 @@ _**Data type:** Boolean_
|
|||
## Examples
|
||||
|
||||
###### Using an aggregate function with default parameters
|
||||
|
||||
```js
|
||||
from(bucket: "example-bucket")
|
||||
|> range(start: 1h)
|
||||
|
@ -89,6 +96,7 @@ from(bucket: "example-bucket")
|
|||
)
|
||||
```
|
||||
###### 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:
|
||||
|
@ -107,6 +115,7 @@ from(bucket: "example-bucket")
|
|||
```
|
||||
|
||||
## Function definition
|
||||
|
||||
```js
|
||||
aggregateWindow = (every, fn, column="_value", timeSrc="_stop", timeDst="_time", tables=<-) =>
|
||||
tables
|
||||
|
@ -119,5 +128,6 @@ aggregateWindow = (every, fn, column="_value", timeSrc="_stop", timeDst="_time",
|
|||
<hr style="margin-top:4rem"/>
|
||||
|
||||
##### Related InfluxQL functions and statements:
|
||||
|
||||
[InfluxQL aggregate functions](https://docs.influxdata.com/influxdb/latest/query_language/functions/#aggregations)
|
||||
[GROUP BY time()](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause)
|
||||
|
|
Loading…
Reference in New Issue