Merge pull request #58 from influxdata/flux-0.19

Flux 0.19
pull/62/head
Scott Anderson 2019-02-13 17:23:31 -07:00 committed by GitHub
commit 4467c344ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 116 additions and 34 deletions

View File

@ -1,6 +1,6 @@
---
title: Flux input functions
description: Flux input functions define sources of data or or display information about data sources.
title: Flux built-in input functions
description: Flux's built-in input functions define sources of data or or display information about data sources.
aliases:
- /v2.0/reference/flux/functions/inputs
menu:
@ -11,7 +11,7 @@ menu:
weight: 301
---
Flux input functions define sources of data or display information about data sources.
Flux's built-in input functions define sources of data or display information about data sources.
The following input functions are available:
{{< children type="functions" >}}

View File

@ -1,6 +1,8 @@
---
title: Flux miscellaneous functions
description: Flux provides miscellaneous functions that serve purposes other than retrieving, transforming, or outputting data.
title: Flux built-in miscellaneous functions
description: >
Flux provides built-in miscellaneous functions that serve purposes other than
retrieving, transforming, or outputting data.
aliases:
- /v2.0/reference/flux/functions/misc
menu:
@ -11,7 +13,7 @@ menu:
weight: 305
---
Flux functions primarily retrieve, shape and transform, then output data, however
Flux's built-in functions primarily retrieve, shape and transform, then output data, however
there are functions available that serve other purposes.
The following functions are are available but don't fit within other function categories:

View File

@ -1,6 +1,6 @@
---
title: Flux output functions
description: Flux output functions yield results or send data to a specified output destination.
title: Flux built-in output functions
description: Flux's built-in output functions yield results or send data to a specified output destination.
aliases:
- /v2.0/reference/flux/functions/outputs
menu:
@ -11,7 +11,7 @@ menu:
weight: 302
---
Flux output functions yield results or send data to a specified output destination.
Flux's built-in output functions yield results or send data to a specified output destination.
The following output functions are are available:
{{< children type="functions" >}}

View File

@ -0,0 +1,15 @@
---
title: Flux built-in testing functions
description: Flux's built-in testing functions test various aspects of piped-forward data.
menu:
v2_0_ref:
name: Tests
identifier: built-in-tests
parent: Built-in
weight: 305
---
Flux's built-in testing functions test various aspects of piped-forward data.
The following built-in testing functions are available:
{{< children type="functions" show="pages" >}}

View File

@ -0,0 +1,46 @@
---
title: contains() function
description: The contains() function tests whether a value is a member of a set.
menu:
v2_0_ref:
name: contains
parent: built-in-tests
weight: 401
---
The `contains()` function tests whether a value is a member of a set.
If the value is a member of the set, the function returns `true`.
If the value is not a member of the set, the functions returns `false`.
```js
contains(
value: 1,
set: [1,2,3]
)
```
## Parameters
### value
The value for which to search.
_**Data type:** Boolean | Integer | UInteger | Float | String | Time_
### set
The set of values in which to search.
_**Data type:** Array of Booleans | Integers | UIntegers | Floats | Strings | Times_
## Examples
###### Filter on a set of specific fields
```js
fields = ["load1", "load5", "load15"]
from(bucket: "example-bucket")
|> range(start:start, stop: stop)
|> filter(fn: (r) =>
r._measurement == "system" and
contains(value: r._field, set: fields)
)
```

View File

@ -1,6 +1,6 @@
---
title: Flux transformation functions
description: Flux transformation functions transform and shape your data in specific ways.
title: Flux built-in transformation functions
description: Flux's built-in transformation functions transform and shape your data in specific ways.
aliases:
- /v2.0/reference/flux/functions/transformations
menu:
@ -11,7 +11,7 @@ menu:
weight: 303
---
Flux transformation functions transform or shape your data in specific ways.
Flux's built-in transformation functions transform or shape your data in specific ways.
There are different types of transformations categorized below:
{{< children show="sections" >}}

View File

@ -1,6 +1,6 @@
---
title: Flux aggregate functions
description: Flux aggregate functions take values from an input table and aggregate them in some way.
title: Flux built-in aggregate functions
description: Flux's built-in aggregate functions take values from an input table and aggregate them in some way.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates
menu:
@ -11,7 +11,7 @@ menu:
weight: 401
---
Flux aggregate functions take values from an input table and aggregate them in some way.
Flux's built-in aggregate functions take values from an input table and aggregate them in some way.
The output table contains is a single row with the aggregated value.
Aggregate operations output a table for every input table they receive.

View File

@ -1,6 +1,6 @@
---
title: Flux selector functions
description: Flux selector functions return one or more records based on function logic.
title: Flux built-in selector functions
description: Flux's built-in selector functions return one or more records based on function logic.
aliases:
- /v2.0/reference/flux/functions/transformations/selectors
menu:
@ -11,7 +11,7 @@ menu:
weight: 401
---
Flux selector functions return one or more records based on function logic.
Flux's built-in selector functions return one or more records based on function logic.
The output table is different than the input table, but individual row values are not.
The following selector functions are available:

