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