Skip to content

Commit

Permalink
flux 0.181.0 release notes and stdlib (influxdata#4397)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderson authored Aug 29, 2022
1 parent 272b19b commit ff91ce8
Show file tree
Hide file tree
Showing 10 changed files with 427 additions and 19 deletions.
16 changes: 16 additions & 0 deletions content/flux/v0.x/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ aliases:
- /influxdb/cloud/reference/release-notes/flux/
---

## v0.181.0 [2022-08-29]

### Features
- Add "headless" json-rpc based REPL.
- Support vectorized unary operators.
- Add [`experimental/polyline` package](/flux/v0.x/stdlib/experimental/polyline)
for downsampling data.
- Update function library to have its own arguments struct.

### Bug fixes
- Update import path for the `Spec` package in the "headless" REPL.
- Update conditional vectorization to handle bad values for `test`,
`consequent`, or `alternate`.

---

## v0.180.1 [2022-08-22]

- _Internal code cleanup._
Expand Down
4 changes: 2 additions & 2 deletions content/flux/v0.x/stdlib/experimental/http/requests/peek.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: Mon, 22 Aug 2022 19:17:07 GMT,
Date: Mon, 29 Aug 2022 17:59:41 GMT,
Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI",
Server: nginx/1.16.1,
X-Rate-Limit-Limit: 1000,
X-Rate-Limit-Remaining: 998,
X-Rate-Reset: 16973
X-Rate-Reset: 21619
] | 200 |