View File

@ -12,7 +12,7 @@ weight: 401
The `stateCount()` function computes the number of consecutive records in a given state.
The state is defined via the function `fn`.
For each consecutive point that evaluates as `true`, the state count will be incremented.
For each consecutive point that evaluates as `true`, the state count is incremented.
When a point evaluates as `false`, the state count is reset.
The state count is added as an additional column to each record.

View File

@ -1,6 +1,6 @@
---
title: Flux type conversion functions
description: Flux type conversion functions convert columns of the input table into a specific data type.
title: Flux built-in type conversion functions
description: Flux's built-in built-in type conversion functions convert columns of the input table into a specific data type.
aliases:
- /v2.0/reference/flux/functions/transformations/type-conversions
menu:
@ -11,7 +11,7 @@ menu:
weight: 401
---
Flux type conversion functions convert columns of the input table into a specific data type.
Flux's built-in type conversion functions convert columns of the input table into a specific data type.
The following type conversion functions are available:
{{< children type="functions" >}}

View File

@ -107,6 +107,8 @@ _**Data type:** String_
Specifies whether empty tables should be created.
Defaults to `false`.
_**Data type:** Boolean_
## Examples
#### Window data into 10 minute intervals

View File

@ -66,7 +66,8 @@ OptionAssignment = "option" [ identifier "." ] identifier "=" Expression
An option assignment creates an option bound to an identifier and gives it a type and a value.
Options may only be assigned in a package block.
An identifier assigned to an option may be reassigned a new value but not a new type.
Once declared, an option may not be redeclared in the same package block.
An option declared in one package may be reassigned a new value in another.
An option keeps the same type for the remainder of its lifetime.
###### Examples

View File

@ -154,7 +154,24 @@ MemberBracketExpression = "[" string_lit "]" .
### Operators
Operators combine operands into expressions.
Operator precedence is encoded directly into the grammar.
The precedence of the operators is given in the table below.
Operators with a lower number have higher precedence.
|Precedence| Operator | Description |
|----------|----------|---------------------------|
| 1 | `a()` | Function call |
| | `a[]` | Member or index access |
| | `.` | Member access |
| 2 | `*` `/` |Multiplication and division|
| 3 | `+` `-` | Addition and subtraction |
| 4 |`==` `!=` | Comparison operators |
| | `<` `<=` | |
| | `>` `>=` | |
| |`=~` `!~` | |
| 5 | `not` | Unary logical expression |
| 6 |`and` `or`| Logical AND and OR |
The operator precedence is encoded directly into the grammar as the following.
```js
Expression = LogicalExpression .
@ -167,12 +184,12 @@ UnaryLogicalOperator = "not" .
ComparisonExpression = MultiplicativeExpression
| ComparisonExpression ComparisonOperator MultiplicativeExpression .
ComparisonOperator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "=~" | "!~" .
MultiplicativeExpression = AdditiveExpression
| MultiplicativeExpression MultiplicativeOperator AdditiveExpression .
MultiplicativeOperator = "*" | "/" .
AdditiveExpression = PipeExpression
| AdditiveExpression AdditiveOperator PipeExpression .
AdditiveExpression = MultiplicativeExpression
| AdditiveExpression AdditiveOperator MultiplicativeExpression .
AdditiveOperator = "+" | "-" .
MultiplicativeExpression = PipeExpression
| MultiplicativeExpression MultiplicativeOperator PipeExpression .
MultiplicativeOperator = "*" | "/" .
PipeExpression = PostfixExpression
| PipeExpression PipeOperator UnaryExpression .
PipeOperator = "|>" .

View File

@ -60,14 +60,12 @@ longIdentifierName
The following keywords are reserved and may not be used as identifiers:
```
and import not return option
and import not return option test
empty in or package builtin
```
{{% note %}}
To be implemented: [IMPL#256](https://github.com/influxdata/platform/issues/256) Add in and empty operator support.
To be implemented: [IMPL#334](https://github.com/influxdata/platform/issues/334) Add "import" support
{{% /note %}}

View File

@ -58,7 +58,8 @@ The `main` package is special for a few reasons:
Packages are initialized in the following order:
1. All imported packages are initialized and assigned to their package identifier.
2. All option declarations are evaluated and assigned regardless of order. An option cannot have dependencies on any other options assigned in the same package block.
2. All option declarations are evaluated and assigned regardless of order.
An option cannot have a dependency on another option assigned in the same package block.
3. All variable declarations are evaluated and assigned regardless of order. A variable cannot have a direct or indirect dependency on itself.
4. Any package side effects are evaluated.

View File

@ -86,7 +86,7 @@ A named type can be created using a type assignment statement.
A named type is equivalent to the type it describes and may be used interchangeably.
```js
TypeAssignement = "type" identifier "=" TypeExpression
TypeAssignment = "type" identifier "=" TypeExpression
TypeExpression = identifier
| TypeParameter
| ObjectType