Flux 0.167 (#4028)

pull/4026/head^2
Scott Anderson 2022-05-17 17:25:05 -07:00 committed by GitHub
parent 57e3db7a74
commit 082cdf8f9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 141 additions and 14 deletions

View File

@ -10,6 +10,24 @@ aliases:
- /influxdb/cloud/reference/release-notes/flux/
---
## v0.167.0 [2022-05-16]
### Features
- Allow default types to be specified for default arguments.
- Add [`date.scale()`](/flux/v0.x/stdlib/date/scale/) to allow for dynamic duration changes.
- Expose aggregate window spec fields for use by the query planner.
- Add [`experimental.preview()`](/flux/v0.x/stdlib/experimental/preview/).
### Bug fixes
- Update `date.add()` and `date.sub()` to ork 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
`table.fill` is present.
- Use `MultiplicativeOperator` in `MultiplicativeExpression`.
---
## v0.166.0 [2022-05-09]
### Features

View File

@ -269,37 +269,43 @@ The operator precedence is encoded directly into the grammar as the following.
```js
Expression = ConditionalExpression .
ConditionalExpression = LogicalExpression
| "if" Expression "then" Expression "else" Expression .
| "if" Expression "then" Expression "else" Expression .
LogicalExpression = UnaryLogicalExpression
| LogicalExpression LogicalOperator UnaryLogicalExpression .
| LogicalExpression LogicalOperator UnaryLogicalExpression .
LogicalOperator = "and" | "or" .
UnaryLogicalExpression = ComparisonExpression
| UnaryLogicalOperator UnaryLogicalExpression .
| UnaryLogicalOperator UnaryLogicalExpression .
UnaryLogicalOperator = "not" | "exists" .
ComparisonExpression = AdditiveExpression
| ComparisonExpression ComparisonOperator AdditiveExpression .
ComparisonExpression = MultiplicativeExpression
| ComparisonExpression ComparisonOperator MultiplicativeExpression .
ComparisonOperator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "=~" | "!~" .
AdditiveExpression = MultiplicativeExpression
| AdditiveExpression AdditiveOperator MultiplicativeExpression .
| AdditiveExpression AdditiveOperator MultiplicativeExpression .
AdditiveOperator = "+" | "-" .
MultiplicativeExpression = PipeExpression
| MultiplicativeExpression MultiplicativeOperator PipeExpression .
MultiplicativeOperator = "*" | "/" | "%" | "^" .
MultiplicativeExpression = ExponentExpression
| ExponentExpression ExponentOperator MultiplicativeExpression .
| ExponentExpression MultiplicativeOperator MultiplicativeExpression .
MultiplicativeOperator = "*" | "/" | "%" .
ExponentExpression = PipeExpression
| ExponentExpression ExponentOperator PipeExpression .
ExponentOperator = "^" .
PipeExpression = PostfixExpression
| PipeExpression PipeOperator UnaryExpression .
| PipeExpression PipeOperator UnaryExpression .
PipeOperator = "|>" .
UnaryExpression = PostfixExpression
| PrefixOperator UnaryExpression .
| PrefixOperator UnaryExpression .
PrefixOperator = "+" | "-" .
PostfixExpression = PrimaryExpression
| PostfixExpression PostfixOperator .
| PostfixExpression PostfixOperator .
PostfixOperator = MemberExpression
| CallExpression
| IndexExpression .
| CallExpression
| IndexExpression .
```
{{% warn %}}
Dividing by 0 or using the mod operator with a divisor of 0 will result in an error.
Floating point divide by zero produces positive or negative infinity according
to the [IEEE-754](https://en.wikipedia.org/wiki/IEEE_754) floating point specification.
{{% /warn %}}
_Also see [Flux Operators](/flux/v0.x/spec/operators)._

View File

@ -0,0 +1,59 @@
---
title: date.scale() function
description: >
`date.scale()` multiplies a duration by a specified value.
menu:
flux_0_x_ref:
name: date.scale
parent: date
weight: 301
introduced: 0.167.0
flux/v0.x/tags: [date/time]
---
`date.scale()` multiplies a duration by a specified value.
This function lets you dynamically scale a duration value.
```js
import "date"
date.scale(d: 1h, n: 12)
// Returns 12h
```
## Parameters
### d {data-type="duration"}
({{< req >}}) Duration to scale.
### n {data-type="int"}
({{< req >}} Amount to scale the duration (`d`) by.
## Examples
### Add n hours to a time
```js
import "date"
n = 5
d = date.scale(d: 1h, n: n)
date.add(d: d, to: 2022-05-10T00:00:00Z)
// Returns 2022-05-10T00:00:00.000000000Z
```
### Add scaled mixed duration to a time
```js
import "date"
n = 5
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

@ -0,0 +1,44 @@
---
title: experimental.preview() function
description: >
`experimental.preview()` limits the number of rows and tables in the stream.
menu:
flux_0_x_ref:
name: experimental.preview
parent: experimental
weight: 302
flux/v0.x/tags: [transformations]
introduced: 0.167.0
---
`experimental.preview()` limits the number of rows and tables in the stream.
```js
import "experimental"
data
|> experimental.preview()
```
## Parameters
### nrows {data-type="int"}
Maximum number of rows per table to return. Default is `5`.
### ntables {data-type="int"}
Maximum number of tables to return. Default is `5`.
### tables {data-type="stream of tables"}
Input data.
Default is piped-forward data (`<-`).
## Examples
### Preview data output
```js
import "experimental"
import "sampledata"
sampledata.int()
|> experimental.preview(nrows: 3)
```