updated the shift function to timeShift
parent
782ed4f55f
commit
94da665ef4
|
@ -1,16 +1,17 @@
|
||||||
---
|
---
|
||||||
title: shift() function
|
title: timeShift() function
|
||||||
description: The `shift()` function adds a fixed duration to time columns.
|
description: The `timeShift()` function adds a fixed duration to time columns.
|
||||||
aliases:
|
aliases:
|
||||||
- /v2.0/reference/flux/functions/transformations/shift
|
- /v2.0/reference/flux/functions/transformations/shift
|
||||||
|
- /v2.0/reference/flux/functions/built-in/transformations/shift
|
||||||
menu:
|
menu:
|
||||||
v2_0_ref:
|
v2_0_ref:
|
||||||
name: shift
|
name: timeShift
|
||||||
parent: built-in-transformations
|
parent: built-in-transformations
|
||||||
weight: 401
|
weight: 401
|
||||||
---
|
---
|
||||||
|
|
||||||
The `shift()` function adds a fixed duration to time columns.
|
The `timeShift()` function adds a fixed duration to time columns.
|
||||||
The output table schema is the same as the input table.
|
The output table schema is the same as the input table.
|
||||||
If the time is `null`, the time will continue to be `null`.
|
If the time is `null`, the time will continue to be `null`.
|
||||||
|
|
||||||
|
@ -18,18 +19,20 @@ _**Function type:** Transformation_
|
||||||
_**Output data type:** Object_
|
_**Output data type:** Object_
|
||||||
|
|
||||||
```js
|
```js
|
||||||
shift(shift: 10h, columns: ["_start", "_stop", "_time"])
|
timeShift(duration: 10h, columns: ["_start", "_stop", "_time"])
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
### shift
|
### duration
|
||||||
The amount of time to add to each time value. The shift may be a negative duration.
|
The amount of time to add to each time value.
|
||||||
|
May be a negative duration.
|
||||||
|
|
||||||
_**Data type:** Duration_
|
_**Data type:** Duration_
|
||||||
|
|
||||||
### columns
|
### columns
|
||||||
The list of all columns to be shifted. Defaults to `["_start", "_stop", "_time"]`.
|
The list of all columns to be shifted.
|
||||||
|
Defaults to `["_start", "_stop", "_time"]`.
|
||||||
|
|
||||||
_**Data type:** Array of strings_
|
_**Data type:** Array of strings_
|
||||||
|
|
||||||
|
@ -39,12 +42,12 @@ _**Data type:** Array of strings_
|
||||||
```js
|
```js
|
||||||
from(bucket: "telegraf/autogen")
|
from(bucket: "telegraf/autogen")
|
||||||
|> range(start: -5m)
|
|> range(start: -5m)
|
||||||
|> shift(shift: 12h)
|
|> timeShift(duration: 12h)
|
||||||
```
|
```
|
||||||
|
|
||||||
###### Shift backward in time
|
###### Shift backward in time
|
||||||
```js
|
```js
|
||||||
from(bucket: "telegraf/autogen")
|
from(bucket: "telegraf/autogen")
|
||||||
|> range(start: -5m)
|
|> range(start: -5m)
|
||||||
|> shift(shift: -12h)
|
|> timeShift(duration: -12h)
|
||||||
```
|
```
|
Loading…
Reference in New Issue