{{% /expand %}}
Expand Down
8 changes: 4 additions & 4 deletions content/flux/v0.x/stdlib/experimental/json/parse.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ array.from(

#### Output data

| color | pendingDuration | id |
| ------ | ---------------- | -------- |
| red | 3 | 15612462 |
| blue | 16 | 15612462 |
| id | color | pendingDuration |
| -------- | ------ | ---------------- |
| 15612462 | red | 3 |
| 15612462 | blue | 16 |

{{% /expand %}}
{{< /expand-wrapper >}}
45 changes: 45 additions & 0 deletions content/flux/v0.x/stdlib/experimental/polyline/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: polyline package
description: >
The `polyline` package provides methods for polyline simplication, an efficient way of downsampling curves while retaining moments of variation throughout the path.
menu:
flux_0_x_ref:
name: polyline
parent: experimental
identifier: experimental/polyline
weight: 21
cascade:

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

The `polyline` package provides methods for polyline simplication, an efficient way of downsampling curves while retaining moments of variation throughout the path.
Import the `experimental/polyline` package:

```js
import "experimental/polyline"
```

This class of algorithms enable efficient rendering of graphs and visualizations without having to load all data into memory.
This is done by reducing the number of vertices that do not contribute significantly to the convexity and concavity of the shape.


## Functions

{{< children type="functions" show="pages" >}}
264 changes: 264 additions & 0 deletions content/flux/v0.x/stdlib/experimental/polyline/rdp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
---
title: polyline.rdp() function
description: >
`polyline.rdp()` applies the Ramer Douglas Peucker (RDP) algorithm to input data to downsample curves composed
of line segments into visually indistinguishable curves with fewer points.
menu:
flux_0_x_ref:
name: polyline.rdp
parent: experimental/polyline
identifier: experimental/polyline/rdp
weight: 201
flux/v0.x/tags: [transformations]
---

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

`polyline.rdp()` applies the Ramer Douglas Peucker (RDP) algorithm to input data to downsample curves composed
of line segments into visually indistinguishable curves with fewer points.



##### Function type signature

```js
(
<-tables: stream[A],
?epsilon: float,
?retention: float,
?timeColumn: string,
?valColumn: string,
) => stream[B] where A: Record, B: Record
```

{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}

## Parameters

### valColumn

Column with Y axis values of the given curve. Default is `_value`.



### timeColumn

Column with X axis values of the given curve. Default is `_time`.



### epsilon

Maximum tolerance value that determines the amount of compression.

Epsilon should be greater than `0.0`.

### retention

Percentage of points to retain after downsampling.

Retention rate should be between `0.0` and `100.0`.

### tables

Input data. Default is piped-forward data (`<-`).




## Examples

- [Downsample data using the RDP algorithm](#downsample-data-using-the-rdp-algorithm)
- [Downsample the data using the epsilon value 1.5](#downsample-the-data-using-the-epsilon-value-15)
- [Downsample the data using a retention rate of 90%](#downsample-the-data-using-a-retention-rate-of-90)

### Downsample data using the RDP algorithm

When using `polyline.rdp()`, leave both `epsilon` and `retention` unspecified
to automatically calculate the maximum tolerance beyond which producing a
visually indistinguishable curve is not be possible.

```js
import "experimental/polyline"

data
|> polyline.rdp()
```

{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}

#### Input data

| _time | _value |
| -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 |
| 2022-08-29T17:57:10Z | -29.76098586714259 |
| 2022-08-29T17:57:20Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 |
| 2022-08-29T17:59:20Z | -12.62058579127679 |
| 2022-08-29T17:59:30Z | -44.44668391211515 |


#### Output data

| _time | _value |
| -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 |
| 2022-08-29T17:57:10Z | -29.76098586714259 |
| 2022-08-29T17:57:20Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 |
| 2022-08-29T17:59:20Z | -12.62058579127679 |
| 2022-08-29T17:59:30Z | -44.44668391211515 |

{{% /expand %}}
{{< /expand-wrapper >}}

### Downsample the data using the epsilon value 1.5

```js
import "experimental/polyline"

data
|> polyline.rdp(epsilon: 1.5)

```

{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}

#### Input data

| _time | _value |
| -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 |
| 2022-08-29T17:57:10Z | -29.76098586714259 |
| 2022-08-29T17:57:20Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 |
| 2022-08-29T17:59:20Z | -12.62058579127679 |
| 2022-08-29T17:59:30Z | -44.44668391211515 |


#### Output data

| _time | _value |
| -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 |
| 2022-08-29T17:57:20Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 |
| 2022-08-29T17:59:20Z | -12.62058579127679 |
| 2022-08-29T17:59:30Z | -44.44668391211515 |

{{% /expand %}}
{{< /expand-wrapper >}}

### Downsample the data using a retention rate of 90%

```js
import "experimental/polyline"

data
|> polyline.rdp(retention: 90.0)

```

{{< expand-wrapper >}}
{{% expand "View example input and ouput" %}}

#### Input data

| _time | _value |
| -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 |
| 2022-08-29T17:57:10Z | -29.76098586714259 |
| 2022-08-29T17:57:20Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 |
| 2022-08-29T17:59:20Z | -12.62058579127679 |
| 2022-08-29T17:59:30Z | -44.44668391211515 |


#### Output data

| _time | _value |
| -------------------- | ------------------- |
| 2022-08-29T17:57:00Z | 10.56555566168836 |
| 2022-08-29T17:57:20Z | -67.50435038579738 |
| 2022-08-29T17:57:30Z | -16.758669047964453 |
| 2022-08-29T17:57:40Z | -47.25865245658065 |
| 2022-08-29T17:57:50Z | 66.16082461651365 |
| 2022-08-29T17:58:00Z | -0.9179216017921821 |
| 2022-08-29T17:58:10Z | -56.89169240573004 |
| 2022-08-29T17:58:20Z | 11.358605472976624 |
| 2022-08-29T17:58:30Z | 28.71147881415803 |
| 2022-08-29T17:58:40Z | -30.928830759588756 |
| 2022-08-29T17:58:50Z | -22.411848631056067 |
| 2022-08-29T17:59:00Z | 17.05503606764129 |
| 2022-08-29T17:59:10Z | 9.834382683760559 |
| 2022-08-29T17:59:30Z | -44.44668391211515 |

{{% /expand %}}
{{< /expand-wrapper >}}
2 changes: 1 addition & 1 deletion content/flux/v0.x/stdlib/http/requests/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/http/requests/requests.flux#L260-L274
https://github.com/influxdata/flux/blob/master/stdlib/http/requests/requests.flux#L274-L288
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
Expand Down
6 changes: 3 additions & 3 deletions content/flux/v0.x/stdlib/http/requests/peek.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/http/requests/requests.flux#L307-L317
https://github.com/influxdata/flux/blob/master/stdlib/http/requests/requests.flux#L321-L331
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
Expand Down Expand Up @@ -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: Mon, 22 Aug 2022 19:17:08 GMT,
Date: Mon, 29 Aug 2022 17:59:42 GMT,
Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI",
Server: nginx/1.16.1,
X-Rate-Limit-Limit: 1000,
X-Rate-Limit-Remaining: 996,
X-Rate-Reset: 16971
X-Rate-Reset: 21617
] | 200 |

{{% /expand %}}
Expand Down
Loading

0 comments on commit ff91ce8

Please sign in to comment.