Merge pull request #4169 from influxdata/flux-0.173

Flux 0.173
pull/4176/head^2
sunbryely-influxdata 2022-06-30 12:24:37 -07:00 committed by GitHub
commit 16478e847a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
459 changed files with 3477 additions and 59 deletions

View File

@ -10,6 +10,40 @@ aliases:
- /influxdb/cloud/reference/release-notes/flux/
---
## v0.173.0 [2022-06-29]
### Breaking changes
- Format scripts with a trailing newline by default when running the formatter.
### Features
- Deprecate [`experimental.http.get`](/flux/v0.x/stdlib/experimental/http/get/).
- Deprecate [`experimental.csv.from()`](/flux/v0.x/stdlib/experimental/csv/from/).
- Promote the following functions from `experimental.array` into the
[`array`](/flux/v0.x/stdlib/array) package:
- [`array.concat()`](/flux/v0.x/stdlib/array/concat/)
- [`array.filter()`](/flux/v0.x/stdlib/array/filter/)
- [`array.map()`](/flux/v0.x/stdlib/array/map/)
- Promote the following functions from `experimental.http.requests` into the
[`http.requests`](/flux/v0.x/stdlib/http/requests/) package:
- [`http.requests.do()`](/flux/v0.x/stdlib/http/requests/do/)
- [`http.requests.get()`](/flux/v0.x/stdlib/http/requests/get/)
- [`http.requests.peek()`](/flux/v0.x/stdlib/http/requests/peek/)
- [`http.requests.post()`](/flux/v0.x/stdlib/http/requests/post/)
- Promote `experimental.bitwise` into the [`bitwise`](/flux/v0.x/stdlib/bitwise/)
package.
- Remove all `Test` statements. New statements are written with `TestCase`.
- Format scripts with a trailing newline by default when running the formatter.
### Bug fixes
- Return an error if the user modifies group key while using
[`join`](/flux/v0.x/stdlib/join/)
---
## v0.172.0 [2022-06-24]
### Features
@ -116,7 +150,7 @@ aliases:
- Add [`experimental.preview()`](/flux/v0.x/stdlib/experimental/preview/).
### Bug fixes
- Update `date.add()` and `date.sub()` to ork correctly with timezones enabled.
- Update `date.add()` and `date.sub()` to work correctly with timezones enabled.
- Fix failing continuous integration tests.
- Update `hourSelection()` to support overnight time ranges.
- Fix logic error in aggregate window planner rule preserve the rule if

View File

@ -1,7 +1,7 @@
---
title: array package
description: >
The `array` package provides functions for building tables from Flux arrays.
The `array` package provides functions for manipulating array and building tables from arrays.
menu:
flux_0_x_ref:
name: array
@ -29,7 +29,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
The `array` package provides functions for building tables from Flux arrays.
The `array` package provides functions for manipulating array and building tables from arrays.
Import the `array` package:
```js

View File

@ -0,0 +1,93 @@
---
title: array.concat() function
description: >
`array.concat()` appends two arrays and returns a new array.
menu:
flux_0_x_ref:
name: array.concat
parent: array
identifier: array/concat
weight: 101
introduced: 0.173.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/array/array.flux#L76-L76
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`array.concat()` appends two arrays and returns a new array.
Neither input array is mutated and a new array is returned.
##### Function type signature
```js
(<-arr: [A], v: [A]) => [A]
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### arr
First array. Default is the piped-forward array (`<-`).
### v
({{< req >}})
Array to append to the first array.
## Examples
### Merge two arrays
```js
import "array"
a = [1, 2, 3]
b = [4, 5, 6]
c = a |> array.concat(v: b)
// Returns [1, 2, 3, 4, 5, 6]
// Output each value in the array as a row in a table
array.from(rows: c |> array.map(fn: (x) => ({_value: x})))
```
{{< expand-wrapper >}}
{{% expand "View example output" %}}
#### Output data
| _value |
| ------- |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,95 @@
---
title: array.filter() function
description: >
`array.filter()` iterates over an array, evaluates each element with a predicate function, and then returns
a new array with only elements that match the predicate.
menu:
flux_0_x_ref:
name: array.filter
parent: array
identifier: array/filter
weight: 101
introduced: 0.173.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/array/array.flux#L128-L128
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`array.filter()` iterates over an array, evaluates each element with a predicate function, and then returns
a new array with only elements that match the predicate.
##### Function type signature
```js
(<-arr: [A], fn: (x: A) => bool) => [A]
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### arr
Array to filter. Default is the piped-forward array (`<-`).
### fn
({{< req >}})
Predicate function to evaluate on each element.
The element is represented by `x` in the predicate function.
## Examples
### Filter array of integers
```js
import "array"
a = [
1,
2,
3,
4,
5,
]
b = a |> array.filter(fn: (x) => x >= 3)
// b returns [3, 4, 5]
// Output the filtered array as a table
array.from(rows: b |> array.map(fn: (x) => ({_value: x})))
```
{{< expand-wrapper >}}
{{% expand "View example output" %}}
#### Output data
| _value |
| ------- |
| 3 |
| 4 |
| 5 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -62,6 +62,7 @@ import "array"
rows = [{foo: "bar", baz: 21.2}, {foo: "bar", baz: 23.8}]
array.from(rows: rows)
```
{{< expand-wrapper >}}
@ -88,5 +89,6 @@ tags = v1.tagValues(bucket: "example-bucket", tag: "host")
wildcard_tag = array.from(rows: [{_value: "*"}])
union(tables: [tags, wildcard_tag])
```

View File

@ -0,0 +1,96 @@
---
title: array.map() function
description: >
`array.map()` iterates over an array, applies a function to each element to produce a new element,
and then returns a new array.
menu:
flux_0_x_ref:
name: array.map
parent: array
identifier: array/map
weight: 101
introduced: 0.173.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/array/array.flux#L101-L101
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`array.map()` iterates over an array, applies a function to each element to produce a new element,
and then returns a new array.
##### Function type signature
```js
(<-arr: [A], fn: (x: A) => B) => [B]
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### arr
Array to operate on. Defaults is the piped-forward array (`<-`).
### fn
({{< req >}})
Function to apply to elements. The element is represented by `x` in the function.
## Examples
### Convert an array of integers to an array of records
```js
import "array"
a = [
1,
2,
3,
4,
5,
]
b = a |> array.map(fn: (x) => ({_value: x}))
// b returns [{_value: 1}, {_value: 2}, {_value: 3}, {_value: 4}, {_value: 5}]
// Output the array of records as a table
array.from(rows: b)
```
{{< expand-wrapper >}}
{{% expand "View example output" %}}
#### Output data
| _value |
| ------- |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,47 @@
---
title: bitwise package
description: >
The `bitwise` package provides functions for performing bitwise operations on integers.
menu:
flux_0_x_ref:
name: bitwise
parent: stdlib
identifier: bitwise
weight: 11
cascade:
flux/v0.x/tags: [bitwise]
introduced: 0.173.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 comments above the package
declaration in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/bitwise/bitwise.flux
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
The `bitwise` package provides functions for performing bitwise operations on integers.
Import the `bitwise` package:
```js
import "bitwise"
```
All integers are 64 bit integers.
Functions prefixed with s operate on signed integers (int).
Functions prefixed with u operate on unsigned integers (uint).
## Functions
{{< children type="functions" show="pages" >}}

View File

