Flux 0.182 (#4414)

* Flux 0.182.0 release notes

* updated experimental message

* Flux 0.182 stdlib updates

* removed uneeded pages from flux_stdlib_frontmatter.yml
pull/4413/head^2
Scott Anderson 2022-09-06 14:37:24 -06:00 committed by GitHub
parent 47aca30bd3
commit a9c64046fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
90 changed files with 609 additions and 1051 deletions

View File

@ -10,10 +10,29 @@ aliases:
- /influxdb/cloud/reference/release-notes/flux/ - /influxdb/cloud/reference/release-notes/flux/
--- ---
## v0.182.0 [2022-09-06]
### Features
- Display yields in `fluxtest`.
- Allow [`experimental.unpivot()`](/flux/v0.x/stdlib/experimental/unpivot/) to
work when the `_time` column is missing.
- Add utility to the `function` package to register a source or transformation.
- Add Rust binary to sit on top of "headless" REPL backend.
### Bug fixes
- Correct type for `fillValueTime`.
- Correct panic in vectorized division by zero.
- Correct inconsistent runtime typing for `logicalVectorEvaluator`.
- Don't treat errors in SQL syntax as internal.
- Improve error handling when missing a property on member expressions.
- Preserve values of non-string group keys in `experimental.diff()`.
---
## v0.181.0 [2022-08-29] ## v0.181.0 [2022-08-29]
### Features ### Features
- Add "headless" json-rpc based REPL. - Add "headless" JSON-RPC based REPL.
- Support vectorized unary operators. - Support vectorized unary operators.
- Add [`experimental/polyline` package](/flux/v0.x/stdlib/experimental/polyline) - Add [`experimental/polyline` package](/flux/v0.x/stdlib/experimental/polyline)
for downsampling data. for downsampling data.

View File

@ -9,6 +9,7 @@ menu:
identifier: date/add identifier: date/add
weight: 101 weight: 101
flux/v0.x/tags: [date/time] flux/v0.x/tags: [date/time]
introduced: 0.162.0
--- ---
<!------------------------------------------------------------------------------ <!------------------------------------------------------------------------------
@ -20,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L601-L601 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L719-L719
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -19,7 +19,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L161-L161 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L188-L188
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -59,6 +59,7 @@ Default is the `location` option.
- [Return the hour of a time value](#return-the-hour-of-a-time-value) - [Return the hour of a time value](#return-the-hour-of-a-time-value)
- [Return the hour of a relative duration](#return-the-hour-of-a-relative-duration) - [Return the hour of a relative duration](#return-the-hour-of-a-relative-duration)
- [Return the current hour](#return-the-current-hour)
### Return the hour of a time value ### Return the hour of a time value
@ -83,3 +84,13 @@ date.hour(t: -8h)// Returns 7
``` ```
### Return the current hour
```js
import "date"
date.hour(t: now())
```

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L506-L506 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L614-L614
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -54,6 +54,7 @@ Durations are relative to `now()`.
- [Return the microsecond of a time value](#return-the-microsecond-of-a-time-value) - [Return the microsecond of a time value](#return-the-microsecond-of-a-time-value)
- [Return the microsecond of a relative duration](#return-the-microsecond-of-a-relative-duration) - [Return the microsecond of a relative duration](#return-the-microsecond-of-a-relative-duration)
- [Return the current microsecond unit](#return-the-current-microsecond-unit)
### Return the microsecond of a time value ### Return the microsecond of a time value
@ -78,3 +79,13 @@ date.microsecond(t: -1890us)// Returns 322661
``` ```
### Return the current microsecond unit
```js
import "date"
date.microsecond(t: now())
```

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L472-L472 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L571-L571
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -54,6 +54,7 @@ Durations are relative to `now()`.
- [Return the millisecond of the time value](#return-the-millisecond-of-the-time-value) - [Return the millisecond of the time value](#return-the-millisecond-of-the-time-value)
- [Return the millisecond of a relative duration](#return-the-millisecond-of-a-relative-duration) - [Return the millisecond of a relative duration](#return-the-millisecond-of-a-relative-duration)
- [Return the current millisecond unit](#return-the-current-millisecond-unit)
### Return the millisecond of the time value ### Return the millisecond of the time value
@ -78,3 +79,13 @@ date.millisecond(t: -150ms)// Returns 127
``` ```
### Return the current millisecond unit
```js
import "date"
date.millisecond(t: now())
```

View File

@ -19,7 +19,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L122-L122 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L140-L140
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -59,6 +59,7 @@ Default is the `location` option.
- [Return the minute of a time value](#return-the-minute-of-a-time-value) - [Return the minute of a time value](#return-the-minute-of-a-time-value)
- [Return the minute of a relative duration](#return-the-minute-of-a-relative-duration) - [Return the minute of a relative duration](#return-the-minute-of-a-relative-duration)
- [Return the current minute](#return-the-current-minute)
### Return the minute of a time value ### Return the minute of a time value
@ -83,3 +84,13 @@ date.minute(t: -45m)// Returns 6
``` ```
### Return the current minute
```js
import "date"
date.minute(t: now())
```

View File

@ -19,7 +19,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L320-L320 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L383-L383
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -59,6 +59,7 @@ Default is the `location` option.
- [Return the month of a time value](#return-the-month-of-a-time-value) - [Return the month of a time value](#return-the-month-of-a-time-value)
- [Return the month of a relative duration](#return-the-month-of-a-relative-duration) - [Return the month of a relative duration](#return-the-month-of-a-relative-duration)
- [Return the current numeric month](#return-the-current-numeric-month)
### Return the month of a time value ### Return the month of a time value
@ -83,3 +84,13 @@ date.month(t: -3mo)// Returns 8
``` ```
### Return the current numeric month
```js
import "date"
date.month(t: now())
```

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L241-L241 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L286-L286
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -61,6 +61,7 @@ Default is the `location` option.
- [Return the day of the month for a time value](#return-the-day-of-the-month-for-a-time-value) - [Return the day of the month for a time value](#return-the-day-of-the-month-for-a-time-value)
- [Return the day of the month for a relative duration](#return-the-day-of-the-month-for-a-relative-duration) - [Return the day of the month for a relative duration](#return-the-day-of-the-month-for-a-relative-duration)
- [Return the current day of the month](#return-the-current-day-of-the-month)
### Return the day of the month for a time value ### Return the day of the month for a time value
@ -85,3 +86,13 @@ date.monthDay(t: -8d)// Returns 25
``` ```
### Return the current day of the month
```js
import "date"
date.monthDay(t: now())
```

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L540-L540 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L657-L657
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -54,6 +54,7 @@ Durations are relative to `now()`.
- [Return the nanosecond for a time value](#return-the-nanosecond-for-a-time-value) - [Return the nanosecond for a time value](#return-the-nanosecond-for-a-time-value)
- [Return the nanosecond for a relative duration](#return-the-nanosecond-for-a-relative-duration) - [Return the nanosecond for a relative duration](#return-the-nanosecond-for-a-relative-duration)
- [Return the current nanosecond unit](#return-the-current-nanosecond-unit)
### Return the nanosecond for a time value ### Return the nanosecond for a time value
@ -78,3 +79,13 @@ date.nanosecond(t: -2111984ns)// Returns 128412016
``` ```
### Return the current nanosecond unit
```js
import "date"
date.nanosecond(t: now())
```

View File

@ -19,7 +19,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L438-L438 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L528-L528
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -59,6 +59,7 @@ Default is the `location` option.
- [Return the quarter for a time value](#return-the-quarter-for-a-time-value) - [Return the quarter for a time value](#return-the-quarter-for-a-time-value)
- [Return the quarter for a relative duration](#return-the-quarter-for-a-relative-duration) - [Return the quarter for a relative duration](#return-the-quarter-for-a-relative-duration)
- [Return the current quarter](#return-the-current-quarter)
### Return the quarter for a time value ### Return the quarter for a time value
@ -83,3 +84,13 @@ date.quarter(t: -7mo)// Returns 2
``` ```
### Return the current quarter
```js
import "date"
date.quarter(t: now())
```

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L768-L768 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L906-L906
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -19,7 +19,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L40-L40 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L49-L49
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -52,6 +52,7 @@ Durations are relative to `now()`.
- [Return the second of a time value](#return-the-second-of-a-time-value) - [Return the second of a time value](#return-the-second-of-a-time-value)
- [Return the second of a relative duration](#return-the-second-of-a-relative-duration) - [Return the second of a relative duration](#return-the-second-of-a-relative-duration)
- [Return the current second](#return-the-current-second)
### Return the second of a time value ### Return the second of a time value
@ -76,3 +77,13 @@ date.second(t: -50s)// Returns 28
``` ```
### Return the current second
```js
import "date"
date.second(t: now())
```

View File

@ -9,6 +9,7 @@ menu:
identifier: date/sub identifier: date/sub
weight: 101 weight: 101
flux/v0.x/tags: [date/time] flux/v0.x/tags: [date/time]
introduced: 0.162.0
--- ---
<!------------------------------------------------------------------------------ <!------------------------------------------------------------------------------
@ -20,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L663-L663 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L782-L782
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L84-L84 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L93-L93
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -19,7 +19,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L731-L731 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L869-L869
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -66,6 +66,8 @@ Default is the `location` option.
- [Truncate time values](#truncate-time-values) - [Truncate time values](#truncate-time-values)
- [Truncate time values using relative durations](#truncate-time-values-using-relative-durations) - [Truncate time values using relative durations](#truncate-time-values-using-relative-durations)
- [Query data from this year](#query-data-from-this-year)
- [Query data from this calendar month](#query-data-from-this-calendar-month)
### Truncate time values ### Truncate time values
@ -114,3 +116,25 @@ date.truncate(t: -1h, unit: 1h)// Returns 2019-12-31T23:00:00.000000000Z
``` ```
### Query data from this year
```js
import "date"
from(bucket: "example-bucket")
|> range(start: date.truncate(t: now(), unit: 1y))
```
### Query data from this calendar month
```js
import "date"
from(bucket: "example-bucket")
|> range(start: date.truncate(t: now(), unit: 1mo))
```

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L399-L399 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L480-L480
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -61,6 +61,7 @@ Default is the `location` option.
- [Return the week of the year](#return-the-week-of-the-year) - [Return the week of the year](#return-the-week-of-the-year)
- [Return the week of the year using a relative duration](#return-the-week-of-the-year-using-a-relative-duration) - [Return the week of the year using a relative duration](#return-the-week-of-the-year-using-a-relative-duration)
- [Return the current week of the year](#return-the-current-week-of-the-year)
### Return the week of the year ### Return the week of the year
@ -85,3 +86,13 @@ date.week(t: -12d)// Returns 42
``` ```
### Return the current week of the year
```js
import "date"
date.week(t: now())
```

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L201-L201 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L237-L237
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -61,6 +61,7 @@ Default is the `location` option.
- [Return the day of the week for a time value](#return-the-day-of-the-week-for-a-time-value) - [Return the day of the week for a time value](#return-the-day-of-the-week-for-a-time-value)
- [Return the day of the week for a relative duration](#return-the-day-of-the-week-for-a-relative-duration) - [Return the day of the week for a relative duration](#return-the-day-of-the-week-for-a-relative-duration)
- [Return the current day of the week](#return-the-current-day-of-the-week)
### Return the day of the week for a time value ### Return the day of the week for a time value
@ -85,3 +86,13 @@ date.weekDay(t: -84h)// Returns 6
``` ```
### Return the current day of the week
```js
import "date"
date.weekDay(t: now())
```

View File

@ -19,7 +19,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L359-L359 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L431-L431
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -59,6 +59,7 @@ Default is the `location` option.
- [Return the year for a time value](#return-the-year-for-a-time-value) - [Return the year for a time value](#return-the-year-for-a-time-value)
- [Return the year for a relative duration](#return-the-year-for-a-relative-duration) - [Return the year for a relative duration](#return-the-year-for-a-relative-duration)
- [Return the current year](#return-the-current-year)
### Return the year for a time value ### Return the year for a time value
@ -83,3 +84,13 @@ date.year(t: -14y)// Returns 2007
``` ```
### Return the current year
```js
import "date"
date.year(t: now())
```

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L281-L281 https://github.com/influxdata/flux/blob/master/stdlib/date/date.flux#L335-L335
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -61,6 +61,7 @@ Default is the `location` option.
- [Return the day of the year for a time value](#return-the-day-of-the-year-for-a-time-value) - [Return the day of the year for a time value](#return-the-day-of-the-year-for-a-time-value)
- [Return the day of the year for a relative duration](#return-the-day-of-the-year-for-a-relative-duration) - [Return the day of the year for a relative duration](#return-the-day-of-the-year-for-a-relative-duration)
- [Return the current day of the year](#return-the-current-day-of-the-year)
### Return the day of the year for a time value ### Return the day of the year for a time value
@ -85,3 +86,13 @@ date.yearDay(t: -1mo)// Returns 276
``` ```
### Return the current day of the year
```js
import "date"
date.yearDay(t: now())
```

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L75-L75 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L77-L77
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -31,7 +31,10 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`experimental.addDuration()` adds a duration to a time value and returns the resulting time value. `experimental.addDuration()` adds a duration to a time value and returns the resulting time value.
{{% warn %}}
#### Deprecated
`experimental.addDuration()` is deprecated in favor of [`date.add()`](/flux/v0.x/stdlib/date/add/).
{{% /warn %}}
##### Function type signature ##### Function type signature

View File

@ -8,7 +8,7 @@ menu:
parent: experimental parent: experimental
identifier: experimental/alignTime identifier: experimental/alignTime
weight: 101 weight: 101
flux/v0.x/tags: [transformations, data/time] flux/v0.x/tags: [transformations, date/time]
introduced: 0.66.0 introduced: 0.66.0
--- ---
@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L491-L495 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L495-L499
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1338-L1338 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1342-L1342
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -37,7 +37,7 @@ If the function does not error the returned value is made into a string and retu
##### Function type signature ##### Function type signature
```js ```js
(fn: () => A) => string (fn: () => A) => {value: A, msg: string, code: uint}
``` ```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}} {{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L446-L446 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L450-L450
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L682-L682 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L686-L686
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1383-L1383 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1387-L1387
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1053-L1053 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1057-L1057
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1087-L1091 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1091-L1095
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1115-L1115 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1119-L1119
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L175-L175 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L179-L179
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1272-L1276 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1276-L1280
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L746-L750 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L750-L754
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -87,12 +87,12 @@ requests.peek(response: requests.get(url: "https://api.agify.io", params: ["name
Connection: keep-alive, Connection: keep-alive,
Content-Length: 41, Content-Length: 41,
Content-Type: application/json; charset=utf-8, Content-Type: application/json; charset=utf-8,
Date: Mon, 29 Aug 2022 17:59:41 GMT, Date: Tue, 06 Sep 2022 16:40:21 GMT,
Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI", Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI",
Server: nginx/1.16.1, Server: nginx/1.16.1,
X-Rate-Limit-Limit: 1000, X-Rate-Limit-Limit: 1000,
X-Rate-Limit-Remaining: 998, X-Rate-Limit-Remaining: 998,
X-Rate-Reset: 21619 X-Rate-Reset: 26378
] | 200 | ] | 200 |
{{% /expand %}} {{% /expand %}}

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L644-L648 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L648-L652
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L395-L399 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L399-L403
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1021-L1026 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1025-L1030
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1139-L1139 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1143-L1143
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1163-L1163 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1167-L1167
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L774-L774 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L778-L778
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1187-L1187 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1191-L1191
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L808-L808 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L812-L812
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L200-L200 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L204-L204
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/polyline/polyline.flux#L66-L75 https://github.com/influxdata/flux/blob/master/stdlib/experimental/polyline/polyline.flux#L71-L80
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -83,20 +83,21 @@ Input data. Default is piped-forward data (`<-`).
## Examples ## Examples
- [Downsample data using the RDP algorithm](#downsample-data-using-the-rdp-algorithm) - [Downsample data using the RDP algorithm](#downsample-data-using-the-rdp-algorithm)
- [Downsample the data using the epsilon value 1.5](#downsample-the-data-using-the-epsilon-value-15) - [Downsample data using the RDP algorithm with an epsilon of 1.5](#downsample-data-using-the-rdp-algorithm-with-an-epsilon-of-15)
- [Downsample the data using a retention rate of 90%](#downsample-the-data-using-a-retention-rate-of-90) - [Downsample data using the RDP algorithm with a retention rate of 90%](#downsample-data-using-the-rdp-algorithm-with-a-retention-rate-of-90)
### Downsample data using the RDP algorithm ### Downsample data using the RDP algorithm
When using `polyline.rdp()`, leave both `epsilon` and `retention` unspecified When using `polyline.rdp()`, leave both `epsilon` and `retention` unspecified
to automatically calculate the maximum tolerance beyond which producing a to automatically calculate the maximum tolerance for producing a visually
visually indistinguishable curve is not be possible. indistinguishable curve.
```js ```js
import "experimental/polyline" import "experimental/polyline"
data data
|> polyline.rdp() |> polyline.rdp()
``` ```
{{< expand-wrapper >}} {{< expand-wrapper >}}
@ -106,49 +107,49 @@ data
| _time | _value | | _time | _value |
| -------------------- | ------------------- | | -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 | | 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-08-29T17:57:10Z | -29.76098586714259 | | 2022-09-06T16:37:50Z | -29.76098586714259 |
| 2022-08-29T17:57:20Z | -67.50435038579738 | | 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 | | 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 | | 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 | | 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 | | 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 | | 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 | | 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 | | 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 | | 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 | | 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 | | 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 | | 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-08-29T17:59:20Z | -12.62058579127679 | | 2022-09-06T16:40:00Z | -12.62058579127679 |
| 2022-08-29T17:59:30Z | -44.44668391211515 | | 2022-09-06T16:40:10Z | -44.44668391211515 |
#### Output data #### Output data
| _time | _value | | _time | _value |
| -------------------- | ------------------- | | -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 | | 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-08-29T17:57:10Z | -29.76098586714259 | | 2022-09-06T16:37:50Z | -29.76098586714259 |
| 2022-08-29T17:57:20Z | -67.50435038579738 | | 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 | | 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 | | 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 | | 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 | | 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 | | 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 | | 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 | | 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 | | 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 | | 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 | | 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 | | 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-08-29T17:59:20Z | -12.62058579127679 | | 2022-09-06T16:40:00Z | -12.62058579127679 |
| 2022-08-29T17:59:30Z | -44.44668391211515 | | 2022-09-06T16:40:10Z | -44.44668391211515 |
{{% /expand %}} {{% /expand %}}
{{< /expand-wrapper >}} {{< /expand-wrapper >}}
### Downsample the data using the epsilon value 1.5 ### Downsample data using the RDP algorithm with an epsilon of 1.5
```js ```js
import "experimental/polyline" import "experimental/polyline"
@ -165,48 +166,48 @@ data
| _time | _value | | _time | _value |
| -------------------- | ------------------- | | -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 | | 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-08-29T17:57:10Z | -29.76098586714259 | | 2022-09-06T16:37:50Z | -29.76098586714259 |
| 2022-08-29T17:57:20Z | -67.50435038579738 | | 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 | | 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 | | 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 | | 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 | | 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 | | 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 | | 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 | | 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 | | 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 | | 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 | | 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 | | 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-08-29T17:59:20Z | -12.62058579127679 | | 2022-09-06T16:40:00Z | -12.62058579127679 |
| 2022-08-29T17:59:30Z | -44.44668391211515 | | 2022-09-06T16:40:10Z | -44.44668391211515 |
#### Output data #### Output data
| _time | _value | | _time | _value |
| -------------------- | ------------------- | | -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 | | 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-08-29T17:57:20Z | -67.50435038579738 | | 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 | | 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 | | 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 | | 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 | | 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 | | 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 | | 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 | | 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 | | 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 | | 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 | | 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 | | 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-08-29T17:59:20Z | -12.62058579127679 | | 2022-09-06T16:40:00Z | -12.62058579127679 |
| 2022-08-29T17:59:30Z | -44.44668391211515 | | 2022-09-06T16:40:10Z | -44.44668391211515 |
{{% /expand %}} {{% /expand %}}
{{< /expand-wrapper >}} {{< /expand-wrapper >}}
### Downsample the data using a retention rate of 90% ### Downsample data using the RDP algorithm with a retention rate of 90%
```js ```js
import "experimental/polyline" import "experimental/polyline"
@ -223,42 +224,42 @@ data
| _time | _value | | _time | _value |
| -------------------- | ------------------- | | -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 | | 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-08-29T17:57:10Z | -29.76098586714259 | | 2022-09-06T16:37:50Z | -29.76098586714259 |
| 2022-08-29T17:57:20Z | -67.50435038579738 | | 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 | | 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 | | 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 | | 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 | | 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 | | 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 | | 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 | | 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 | | 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 | | 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 | | 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 | | 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-08-29T17:59:20Z | -12.62058579127679 | | 2022-09-06T16:40:00Z | -12.62058579127679 |
| 2022-08-29T17:59:30Z | -44.44668391211515 | | 2022-09-06T16:40:10Z | -44.44668391211515 |
#### Output data #### Output data
| _time | _value | | _time | _value |
| -------------------- | ------------------- | | -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 | | 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-08-29T17:57:20Z | -67.50435038579738 | | 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 | | 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 | | 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 | | 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 | | 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 | | 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 | | 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 | | 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 | | 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 | | 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 | | 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 | | 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-08-29T17:59:30Z | -44.44668391211515 | | 2022-09-06T16:40:10Z | -44.44668391211515 |
{{% /expand %}} {{% /expand %}}
{{< /expand-wrapper >}} {{< /expand-wrapper >}}

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1306-L1306 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1310-L1310
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L880-L885 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L884-L889
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L244-L244 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L248-L248
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L907-L907 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L911-L911
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L929-L931 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L933-L935
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L971-L974 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L975-L978
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L134-L134 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L138-L138
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -31,7 +31,10 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`experimental.subDuration()` subtracts a duration from a time value and returns the resulting time value. `experimental.subDuration()` subtracts a duration from a time value and returns the resulting time value.
{{% warn %}}
#### Deprecated
`experimental.subDuration()` is deprecated in favor of [`date.sub()`](/flux/v0.x/stdlib/date/sub/).
{{% /warn %}}
##### Function type signature ##### Function type signature

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L995-L995 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L999-L999
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L311-L311 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L315-L315
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1216-L1216 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1220-L1220
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -1,77 +0,0 @@
---
title: columns() function
description: >
`columns()` returns the column labels in each input table.
menu:
flux_0_x_ref:
name: columns
parent: experimental/universe
identifier: experimental/universe/columns
weight: 201
flux/v0.x/tags: [transformations]
introduced: v0.166.0
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/universe/universe.flux#L40-L40
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`columns()` returns the column labels in each input table.
**Note:** `universe.columns()` is an experimental function with a more precise type signature.
For each input table, `columns` outputs a table with the same group key
columns and a new column containing the column labels in the input table.
Each row in an output table contains the group key value and the label of one
column of the input table.
Each output table has the same number of rows as the number of columns of the input table.
##### Function type signature
```js
(<-tables: stream[B], ?column: A = "_value") => stream[{A: string}] where A: Label, B: Record
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### column
Name of the output column to store column labels in.
Default is "_value".
### tables
Input data. Default is piped-forward data (`<-`).
## Examples
### List all columns per input table
```js
import "experimental/universe"
import "sampledata"
sampledata.string()
|> universe.columns(column: "labels")
```

View File

@ -1,193 +0,0 @@
---
title: fill() function
description: >
`fill()` replaces all null values in input tables with a non-null value.
menu:
flux_0_x_ref:
name: fill
parent: experimental/universe
identifier: experimental/universe/fill
weight: 201
flux/v0.x/tags: [transformations]
introduced: v0.166.0
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/universe/universe.flux#L84-L92
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`fill()` replaces all null values in input tables with a non-null value.
**Note:** `universe.fill()` is an experimental function with a more precise type signature.
Output tables are the same as the input tables with all null values replaced
in the specified column.
##### Function type signature
```js
(<-tables: stream[{C with A: B}], ?column: A = "_value", ?usePrevious: bool, ?value: B) => stream[{C with A: B}] where A: Label, C: Record
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### column
Column to replace null values in. Default is `_value`.
### value
Constant value to replace null values with.
Value type must match the type of the specified column.
### usePrevious
Replace null values with the previous non-null value.
Default is `false`.
### tables
Input data. Default is piped-forward data (`<-`).
## Examples
- [Fill null values with a specified non-null value](#fill-null-values-with-a-specified-non-null-value)
- [Fill null values with the previous non-null value](#fill-null-values-with-the-previous-non-null-value)
### Fill null values with a specified non-null value
```js
import "experimental/universe"
import "sampledata"
sampledata.int(includeNull: true)
|> universe.fill(value: 0)
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | | t1 |
| 2021-01-01T00:00:40Z | | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
#### Output data
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | 0 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 0 | t1 |
| 2021-01-01T00:00:40Z | 0 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 0 | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 0 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}
### Fill null values with the previous non-null value
```js
import "experimental/universe"
import "sampledata"
sampledata.int(includeNull: true)
|> universe.fill(usePrevious: true)
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | | t1 |
| 2021-01-01T00:00:40Z | | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
#### Output data
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | -2 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 7 | t1 |
| 2021-01-01T00:00:40Z | 7 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 19 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -1,108 +0,0 @@
---
title: mean() function
description: >
`mean()` returns the average of non-null values in a specified column from each
input table.
menu:
flux_0_x_ref:
name: mean
parent: experimental/universe
identifier: experimental/universe/mean
weight: 201
flux/v0.x/tags: [transformations, aggregates]
introduced: v0.166.0
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/universe/universe.flux#L118-L122
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`mean()` returns the average of non-null values in a specified column from each
input table.
**Note:** `universe.mean()` is an experimental function with a more precise type signature.
##### Function type signature
```js
(<-tables: stream[{B with A: C}], ?column: A = "_value") => stream[{A: C}] where A: Label, B: Record, C: Numeric
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### column
Column to use to compute means. Default is `_value`.
### tables
Input data. Default is piped-forward data (`<-`).
## Examples
### Return the average of values in each input table
```js
import "experimental/universe"
import "sampledata"
sampledata.int()
|> universe.mean()
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | 10 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 17 | t1 |
| 2021-01-01T00:00:40Z | 15 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 19 | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 13 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
#### Output data
| *tag | _value |
| ---- | ------- |
| t1 | 8.5 |
| *tag | _value |
| ---- | ----------------- |
| t2 | 8.833333333333334 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1314-L1319 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1318-L1323
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L576-L591 https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L580-L595
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -82,12 +82,12 @@ requests.peek(response: requests.get(url: "https://api.agify.io", params: ["name
Connection: keep-alive, Connection: keep-alive,
Content-Length: 41, Content-Length: 41,
Content-Type: application/json; charset=utf-8, Content-Type: application/json; charset=utf-8,
Date: Mon, 29 Aug 2022 17:59:42 GMT, Date: Tue, 06 Sep 2022 16:40:23 GMT,
Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI", Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI",
Server: nginx/1.16.1, Server: nginx/1.16.1,
X-Rate-Limit-Limit: 1000, X-Rate-Limit-Limit: 1000,
X-Rate-Limit-Remaining: 996, X-Rate-Limit-Remaining: 996,
X-Rate-Reset: 21617 X-Rate-Reset: 26377
] | 200 | ] | 200 |
{{% /expand %}} {{% /expand %}}

View File

@ -136,8 +136,8 @@ requests.peek(response: response)
#### Output data #### Output data
| statusCode | body | headers | duration | | statusCode | body | headers | duration |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| 200 | <!doctype html> | 200 | <!doctype html>
<html> <html>
<head> <head>
@ -187,14 +187,14 @@ requests.peek(response: response)
| [ | [
Accept-Ranges: bytes, Accept-Ranges: bytes,
Cache-Control: max-age=604800, Cache-Control: max-age=604800,
Content-Length: 1256,
Content-Type: text/html; charset=UTF-8, Content-Type: text/html; charset=UTF-8,
Date: Mon, 29 Aug 2022 17:59:43 GMT, Date: Tue, 06 Sep 2022 16:40:23 GMT,
Etag: "3147526947+gzip", Etag: "3147526947",
Expires: Mon, 05 Sep 2022 17:59:43 GMT, Expires: Tue, 13 Sep 2022 16:40:23 GMT,
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT, Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT,
Server: EOS (vny/0452), Server: EOS (vny/0452)
Vary: Accept-Encoding ] | 103758367 |
] | 151995957 |
{{% /expand %}} {{% /expand %}}
{{< /expand-wrapper >}} {{< /expand-wrapper >}}

View File

@ -1,52 +0,0 @@
---
title: debug.unpivot() function
description: >
`debug.unpivot()` removes the `_time` column and any other column not in the group key and outputs a new table with `_field` and `_value` columns pairs.
The output stream retains the group key and all group key columns of the input stream.
Specialized to transform the pivoted output from `iox.from()` into the unpivoted format.
menu:
flux_0_x_ref:
name: debug.unpivot
parent: internal/debug
identifier: internal/debug/unpivot
weight: 201
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/debug/debug.flux#L62-L65
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`debug.unpivot()` removes the `_time` column and any other column not in the group key and outputs a new table with `_field` and `_value` columns pairs.
The output stream retains the group key and all group key columns of the input stream.
Specialized to transform the pivoted output from `iox.from()` into the unpivoted format.
##### Function type signature
```js
(<-tables: stream[{A with _time: time}]) => stream[{B with _value: C, _field: string}] where A: Record, B: Record
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### tables
Input data. Default is piped-forward data (`<-`).

View File

@ -36,7 +36,7 @@ Import the `internal/promql` package:
import "internal/promql" import "internal/promql"
``` ```
THIS PACKAGE IS NOT MEANT FOR EXTERNAL USE. **Important**: This package is not meant for external use.
## Functions ## Functions

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L19-L19 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L33-L33
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.changes()` implements functionality equivalent to `promql.changes()` implements functionality equivalent to
[PromQL's `changes()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#changes). [PromQL's `changes()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#changes).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature
@ -48,3 +48,53 @@ Input data. Default is piped-forward data (`<-`).
## Examples
### Return the number of times that values in a series change
```js
import "internal/promql"
import "sampledata"
sampledata.float()
|> promql.changes()
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | *tag | _value |
| -------------------- | ---- | ------- |
| 2021-01-01T00:00:00Z | t1 | -2.18 |
| 2021-01-01T00:00:10Z | t1 | 10.92 |
| 2021-01-01T00:00:20Z | t1 | 7.35 |
| 2021-01-01T00:00:30Z | t1 | 17.53 |
| 2021-01-01T00:00:40Z | t1 | 15.23 |
| 2021-01-01T00:00:50Z | t1 | 4.43 |
| _time | *tag | _value |
| -------------------- | ---- | ------- |
| 2021-01-01T00:00:00Z | t2 | 19.85 |
| 2021-01-01T00:00:10Z | t2 | 4.97 |
| 2021-01-01T00:00:20Z | t2 | -3.75 |
| 2021-01-01T00:00:30Z | t2 | 19.77 |
| 2021-01-01T00:00:40Z | t2 | 13.86 |
| 2021-01-01T00:00:50Z | t2 | 1.86 |
#### Output data
| *tag | _value |
| ---- | ------- |
| t1 | 5 |
| *tag | _value |
| ---- | ------- |
| t2 | 5 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L45-L45 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L68-L68
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -32,7 +32,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
PromQL's [`time()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#time) and PromQL's [`time()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#time) and
[`vector()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#vector) functions. [`vector()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#vector) functions.
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -2,8 +2,6 @@
title: promql.extrapolatedRate() function title: promql.extrapolatedRate() function
description: > description: >
`promql.extrapolatedRate()` is a helper function that calculates extrapolated rates over `promql.extrapolatedRate()` is a helper function that calculates extrapolated rates over
counters and is used to implement PromQL's rate(), delta(), and increase() functions.
extrapolatedRate is a helper function that calculates extrapolated rates over
counters and is used to implement PromQL's counters and is used to implement PromQL's
[`rate()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#rate), [`rate()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#rate),
[`delta()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#increase), [`delta()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#increase),
@ -25,7 +23,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L59-L63 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L82-L86
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -33,14 +31,12 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
-------------------------------------------------------------------------------> ------------------------------------------------------------------------------->
`promql.extrapolatedRate()` is a helper function that calculates extrapolated rates over `promql.extrapolatedRate()` is a helper function that calculates extrapolated rates over
counters and is used to implement PromQL's rate(), delta(), and increase() functions.
extrapolatedRate is a helper function that calculates extrapolated rates over
counters and is used to implement PromQL's counters and is used to implement PromQL's
[`rate()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#rate), [`rate()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#rate),
[`delta()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#increase), [`delta()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#increase),
and [`increase()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#delta) functions. and [`increase()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#delta) functions.
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L72-L76 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L97-L101
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.holtWinters()` implements functionality equivalent to `promql.holtWinters()` implements functionality equivalent to
[PromQL's `holt_winters()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#holt_winters). [PromQL's `holt_winters()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#holt_winters).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -22,7 +22,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L93-L96 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L122-L125
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -34,7 +34,7 @@ counters and is used to implement PromQL's
[`irate()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#irate) and [`irate()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#irate) and
[`idelta()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#idelta) functions. [`idelta()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#idelta) functions.
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -2,7 +2,7 @@
title: promql.join() function title: promql.join() function
description: > description: >
`promql.join()` joins two streams of tables on the **group key and `_time` column**. `promql.join()` joins two streams of tables on the **group key and `_time` column**.
See `experimental.join`. See [`experimental.join`](/flux/v0.x/stdlib/experimental/join/).
menu: menu:
flux_0_x_ref: flux_0_x_ref:
name: promql.join name: promql.join
@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L215-L215 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L274-L274
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -28,9 +28,9 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
-------------------------------------------------------------------------------> ------------------------------------------------------------------------------->
`promql.join()` joins two streams of tables on the **group key and `_time` column**. `promql.join()` joins two streams of tables on the **group key and `_time` column**.
See `experimental.join`. See [`experimental.join`](/flux/v0.x/stdlib/experimental/join/).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L107-L113 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L138-L144
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.labelReplace()` implements functionality equivalent to `promql.labelReplace()` implements functionality equivalent to
[PromQL's `label_replace()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#label_replace). [PromQL's `label_replace()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#label_replace).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -2,7 +2,8 @@
title: promql.linearRegression() function title: promql.linearRegression() function
description: > description: >
`promql.linearRegression()` implements linear regression functionality required to implement `promql.linearRegression()` implements linear regression functionality required to implement
PromQL's deriv() and predict_linear() functions: PromQL's [`deriv()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#deriv)
and [`predict_linear()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#predict_linear) functions.
menu: menu:
flux_0_x_ref: flux_0_x_ref:
name: promql.linearRegression name: promql.linearRegression
@ -20,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L125-L129 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L156-L160
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -28,10 +29,10 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
-------------------------------------------------------------------------------> ------------------------------------------------------------------------------->
`promql.linearRegression()` implements linear regression functionality required to implement `promql.linearRegression()` implements linear regression functionality required to implement
PromQL's deriv() and predict_linear() functions: PromQL's [`deriv()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#deriv)
and [`predict_linear()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#predict_linear) functions.
https://prometheus.io/docs/prometheus/latest/querying/functions/#deriv **Important**: The `internal/promql` package is not meant for external use.
https://prometheus.io/docs/prometheus/latest/querying/functions/#predict_linear
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L154-L163 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L191-L200
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.promHistogramQuantile()` implements functionality equivalent to `promql.promHistogramQuantile()` implements functionality equivalent to
[PromQL's `histogram_quantile()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile). [PromQL's `histogram_quantile()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L26-L26 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L42-L42
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.promqlDayOfMonth()` implements functionality equivalent to `promql.promqlDayOfMonth()` implements functionality equivalent to
[PromQL's `day_of_month()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#day_of_month). [PromQL's `day_of_month()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#day_of_month).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L33-L33 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L51-L51
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.promqlDayOfWeek()` implements functionality equivalent to `promql.promqlDayOfWeek()` implements functionality equivalent to
[PromQL's `day_of_week()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#day_of_week). [PromQL's `day_of_week()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#day_of_week).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L40-L40 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L60-L60
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.promqlDaysInMonth()` implements functionality equivalent to `promql.promqlDaysInMonth()` implements functionality equivalent to
[PromQL's `days_in_month()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#days_in_month). [PromQL's `days_in_month()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#days_in_month).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L83-L83 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L110-L110
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.promqlHour()` implements functionality equivalent to `promql.promqlHour()` implements functionality equivalent to
[PromQL's `hour()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#hour). [PromQL's `hour()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#hour).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L136-L136 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L169-L169
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.promqlMinute()` implements functionality equivalent to `promql.promqlMinute()` implements functionality equivalent to
[PromQL's `minute()` function]( https://prometheus.io/docs/prometheus/latest/querying/functions/#minute). [PromQL's `minute()` function]( https://prometheus.io/docs/prometheus/latest/querying/functions/#minute).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L143-L143 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L178-L178
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.promqlMonth()` implements functionality equivalent to `promql.promqlMonth()` implements functionality equivalent to
[PromQL's `month()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#month). [PromQL's `month()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#month).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L184-L184 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L239-L239
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.promqlYear()` implements functionality equivalent to `promql.promqlYear()` implements functionality equivalent to
[PromQL's `year()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#year). [PromQL's `year()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#year).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -21,7 +21,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L194-L204 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L251-L261
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -32,7 +32,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
below 0.0, by either returning positive infinity or negative infinity in the `_value` below 0.0, by either returning positive infinity or negative infinity in the `_value`
column respectively. `q` must be a float. column respectively. `q` must be a float.
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L170-L170 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L209-L209
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.resets()` implements functionality equivalent to `promql.resets()` implements functionality equivalent to
[PromQL's `resets()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#resets). [PromQL's `resets()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#resets).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature

View File

@ -20,7 +20,7 @@ documentation is generated.
To make updates to this documentation, update the function comments above the To make updates to this documentation, update the function comments above the
function definition in the Flux source code: function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L177-L177 https://github.com/influxdata/flux/blob/master/stdlib/internal/promql/promql.flux#L230-L230
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`promql.timestamp()` implements functionality equivalent to `promql.timestamp()` implements functionality equivalent to
[PromQL's `timestamp()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#timestamp). [PromQL's `timestamp()` function](https://prometheus.io/docs/prometheus/latest/querying/functions/#timestamp).
**Important**: The `internal/promql` package is not meant for external use.
##### Function type signature ##### Function type signature
@ -48,3 +48,63 @@ Input data. Defaults is piped-forward data (`<-`).
## Examples
### Convert timestamps into seconds since the Unix epoch
```js
import "internal/promql"
import "sampledata"
sampledata.float()
|> promql.timestamp()
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | *tag | _value |
| -------------------- | ---- | ------- |
| 2021-01-01T00:00:00Z | t1 | -2.18 |
| 2021-01-01T00:00:10Z | t1 | 10.92 |
| 2021-01-01T00:00:20Z | t1 | 7.35 |
| 2021-01-01T00:00:30Z | t1 | 17.53 |
| 2021-01-01T00:00:40Z | t1 | 15.23 |
| 2021-01-01T00:00:50Z | t1 | 4.43 |
| _time | *tag | _value |
| -------------------- | ---- | ------- |
| 2021-01-01T00:00:00Z | t2 | 19.85 |
| 2021-01-01T00:00:10Z | t2 | 4.97 |
| 2021-01-01T00:00:20Z | t2 | -3.75 |
| 2021-01-01T00:00:30Z | t2 | 19.77 |
| 2021-01-01T00:00:40Z | t2 | 13.86 |
| 2021-01-01T00:00:50Z | t2 | 1.86 |
#### Output data
| _time | *tag | _value |
| -------------------- | ---- | ---------- |
| 2021-01-01T00:00:00Z | t1 | 1609459200 |
| 2021-01-01T00:00:10Z | t1 | 1609459210 |
| 2021-01-01T00:00:20Z | t1 | 1609459220 |
| 2021-01-01T00:00:30Z | t1 | 1609459230 |
| 2021-01-01T00:00:40Z | t1 | 1609459240 |
| 2021-01-01T00:00:50Z | t1 | 1609459250 |
| _time | *tag | _value |
| -------------------- | ---- | ---------- |
| 2021-01-01T00:00:00Z | t2 | 1609459200 |
| 2021-01-01T00:00:10Z | t2 | 1609459210 |
| 2021-01-01T00:00:20Z | t2 | 1609459220 |
| 2021-01-01T00:00:30Z | t2 | 1609459230 |
| 2021-01-01T00:00:40Z | t2 | 1609459240 |
| 2021-01-01T00:00:50Z | t2 | 1609459250 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -1,17 +1,16 @@
--- ---
title: universe package title: testing package
description: > description: >
The `universe` package provides equivalent functions to the standard universe package The `testing` package provides functions for testing Flux operations.
but with more precise type signatures.
menu: menu:
flux_0_x_ref: flux_0_x_ref:
name: universe name: testing
parent: experimental parent: internal
identifier: experimental/universe identifier: internal/testing
weight: 21 weight: 21
cascade: cascade:
introduced: v0.166.0 introduced: 0.182.0
--- ---
<!------------------------------------------------------------------------------ <!------------------------------------------------------------------------------
@ -23,19 +22,18 @@ documentation is generated.
To make updates to this documentation, update the comments above the package To make updates to this documentation, update the comments above the package
declaration in the Flux source code: declaration in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/experimental/universe/universe.flux https://github.com/influxdata/flux/blob/master/stdlib/internal/testing/testing.flux
Contributing to Flux: https://github.com/influxdata/flux#contributing Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
-------------------------------------------------------------------------------> ------------------------------------------------------------------------------->
The `universe` package provides equivalent functions to the standard universe package The `testing` package provides functions for testing Flux operations.
but with more precise type signatures. Import the `internal/testing` package:
Import the `experimental/universe` package:
```js ```js
import "experimental/universe" import "internal/testing"
``` ```

View File

@ -0,0 +1,74 @@
---
title: testing.shouldErrorWithCode() function
description: >
`testing.shouldErrorWithCode()` calls a function that catches any error and checks that the error matches the expected value.
menu:
flux_0_x_ref:
name: testing.shouldErrorWithCode
parent: internal/testing
identifier: internal/testing/shouldErrorWithCode
weight: 201
flux/v0.x/tags: [tests]
introduced: 0.182.0
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/internal/testing/testing.flux#L34-L42
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`testing.shouldErrorWithCode()` calls a function that catches any error and checks that the error matches the expected value.
##### Function type signature
```js
(code: uint, fn: () => A, want: regexp) => stream[{match: bool, code: uint, _diff: string}]
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### fn
({{< req >}})
Function to call.
### want
({{< req >}})
Regular expression to match the expected error.
### code
({{< req >}})
Which flux error code to expect
## Examples
### Test die function errors
```js
import "testing"
testing.shouldErrorWithCode(fn: () => die(msg: "error message"), want: /error message/, code: 3)
```

View File

@ -1,78 +0,0 @@
---
title: join.join() function
description: >
`join.join()` is under active development and is not yet ready for public consumption.
menu:
flux_0_x_ref:
name: join.join
parent: join
identifier: join/join
weight: 101
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/join/join.flux#L13-L23
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`join.join()` is under active development and is not yet ready for public consumption.
##### Function type signature
```js
(
<-left: stream[A],
as: (l: A, r: B) => C,
method: string,
on: (l: A, r: B) => bool,
right: stream[B],
) => stream[C] where A: Record, B: Record, C: Record
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### left
left:
### right
({{< req >}})
right:
### on
({{< req >}})
on:
### as
({{< req >}})
as:
### method
({{< req >}})
method:

View File

@ -1,99 +0,0 @@
---
title: testing.benchmark() function
description: >
`testing.benchmark()` executes a test case without comparing test output with the expected test output.
This lets you accurately benchmark a test case without the added overhead of
comparing test output that occurs in `testing.run()`.
menu:
flux_0_x_ref:
name: testing.benchmark
parent: testing
identifier: testing/benchmark
weight: 101
introduced: 0.49.0
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L353-L357
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`testing.benchmark()` executes a test case without comparing test output with the expected test output.
This lets you accurately benchmark a test case without the added overhead of
comparing test output that occurs in `testing.run()`.
##### Function type signature
```js
(case: () => {A with input: B, fn: (<-: B) => C}) => C
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### case
({{< req >}})
Test case to benchmark.
## Examples
### Define and benchmark a test case
The following script defines a test case for the sum() function and enables
profilers to measure query performance.
```js
import "csv"
import "testing"
import "profiler"
option profiler.enabledProfilers = ["query", "operator"]
inData =
"
#datatype,string,long,string,dateTime:RFC3339,string,double
#group,false,false,true,false,true,false
#default,_result,,,,,
,result,table,_measurement,_time,_field,_value
,,0,m,2021-01-01T00:00:00Z,t,1.2
,,0,m,2021-01-02T00:00:00Z,t,1.4
,,0,m,2021-01-03T00:00:00Z,t,2.2
"
outData =
"
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,string,string,double
#group,false,false,true,true,true,true,false
#default,_result,,,,,,
,result,table,_start,_stop,_measurement,_field,_value
,,0,2021-01-01T00:00:00Z,2021-01-03T01:00:00Z,m,t,4.8
"
t_sum = (table=<-) =>
table
|> range(start: 2021-01-01T00:00:00Z, stop: 2021-01-03T01:00:00Z)
|> sum()
test _sum = () => ({input: csv.from(csv: inData), want: csv.from(csv: outData), fn: t_sum})
testing.benchmark(case: _sum)
```

View File

@ -1,103 +0,0 @@
---
title: testing.inspect() function
description: >
`testing.inspect()` returns information about a test case.
menu:
flux_0_x_ref:
name: testing.inspect
parent: testing
identifier: testing/inspect
weight: 101
introduced: 0.18.0
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L237-L249
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`testing.inspect()` returns information about a test case.
##### Function type signature
```js
(
case: () => {A with want: stream[C], input: B, fn: (<-: B) => stream[C]},
) => {
want: stream[C],
input: B,
got: stream[C],
fn: (<-: B) => stream[C],
diff: stream[{C with _diff: string}],
} where C: Record
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### case
({{< req >}})
Test case to inspect.
## Examples
### Define and inspect a test case
```js
import "testing"
inData =
"
#datatype,string,long,string,dateTime:RFC3339,string,double
#group,false,false,true,false,true,false
#default,_result,,,,,
,result,table,_measurement,_time,_field,_value
,,0,m,2021-01-01T00:00:00Z,t,1.2
,,0,m,2021-01-02T00:00:00Z,t,1.4
,,0,m,2021-01-03T00:00:00Z,t,2.2
"
outData =
"
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,string,string,double
#group,false,false,true,true,true,true,false
#default,_result,,,,,,
,result,table,_start,_stop,_measurement,_field,_value
,,0,2021-01-01T00:00:00Z,2021-01-03T01:00:00Z,m,t,4.8
"
t_sum = (table=<-) =>
table
|> range(start: 2021-01-01T00:00:00Z, stop: 2021-01-03T01:00:00Z)
|> sum()
test _sum = () => ({input: csv.from(csv: inData), want: csv.from(csv: outData), fn: t_sum})
testing.inpsect(case: _sum)// Returns: {
// fn: (<-table: [{_time: time | t10997}]) -> [t10996],
// input: fromCSV -> range -> map,
// want: fromCSV -> yield,
// got: fromCSV -> range -> map -> range -> sum -> yield,
// diff: ( fromCSV; fromCSV -> range -> map -> range -> sum; ) -> diff -> yield
// }
```

View File

@ -1,89 +0,0 @@
---
title: testing.run() function
description: >
`testing.run()` executes a specified test case.
menu:
flux_0_x_ref:
name: testing.run
parent: testing
identifier: testing/run
weight: 101
introduced: 0.20.0
---
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/testing/testing.flux#L296-L298
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`testing.run()` executes a specified test case.
##### Function type signature
```js
(case: () => {A with want: stream[C], input: B, fn: (<-: B) => stream[C]}) => stream[{C with _diff: string}] where C: Record
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### case
({{< req >}})
Test case to run.
## Examples
### Define and execute a test case
```js
import "csv"
import "testing"
inData =
"
#datatype,string,long,string,dateTime:RFC3339,string,double
#group,false,false,true,false,true,false
#default,_result,,,,,
,result,table,_measurement,_time,_field,_value
,,0,m,2021-01-01T00:00:00Z,t,1.2
,,0,m,2021-01-02T00:00:00Z,t,1.4
,,0,m,2021-01-03T00:00:00Z,t,2.2
"
outData =
"
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,string,string,double
#group,false,false,true,true,true,true,false
#default,_result,,,,,,
,result,table,_start,_stop,_measurement,_field,_value
,,0,2021-01-01T00:00:00Z,2021-01-03T01:00:00Z,m,t,4.8
"
t_sum = (table=<-) =>
table
|> range(start: 2021-01-01T00:00:00Z, stop: 2021-01-03T01:00:00Z)
|> sum()
test _sum = () => ({input: csv.from(csv: inData), want: csv.from(csv: outData), fn: t_sum})
testing.run(case: _sum)
```

View File

@ -101,7 +101,7 @@ from(bucket: "example-bucket")
```js ```js
from(bucket: "example-bucket") from(bucket: "example-bucket")
|> range(start: 1621726200000000000, stop: 1621728000000000000) |> range(start: 1621726200, stop: 1621728000)
``` ```

View File

@ -149,14 +149,14 @@ union(tables: [t1, t2])
| _time | _value | tag | | _time | _value | tag |
| -------------------- | ------- | ---- | | -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 0 | bar |
| 2021-01-02T00:00:00Z | -1 | bar |
| 2021-01-03T00:00:00Z | -2 | bar |
| 2021-01-04T00:00:00Z | -3 | bar |
| 2021-01-01T00:00:00Z | 1 | foo | | 2021-01-01T00:00:00Z | 1 | foo |
| 2021-01-02T00:00:00Z | 2 | foo | | 2021-01-02T00:00:00Z | 2 | foo |
| 2021-01-03T00:00:00Z | 3 | foo | | 2021-01-03T00:00:00Z | 3 | foo |
| 2021-01-04T00:00:00Z | 4 | foo | | 2021-01-04T00:00:00Z | 4 | foo |
| 2021-01-01T00:00:00Z | 0 | bar |
| 2021-01-02T00:00:00Z | -1 | bar |
| 2021-01-03T00:00:00Z | -2 | bar |
| 2021-01-04T00:00:00Z | -3 | bar |
{{% /expand %}} {{% /expand %}}
{{< /expand-wrapper >}} {{< /expand-wrapper >}}

View File

@ -2501,32 +2501,17 @@
- /influxdb/v2.0/reference/flux/stdlib/testing/assertequals/ - /influxdb/v2.0/reference/flux/stdlib/testing/assertequals/
- /influxdb/cloud/reference/flux/stdlib/testing/assertequals/ - /influxdb/cloud/reference/flux/stdlib/testing/assertequals/
/flux/v0.x/stdlib/testing/benchmark.md: |
aliases:
- /influxdb/v2.0/reference/flux/stdlib/testing/benchmark/
- /influxdb/cloud/reference/flux/stdlib/testing/benchmark/
/flux/v0.x/stdlib/testing/diff.md: | /flux/v0.x/stdlib/testing/diff.md: |
aliases: aliases:
- /influxdb/v2.0/reference/flux/functions/testing/diff/ - /influxdb/v2.0/reference/flux/functions/testing/diff/
- /influxdb/v2.0/reference/flux/stdlib/testing/diff/ - /influxdb/v2.0/reference/flux/stdlib/testing/diff/
- /influxdb/cloud/reference/flux/stdlib/testing/diff/ - /influxdb/cloud/reference/flux/stdlib/testing/diff/
/flux/v0.x/stdlib/testing/inspect.md: |
aliases:
- /influxdb/v2.0/reference/flux/stdlib/testing/inspect/
- /influxdb/cloud/reference/flux/stdlib/testing/inspect/
/flux/v0.x/stdlib/testing/load.md: | /flux/v0.x/stdlib/testing/load.md: |
aliases: aliases:
- /influxdb/v2.0/reference/flux/stdlib/testing/load/ - /influxdb/v2.0/reference/flux/stdlib/testing/load/
- /influxdb/cloud/reference/flux/stdlib/testing/load/ - /influxdb/cloud/reference/flux/stdlib/testing/load/
/flux/v0.x/stdlib/testing/run.md: |
aliases:
- /influxdb/v2.0/reference/flux/stdlib/testing/run/
- /influxdb/cloud/reference/flux/stdlib/testing/run/
/flux/v0.x/stdlib/universe/_index.md: | /flux/v0.x/stdlib/universe/_index.md: |
aliases: aliases:
- /influxdb/v2.0/reference/flux/functions/built-in/ - /influxdb/v2.0/reference/flux/functions/built-in/

View File

@ -8,8 +8,7 @@
{{ $name := replaceRE " function" "" .Title }} {{ $name := replaceRE " function" "" .Title }}
<div class="warn block"> <div class="warn block">
<p> <p>
<code>{{ $name | safeHTML }}</code> is {{ if in $name "experimental" }}{{ else }}experimental and{{ end }} subject to change at any time. <code>{{ $name | safeHTML }}</code> is {{ if in $name "experimental" }}{{ else }}experimental and{{ end }} <a href="{{ $expRiskURL }}"></a>subject to change at any time</a>.
By using this function, you accept the <a href="{{ $expRiskURL }}">risks of experimental functions</a>.
</p> </p>
</div> </div>
{{ else if eq .Kind "section" }} {{ else if eq .Kind "section" }}
@ -17,8 +16,7 @@
{{ $packageTitle := cond (isset .Params "list_title") $.Params.list_title .Title }} {{ $packageTitle := cond (isset .Params "list_title") $.Params.list_title .Title }}
{{ $packageName := replaceRE `^(.*)( package)` "<code>$1</code>$2" $packageTitle }} {{ $packageName := replaceRE `^(.*)( package)` "<code>$1</code>$2" $packageTitle }}
<p> <p>
The {{ $packageName | safeHTML }} is experimental and subject to change at any time. The {{ $packageName | safeHTML }} is experimental and <a href="{{ $expRiskURL }}"></a>subject to change at any time</a>.
By using this package, you accept the <a href="{{ $expRiskURL }}">risks of experimental functions</a>.
</p> </p>
</div> </div>
{{ end }} {{ end }}