Flux 0.183 (#4454)

* flux 0.183.0 release notes

* flux 0.183.0 stdlib updates
pull/4447/head
Scott Anderson 2022-09-12 14:41:38 -06:00 committed by GitHub
parent 51f12c9d71
commit 90961e38ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 201 additions and 121 deletions

View File

@ -10,6 +10,22 @@ aliases:
- /influxdb/cloud/reference/release-notes/flux/
---
## v0.183.0 [2022-09-12]
### Features
- Add support for piped-forward arrays to [`array.from()`](/flux/v0.x/stdlib/array/from/).
- Add parameter to [`experimental.unpivot()`](/flux/v0.x/stdlib/experimental/unpivot/)
for non-field and non-group-key columns.
- Add a syntax for describing label literals.
- Don't display nulls as 0 in the output of `experimental.diff()`.
### Bug fixes
- Fix duplicate definitions and update issue links in the Flux SPEC.
- Don't include opening parentheses in invalid call expressions.
- Improve error message when joining with an empty table.
---
## v0.182.0 [2022-09-06]
### Features

View File

@ -35,7 +35,7 @@ records must have the same keys and data types.
##### Function type signature
```js
(rows: [A]) => stream[A] where A: Record
(<-rows: [A]) => stream[A] where A: Record
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
@ -43,8 +43,8 @@ records must have the same keys and data types.
## Parameters
### rows
({{< req >}})
Array of records to construct a table with.
Array of records to construct a table with. Default is the piped-forward array (`<-`).

View File

@ -43,7 +43,7 @@ records must have the same keys and data types.
##### Function type signature
```js
(rows: [A]) => stream[A] where A: Record
(<-rows: [A]) => stream[A] where A: Record
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
@ -51,7 +51,7 @@ records must have the same keys and data types.
## Parameters
### rows
({{< req >}})
Array of records to construct a table with.

View File

@ -22,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/experimental.flux#L1342-L1342
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1375-L1375
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

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/experimental.flux#L1387-L1387
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1420-L1420
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md

View File

@ -87,12 +87,12 @@ requests.peek(response: requests.get(url: "https://api.agify.io", params: ["name
Connection: keep-alive,
Content-Length: 41,
Content-Type: application/json; charset=utf-8,
Date: Tue, 06 Sep 2022 16:40:21 GMT,
Date: Mon, 12 Sep 2022 19:26:11 GMT,
Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI",
Server: nginx/1.16.1,
X-Rate-Limit-Limit: 1000,
X-Rate-Limit-Remaining: 998,
X-Rate-Reset: 26378
X-Rate-Reset: 16429
] | 200 |
{{% /expand %}}

View File

@ -107,44 +107,44 @@ data
| _time | _value |
| -------------------- | ------------------- |
| 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-09-06T16:37:50Z | -29.76098586714259 |
| 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-09-06T16:40:00Z | -12.62058579127679 |
| 2022-09-06T16:40:10Z | -44.44668391211515 |
| 2022-09-12T19:23:30Z | 10.56555566168836 |
| 2022-09-12T19:23:40Z | -29.76098586714259 |
| 2022-09-12T19:23:50Z | -67.50435038579738 |
| 2022-09-12T19:24:00Z | -16.758669047964453 |
| 2022-09-12T19:24:10Z | -47.25865245658065 |
| 2022-09-12T19:24:20Z | 66.16082461651365 |
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
| 2022-09-12T19:24:40Z | -56.89169240573004 |
| 2022-09-12T19:24:50Z | 11.358605472976624 |
| 2022-09-12T19:25:00Z | 28.71147881415803 |
| 2022-09-12T19:25:10Z | -30.928830759588756 |
| 2022-09-12T19:25:20Z | -22.411848631056067 |
| 2022-09-12T19:25:30Z | 17.05503606764129 |
| 2022-09-12T19:25:40Z | 9.834382683760559 |
| 2022-09-12T19:25:50Z | -12.62058579127679 |
| 2022-09-12T19:26:00Z | -44.44668391211515 |
#### Output data
| _time | _value |
| -------------------- | ------------------- |
| 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-09-06T16:37:50Z | -29.76098586714259 |
| 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-09-06T16:40:00Z | -12.62058579127679 |
| 2022-09-06T16:40:10Z | -44.44668391211515 |
| 2022-09-12T19:23:30Z | 10.56555566168836 |
| 2022-09-12T19:23:40Z | -29.76098586714259 |
| 2022-09-12T19:23:50Z | -67.50435038579738 |
| 2022-09-12T19:24:00Z | -16.758669047964453 |
| 2022-09-12T19:24:10Z | -47.25865245658065 |
| 2022-09-12T19:24:20Z | 66.16082461651365 |
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
| 2022-09-12T19:24:40Z | -56.89169240573004 |
| 2022-09-12T19:24:50Z | 11.358605472976624 |
| 2022-09-12T19:25:00Z | 28.71147881415803 |
| 2022-09-12T19:25:10Z | -30.928830759588756 |
| 2022-09-12T19:25:20Z | -22.411848631056067 |
| 2022-09-12T19:25:30Z | 17.05503606764129 |
| 2022-09-12T19:25:40Z | 9.834382683760559 |
| 2022-09-12T19:25:50Z | -12.62058579127679 |
| 2022-09-12T19:26:00Z | -44.44668391211515 |
{{% /expand %}}
{{< /expand-wrapper >}}
@ -166,43 +166,43 @@ data
| _time | _value |
| -------------------- | ------------------- |
| 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-09-06T16:37:50Z | -29.76098586714259 |
| 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-09-06T16:40:00Z | -12.62058579127679 |
| 2022-09-06T16:40:10Z | -44.44668391211515 |
| 2022-09-12T19:23:30Z | 10.56555566168836 |
| 2022-09-12T19:23:40Z | -29.76098586714259 |
| 2022-09-12T19:23:50Z | -67.50435038579738 |
| 2022-09-12T19:24:00Z | -16.758669047964453 |
| 2022-09-12T19:24:10Z | -47.25865245658065 |
| 2022-09-12T19:24:20Z | 66.16082461651365 |
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
| 2022-09-12T19:24:40Z | -56.89169240573004 |
| 2022-09-12T19:24:50Z | 11.358605472976624 |
| 2022-09-12T19:25:00Z | 28.71147881415803 |
| 2022-09-12T19:25:10Z | -30.928830759588756 |
| 2022-09-12T19:25:20Z | -22.411848631056067 |
| 2022-09-12T19:25:30Z | 17.05503606764129 |
| 2022-09-12T19:25:40Z | 9.834382683760559 |
| 2022-09-12T19:25:50Z | -12.62058579127679 |
| 2022-09-12T19:26:00Z | -44.44668391211515 |
#### Output data
| _time | _value |
| -------------------- | ------------------- |
| 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-09-06T16:40:00Z | -12.62058579127679 |
| 2022-09-06T16:40:10Z | -44.44668391211515 |
| 2022-09-12T19:23:30Z | 10.56555566168836 |
| 2022-09-12T19:23:50Z | -67.50435038579738 |
| 2022-09-12T19:24:00Z | -16.758669047964453 |
| 2022-09-12T19:24:10Z | -47.25865245658065 |
| 2022-09-12T19:24:20Z | 66.16082461651365 |
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
| 2022-09-12T19:24:40Z | -56.89169240573004 |
| 2022-09-12T19:24:50Z | 11.358605472976624 |
| 2022-09-12T19:25:00Z | 28.71147881415803 |
| 2022-09-12T19:25:10Z | -30.928830759588756 |
| 2022-09-12T19:25:20Z | -22.411848631056067 |
| 2022-09-12T19:25:30Z | 17.05503606764129 |
| 2022-09-12T19:25:40Z | 9.834382683760559 |
| 2022-09-12T19:25:50Z | -12.62058579127679 |
| 2022-09-12T19:26:00Z | -44.44668391211515 |
{{% /expand %}}
{{< /expand-wrapper >}}
@ -224,42 +224,42 @@ data
| _time | _value |
| -------------------- | ------------------- |
| 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-09-06T16:37:50Z | -29.76098586714259 |
| 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-09-06T16:40:00Z | -12.62058579127679 |
| 2022-09-06T16:40:10Z | -44.44668391211515 |
| 2022-09-12T19:23:30Z | 10.56555566168836 |
| 2022-09-12T19:23:40Z | -29.76098586714259 |
| 2022-09-12T19:23:50Z | -67.50435038579738 |
| 2022-09-12T19:24:00Z | -16.758669047964453 |
| 2022-09-12T19:24:10Z | -47.25865245658065 |
| 2022-09-12T19:24:20Z | 66.16082461651365 |
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
| 2022-09-12T19:24:40Z | -56.89169240573004 |
| 2022-09-12T19:24:50Z | 11.358605472976624 |
| 2022-09-12T19:25:00Z | 28.71147881415803 |
| 2022-09-12T19:25:10Z | -30.928830759588756 |
| 2022-09-12T19:25:20Z | -22.411848631056067 |
| 2022-09-12T19:25:30Z | 17.05503606764129 |
| 2022-09-12T19:25:40Z | 9.834382683760559 |
| 2022-09-12T19:25:50Z | -12.62058579127679 |
| 2022-09-12T19:26:00Z | -44.44668391211515 |
#### Output data
| _time | _value |
| -------------------- | ------------------- |
| 2022-09-06T16:37:40Z | 10.56555566168836 |
| 2022-09-06T16:38:00Z | -67.50435038579738 |
| 2022-09-06T16:38:10Z | -16.758669047964453 |
| 2022-09-06T16:38:20Z | -47.25865245658065 |
| 2022-09-06T16:38:30Z | 66.16082461651365 |
| 2022-09-06T16:38:40Z | -0.9179216017921821 |
| 2022-09-06T16:38:50Z | -56.89169240573004 |
| 2022-09-06T16:39:00Z | 11.358605472976624 |
| 2022-09-06T16:39:10Z | 28.71147881415803 |
| 2022-09-06T16:39:20Z | -30.928830759588756 |
| 2022-09-06T16:39:30Z | -22.411848631056067 |
| 2022-09-06T16:39:40Z | 17.05503606764129 |
| 2022-09-06T16:39:50Z | 9.834382683760559 |
| 2022-09-06T16:40:10Z | -44.44668391211515 |
| 2022-09-12T19:23:30Z | 10.56555566168836 |
| 2022-09-12T19:23:50Z | -67.50435038579738 |
| 2022-09-12T19:24:00Z | -16.758669047964453 |
| 2022-09-12T19:24:10Z | -47.25865245658065 |
| 2022-09-12T19:24:20Z | 66.16082461651365 |
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
| 2022-09-12T19:24:40Z | -56.89169240573004 |
| 2022-09-12T19:24:50Z | 11.358605472976624 |
| 2022-09-12T19:25:00Z | 28.71147881415803 |
| 2022-09-12T19:25:10Z | -30.928830759588756 |
| 2022-09-12T19:25:20Z | -22.411848631056067 |
| 2022-09-12T19:25:30Z | 17.05503606764129 |
| 2022-09-12T19:25:40Z | 9.834382683760559 |
| 2022-09-12T19:26:00Z | -44.44668391211515 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -1,15 +1,18 @@
---
title: experimental.unpivot() function
description: >
`experimental.unpivot()` removes the `_time` column and any other column not in the group key and outputs a new table with `_field` and `_value` columns pairs.
The output stream retains the group key and all group key columns of the input stream.
Specialized to transform the pivoted output from `iox.from()` into the unpivoted format.
`experimental.unpivot()` creates `_field` and `_value` columns pairs using all columns (other than `_time`)
_not_ in the group key.
The `_field` column contains the original column label and the `_value` column
contains the original column value.
menu:
flux_0_x_ref:
name: experimental.unpivot
parent: experimental
identifier: experimental/unpivot
weight: 101
flux/v0.x/tags: [transformations]
introduced: 0.172.0
---
<!------------------------------------------------------------------------------
@ -21,23 +24,25 @@ 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/experimental.flux#L1318-L1323
https://github.com/influxdata/flux/blob/master/stdlib/experimental/experimental.flux#L1350-L1356
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->
`experimental.unpivot()` removes the `_time` column and any other column not in the group key and outputs a new table with `_field` and `_value` columns pairs.
`experimental.unpivot()` creates `_field` and `_value` columns pairs using all columns (other than `_time`)
_not_ in the group key.
The `_field` column contains the original column label and the `_value` column
contains the original column value.
The output stream retains the group key and all group key columns of the input stream.
Specialized to transform the pivoted output from `iox.from()` into the unpivoted format.
`_field` is added to the output group key.
##### Function type signature
```js
(<-tables: stream[{A with _time: time}]) => stream[{B with _value: C, _field: string}] where A: Record, B: Record
(<-tables: stream[{A with _time: time}], ?otherColumns: [string]) => stream[{B with _value: C, _field: string}] where A: Record, B: Record
```
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
@ -50,3 +55,62 @@ Input data. Default is piped-forward data (`<-`).
### otherColumns
List of column names that are not in the group key but are also not field columns. Default is `["_time"]`.
## Examples
### Unpivot data into _field and _value columns
```js
import "experimental"
data
|> experimental.unpivot()
```
{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}
#### Input data
| _time | *location | temp | hum |
| -------------------- | --------- | ----- | ---- |
| 2022-01-01T00:00:00Z | Denver | 10.2 | 81.5 |
| 2022-01-02T00:00:00Z | Denver | 12.4 | 41.3 |
| _time | *location | temp | hum |
| -------------------- | --------- | ----- | ---- |
| 2022-01-01T00:00:00Z | New York | 50.1 | 99.2 |
| 2022-01-02T00:00:00Z | New York | 55.8 | 97.7 |
#### Output data
| *location | *_field | _time | _value |
| --------- | ------- | -------------------- | ------- |
| Denver | hum | 2022-01-01T00:00:00Z | 81.5 |
| Denver | hum | 2022-01-02T00:00:00Z | 41.3 |
| *location | *_field | _time | _value |
| --------- | ------- | -------------------- | ------- |
| New York | hum | 2022-01-01T00:00:00Z | 99.2 |
| New York | hum | 2022-01-02T00:00:00Z | 97.7 |
| *location | *_field | _time | _value |
| --------- | ------- | -------------------- | ------- |
| Denver | temp | 2022-01-01T00:00:00Z | 10.2 |
| Denver | temp | 2022-01-02T00:00:00Z | 12.4 |
| *location | *_field | _time | _value |
| --------- | ------- | -------------------- | ------- |
| New York | temp | 2022-01-01T00:00:00Z | 50.1 |
| New York | temp | 2022-01-02T00:00:00Z | 55.8 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -82,12 +82,12 @@ requests.peek(response: requests.get(url: "https://api.agify.io", params: ["name
Connection: keep-alive,
Content-Length: 41,
Content-Type: application/json; charset=utf-8,
Date: Tue, 06 Sep 2022 16:40:23 GMT,
Date: Mon, 12 Sep 2022 19:26:13 GMT,
Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI",
Server: nginx/1.16.1,
X-Rate-Limit-Limit: 1000,
X-Rate-Limit-Remaining: 996,
X-Rate-Reset: 26377
X-Rate-Reset: 16427
] | 200 |
{{% /expand %}}

View File

@ -189,12 +189,12 @@ requests.peek(response: response)
Cache-Control: max-age=604800,
Content-Length: 1256,
Content-Type: text/html; charset=UTF-8,
Date: Tue, 06 Sep 2022 16:40:23 GMT,
Date: Mon, 12 Sep 2022 19:26:13 GMT,
Etag: "3147526947",
Expires: Tue, 13 Sep 2022 16:40:23 GMT,
Expires: Mon, 19 Sep 2022 19:26:13 GMT,
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT,
Server: EOS (vny/0452)
] | 103758367 |
Server: EOS (vny/0451)
] | 97664868 |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -149,14 +149,14 @@ union(tables: [t1, t2])
| _time | _value | tag |
| -------------------- | ------- | ---- |
| 2021-01-01T00:00:00Z | 1 | foo |
| 2021-01-02T00:00:00Z | 2 | foo |
| 2021-01-03T00:00:00Z | 3 | foo |
| 2021-01-04T00:00:00Z | 4 | foo |
| 2021-01-01T00:00:00Z | 0 | bar |
| 2021-01-02T00:00:00Z | -1 | bar |
| 2021-01-03T00:00:00Z | -2 | bar |
| 2021-01-04T00:00:00Z | -3 | bar |
| 2021-01-01T00:00:00Z | 1 | foo |
| 2021-01-02T00:00:00Z | 2 | foo |
| 2021-01-03T00:00:00Z | 3 | foo |
| 2021-01-04T00:00:00Z | 4 | foo |
{{% /expand %}}
{{< /expand-wrapper >}}