updated duration related docs to address PR feedback

pull/1039/head
Scott Anderson 2020-05-14 08:08:05 -06:00
parent 3c9f64abb5
commit a8cebd8bfa
4 changed files with 23 additions and 23 deletions

View File

@ -113,8 +113,8 @@ dataSet
```
{{% note %}}
The `every` parameter supports all [duration values](/v2.0/reference/flux/language/types/#duration-types),
including calendar month (`1mo`) and year (`1y`).
The `every` parameter supports all [valid duration units](/v2.0/reference/flux/language/types/#duration-types),
including **calendar months (`1mo`)** and **years (`1y`)**.
{{% /note %}}
Each window of time is output in its own table containing all records that fall within the window.

View File

@ -61,8 +61,8 @@ Use the `every` parameter to define a duration of each window.
{{% note %}}
#### Calendar months and years
`every` supports all [duration values](/v2.0/reference/flux/language/types/#duration-types),
including **calendar months (`1mo`) and years (`1y`)**.
`every` supports all [valid duration units](/v2.0/reference/flux/language/types/#duration-types),
including **calendar months (`1mo`)** and **years (`1y`)**.
{{% /note %}}
For this example, window data in five minute intervals (`5m`).

View File

@ -12,7 +12,7 @@ weight: 501
related:
- /v2.0/query-data/flux/window-aggregate/
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#aggregations, InfluxQL Aggregate functions
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause, InfluxQL GROUP BY time()
- https://docs.influxdata.com/influxdb/latest/query_language/explore-data/#the-group-by-clause, InfluxQL GROUP BY time()
---
The `aggregateWindow()` function applies an aggregate or selector function
@ -51,8 +51,8 @@ The duration of windows.
{{% note %}}
#### Calendar months and years
`every` supports all [duration values](/v2.0/reference/flux/language/types/#duration-types),
including **calendar months (`1mo`) and years (`1y`)**.
`every` supports all [valid duration units](/v2.0/reference/flux/language/types/#duration-types),
including **calendar months (`1mo`)** and **years (`1y`)**.
{{% /note %}}
_**Data type:** Duration_
@ -97,15 +97,23 @@ Defaults to `true`.
_**Data type:** Boolean_
## Examples
##### Using an aggregate function with default parameters
The examples below use a `data` variable to represent a filtered data set.
```js
from(bucket: "example-bucket")
data = from(bucket: "example-bucket")
|> range(start: -1h)
|> filter(fn: (r) =>
r._measurement == "mem" and
r._field == "used_percent")
```
##### Use an aggregate function with default parameters
The following example uses the default parameters of the
[`mean()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/mean/)
to aggregate time-based windows:
```js
data
|> aggregateWindow(
every: 5m,
fn: mean
@ -113,15 +121,11 @@ from(bucket: "example-bucket")
```
##### 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
define an anonymous function with `column` and `tables` parameters that pipes-forward
tables into the aggregate or selector function with all required parameters defined:
```js
from(bucket: "example-bucket")
|> range(start: -1h)
|> filter(fn: (r) =>
r._measurement == "mem" and
r._field == "used_percent")
data
|> aggregateWindow(
column: "_value",
every: 5m,
@ -131,11 +135,7 @@ from(bucket: "example-bucket")
##### Window and aggregate by calendar month
```js
from(bucket: "example-bucket")
|> range(start: -1y)
|> filter(fn: (r) =>
r._measurement == "mem" and
r._field == "used_percent")
data
|> aggregateWindow(every: 1mo, fn: mean)
```

View File

@ -43,8 +43,8 @@ window(
{{% note %}}
#### Calendar months and years
`every`, `period`, and `offset` support all [duration values](/v2.0/reference/flux/language/types/#duration-types),
including **calendar months (`1mo`) and years (`1y`)**.
`every`, `period`, and `offset` support all [valid duration units](/v2.0/reference/flux/language/types/#duration-types),
including **calendar months (`1mo`)** and **years (`1y`)**.
{{% /note %}}
### every