@ -0,0 +1,128 @@
---
title: bitwise.sand() function
description: >
`bitwise.sand()` performs the bitwise operation, `a AND b`, with integers.
menu:
flux_0_x_ref:
name: bitwise.sand
parent: bitwise
identifier: bitwise/sand
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/bitwise/bitwise.flux#L230-L230
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.sand()` performs the bitwise operation, `a AND b`, with integers.
##### Function type signature
```js
(a: int, b: int) => int
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Right hand operand.
## Examples
- [Perform a bitwise AND operation](#perform-a-bitwise-and-operation)
- [Perform a bitwise AND operation on a stream of tables](#perform-a-bitwise-and-operation-on-a-stream-of-tables)
### Perform a bitwise AND operation
```js
import "bitwise"
bitwise.sand(a: 1234, b: 4567)// Returns 210
```
### Perform a bitwise AND operation on a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.sand(a: r._value, b: 3)}))
```
{{< 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
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 2 | t1 |
| 2021-01-01T00:00:10Z | 2 | t1 |
| 2021-01-01T00:00:20Z | 3 | t1 |
| 2021-01-01T00:00:30Z | 1 | t1 |
| 2021-01-01T00:00:40Z | 3 | t1 |
| 2021-01-01T00:00:50Z | 0 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 3 | t2 |
| 2021-01-01T00:00:10Z | 0 | t2 |
| 2021-01-01T00:00:20Z | 1 | t2 |
| 2021-01-01T00:00:30Z | 3 | t2 |
| 2021-01-01T00:00:40Z | 1 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,130 @@
---
title: bitwise.sclear() function
description: >
`bitwise.sclear()` performs the bitwise operation `a AND NOT b`.
Both `a` and `b` are integers.
menu:
flux_0_x_ref:
name: bitwise.sclear
parent: bitwise
identifier: bitwise/sclear
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/bitwise/bitwise.flux#L338-L338
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.sclear()` performs the bitwise operation `a AND NOT b`.
Both `a` and `b` are integers.
##### Function type signature
```js
(a: int, b: int) => int
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Bits to clear.
## Examples
- [Perform a bitwise AND NOT operation](#perform-a-bitwise-and-not-operation)
- [Perform a bitwise AND NOT operation on a stream of tables](#perform-a-bitwise-and-not-operation-on-a-stream-of-tables)
### Perform a bitwise AND NOT operation
```js
import "bitwise"
bitwise.sclear(a: 1234, b: 4567)// Returns 1024
```
### Perform a bitwise AND NOT operation on a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.sclear(a: r._value, b: 3)}))
```
{{< 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
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -4 | t1 |
| 2021-01-01T00:00:10Z | 8 | t1 |
| 2021-01-01T00:00:20Z | 4 | t1 |
| 2021-01-01T00:00:30Z | 16 | t1 |
| 2021-01-01T00:00:40Z | 12 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 16 | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -4 | t2 |
| 2021-01-01T00:00:30Z | 16 | t2 |
| 2021-01-01T00:00:40Z | 12 | t2 |
| 2021-01-01T00:00:50Z | 0 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,130 @@
---
title: bitwise.slshift() function
description: >
`bitwise.slshift()` shifts the bits in `a` left by `b` bits.
Both `a` and `b` are integers.
menu:
flux_0_x_ref:
name: bitwise.slshift
parent: bitwise
identifier: bitwise/slshift
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/bitwise/bitwise.flux#L366-L366
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.slshift()` shifts the bits in `a` left by `b` bits.
Both `a` and `b` are integers.
##### Function type signature
```js
(a: int, b: int) => int
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Number of bits to shift.
## Examples
- [Shift bits left in an integer](#shift-bits-left-in-an-integer)
- [Shift bits left in integers in a stream of tables](#shift-bits-left-in-integers-in-a-stream-of-tables)
### Shift bits left in an integer
```js
import "bitwise"
bitwise.slshift(a: 1234, b: 2)// Returns 4936
```
### Shift bits left in integers in a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.slshift(a: r._value, b: 3)}))
```
{{< 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
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -16 | t1 |
| 2021-01-01T00:00:10Z | 80 | t1 |
| 2021-01-01T00:00:20Z | 56 | t1 |
| 2021-01-01T00:00:30Z | 136 | t1 |
| 2021-01-01T00:00:40Z | 120 | t1 |
| 2021-01-01T00:00:50Z | 32 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 152 | t2 |
| 2021-01-01T00:00:10Z | 32 | t2 |
| 2021-01-01T00:00:20Z | -24 | t2 |
| 2021-01-01T00:00:30Z | 152 | t2 |
| 2021-01-01T00:00:40Z | 104 | t2 |
| 2021-01-01T00:00:50Z | 8 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,122 @@
---
title: bitwise.snot() function
description: >
`bitwise.snot()` inverts every bit in `a`, an integer.
menu:
flux_0_x_ref:
name: bitwise.snot
parent: bitwise
identifier: bitwise/snot
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/bitwise/bitwise.flux#L283-L283
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.snot()` inverts every bit in `a`, an integer.
##### Function type signature
```js
(a: int) => int
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Integer to invert.
## Examples
- [Invert bits in an integer](#invert-bits-in-an-integer)
- [Invert bits in integers in a stream of tables](#invert-bits-in-integers-in-a-stream-of-tables)
### Invert bits in an integer
```js
import "bitwise"
bitwise.snot(a: 1234)// Returns -1235
```
### Invert bits in integers in a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.snot(a: r._value)}))
```
{{< 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
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 1 | t1 |
| 2021-01-01T00:00:10Z | -11 | t1 |
| 2021-01-01T00:00:20Z | -8 | t1 |
| 2021-01-01T00:00:30Z | -18 | t1 |
| 2021-01-01T00:00:40Z | -16 | t1 |
| 2021-01-01T00:00:50Z | -5 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -20 | t2 |
| 2021-01-01T00:00:10Z | -5 | t2 |
| 2021-01-01T00:00:20Z | 2 | t2 |
| 2021-01-01T00:00:30Z | -20 | t2 |
| 2021-01-01T00:00:40Z | -14 | t2 |
| 2021-01-01T00:00:50Z | -2 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,128 @@
---
title: bitwise.sor() function
description: >
`bitwise.sor()` performs the bitwise operation, `a OR b`, with integers.
menu:
flux_0_x_ref:
name: bitwise.sor
parent: bitwise
identifier: bitwise/sor
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/bitwise/bitwise.flux#L257-L257
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.sor()` performs the bitwise operation, `a OR b`, with integers.
##### Function type signature
```js
(a: int, b: int) => int
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Right hand operand.
## Examples
- [Perform a bitwise OR operation](#perform-a-bitwise-or-operation)
- [Perform a bitwise OR operation on a stream of tables](#perform-a-bitwise-or-operation-on-a-stream-of-tables)
### Perform a bitwise OR operation
```js
import "bitwise"
bitwise.sor(a: 1234, b: 4567)// Returns 5591
```
### Perform a bitwise OR operation on a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.sor(a: r._value, b: 3)}))
```
{{< 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
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -1 | t1 |
| 2021-01-01T00:00:10Z | 11 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 19 | t1 |
| 2021-01-01T00:00:40Z | 15 | t1 |
| 2021-01-01T00:00:50Z | 7 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 19 | t2 |
| 2021-01-01T00:00:10Z | 7 | t2 |
| 2021-01-01T00:00:20Z | -1 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 15 | t2 |
| 2021-01-01T00:00:50Z | 3 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,130 @@
---
title: bitwise.srshift() function
description: >
`bitwise.srshift()` shifts the bits in `a` right by `b` bits.
Both `a` and `b` are integers.
menu:
flux_0_x_ref:
name: bitwise.srshift
parent: bitwise
identifier: bitwise/srshift
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/bitwise/bitwise.flux#L394-L394
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.srshift()` shifts the bits in `a` right by `b` bits.
Both `a` and `b` are integers.
##### Function type signature
```js
(a: int, b: int) => int
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Number of bits to shift.
## Examples
- [Shift bits right in an integer](#shift-bits-right-in-an-integer)
- [Shift bits right in integers in a stream of tables](#shift-bits-right-in-integers-in-a-stream-of-tables)
### Shift bits right in an integer
```js
import "bitwise"
bitwise.srshift(a: 1234, b: 2)// Returns 308
```
### Shift bits right in integers in a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.srshift(a: r._value, b: 3)}))
```
{{< 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
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -1 | t1 |
| 2021-01-01T00:00:10Z | 1 | t1 |
| 2021-01-01T00:00:20Z | 0 | t1 |
| 2021-01-01T00:00:30Z | 2 | t1 |
| 2021-01-01T00:00:40Z | 1 | t1 |
| 2021-01-01T00:00:50Z | 0 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 2 | t2 |
| 2021-01-01T00:00:10Z | 0 | t2 |
| 2021-01-01T00:00:20Z | -1 | t2 |
| 2021-01-01T00:00:30Z | 2 | t2 |
| 2021-01-01T00:00:40Z | 1 | t2 |
| 2021-01-01T00:00:50Z | 0 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,128 @@
---
title: bitwise.sxor() function
description: >
`bitwise.sxor()` performs the bitwise operation, `a XOR b`, with integers.
menu:
flux_0_x_ref:
name: bitwise.sxor
parent: bitwise
identifier: bitwise/sxor
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/bitwise/bitwise.flux#L310-L310
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.sxor()` performs the bitwise operation, `a XOR b`, with integers.
##### Function type signature
```js
(a: int, b: int) => int
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Right hand operand.
## Examples
- [Perform a bitwise XOR operation](#perform-a-bitwise-xor-operation)
- [Perform a bitwise XOR operation on a stream of tables](#perform-a-bitwise-xor-operation-on-a-stream-of-tables)
### Perform a bitwise XOR operation
```js
import "bitwise"
bitwise.sxor(a: 1234, b: 4567)// Returns 5381
```
### Perform a bitwise XOR operation on a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.sxor(a: r._value, b: 3)}))
```
{{< 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
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | -3 | t1 |
| 2021-01-01T00:00:10Z | 9 | t1 |
| 2021-01-01T00:00:20Z | 4 | t1 |
| 2021-01-01T00:00:30Z | 18 | t1 |
| 2021-01-01T00:00:40Z | 12 | t1 |
| 2021-01-01T00:00:50Z | 7 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 16 | t2 |
| 2021-01-01T00:00:10Z | 7 | t2 |
| 2021-01-01T00:00:20Z | -2 | t2 |
| 2021-01-01T00:00:30Z | 16 | t2 |
| 2021-01-01T00:00:40Z | 14 | t2 |
| 2021-01-01T00:00:50Z | 2 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,128 @@
---
title: bitwise.uand() function
description: >
`bitwise.uand()` performs the bitwise operation, `a AND b`, with unsigned integers.
menu:
flux_0_x_ref:
name: bitwise.uand
parent: bitwise
identifier: bitwise/uand
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/bitwise/bitwise.flux#L40-L40
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.uand()` performs the bitwise operation, `a AND b`, with unsigned integers.
##### Function type signature
```js
(a: uint, b: uint) => uint
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Right hand operand.
## Examples
- [Perform a bitwise AND operation](#perform-a-bitwise-and-operation)
- [Perform a bitwise AND operation on a stream of tables](#perform-a-bitwise-and-operation-on-a-stream-of-tables)
### Perform a bitwise AND operation
```js
import "bitwise"
bitwise.uand(a: uint(v: 1234), b: uint(v: 4567))// Returns 210 (uint)
```
### Perform a bitwise AND operation on a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.uint()
|> map(fn: (r) => ({r with _value: bitwise.uand(a: r._value, b: uint(v: 3))}))
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551614 | 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 | 18446744073709551613 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 13 | 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 | 3 | t1 |
| 2021-01-01T00:00:30Z | 1 | t1 |
| 2021-01-01T00:00:40Z | 3 | t1 |
| 2021-01-01T00:00:50Z | 0 | t1 |
| _time | _value | *tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 3 | t2 |
| 2021-01-01T00:00:10Z | 0 | t2 |
| 2021-01-01T00:00:20Z | 1 | t2 |
| 2021-01-01T00:00:30Z | 3 | t2 |
| 2021-01-01T00:00:40Z | 1 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,128 @@
---
title: bitwise.uclear() function
description: >
`bitwise.uclear()` performs the bitwise operation `a AND NOT b`, with unsigned integers.
menu:
flux_0_x_ref:
name: bitwise.uclear
parent: bitwise
identifier: bitwise/uclear
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/bitwise/bitwise.flux#L147-L147
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.uclear()` performs the bitwise operation `a AND NOT b`, with unsigned integers.
##### Function type signature
```js
(a: uint, b: uint) => uint
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Bits to clear.
## Examples
- [Perform a bitwise AND NOT operation](#perform-a-bitwise-and-not-operation)
- [Perform a bitwise AND NOT operation on a stream of tables](#perform-a-bitwise-and-not-operation-on-a-stream-of-tables)
### Perform a bitwise AND NOT operation
```js
import "bitwise"
bitwise.uclear(a: uint(v: 1234), b: uint(v: 4567))// Returns 1024 (uint)
```
### Perform a bitwise AND NOT operation on a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.uint()
|> map(fn: (r) => ({r with _value: bitwise.uclear(a: r._value, b: uint(v: 3))}))
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551614 | 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 | 18446744073709551613 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 13 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
#### Output data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551612 | t1 |
| 2021-01-01T00:00:10Z | 8 | t1 |
| 2021-01-01T00:00:20Z | 4 | t1 |
| 2021-01-01T00:00:30Z | 16 | t1 |
| 2021-01-01T00:00:40Z | 12 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 16 | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | 18446744073709551612 | t2 |
| 2021-01-01T00:00:30Z | 16 | t2 |
| 2021-01-01T00:00:40Z | 12 | t2 |
| 2021-01-01T00:00:50Z | 0 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,130 @@
---
title: bitwise.ulshift() function
description: >
`bitwise.ulshift()` shifts the bits in `a` left by `b` bits.
Both `a` and `b` are unsigned integers.
menu:
flux_0_x_ref:
name: bitwise.ulshift
parent: bitwise
identifier: bitwise/ulshift
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/bitwise/bitwise.flux#L175-L175
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.ulshift()` shifts the bits in `a` left by `b` bits.
Both `a` and `b` are unsigned integers.
##### Function type signature
```js
(a: uint, b: uint) => uint
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Number of bits to shift.
## Examples
- [Shift bits left in an unsigned integer](#shift-bits-left-in-an-unsigned-integer)
- [Shift bits left in unsigned integers in a stream of tables](#shift-bits-left-in-unsigned-integers-in-a-stream-of-tables)
### Shift bits left in an unsigned integer
```js
import "bitwise"
bitwise.ulshift(a: uint(v: 1234), b: uint(v: 2))// Returns 4936 (uint)
```
### Shift bits left in unsigned integers in a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.uint()
|> map(fn: (r) => ({r with _value: bitwise.ulshift(a: r._value, b: uint(v: 3))}))
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551614 | 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 | 18446744073709551613 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 13 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
#### Output data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551600 | t1 |
| 2021-01-01T00:00:10Z | 80 | t1 |
| 2021-01-01T00:00:20Z | 56 | t1 |
| 2021-01-01T00:00:30Z | 136 | t1 |
| 2021-01-01T00:00:40Z | 120 | t1 |
| 2021-01-01T00:00:50Z | 32 | t1 |
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 152 | t2 |
| 2021-01-01T00:00:10Z | 32 | t2 |
| 2021-01-01T00:00:20Z | 18446744073709551592 | t2 |
| 2021-01-01T00:00:30Z | 152 | t2 |
| 2021-01-01T00:00:40Z | 104 | t2 |
| 2021-01-01T00:00:50Z | 8 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,122 @@
---
title: bitwise.unot() function
description: >
`bitwise.unot()` inverts every bit in `a`, an unsigned integer.
menu:
flux_0_x_ref:
name: bitwise.unot
parent: bitwise
identifier: bitwise/unot
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/bitwise/bitwise.flux#L93-L93
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.unot()` inverts every bit in `a`, an unsigned integer.
##### Function type signature
```js
(a: uint) => uint
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Unsigned integer to invert.
## Examples
- [Invert bits in an unsigned integer](#invert-bits-in-an-unsigned-integer)
- [Invert bits in unsigned integers in a stream of tables](#invert-bits-in-unsigned-integers-in-a-stream-of-tables)
### Invert bits in an unsigned integer
```js
import "bitwise"
bitwise.unot(a: uint(v: 1234))// Returns 18446744073709550381 (uint)
```
### Invert bits in unsigned integers in a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.uint()
|> map(fn: (r) => ({r with _value: bitwise.unot(a: r._value)}))
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551614 | 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 | 18446744073709551613 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 13 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
#### Output data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 1 | t1 |
| 2021-01-01T00:00:10Z | 18446744073709551605 | t1 |
| 2021-01-01T00:00:20Z | 18446744073709551608 | t1 |
| 2021-01-01T00:00:30Z | 18446744073709551598 | t1 |
| 2021-01-01T00:00:40Z | 18446744073709551600 | t1 |
| 2021-01-01T00:00:50Z | 18446744073709551611 | t1 |
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551596 | t2 |
| 2021-01-01T00:00:10Z | 18446744073709551611 | t2 |
| 2021-01-01T00:00:20Z | 2 | t2 |
| 2021-01-01T00:00:30Z | 18446744073709551596 | t2 |
| 2021-01-01T00:00:40Z | 18446744073709551602 | t2 |
| 2021-01-01T00:00:50Z | 18446744073709551614 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,128 @@
---
title: bitwise.uor() function
description: >
`bitwise.uor()` performs the bitwise operation, `a OR b`, with unsigned integers.
menu:
flux_0_x_ref:
name: bitwise.uor
parent: bitwise
identifier: bitwise/uor
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/bitwise/bitwise.flux#L67-L67
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.uor()` performs the bitwise operation, `a OR b`, with unsigned integers.
##### Function type signature
```js
(a: uint, b: uint) => uint
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Right hand operand.
## Examples
- [Perform a bitwise OR operation](#perform-a-bitwise-or-operation)
- [Perform a bitwise OR operation on a stream of tables](#perform-a-bitwise-or-operation-on-a-stream-of-tables)
### Perform a bitwise OR operation
```js
import "bitwise"
bitwise.uor(a: uint(v: 1234), b: uint(v: 4567))// Returns 5591 (uint)
```
### Perform a bitwise OR operation on a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.uint()
|> map(fn: (r) => ({r with _value: bitwise.uor(a: r._value, b: uint(v: 3))}))
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551614 | 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 | 18446744073709551613 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 13 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
#### Output data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551615 | t1 |
| 2021-01-01T00:00:10Z | 11 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 19 | t1 |
| 2021-01-01T00:00:40Z | 15 | t1 |
| 2021-01-01T00:00:50Z | 7 | t1 |
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 19 | t2 |
| 2021-01-01T00:00:10Z | 7 | t2 |
| 2021-01-01T00:00:20Z | 18446744073709551615 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 15 | t2 |
| 2021-01-01T00:00:50Z | 3 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,130 @@
---
title: bitwise.urshift() function
description: >
`bitwise.urshift()` shifts the bits in `a` right by `b` bits.
Both `a` and `b` are unsigned integers.
menu:
flux_0_x_ref:
name: bitwise.urshift
parent: bitwise
identifier: bitwise/urshift
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/bitwise/bitwise.flux#L203-L203
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.urshift()` shifts the bits in `a` right by `b` bits.
Both `a` and `b` are unsigned integers.
##### Function type signature
```js
(a: uint, b: uint) => uint
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Number of bits to shift.
## Examples
- [Shift bits right in an unsigned integer](#shift-bits-right-in-an-unsigned-integer)
- [Shift bits right in unsigned integers in a stream of tables](#shift-bits-right-in-unsigned-integers-in-a-stream-of-tables)
### Shift bits right in an unsigned integer
```js
import "bitwise"
bitwise.urshift(a: uint(v: 1234), b: uint(v: 2))// Returns 308 (uint)
```
### Shift bits right in unsigned integers in a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.uint()
|> map(fn: (r) => ({r with _value: bitwise.urshift(a: r._value, b: uint(v: 3))}))
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551614 | 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 | 18446744073709551613 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 13 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
#### Output data
| _time | _value | *tag |
| -------------------- | ------------------- | ---- |
| 2021-01-01T00:00:00Z | 2305843009213693951 | t1 |
| 2021-01-01T00:00:10Z | 1 | t1 |
| 2021-01-01T00:00:20Z | 0 | t1 |
| 2021-01-01T00:00:30Z | 2 | t1 |
| 2021-01-01T00:00:40Z | 1 | t1 |
| 2021-01-01T00:00:50Z | 0 | t1 |
| _time | _value | *tag |
| -------------------- | ------------------- | ---- |
| 2021-01-01T00:00:00Z | 2 | t2 |
| 2021-01-01T00:00:10Z | 0 | t2 |
| 2021-01-01T00:00:20Z | 2305843009213693951 | t2 |
| 2021-01-01T00:00:30Z | 2 | t2 |
| 2021-01-01T00:00:40Z | 1 | t2 |
| 2021-01-01T00:00:50Z | 0 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -0,0 +1,128 @@
---
title: bitwise.uxor() function
description: >
`bitwise.uxor()` performs the bitwise operation, `a XOR b`, with unsigned integers.
menu:
flux_0_x_ref:
name: bitwise.uxor
parent: bitwise
identifier: bitwise/uxor
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/bitwise/bitwise.flux#L120-L120
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`bitwise.uxor()` performs the bitwise operation, `a XOR b`, with unsigned integers.
##### Function type signature
```js
(a: uint, b: uint) => uint
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
## Parameters
### a
({{< req >}})
Left hand operand.
### b
({{< req >}})
Right hand operand.
## Examples
- [Perform a bitwise XOR operation](#perform-a-bitwise-xor-operation)
- [Perform a bitwise XOR operation on a stream of tables](#perform-a-bitwise-xor-operation-on-a-stream-of-tables)
### Perform a bitwise XOR operation
```js
import "bitwise"
bitwise.uxor(a: uint(v: 1234), b: uint(v: 4567))// Returns 5381 (uint)
```
### Perform a bitwise XOR operation on a stream of tables
```js
import "bitwise"
import "sampledata"
sampledata.uint()
|> map(fn: (r) => ({r with _value: bitwise.uxor(a: r._value, b: uint(v: 3))}))
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551614 | 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 | 18446744073709551613 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 13 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
#### Output data
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 18446744073709551613 | t1 |
| 2021-01-01T00:00:10Z | 9 | t1 |
| 2021-01-01T00:00:20Z | 4 | t1 |
| 2021-01-01T00:00:30Z | 18 | t1 |
| 2021-01-01T00:00:40Z | 12 | t1 |
| 2021-01-01T00:00:50Z | 7 | t1 |
| _time | _value | *tag |
| -------------------- | -------------------- | ---- |
| 2021-01-01T00:00:00Z | 16 | t2 |
| 2021-01-01T00:00:10Z | 7 | t2 |
| 2021-01-01T00:00:20Z | 18446744073709551614 | t2 |
| 2021-01-01T00:00:30Z | 16 | t2 |
| 2021-01-01T00:00:40Z | 14 | t2 |
| 2021-01-01T00:00:50Z | 2 | t2 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -69,6 +69,7 @@ import "sampledata"
sampledata.float()
|> anomalydetection.mad(threshold: 1.0)
```
{{< expand-wrapper >}}

View File

@ -85,5 +85,6 @@ import "sampledata"
sampledata.float()
|> statsmodels.linearRegression()
```

View File

@ -184,5 +184,6 @@ alerta.alert(
type: "exampleAlertType",
timestamp: now(),
)
```

View File

@ -57,5 +57,6 @@ import "contrib/bonitoo-io/hex"
hex.bytes(v: "FF5733")// Returns [255 87 51] (bytes)
```

View File

@ -57,5 +57,6 @@ import "contrib/bonitoo-io/hex"
hex.int(v: "4d2")// Returns 1234
```

View File

@ -68,6 +68,7 @@ import "contrib/bonitoo-io/hex"
hex.string(v: 1234)// Returns 4d2
```
@ -78,6 +79,7 @@ import "contrib/bonitoo-io/hex"
hex.string(v: true)// Returns "true"
```
@ -88,6 +90,7 @@ import "contrib/bonitoo-io/hex"
hex.string(v: 1m)// Returns "1m"
```
@ -98,6 +101,7 @@ import "contrib/bonitoo-io/hex"
hex.string(v: 2021-01-01T00:00:00Z)// Returns "2021-01-01T00:00:00Z"
```
@ -108,6 +112,7 @@ import "contrib/bonitoo-io/hex"
hex.string(v: 1234)// Returns "4d2"
```
@ -118,6 +123,7 @@ import "contrib/bonitoo-io/hex"
hex.string(v: uint(v: 5678))// Returns "162e"
```
@ -128,6 +134,7 @@ import "contrib/bonitoo-io/hex"
hex.string(v: 10.12)// Returns "10.12"
```
@ -138,6 +145,7 @@ import "contrib/bonitoo-io/hex"
hex.string(v: bytes(v: "Hello world!"))// Returns "48656c6c6f20776f726c6421"
```
@ -157,6 +165,7 @@ data =
data
|> map(fn: (r) => ({r with _value: hex.string(v: r.foo)}))
```
{{< expand-wrapper >}}

View File

@ -57,5 +57,6 @@ import "contrib/bonitoo-io/hex"
hex.uint(v: "4d2")// Returns 1234
```

View File

@ -175,5 +175,6 @@ servicenow.event(
"info",
additionalInfo: {"devId": r.dev_id},
)
```

View File

@ -171,5 +171,6 @@ from(bucket: "example-bucket")
warn: (r) => r._value > 20,
info: (r) => r._value > 10,
)
```

View File

@ -145,5 +145,6 @@ from(bucket: "example-bucket")
measurement: "pulse",
threshold: 2,
)
```

View File

@ -77,5 +77,6 @@ tickscript.defineCheck(id: "000000000000", name: "Example check name")// Returns
// tags: {}
// }
```

View File

@ -65,6 +65,7 @@ import "contrib/bonitoo-io/tickscript"
data
|> tickscript.groupBy(columns: ["host", "region"])
```
{{< expand-wrapper >}}

View File

@ -97,6 +97,7 @@ states =
|> group(columns: ["host"])
tickscript.join(tables: {metric: metrics, state: states}, on: ["_time", "host"], measurement: "example-m")
```
{{< expand-wrapper >}}

View File

@ -92,6 +92,7 @@ import "sampledata"
sampledata.int()
|> tickscript.select(as: "example-name")
```
{{< expand-wrapper >}}
@ -149,6 +150,7 @@ import "sampledata"
sampledata.int()
|> tickscript.select(as: "sum", fn: sum)
```
{{< expand-wrapper >}}
@ -196,6 +198,7 @@ import "sampledata"
sampledata.int()
|> tickscript.select(as: "max", fn: max)
```
{{< expand-wrapper >}}

View File

@ -104,6 +104,7 @@ import "contrib/bonitoo-io/tickscript"
data
|> tickscript.selectWindow(fn: sum, as: "example-name", every: 1h, defaultValue: 0)
```
{{< expand-wrapper >}}

View File

@ -127,5 +127,6 @@ victorops.alert(
entityDisplayName: "Example Alert 1",
stateMessage: "Last reported cpu_idle was ${string(v: r._value)}.",
)
```

View File

@ -200,5 +200,6 @@ zenoss.event(
else
"Clear",
)
```

View File

@ -102,5 +102,6 @@ discord.send(
content: "The current status is \"${lastReported.status}\".",
avatar_url: "https://staff-photos.net/pic.jpg",
)
```

View File

@ -85,6 +85,7 @@ import "contrib/jsternberg/aggregate"
sampledata.float()
|> aggregate.table(columns: {"min_bottom_degrees": aggregate.min(column: "_value")})
```
{{< expand-wrapper >}}

View File

@ -112,6 +112,7 @@ InfluxDB [API token](https://docs.influxdata.com/influxdb/latest/security/tokens
import "contrib/jsternberg/influxdb"
influxdb.from(bucket: "example-bucket")
```
@ -121,6 +122,7 @@ influxdb.from(bucket: "example-bucket")
import "contrib/jsternberg/influxdb"
influxdb.from(bucketID: "0261d8287f4d6000")
```
@ -133,5 +135,6 @@ import "influxdata/influxdb/secrets"
token = secrets.get(key: "INFLUXDB_CLOUD_TOKEN")
from(bucket: "example-bucket", host: "https://us-west-2-1.aws.cloud2.influxdata.com", org: "example-org", token: token)
```

View File

@ -146,6 +146,7 @@ InfluxDB [API token](https://docs.influxdata.com/influxdb/latest/security/tokens
import "contrib/jsternberg/influxdb"
influxdb.select(from: "example-bucket", start: -1d, m: "example-measurement", fields: ["field1"])
```
@ -155,6 +156,7 @@ influxdb.select(from: "example-bucket", start: -1d, m: "example-measurement", fi
import "contrib/jsternberg/influxdb"
influxdb.select(from: "example-bucket", start: -1d, m: "example-measurement", fields: ["field1", "field2", "field3"])
```
@ -169,6 +171,7 @@ influxdb.select(
m: "example-measurement",
where: (r) => r.host == "host1" and r.region == "us-west",
)
```
@ -189,5 +192,6 @@ influxdb.select(
org: "example-org",
token: token,
)
```

View File

@ -111,5 +111,6 @@ bigpanda.sendAlert(
description: "${lastReported._field} is ${lastReported.status}: ${string(v: lastReported._value)}",
},
)
```

View File

@ -66,6 +66,7 @@ import "contrib/rhajek/bigpanda"
bigpanda.statusFromLevel(level: "crit")// Returns "critical"
```
@ -78,6 +79,7 @@ import "contrib/rhajek/bigpanda"
data
|> map(fn: (r) => ({r with big_panda_status: bigpanda.statusFromLevel(level: r._level)}))
```
{{< expand-wrapper >}}

View File

@ -160,5 +160,6 @@ opsgenie.sendAlert(
alias: "example-disk-usage",
responders: ["user:john@example.com", "team:itcrowd"],
)
```

View File

@ -144,5 +144,6 @@ sensu.event(
checkName: "diskUsage",
text: "Disk usage is **${lastReported.status}**.",
)
```

View File

@ -58,5 +58,6 @@ import "contrib/sranka/sensu"
sensu.toSensuName(v: "Example name conversion")// Returns "Example_name_conversion"
```

View File

@ -89,5 +89,6 @@ teams.message(
text: "Disk usage is: *${lastReported.status}*.",
summary: "Disk usage is ${lastReported.status}",
)
```

View File

@ -117,5 +117,6 @@ crit_statuses =
crit_statuses
|> endpoint(mapFn: (r) => ({channel: "-12345", text: "Disk usage is **${r.status}**.", silent: true}))()
```

View File

@ -116,5 +116,6 @@ lastReported =
|> findRecord(fn: (key) => true, idx: 0)
telegram.message(token: token, channel: "-12345", text: "Disk usage is **${lastReported.status}**.")
```

View File

@ -104,5 +104,6 @@ webexteams.message(
text: "Disk usage is ${lastReported.status}.",
markdown: "Disk usage is **${lastReported.status}**.",
)
```

View File

@ -115,6 +115,7 @@ import "contrib/tomhollingworth/events"
data
|> events.duration(unit: 1m, stop: 2020-01-02T00:00:00Z)
```
{{< expand-wrapper >}}
@ -170,6 +171,7 @@ union(
],
)
|> pivot(rowKey: ["_time", "state"], columnKey: ["function"], valueColumn: "value")
```
{{< expand-wrapper >}}

View File

@ -80,6 +80,7 @@ header row and all subsequent rows as data.
import "csv"
csv.from(file: "path/to/data-file.csv")
```
@ -89,6 +90,7 @@ csv.from(file: "path/to/data-file.csv")
import "csv"
csv.from(file: "/path/to/data-file.csv", mode: "raw")
```
@ -112,6 +114,7 @@ csvData =
"
csv.from(csv: csvData)
```
{{< expand-wrapper >}}
@ -151,6 +154,7 @@ _start,_stop,_time,region,host,_value
"
csv.from(csv: csvData, mode: "raw")
```
{{< expand-wrapper >}}

View File

@ -74,6 +74,7 @@ import "date"
date.add(d: 6h, to: 2019-09-16T12:00:00Z)// Returns 2019-09-16T18:00:00.000000000Z
```
@ -90,6 +91,7 @@ option now = () => 2021-12-10T16:27:40Z
date.add(d: 1mo, to: -1d)// Returns 2022-01-09T16:27:40Z
```
@ -102,5 +104,6 @@ option now = () => 2022-01-01T12:00:00Z
date.add(d: 6h, to: 3h)// Returns 2022-01-01T21:00:00.000000000Z
```

View File

@ -55,6 +55,7 @@ option now = () => 2021-12-30T00:40:44Z
boundaries.friday()// Returns {start: 2021-12-24T08:00:00Z, stop:2022-12-25T08:00:00Z }
```
@ -67,5 +68,6 @@ day = boundaries.friday()
from(bucket: "example-bucket")
|> range(start: day.start, stop: day.stop)
```

View File

@ -57,6 +57,7 @@ option now = () => 2021-12-30T00:40:44Z
boundaries.monday()// Returns {start: 2021-12-27T08:00:00Z, stop:2021-12-28T08:00:00Z }
```
@ -69,5 +70,6 @@ day = boundaries.monday()
from(bucket: "example-bucket")
|> range(start: day.start, stop: day.stop)
```

View File

@ -64,6 +64,7 @@ option now = () => 2022-05-10T10:10:00Z
boundaries.month()// Returns {start:2022-05-01T00:00:00.000000000Z, stop:2022-06-01T00:00:00.000000000Z}
```
@ -76,6 +77,7 @@ thisMonth = boundaries.month()
from(bucket: "example-bucket")
|> range(start: thisMonth.start, stop: thisMonth.stop)
```
@ -88,5 +90,6 @@ lastMonth = boundaries.month(month_offset: -1)
from(bucket: "example-bucket")
|> range(start: lastMonth.start, stop: lastMonth.stop)
```

View File

@ -55,6 +55,7 @@ option now = () => 2021-12-30T00:40:44Z
boundaries.saturday()// Returns {start: 2022-12-25T08:00:00Z, stop:2022-12-26T08:00:00Z }
```
@ -67,5 +68,6 @@ day = boundaries.saturday()
from(bucket: "example-bucket")
|> range(start: day.start, stop: day.stop)
```

View File

@ -55,6 +55,7 @@ option now = () => 2021-12-30T00:40:44Z
boundaries.sunday()// Returns {start: 2021-12-26T08:00:00Z, stop:2021-12-27T08:00:00Z }
```
@ -67,5 +68,6 @@ day = boundaries.sunday()
from(bucket: "example-bucket")
|> range(start: day.start, stop: day.stop)
```

View File

@ -55,6 +55,7 @@ option now = () => 2021-12-30T00:40:44Z
boundaries.thursday()// Returns {start: 2021-12-23T08:00:00Z, stop:2021-12-24T08:00:00Z }
```
@ -67,5 +68,6 @@ day = boundaries.thursday()
from(bucket: "example-bucket")
|> range(start: day.start, stop: day.stop)
```

View File

@ -55,6 +55,7 @@ option now = () => 2021-12-30T00:40:44Z
boundaries.tuesday()// Returns {start: 2021-12-28T08:00:00Z, stop:2021-12-29T08:00:00Z }
```
@ -67,5 +68,6 @@ day = boundaries.tuesday()
from(bucket: "example-bucket")
|> range(start: day.start, stop: day.stop)
```

View File

@ -51,6 +51,7 @@ day = boundaries.wednesday()
from(bucket: "example-bucket")
|> range(start: day.start, stop: day.stop)
```
This will return all records from Wednesday this week

View File

@ -73,6 +73,7 @@ option now = () => 2022-05-10T00:00:00.00001Z
boundaries.week()// Returns {start: 2022-05-09T00:00:00.000000000Z, stop: 2022-05-16T00:00:00.000000000Z}
```
@ -87,6 +88,7 @@ boundaries.week(
start_sunday: true,
)// Returns {start: 2022-05-08T00:00:00.000000000Z, stop: 2022-05-14T00:00:00.000000000Z}
```
@ -99,6 +101,7 @@ thisWeek = boundaries.week()
from(bucket: "example-bucket")
|> range(start: thisWeek.start, stop: thisWeek.stop)
```
@ -111,5 +114,6 @@ lastWeek = boundaries.week(week_offset: -1)
from(bucket: "example-bucket")
|> range(start: lastWeek.start, stop: lastWeek.stop)
```

View File

@ -55,6 +55,7 @@ option now = () => 2022-01-02T13:45:28Z
boundaries.yesterday()// Returns {start: 2022-01-01T00:00:00.000000000Z, stop: 2022-01-02T00:00:00.000000000Z}
```
@ -67,5 +68,6 @@ day = boundaries.yesterday()
from(bucket: "example-bucket")
|> range(start: day.start, stop: day.stop)
```

View File

@ -67,6 +67,7 @@ import "date"
date.hour(t: 2020-02-11T12:21:03.29353494Z)// Returns 12
```
@ -79,5 +80,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.hour(t: -8h)// Returns 7
```

View File

@ -62,6 +62,7 @@ import "date"
date.microsecond(t: 2020-02-11T12:21:03.29353494Z)// Returns 293534
```
@ -74,5 +75,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.microsecond(t: -1890us)// Returns 322661
```

View File

@ -62,6 +62,7 @@ import "date"
date.millisecond(t: 2020-02-11T12:21:03.29353494Z)// Returns 293
```
@ -74,5 +75,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.millisecond(t: -150ms)// Returns 127
```

View File

@ -67,6 +67,7 @@ import "date"
date.minute(t: 2020-02-11T12:21:03.29353494Z)// Returns 21
```
@ -79,5 +80,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.minute(t: -45m)// Returns 6
```

View File

@ -67,6 +67,7 @@ import "date"
date.month(t: 2020-02-11T12:21:03.29353494Z)// Returns 2
```
@ -79,5 +80,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.month(t: -3mo)// Returns 8
```

View File

@ -69,6 +69,7 @@ import "date"
date.monthDay(t: 2020-02-11T12:21:03.29353494Z)// Returns 11
```
@ -81,5 +82,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.monthDay(t: -8d)// Returns 25
```

View File

@ -62,6 +62,7 @@ import "date"
date.nanosecond(t: 2020-02-11T12:21:03.29353494Z)// Returns 293534940
```
@ -74,5 +75,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.nanosecond(t: -2111984ns)// Returns 128412016
```

View File

@ -67,6 +67,7 @@ import "date"
date.quarter(t: 2020-02-11T12:21:03.29353494Z)// Returns 1
```
@ -79,5 +80,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.quarter(t: -7mo)// Returns 2
```

View File

@ -69,6 +69,7 @@ d = date.scale(d: 1h, n: n)
date.add(d: d, to: 2022-05-10T00:00:00Z)// Returns 2022-05-10T00:00:00.000000000Z
```
@ -82,5 +83,6 @@ d = date.scale(d: 1mo1h, n: 5)
date.add(d: d, to: 2022-01-01T00:00:00Z)// Returns 2022-06-01T05:00:00.000000000Z
```

View File

@ -60,6 +60,7 @@ import "date"
date.second(t: 2020-02-11T12:21:03.29353494Z)// Returns 3
```
@ -72,5 +73,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.second(t: -50s)// Returns 28
```

View File

@ -74,6 +74,7 @@ import "date"
date.sub(from: 2019-09-16T12:00:00Z, d: 6h)// Returns 2019-09-16T06:00:00.000000000Z
```
@ -86,6 +87,7 @@ option now = () => 2022-01-01T12:00:00Z
date.sub(d: 6h, from: -3h)// Returns 2022-01-01T03:00:00.000000000Z
```
@ -102,5 +104,6 @@ option now = () => 2021-12-10T16:27:40Z
date.sub(from: -1h, d: 2d)// Returns 2021-12-08T15:27:40Z
```

View File

@ -69,6 +69,7 @@ import "date"
date.time(t: 2020-02-11T12:21:03.29353494Z)// Returns 2020-02-11T12:21:03.293534940Z
```
@ -81,5 +82,6 @@ option now = () => 2022-01-01T00:00:00Z
date.time(t: -1h)// Returns 2021-12-31T23:00:00.000000000Z
```

View File

@ -92,6 +92,7 @@ date.truncate(t: 2019-06-03T13:59:01Z, unit: 1mo)
// Returns 2019-05-31T22:00:00.000000000Z
date.truncate(t: 2019-06-03T13:59:01Z, unit: 1y)// Returns 2018-12-31T23:00:00.000000000Z
```
@ -110,5 +111,6 @@ date.truncate(t: -1m, unit: 1m)
// Returns 2019-12-31T23:59:00.000000000Z
date.truncate(t: -1h, unit: 1h)// Returns 2019-12-31T23:00:00.000000000Z
```

View File

@ -69,6 +69,7 @@ import "date"
date.week(t: 2020-02-11T12:21:03.29353494Z)// Returns 7
```
@ -81,5 +82,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.week(t: -12d)// Returns 42
```

View File

@ -69,6 +69,7 @@ import "date"
date.weekDay(t: 2020-02-11T12:21:03.29353494Z)// Returns 2
```
@ -81,5 +82,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.weekDay(t: -84h)// Returns 6
```

View File

@ -67,6 +67,7 @@ import "date"
date.year(t: 2020-02-11T12:21:03.29353494Z)// Returns 2020
```
@ -79,5 +80,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.year(t: -14y)// Returns 2007
```

View File

@ -69,6 +69,7 @@ import "date"
date.yearDay(t: 2020-02-11T12:21:03.29353494Z)// Returns 42
```
@ -81,5 +82,6 @@ option now = () => 2020-02-11T12:21:03.29353494Z
date.yearDay(t: -1mo)// Returns 276
```

View File

@ -58,5 +58,6 @@ import "dict"
d = dict.fromList(pairs: [{key: 1, value: "foo"}, {key: 2, value: "bar"}])// Returns [1: "foo", 2: "bar"]
```

View File

@ -73,5 +73,6 @@ d = [1: "foo", 2: "bar"]
dict.get(dict: d, key: 1, default: "")// Returns "foo"
```

View File

@ -78,6 +78,7 @@ d = [1: "foo", 2: "bar"]
dict.insert(dict: d, key: 3, value: "baz")// Returns [1: "foo", 2: "bar", 3: "baz"]
```
@ -90,5 +91,6 @@ d = [1: "foo", 2: "bar"]
dict.insert(dict: d, key: 2, value: "baz")// Returns [1: "foo", 2: "baz"]
```

View File

@ -67,5 +67,6 @@ d = [1: "foo", 2: "bar"]
dict.remove(dict: d, key: 1)// Returns [2: "bar"]
```

View File

@ -76,6 +76,7 @@ import "experimental"
experimental.addDuration(d: 6h, to: 2019-09-16T12:00:00Z)// Returns 2019-09-16T18:00:00.000000000Z
```
@ -92,6 +93,7 @@ option now = () => 2021-12-10T16:27:40Z
experimental.addDuration(d: 1mo, to: -1d)// Returns 2022-01-09T16:27:40Z
```
@ -104,5 +106,6 @@ option now = () => 2022-01-01T12:00:00Z
experimental.addDuration(d: 6h, to: 3h)// Returns 2022-01-01T21:00:00.000000000Z
```

View File

@ -82,6 +82,7 @@ data =
data
|> aggregate.rate(every: 30s, unit: 1s, groupColumns: ["tag"])
```
{{< expand-wrapper >}}

View File

@ -72,6 +72,7 @@ import "experimental"
data
|> window(every: 1mo)
|> experimental.alignTime(alignTo: 2021-01-01T00:00:00Z)
```
{{< expand-wrapper >}}

View File

@ -36,7 +36,7 @@ Import the `experimental/array` package:
import "experimental/array"
```
**Deprecated**: This package is deprecated in favor of [`array`](https://docs.influxdata.com/flux/v0.x/stdlib/array/).
## Functions

View File

@ -10,6 +10,7 @@ menu:
weight: 201
introduced: 0.155.0
deprecated: 0.172.0
---
<!------------------------------------------------------------------------------
@ -21,7 +22,7 @@ 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/array/array.flux#L84-L84
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L88-L88
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,7 +31,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`array.concat()` appends two arrays and returns a new array.
**Deprecated**: `concat()` is deprecated in favor of [`concat()`](https://docs.influxdata.com/flux/v0.x/stdlib/array/concat).
Neither input array is mutated and a new array is returned.
@ -72,6 +73,7 @@ c = a |> array.concat(v: b)
// Returns [1, 2, 3, 4, 5, 6]
// Output each value in the array as a row in a table
array.from(rows: c |> array.map(fn: (x) => ({_value: x})))
```
{{< expand-wrapper >}}

View File

@ -11,6 +11,7 @@ menu:
weight: 201
introduced: 0.155.0
deprecated: 0.172.0
---
<!------------------------------------------------------------------------------
@ -22,7 +23,7 @@ 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/array/array.flux#L136-L136
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L146-L146
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -32,7 +33,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`array.filter()` iterates over an array, evaluates each element with a predicate function, and then returns
a new array with only elements that match the predicate.
**Deprecated**: `filter()` is deprecated in favor of [`filter()`](https://docs.influxdata.com/flux/v0.x/stdlib/array/filter).
##### Function type signature
@ -77,6 +78,7 @@ b = a |> array.filter(fn: (x) => x >= 3)
// b returns [3, 4, 5]
// Output the filtered array as a table
array.from(rows: b |> array.map(fn: (x) => ({_value: x})))
```
{{< expand-wrapper >}}

View File

@ -21,7 +21,7 @@ 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/array/array.flux#L56-L56
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L57-L57
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -30,9 +30,8 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`array.from()` constructs a table from an array of records.
The `experimental/array.from()` function was promoted to the `array` package in
Flux 0.103.0. This function is available for backwards compatibility, but we
recommend using the `array` package instead.
**Deprecated**: `from()` is deprecated in favor of [`from()`](https://docs.influxdata.com/flux/v0.x/stdlib/array/from).
This function is available for backwards compatibility, but we recommend using the `array` package instead.
Each record in the array is converted into an output row or record. All
@ -68,6 +67,7 @@ import "experimental/array"
rows = [{foo: "bar", baz: 21.2}, {foo: "bar", baz: 23.8}]
array.from(rows: rows)
```
{{< expand-wrapper >}}
@ -94,5 +94,6 @@ tags = v1.tagValues(bucket: "example-bucket", tag: "host")
wildcard_tag = array.from(rows: [{_value: "*"}])
union(tables: [tags, wildcard_tag])
```

View File

@ -11,6 +11,7 @@ menu:
weight: 201
introduced: 0.155.0
deprecated: 0.172.0
---
<!------------------------------------------------------------------------------
@ -22,7 +23,7 @@ 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/array/array.flux#L109-L109
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L116-L116
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -32,7 +33,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`array.map()` iterates over an array, applies a function to each element to produce a new element,
and then returns a new array.
**Deprecated**: `map()` is deprecated in favor of [`map()`](https://docs.influxdata.com/flux/v0.x/stdlib/array/map).
##### Function type signature
@ -76,6 +77,7 @@ b = a |> array.map(fn: (x) => ({_value: x}))
// b returns [{_value: 1}, {_value: 2}, {_value: 3}, {_value: 4}, {_value: 5}]
// Output the array of records as a table
array.from(rows: b)
```
{{< expand-wrapper >}}

View File

@ -77,5 +77,6 @@ Cloud Bigtable table name.
import "experimental/bigtable"
bigtable.from(token: "example-token", project: "example-project", instance: "example-instance", table: "example-table")
```

View File

@ -11,6 +11,7 @@ weight: 21
cascade:
flux/v0.x/tags: [bitwise]
introduced: 0.138.0
deprecated: 0.173.0
---
<!------------------------------------------------------------------------------
@ -36,6 +37,8 @@ Import the `experimental/bitwise` package:
import "experimental/bitwise"
```
**Deprecated**: This package is deprecated in favor of [`bitwise`](https://docs.influxdata.com/flux/v0.x/stdlib/bitwise/).
All integers are 64 bit integers.
Functions prefixed with s operate on signed integers (int).

View File

@ -19,7 +19,7 @@ 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/bitwise/bitwise.flux#L230-L230
https://github.com/influxdata/flux/blob/master/stdlib/experimental/bitwise/bitwise.flux#L251-L251
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -28,7 +28,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`bitwise.sand()` performs the bitwise operation, `a AND b`, with integers.
**Deprecated**: `sand` is deprecated in favor of [`bitwise`](https://docs.influxdata.com/flux/v0.x/stdlib/bitwise/sand/).
##### Function type signature
@ -65,6 +65,7 @@ import "experimental/bitwise"
bitwise.sand(a: 1234, b: 4567)// Returns 210
```
@ -76,6 +77,7 @@ import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.sand(a: r._value, b: 3)}))
```
{{< expand-wrapper >}}

View File

@ -20,7 +20,7 @@ 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/bitwise/bitwise.flux#L338-L338
https://github.com/influxdata/flux/blob/master/stdlib/experimental/bitwise/bitwise.flux#L367-L367
Contributing to Flux: https://github.com/influxdata/flux#contributing
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
`bitwise.sclear()` performs the bitwise operation `a AND NOT b`.
Both `a` and `b` are integers.
**Deprecated**: `sclear` is deprecated in favor of [`bitwise`](https://docs.influxdata.com/flux/v0.x/stdlib/bitwise/sclear/).
##### Function type signature
@ -67,6 +67,7 @@ import "experimental/bitwise"
bitwise.sclear(a: 1234, b: 4567)// Returns 1024
```
@ -78,6 +79,7 @@ import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.sclear(a: r._value, b: 3)}))
```
{{< expand-wrapper >}}

View File

@ -20,7 +20,7 @@ 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/bitwise/bitwise.flux#L366-L366
https://github.com/influxdata/flux/blob/master/stdlib/experimental/bitwise/bitwise.flux#L397-L397
Contributing to Flux: https://github.com/influxdata/flux#contributing
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
`bitwise.slshift()` shifts the bits in `a` left by `b` bits.
Both `a` and `b` are integers.
**Deprecated**: `slshift` is deprecated in favor of [`bitwise`](https://docs.influxdata.com/flux/v0.x/stdlib/bitwise/slshift/).
##### Function type signature
@ -67,6 +67,7 @@ import "experimental/bitwise"
bitwise.slshift(a: 1234, b: 2)// Returns 4936
```
@ -78,6 +79,7 @@ import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.slshift(a: r._value, b: 3)}))
```
{{< expand-wrapper >}}

View File

@ -19,7 +19,7 @@ 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/bitwise/bitwise.flux#L283-L283
https://github.com/influxdata/flux/blob/master/stdlib/experimental/bitwise/bitwise.flux#L308-L308
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -28,7 +28,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`bitwise.snot()` inverts every bit in `a`, an integer.
**Deprecated**: `snot` is deprecated in favor of [`bitwise`](https://docs.influxdata.com/flux/v0.x/stdlib/bitwise/snot/).
##### Function type signature
@ -59,6 +59,7 @@ import "experimental/bitwise"
bitwise.snot(a: 1234)// Returns -1235
```
@ -70,6 +71,7 @@ import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.snot(a: r._value)}))
```
{{< expand-wrapper >}}

View File

@ -19,7 +19,7 @@ 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/bitwise/bitwise.flux#L257-L257
https://github.com/influxdata/flux/blob/master/stdlib/experimental/bitwise/bitwise.flux#L280-L280
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
@ -28,7 +28,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`bitwise.sor()` performs the bitwise operation, `a OR b`, with integers.
**Deprecated**: `sor` is deprecated in favor of [`bitwise`](https://docs.influxdata.com/flux/v0.x/stdlib/bitwise/sor/).
##### Function type signature
@ -65,6 +65,7 @@ import "experimental/bitwise"
bitwise.sor(a: 1234, b: 4567)// Returns 5591
```
@ -76,6 +77,7 @@ import "sampledata"
sampledata.int()
|> map(fn: (r) => ({r with _value: bitwise.sor(a: r._value, b: 3)}))
```
{{< expand-wrapper >}}

Some files were not shown because too many files have changed in this diff Show More