Merge pull request #325 from influxdata/flux/new-functions
New Flux functions for 0.36.1pull/328/head
commit
30a0085327
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
title: sleep() function
|
||||
description: The `sleep()` function delays execution by a specified duration.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: sleep
|
||||
parent: built-in-misc
|
||||
weight: 401
|
||||
---
|
||||
|
||||
The `sleep()` function delays execution by a specified duration.
|
||||
|
||||
_**Function type:** Miscellaneous_
|
||||
|
||||
```js
|
||||
sleep(
|
||||
v: x,
|
||||
duration: 10s
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### v
|
||||
Defines input tables.
|
||||
`sleep()` accepts piped-forward data and passes it on unmodified after the
|
||||
specified [duration](#duration).
|
||||
If data is not piped-forward into `sleep()`, set `v` to specify a stream object.
|
||||
The examples [below](#examples) illustrate how.
|
||||
|
||||
_**Data type:** Object_
|
||||
|
||||
### duration
|
||||
The length of time to delay execution.
|
||||
|
||||
_**Data type:** Duration_
|
||||
|
||||
## Examples
|
||||
|
||||
### Delay execution in a chained query
|
||||
```js
|
||||
from(bucket: "example-bucket")
|
||||
|> range(start: -1h)
|
||||
|> sleep(duration: 10s)
|
||||
```
|
||||
|
||||
### Delay execution using a stream variable
|
||||
```js
|
||||
x = from(bucket: "example-bucket")
|
||||
|> range(start: -1h)
|
||||
|
||||
sleep(v: x, duration: 10s)
|
||||
```
|
|
@ -8,7 +8,6 @@ menu:
|
|||
name: mode
|
||||
parent: built-in-aggregates
|
||||
weight: 501
|
||||
draft: true
|
||||
---
|
||||
|
||||
The `mode()` function computes the mode or value that occurs most often in a
|
||||
|
@ -20,6 +19,18 @@ _**Function type:** Aggregate_
|
|||
mode(column: "_value")
|
||||
```
|
||||
|
||||
Multiple modes are returned in a sorted table.
|
||||
If there is no mode, `mode()` returns `null`.
|
||||
|
||||
##### Supported data types
|
||||
|
||||
- String
|
||||
- Float
|
||||
- Integer
|
||||
- UInteger
|
||||
- Boolean
|
||||
- Time
|
||||
|
||||
## Parameters
|
||||
|
||||
### column
|
||||
|
@ -30,7 +41,7 @@ _**Data type:** String_
|
|||
|
||||
## Examples
|
||||
|
||||
###### Mode as an aggregate
|
||||
###### Return the mode of windowed data
|
||||
```js
|
||||
from(bucket: "example-bucket")
|
||||
|> filter(fn: (r) =>
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
title: elapsed() function
|
||||
description: The `elapsed()` function returns the time between subsequent records.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: elapsed
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
---
|
||||
|
||||
The `elapsed()` function returns the time between subsequent records.
|
||||
Given an input table, `elapsed()` returns the same table without the first record
|
||||
(as elapsed time is not defined) and an additional column containing the elapsed time.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
|
||||
```js
|
||||
elapsed(
|
||||
unit: 1s,
|
||||
timeColumn: "_time",
|
||||
columnName: "elapsed"
|
||||
)
|
||||
```
|
||||
|
||||
_`elapsed()` returns an errors if the `timeColumn` is not present in the input table._
|
||||
|
||||
## Parameters
|
||||
|
||||
### unit
|
||||
The unit time to returned.
|
||||
_Defaults to `1s`._
|
||||
|
||||
_**Data type:** Duration_
|
||||
|
||||
### timeColumn
|
||||
The column to use to compute the elapsed time.
|
||||
_Defaults to `"_time"`._
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### columnName
|
||||
The column to store elapsed times.
|
||||
_Defaults to `"elapsed"`._
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
## Examples
|
||||
|
||||
##### Calculate the time between points in seconds
|
||||
```js
|
||||
from(bucket: "example-bucket")
|
||||
|> range(start: -5m)
|
||||
|> elapsed(unit: 1s)
|
||||
```
|
Loading…
Reference in New Issue