Flux 0.138.0 and 0.139.0 (#3335)

* added release notes for flux 0.138 and 0.139 and related updates

* updated spec with related implementation issue

* Apply suggestions from code review

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* updated to address PR feedback, added related links to int, uint, and bitwise docs

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>
pull/3342/head
Scott Anderson 2021-11-03 09:47:58 -06:00 committed by GitHub
parent aae86f8bc9
commit 3961ad4621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 613 additions and 1 deletions

View File

@ -14,6 +14,7 @@ related:
- /flux/v0.x/stdlib/universe/int/
- /flux/v0.x/stdlib/universe/toint/
- /flux/v0.x/stdlib/contrib/bonitoo-io/hex/int/
- /flux/v0.x/stdlib/experimental/bitwise/
list_code_example: |
```js
0
@ -178,6 +179,7 @@ data
## Operate on integers
- [Perform arithmetic operations on integers](#perform-arithmetic-operations-on-integers)
- [Perform bitwise operations on integers](#perform-bitwise-operations-on-integers)
- [Compare integers](#compare-integers)
### Perform arithmetic operations on integers
@ -207,6 +209,35 @@ When operating with integer operands, fractional results are truncated at the de
// Returns 100
```
### Perform bitwise operations on integers
Use the [`experimental/bitwise` package](/flux/v0.x/stdlib/experimental/bitwise/)
to perform bitwise operations on integers.
```js
import "experimental/bitwise"
bitwise.sand(a: 12, b: 21)
// Returns 4
bitwise.sor(a: 12, b: 21)
// Returns 29
bitwise.sxor(a: 12, b: 21)
// Returns 25
bitwise.sclear(a: 12, b: 21)
// Returns 8
bitwise.snot(a: 12)
// Returns -13
bitwise.slshift(a: 12, b: 21)
// Returns 25165824
bitwise.srshift(a: 21, b: 4)
// Returns 1
```
### Compare integers
Use [Flux comparison operators](/flux/v0.x/spec/operators/#comparison-operators)
to compare integers.

View File

@ -14,6 +14,7 @@ related:
- /flux/v0.x/stdlib/universe/uint/
- /flux/v0.x/stdlib/universe/touint/
- /flux/v0.x/stdlib/contrib/bonitoo-io/hex/uint/
- /flux/v0.x/stdlib/experimental/bitwise/
list_code_example: |
```js
uint(v: 123)
@ -176,6 +177,7 @@ data
## Operate on uintegers
- [Perform arithmetic operations on uintegers](#perform-arithmetic-operations-on-uintegers)
- [Perform bitwise operations on uintegers](#perform-bitwise-operations-on-uintegers)
- [Compare uintegers](#compare-uintegers)
### Perform arithmetic operations on uintegers
@ -205,6 +207,35 @@ uint(v: 10) ^ uint(v: 2)
// Returns 100
```
### Perform bitwise operations on uintegers
Use the [`experimental/bitwise` package](/flux/v0.x/stdlib/experimental/bitwise/)
to perform bitwise operations on uintegers.
```js
import "experimental/bitwise"
bitwise.uand(a: uint(v: 12), b: uint(v: 21))
// Returns 4
bitwise.uor(a: uint(v: 12), b: uint(v: 21))
// Returns 29
bitwise.uxor(a: uint(v: 12), b: uint(v: 21))
// Returns 25
bitwise.uclear(a: uint(v: 12), b: uint(v: 21))
// Returns 8
bitwise.unot(a: uint(v: 12))
// Returns 18446744073709551603
bitwise.ulshift(a: uint(v: 12), b: uint(v: 21))
// Returns 25165824
bitwise.urshift(a: uint(v: 21), b: uint(v: 4))
// Returns 1
```
### Compare uintegers
Use [Flux comparison operators](/flux/v0.x/spec/operators/#comparison-operators)
to compare uintegers.

View File

@ -10,6 +10,30 @@ aliases:
- /influxdb/cloud/reference/release-notes/flux/
---
## v0.139.0 [2021-11-01]
### Features
- Continue type inference through errors at runtime.
### Bug fixes
- Revert `runtime.now()` and related updates.
---
## v0.138.0 [2021-11-01]
### Features
- Create a BigTable dependency to let Flux mimic or control BigTable API usage.
- Report multiple type inference errors.
- Add [bitwise operations](/flux/v0.x/stdlib/experimental/bitwise/).
### Bug fixes
- Update [`fill()`](/flux/v0.x/stdlib/universe/fill/) to return tables unchanged
when using `usePrevious` to fill a non-existent column.
- Add `runtime.now()` to return the same time throughout a script execution.
---
## v0.137.0 [2021-10-28]
### Features

View File

@ -108,6 +108,10 @@ Durations can be added to times to produce a new time.
3d12h4m25s // 3 days, 12 hours, 4 minutes, and 25 seconds
```
{{% note %}}
[IMPL#2026](https://github.com/influxdata/flux/issues/2026) Operator for time arithmetic
{{% /note %}}
### String types
A _string type_ represents a possibly empty sequence of characters.
Strings are immutable and cannot be modified once created.

View File

@ -0,0 +1,30 @@
---
title: Flux experimental bitwise package
list_title: bitwise package
description: >
The Flux experimental `bitwise` package provides functions for performing
bitwise operations on integers.
Import the `experimental/bitwise` package.
menu:
flux_0_x_ref:
name: bitwise
parent: experimental
weight: 301
flux/v0.x/tags: [functions, bitwise, package]
cascade:
introduced: 0.138.0
---
The Flux experimental `bitwise` package provides functions for performing bitwise
operations on integers and unsigned integers.
Import the `experimental/bitwise` package:
```js
import "experimental/bitwise"
```
## Functions
Functions prefixed with `s` operate on [signed integers (int)](/flux/v0.x/data-types/basic/int/#perform-bitwise-operations-on-integers).
Functions prefixed with `u` operate on [unsigned integers (uint)](/flux/v0.x/data-types/basic/uint/#perform-bitwise-operations-on-uintegers).
{{< children type="functions" show="pages" >}}

View File

@ -0,0 +1,36 @@
---
title: bitwise.sand() function
description: >
`bitwise.sand()` performs the bitwise operation `a AND b` with
[integer](/flux/v0.x/data-types/basic/int/) values.
menu:
flux_0_x_ref:
name: bitwise.sand
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/int/
flux/v0.x/tags: [bitwise]
---
`bitwise.sand()` performs the bitwise operation, `a AND b`, with
[integer](/flux/v0.x/data-types/basic/int/) values.
```js
import "experimental/bitwise"
bitwise.sand(
a: 12,
b: 21
)
// Returns 4
```
## Parameters
### a {data-type="int"}
Left operand.
### b {data-type="int"}
Right operand.

View File

@ -0,0 +1,36 @@
---
title: bitwise.sclear() function
description: >
`bitwise.sclear()` performs the bitwise operation `a AND NOT b` with
[integer](/flux/v0.x/data-types/basic/int/) values.
menu:
flux_0_x_ref:
name: bitwise.sclear
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/int/
flux/v0.x/tags: [bitwise]
---
`bitwise.sclear()` performs the bitwise operation, `a AND NOT b`, with
[integer](/flux/v0.x/data-types/basic/int/) values.
```js
import "experimental/bitwise"
bitwise.sclear(
a: 12,
b: 21
)
// Returns 8
```
## Parameters
### a {data-type="int"}
Left operand.
### b {data-type="int"}
Right operand.

View File

@ -0,0 +1,36 @@
---
title: bitwise.slshift() function
description: >
`bitwise.slshift()` shifts bits in `a` left by `b` bits.
Both `a` and `b` are [integers](/flux/v0.x/data-types/basic/int/).
menu:
flux_0_x_ref:
name: bitwise.slshift
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/int/
flux/v0.x/tags: [bitwise]
---
`bitwise.slshift()` shifts bits in `a` left by `b` bits.
Both `a` and `b` are [integers](/flux/v0.x/data-types/basic/int/).
```js
import "experimental/bitwise"
bitwise.slshift(
a: 12,
b: 21
)
// Returns 25165824
```
## Parameters
### a {data-type="int"}
Left operand.
### b {data-type="int"}
Number of bits to shift.

View File

@ -0,0 +1,30 @@
---
title: bitwise.snot() function
description: >
`bitwise.snot()` inverts every bit in `a`, an
[integer](/flux/v0.x/data-types/basic/int/) value.
menu:
flux_0_x_ref:
name: bitwise.snot
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/int/
flux/v0.x/tags: [bitwise]
---
`bitwise.snot()` inverts every bit in `a`, an
[integer](/flux/v0.x/data-types/basic/int/) value.
```js
import "experimental/bitwise"
bitwise.snot(a: 12)
// Returns -13
```
## Parameters
### a {data-type="int"}
Integer to invert.

View File

@ -0,0 +1,36 @@
---
title: bitwise.sor() function
description: >
`bitwise.sor()` performs the bitwise operation `a OR b` with
[integer](/flux/v0.x/data-types/basic/int/) values.
menu:
flux_0_x_ref:
name: bitwise.sor
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/int/
flux/v0.x/tags: [bitwise]
---
`bitwise.sor()` performs the bitwise operation, `a OR b`, with
[integer](/flux/v0.x/data-types/basic/int/) values.
```js
import "experimental/bitwise"
bitwise.sor(
a: 12,
b: 21
)
// Returns 29
```
## Parameters
### a {data-type="int"}
Left operand.
### b {data-type="int"}
Right operand.

View File

@ -0,0 +1,36 @@
---
title: bitwise.srshift() function
description: >
`bitwise.srshift()` shifts bits in `a` right by `b` bits.
Both `a` and `b` are [integers](/flux/v0.x/data-types/basic/int/).
menu:
flux_0_x_ref:
name: bitwise.srshift
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/int/
flux/v0.x/tags: [bitwise]
---
`bitwise.srshift()` shifts bits in `a` right by `b` bits.
Both `a` and `b` are [integers](/flux/v0.x/data-types/basic/int/).
```js
import "experimental/bitwise"
bitwise.srshift(
a: 21,
b: 4
)
// Returns 1
```
## Parameters
### a {data-type="int"}
Left operand.
### b {data-type="int"}
Number of bits to shift.

View File

@ -0,0 +1,36 @@
---
title: bitwise.sxor() function
description: >
`bitwise.sxor()` performs the bitwise operation `a XOR b` with
[integer](/flux/v0.x/data-types/basic/int/) values.
menu:
flux_0_x_ref:
name: bitwise.sxor
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/int/
flux/v0.x/tags: [bitwise]
---
`bitwise.sxor()` performs the bitwise operation, `a XOR b`, with
[integer](/flux/v0.x/data-types/basic/int/) values.
```js
import "experimental/bitwise"
bitwise.sxor(
a: 12,
b: 21
)
// Returns 25
```
## Parameters
### a {data-type="int"}
Left operand.
### b {data-type="int"}
Right operand.

View File

@ -0,0 +1,36 @@
---
title: bitwise.uand() function
description: >
`bitwise.uand()` performs the bitwise operation `a AND b` with
[unsigned integer](/flux/v0.x/data-types/basic/uint/) values.
menu:
flux_0_x_ref:
name: bitwise.uand
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/uint/
flux/v0.x/tags: [bitwise]
---
`bitwise.uand()` performs the bitwise operation, `a AND b`, with
[unsigned integer](/flux/v0.x/data-types/basic/uint/) values.
```js
import "experimental/bitwise"
bitwise.uand(
a: uint(v: 12),
b: uint(v: 21)
)
// Returns 4 (uint)
```
## Parameters
### a {data-type="uint"}
Left operand.
### b {data-type="uint"}
Right operand.

View File

@ -0,0 +1,36 @@
---
title: bitwise.uclear() function
description: >
`bitwise.uclear()` performs the bitwise operation `a AND NOT b` with
[unsigned integer](/flux/v0.x/data-types/basic/uint/) values.
menu:
flux_0_x_ref:
name: bitwise.uclear
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/uint/
flux/v0.x/tags: [bitwise]
---
`bitwise.uclear()` performs the bitwise operation, `a AND NOT b`, with
[unsigned integer](/flux/v0.x/data-types/basic/uint/) values.
```js
import "experimental/bitwise"
bitwise.uclear(
a: uint(v: 12),
b: uint(v: 21)
)
// Returns 8 (uint)
```
## Parameters
### a {data-type="uint"}
Left operand.
### b {data-type="uint"}
Right operand.

View File

@ -0,0 +1,36 @@
---
title: bitwise.ulshift() function
description: >
`bitwise.ulshift()` shifts bits in `a` left by `b` bits.
Both `a` and `b` are [unsigned integers](/flux/v0.x/data-types/basic/uint/).
menu:
flux_0_x_ref:
name: bitwise.ulshift
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/uint/
flux/v0.x/tags: [bitwise]
---
`bitwise.ulshift()` shifts bits in `a` left by `b` bits.
Both `a` and `b` are [unsigned integers](/flux/v0.x/data-types/basic/uint/).
```js
import "experimental/bitwise"
bitwise.ulshift(
a: uint(v: 12),
b: uint(v: 21)
)
// Returns 25165824 (uint)
```
## Parameters
### a {data-type="uint"}
Left operand.
### b {data-type="uint"}
Number of bits to shift.

View File

@ -0,0 +1,30 @@
---
title: bitwise.unot() function
description: >
`bitwise.unot()` inverts every bit in `a`, an
[unsigned integer](/flux/v0.x/data-types/basic/uint/) value.
menu:
flux_0_x_ref:
name: bitwise.unot
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/uint/
flux/v0.x/tags: [bitwise]
---
`bitwise.unot()` inverts every bit in `a`, an
[unsigned integer](/flux/v0.x/data-types/basic/uint/) value.
```js
import "experimental/bitwise"
bitwise.unot(a: uint(v: 12))
// Returns 18446744073709551603 (uint)
```
## Parameters
### a {data-type="uint"}
Unsigned integer to invert.

View File

@ -0,0 +1,36 @@
---
title: bitwise.uor() function
description: >
`bitwise.uor()` performs the bitwise operation `a OR b` with
[unsigned integer](/flux/v0.x/data-types/basic/uint/) values.
menu:
flux_0_x_ref:
name: bitwise.uor
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/uint/
flux/v0.x/tags: [bitwise]
---
`bitwise.uor()` performs the bitwise operation, `a OR b`, with
[unsigned integer](/flux/v0.x/data-types/basic/uint/) values.
```js
import "experimental/bitwise"
bitwise.uor(
a: uint(v: 12),
b: uint(v: 21)
)
// Returns 29 (uint)
```
## Parameters
### a {data-type="uint"}
Left operand.
### b {data-type="uint"}
Right operand.

View File

@ -0,0 +1,36 @@
---
title: bitwise.urshift() function
description: >
`bitwise.urshift()` shifts bits in `a` right by `b` bits.
Both `a` and `b` are [unsigned integers](/flux/v0.x/data-types/basic/uint/).
menu:
flux_0_x_ref:
name: bitwise.urshift
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/uint/
flux/v0.x/tags: [bitwise]
---
`bitwise.urshift()` shifts bits in `a` right by `b` bits.
Both `a` and `b` are [unsigned integers](/flux/v0.x/data-types/basic/uint/).
```js
import "experimental/bitwise"
bitwise.urshift(
a: uint(v: 21),
b: uint(v: 4)
)
// Returns 1 (uint)
```
## Parameters
### a {data-type="uint"}
Left operand.
### b {data-type="uint"}
Number of bits to shift.

View File

@ -0,0 +1,36 @@
---
title: bitwise.uxor() function
description: >
`bitwise.uxor()` performs the bitwise operation `a XOR b` with
[unsigned integer](/flux/v0.x/data-types/basic/uint/) values.
menu:
flux_0_x_ref:
name: bitwise.uxor
parent: bitwise
weight: 401
related:
- /flux/v0.x/data-types/basic/uint/
flux/v0.x/tags: [bitwise]
---
`bitwise.uxor()` performs the bitwise operation, `a XOR b`, with
[unsigned integer](/flux/v0.x/data-types/basic/uint/) values.
```js
import "experimental/bitwise"
bitwise.uxor(
a: uint(v: 12),
b: uint(v: 21)
)
// Returns 25 (uint)
```
## Parameters
### a {data-type="uint"}
Left operand.
### b {data-type="uint"}
Right operand.

View File

@ -24,7 +24,7 @@ The "built-in" functions in the `universe` package provide a foundation for work
The `universe` package provides the following options:
```js
option now = () => system.time
option now = () => system.time()
option location = timezone.utc
```