commit
1b7c8d9ac5
|
@ -103,7 +103,7 @@ count = 12
|
|||
```
|
||||
{{% /note %}}
|
||||
|
||||
Check data is represented as an object, `r`.
|
||||
Check data is represented as a record, `r`.
|
||||
Access specific column values using dot notation: `r.columnName`.
|
||||
|
||||
Use data from the following columns:
|
||||
|
|
|
@ -20,7 +20,7 @@ The Docker Monitoring template includes the following:
|
|||
- one [Telegraf configuration](/v2.0/write-data/no-code/use-telegraf/auto-config/view-telegraf-config/): Docker input plugin
|
||||
- one variable: `bucket`
|
||||
- four [checks](/v2.0/reference/glossary/#check): `Container cpu`, `mem`, `disk`, `non-zero exit`
|
||||
- one [notification endpoint](v2.0/reference/glossary/#notification-endpoint): `Http Post`
|
||||
- one [notification endpoint](/v2.0/reference/glossary/#notification-endpoint): `Http Post`
|
||||
- one [notification rule](/v2.0/reference/glossary/#notification-rule): `Crit Alert`
|
||||
|
||||
For more information about how checks, notification endpoints, and notifications rules work together, see [monitor data and send alerts](/v2.0/monitor-alert/).
|
||||
|
|
|
@ -70,10 +70,10 @@ data = from(bucket: "telegraf/default")
|
|||
|
||||
{{% note %}}
|
||||
#### Using task options in your Flux script
|
||||
Task options are passed as part of a `task` object and can be referenced in your Flux script.
|
||||
Task options are passed as part of a `task` option record and can be referenced in your Flux script.
|
||||
In the example above, the time range is defined as `-task.every`.
|
||||
|
||||
`task.every` is dot notation that references the `every` property of the `task` object.
|
||||
`task.every` is dot notation that references the `every` property of the `task` option record.
|
||||
`every` is defined as `1h`, therefore `-task.every` equates to `-1h`.
|
||||
|
||||
Using task options to define values in your Flux script can make reusing your task easier.
|
||||
|
|
|
@ -27,17 +27,17 @@ Aggregate functions all have the same basic characteristics:
|
|||
## How reduce() works
|
||||
The `reduce()` function operates on one row at a time using the function defined in
|
||||
the [`fn` parameter](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/reduce/#fn).
|
||||
The `fn` function maps keys to specific values using two [objects](/v2.0/query-data/get-started/syntax-basics/#objects)
|
||||
The `fn` function maps keys to specific values using two [records](/v2.0/query-data/get-started/syntax-basics/#records)
|
||||
specified by the following parameters:
|
||||
|
||||
| Parameter | Description |
|
||||
|:---------: |:----------- |
|
||||
| `r` | An object that represents the row or record. |
|
||||
| `accumulator` | An object that contains values used in each row's aggregate calculation. |
|
||||
| Parameter | Description |
|
||||
|:---------: |:----------- |
|
||||
| `r` | A record that represents the row or record. |
|
||||
| `accumulator` | A record that contains values used in each row's aggregate calculation. |
|
||||
|
||||
{{% note %}}
|
||||
The `reduce()` function's [`identity` parameter](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/reduce/#identity)
|
||||
defines the initial `accumulator` object.
|
||||
defines the initial `accumulator` record.
|
||||
{{% /note %}}
|
||||
|
||||
### Example reduce() function
|
||||
|
@ -63,9 +63,9 @@ To illustrate how this function works, take this simplified table for example:
|
|||
| 2019-04-23T16:11:19Z | 1.2 |
|
||||
| 2019-04-23T16:11:29Z | 3.8 |
|
||||
|
||||
###### Input objects
|
||||
The `fn` function uses the data in the first row to define the `r` object.
|
||||
It defines the `accumulator` object using the `identity` parameter.
|
||||
###### Input records
|
||||
The `fn` function uses the data in the first row to define the `r` record.
|
||||
It defines the `accumulator` record using the `identity` parameter.
|
||||
|
||||
```js
|
||||
r = { _time: 2019-04-23T16:10:49.00Z, _value: 1.6 }
|
||||
|
@ -73,7 +73,7 @@ accumulator = { sum : 0.0, product : 1.0 }
|
|||
```
|
||||
|
||||
###### Key mappings
|
||||
It then uses the `r` and `accumulator` objects to populate values in the key mappings:
|
||||
It then uses the `r` and `accumulator` records to populate values in the key mappings:
|
||||
```js
|
||||
// sum: r._value + accumulator.sum
|
||||
sum: 1.6 + 0.0
|
||||
|
@ -82,23 +82,23 @@ sum: 1.6 + 0.0
|
|||
product: 1.6 * 1.0
|
||||
```
|
||||
|
||||
###### Output object
|
||||
This produces an output object with the following key value pairs:
|
||||
###### Output record
|
||||
This produces an output record with the following key value pairs:
|
||||
|
||||
```js
|
||||
{ sum: 1.6, product: 1.6 }
|
||||
```
|
||||
|
||||
The function then processes the next row using this **output object** as the `accumulator`.
|
||||
The function then processes the next row using this **output record** as the `accumulator`.
|
||||
|
||||
{{% note %}}
|
||||
Because `reduce()` uses the output object as the `accumulator` when processing the next row,
|
||||
keys mapped in the `fn` function must match keys in the `identity` and `accumulator` objects.
|
||||
Because `reduce()` uses the output record as the `accumulator` when processing the next row,
|
||||
keys mapped in the `fn` function must match keys in the `identity` and `accumulator` records.
|
||||
{{% /note %}}
|
||||
|
||||
###### Processing the next row
|
||||
```js
|
||||
// Input objects for the second row
|
||||
// Input records for the second row
|
||||
r = { _time: 2019-04-23T16:10:59.00Z, _value: 2.3 }
|
||||
accumulator = { sum : 1.6, product : 1.6 }
|
||||
|
||||
|
@ -106,18 +106,18 @@ accumulator = { sum : 1.6, product : 1.6 }
|
|||
sum: 2.3 + 1.6
|
||||
product: 2.3 * 1.6
|
||||
|
||||
// Output object of the second row
|
||||
// Output record of the second row
|
||||
{ sum: 3.9, product: 3.68 }
|
||||
```
|
||||
|
||||
It then uses the new output object as the `accumulator` for the next row.
|
||||
It then uses the new output record as the `accumulator` for the next row.
|
||||
This cycle continues until all rows in the table are processed.
|
||||
|
||||
##### Final output object and table
|
||||
After all records in the table are processed, `reduce()` uses the final output object
|
||||
##### Final output record and table
|
||||
After all records in the table are processed, `reduce()` uses the final output record
|
||||
to create a transformed table with one row and columns for each mapped key.
|
||||
|
||||
###### Final output object
|
||||
###### Final output record
|
||||
```js
|
||||
{ sum: 9.6, product: 11.74656 }
|
||||
```
|
||||
|
@ -162,7 +162,7 @@ does the same thing and is much more performant._
|
|||
average = (tables=<-, outputField="average") =>
|
||||
tables
|
||||
|> reduce(
|
||||
// Define the initial accumulator object
|
||||
// Define the initial accumulator record
|
||||
identity: {
|
||||
count: 1.0,
|
||||
sum: 0.0,
|
||||
|
|
|
@ -3,7 +3,7 @@ title: Check if a value exists
|
|||
seotitle: Use Flux to check if a value exists
|
||||
list_title: Exists
|
||||
description: >
|
||||
Use the Flux `exists` operator to check if an object contains a key or if that
|
||||
Use the Flux `exists` operator to check if a record contains a key or if that
|
||||
key's value is `null`.
|
||||
v2.0/tags: [exists]
|
||||
menu:
|
||||
|
@ -24,7 +24,7 @@ list_code_example: |
|
|||
```
|
||||
---
|
||||
|
||||
Use the Flux `exists` operator to check if an object contains a key or if that
|
||||
Use the Flux `exists` operator to check if a record contains a key or if that
|
||||
key's value is `null`.
|
||||
|
||||
```js
|
||||
|
|
|
@ -50,7 +50,7 @@ Define a geographic region using one of the the following shapes:
|
|||
- [polygon](#polygon)
|
||||
|
||||
### box
|
||||
Define a box-shaped region by specifying an object containing the following properties:
|
||||
Define a box-shaped region by specifying a record containing the following properties:
|
||||
|
||||
- **minLat:** minimum latitude in decimal degrees (WGS 84) _(Float)_
|
||||
- **maxLat:** maximum latitude in decimal degrees (WGS 84) _(Float)_
|
||||
|
@ -68,7 +68,7 @@ Define a box-shaped region by specifying an object containing the following prop
|
|||
```
|
||||
|
||||
### circle
|
||||
Define a circular region by specifying an object containing the following properties:
|
||||
Define a circular region by specifying a record containing the following properties:
|
||||
|
||||
- **lat**: latitude of the circle center in decimal degrees (WGS 84) _(Float)_
|
||||
- **lon**: longitude of the circle center in decimal degrees (WGS 84) _(Float)_
|
||||
|
@ -84,12 +84,12 @@ Define a circular region by specifying an object containing the following proper
|
|||
```
|
||||
|
||||
### polygon
|
||||
Define a polygonal region with an object containing the latitude and longitude for
|
||||
Define a polygonal region with a record containing the latitude and longitude for
|
||||
each point in the polygon:
|
||||
|
||||
- **points**: points that define the custom polygon _(Array of objects)_
|
||||
- **points**: points that define the custom polygon _(Array of records)_
|
||||
|
||||
Define each point with an object containing the following properties:
|
||||
Define each point with a record containing the following properties:
|
||||
|
||||
- **lat**: latitude in decimal degrees (WGS 84) _(Float)_
|
||||
- **lon**: longitude in decimal degrees (WGS 84) _(Float)_
|
||||
|
|
|
@ -3,7 +3,7 @@ title: Calculate the moving average
|
|||
seotitle: Calculate the moving average in Flux
|
||||
list_title: Moving Average
|
||||
description: >
|
||||
Use the [`movingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/)
|
||||
Use the [`movingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/movingaverage/)
|
||||
or [`timedMovingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/)
|
||||
functions to return the moving average of data.
|
||||
weight: 210
|
||||
|
@ -13,12 +13,12 @@ menu:
|
|||
name: Moving Average
|
||||
v2.0/tags: [query, moving average]
|
||||
related:
|
||||
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/
|
||||
- /v2.0/reference/flux/stdlib/built-in/transformations/movingaverage/
|
||||
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/
|
||||
list_query_example: moving_average
|
||||
---
|
||||
|
||||
Use the [`movingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/)
|
||||
Use the [`movingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/movingaverage/)
|
||||
or [`timedMovingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/)
|
||||
functions to return the moving average of data.
|
||||
|
||||
|
|
|
@ -45,13 +45,13 @@ Rows that evaluate to `false` are **excluded** from the output data.
|
|||
|
||||
The `fn` predicate function requires an `r` argument, which represents each row
|
||||
as `filter()` iterates over input data.
|
||||
Key-value pairs in the row object represent columns and their values.
|
||||
Key-value pairs in the row record represent columns and their values.
|
||||
Use **dot notation** or **bracket notation** to reference specific column values in the predicate function.
|
||||
Use [logical operators](/v2.0/reference/flux/language/operators/#logical-operators)
|
||||
to chain multiple predicate expressions together.
|
||||
|
||||
```js
|
||||
// Row object
|
||||
// Row record
|
||||
r = {foo: "bar", baz: "quz"}
|
||||
|
||||
// Example predicate function
|
||||
|
|
|
@ -34,7 +34,7 @@ This lets you, for example, dynamically set variables using query results.
|
|||
|
||||
1. [Extract a column from the input stream](#extract-a-column)
|
||||
_**or**_ [extract a row from the input stream](#extract-a-row).
|
||||
2. Use the returned array or object to reference scalar values.
|
||||
2. Use the returned array or record to reference scalar values.
|
||||
|
||||
_The samples on this page use the [sample data provided below](#sample-data)._
|
||||
|
||||
|
@ -108,7 +108,7 @@ SFOTemps[2]
|
|||
Use the [`findRecord()` function](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findrecord/)
|
||||
to output data from a single row in the extracted table.
|
||||
Specify the index of the row to output using the `idx` parameter.
|
||||
The function outputs an object with key-value pairs for each column.
|
||||
The function outputs a record with key-value pairs for each column.
|
||||
|
||||
```js
|
||||
sampleData
|
||||
|
@ -125,11 +125,11 @@ sampleData
|
|||
// }
|
||||
```
|
||||
|
||||
### Use an extracted row object
|
||||
Use a variable to store the extracted row object.
|
||||
### Use an extracted row record
|
||||
Use a variable to store the extracted row record.
|
||||
In the example below, `tempInfo` represents the extracted row.
|
||||
Use [dot notation](/v2.0/query-data/get-started/syntax-basics/#objects) to reference
|
||||
keys in the object.
|
||||
Use [dot notation](/v2.0/query-data/get-started/syntax-basics/#records) to reference
|
||||
keys in the record.
|
||||
|
||||
```js
|
||||
tempInfo = sampleData
|
||||
|
@ -180,7 +180,7 @@ lastJFKTemp
|
|||
|
||||
##### Extract scalar row data
|
||||
```js
|
||||
// Define a helper function to extract a row as an object
|
||||
// Define a helper function to extract a row as a record
|
||||
getRow = (tables=<-, field, idx=0) => {
|
||||
extract = tables
|
||||
|> findRecord(
|
||||
|
|
|
@ -77,13 +77,13 @@ The `filter()` function has one parameter, `fn`, which expects an anonymous func
|
|||
with logic that filters data based on columns or attributes.
|
||||
|
||||
Flux's anonymous function syntax is similar to Javascript's.
|
||||
Records or rows are passed into the `filter()` function as an object (`r`).
|
||||
The anonymous function takes the object and evaluates it to see if it matches the defined filters.
|
||||
Records or rows are passed into the `filter()` function as a record (`r`).
|
||||
The anonymous function takes the record and evaluates it to see if it matches the defined filters.
|
||||
Use the `and` relational operator to chain multiple filters.
|
||||
|
||||
```js
|
||||
// Pattern
|
||||
(r) => (r.objectProperty comparisonOperator comparisonExpression)
|
||||
(r) => (r.recordProperty comparisonOperator comparisonExpression)
|
||||
|
||||
// Example with single filter
|
||||
(r) => (r._measurement == "cpu")
|
||||
|
|
|
@ -57,14 +57,14 @@ this is a string
|
|||
2
|
||||
```
|
||||
|
||||
### Objects
|
||||
Flux also supports objects. Each value in an object can be a different data type.
|
||||
### Records
|
||||
Flux also supports records. Each value in a record can be a different data type.
|
||||
|
||||
```js
|
||||
> o = {name:"Jim", age: 42, "favorite color": "red"}
|
||||
```
|
||||
|
||||
Use **dot notation** to access a properties of an object:
|
||||
Use **dot notation** to access a properties of a record:
|
||||
|
||||
```js
|
||||
> o.name
|
||||
|
@ -85,7 +85,7 @@ red
|
|||
```
|
||||
|
||||
{{% note %}}
|
||||
Use bracket notation to reference object properties with special or
|
||||
Use bracket notation to reference record properties with special or
|
||||
white space characters in the property key.
|
||||
{{% /note %}}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ The data model consists of tables, records, columns and streams.
|
|||
|
||||
## Record
|
||||
|
||||
A **record** is a tuple of named values and is represented using an object type.
|
||||
A **record** is a tuple of named values and is represented using a record type.
|
||||
|
||||
## Column
|
||||
|
||||
|
@ -93,7 +93,7 @@ By interpreting a _null_ operand as an unknown value, we have the following defi
|
|||
- _null_ and true = _null_
|
||||
- _null_ and _null_ = _null_
|
||||
|
||||
Because records are represented using object types, attempting to access a column
|
||||
Because records are represented using record types, attempting to access a column
|
||||
whose value is unknown or missing from a record will also return _null_.
|
||||
|
||||
{{% note %}}
|
||||
|
@ -131,7 +131,7 @@ from(bucket: "db")
|
|||
```
|
||||
|
||||
If a parameter is renamed from `r` to `v`, the script fails:
|
||||
|
||||
|
||||
```js
|
||||
from(bucket: "db")
|
||||
|> filter(fn: (v) => ...)
|
||||
|
|
|
@ -33,18 +33,18 @@ Literal = int_lit
|
|||
| duration_lit
|
||||
| date_time_lit
|
||||
| pipe_receive_lit
|
||||
| ObjectLiteral
|
||||
| RecordLiteral
|
||||
| ArrayLiteral
|
||||
| FunctionLiteral .
|
||||
```
|
||||
|
||||
### Object literals
|
||||
### Record literals
|
||||
|
||||
Object literals construct a value with the object type.
|
||||
Record literals construct a value with the record type.
|
||||
|
||||
```js
|
||||
ObjectLiteral = "{" ObjectBody "}" .
|
||||
ObjectBody = WithProperties | PropertyList .
|
||||
RecordLiteral = "{" RecordBody "}" .
|
||||
RecordBody = WithProperties | PropertyList .
|
||||
WithProperties = identifier "with" PropertyList .
|
||||
PropertyList = [ Property { "," Property } ] .
|
||||
Property = identifier [ ":" Expression ]
|
||||
|
@ -171,21 +171,21 @@ IndexExpression = "[" Expression "]" .
|
|||
```
|
||||
|
||||
## Member expressions
|
||||
Member expressions access a property of an object.
|
||||
Member expressions access a property of a record.
|
||||
They are specified using an expression in one of the following forms:
|
||||
|
||||
```js
|
||||
obj.k
|
||||
rec.k
|
||||
// or
|
||||
obj["k"]
|
||||
rec["k"]
|
||||
```
|
||||
|
||||
The property being accessed must be either an identifier or a string literal.
|
||||
In either case the literal value is the name of the property being accessed, the identifier is not evaluated.
|
||||
It is not possible to access an object's property using an arbitrary expression.
|
||||
It is not possible to access a record's property using an arbitrary expression.
|
||||
|
||||
If `obj` contains an entry with property `k`, both `obj.k` and `obj["k"]` return the value associated with `k`.
|
||||
If `obj` does **not** contain an entry with property `k`, both `obj.k` and `obj["k"]` return _null_.
|
||||
If `rec` contains an entry with property `k`, both `rec.k` and `rec["k"]` return the value associated with `k`.
|
||||
If `rec` does **not** contain an entry with property `k`, both `rec.k` and `rec["k"]` return _null_.
|
||||
|
||||
```js
|
||||
MemberExpression = DotExpression | MemberBracketExpression .
|
||||
|
|
|
@ -92,7 +92,7 @@ Function operators facilitate the creation of functions and control the flow of
|
|||
|:--------: |:----------- | -------- | ------- |
|
||||
| <code>|></code> | Pipe‑forward | <code>data |> function()</code> | Tables contained in the "data" variable are piped into the function. |
|
||||
| `<-` | Pipe‑receive | `tables=<-` | The "tables" variable or parameter is assigned to data piped into the operation. _This operator is used for any data type passed into a function; not just table data._ |
|
||||
| `=>` | Arrow | `(r) => r.tag1 == "tagvalue"` | The arrow passes an object or parameters into function operations. |
|
||||
| `=>` | Arrow | `(r) => r.tag1 == "tagvalue"` | The arrow passes a record or parameters into function operations. |
|
||||
| `()` | Function call | `top(n:10)` | Call the `top` function setting the `n` parameter to `10` and perform the associated operations. |
|
||||
|
||||
---
|
||||
|
@ -116,7 +116,7 @@ Literal constructors define fixed values.
|
|||
| Operator | Description |
|
||||
|:--------:| ----------- |
|
||||
| `[ ]` | List / array |
|
||||
| `{ }` | Object |
|
||||
| `{ }` | Record |
|
||||
| `""` | String |
|
||||
|
||||
## Miscellaneous operators
|
||||
|
|
|
@ -41,10 +41,10 @@ count = 12
|
|||
{{% /note %}}
|
||||
|
||||
|
||||
## Use dot notation to interpolate object values
|
||||
[Objects](/v2.0/reference/flux/language/expressions/#object-literals) consist of key-value pairs.
|
||||
## Use dot notation to interpolate record values
|
||||
[Records](/v2.0/reference/flux/language/expressions/#record-literals) consist of key-value pairs.
|
||||
Use [dot notation](/v2.0/reference/flux/language/expressions/#member-expressions)
|
||||
to interpolate values from an object.
|
||||
to interpolate values from a record.
|
||||
|
||||
```js
|
||||
person = {
|
||||
|
@ -57,9 +57,9 @@ person = {
|
|||
// My name is John and I'm 42 years old.
|
||||
```
|
||||
|
||||
Flux returns each record in query results as an object.
|
||||
In Flux row functions, each row object is represented by `r`.
|
||||
Use dot notation to interpolate specific column values from the `r` object.
|
||||
Flux returns each record in query results as a record.
|
||||
In Flux row functions, each row record is represented by `r`.
|
||||
Use dot notation to interpolate specific column values from the `r` record.
|
||||
|
||||
##### Use string interpolation to add a human-readable message
|
||||
```js
|
||||
|
|
|
@ -42,5 +42,5 @@ Kinds = identifier { "+" identifier } .
|
|||
##### Example
|
||||
|
||||
```js
|
||||
builtin filter : (<-tables: [T], fn: (r: T) -> bool) -> [T]
|
||||
builtin filter : (<-tables: [T], fn: (r: T) => bool) => [T]
|
||||
```
|
||||
|
|
|
@ -15,7 +15,7 @@ Any section that is not currently implemented is commented with a **[IMPL#XXX]**
|
|||
{{% /note %}}
|
||||
|
||||
A **type** defines the set of values and operations on those values.
|
||||
Types are never explicitly declared as part of the syntax except as part of a [builtin statement](#system-built-ins).
|
||||
Types are never explicitly declared as part of the syntax except as part of a [builtin statement](/v2.0/reference/flux/language/system-built-ins/).
|
||||
Types are always inferred from the usage of the value.
|
||||
Type inference follows a Hindley-Milner style inference system.
|
||||
|
||||
|
@ -136,10 +136,17 @@ An _array type_ represents a sequence of values of any other type.
|
|||
All values in the array must be of the same type.
|
||||
The length of an array is the number of elements in the array.
|
||||
|
||||
### Object types
|
||||
An _object type_ represents a set of unordered key and value pairs.
|
||||
### Record types
|
||||
A _record type_ represents a set of unordered key and value pairs.
|
||||
The key must always be a string.
|
||||
The value may be any other type, and need not be the same as other values within the object.
|
||||
The value may be any other type, and need not be the same as other values within the record.
|
||||
|
||||
Keys in a record may only be referenced statically.
|
||||
|
||||
Type inference determines the properties that are present in a record.
|
||||
If type inference determines all the properties in a record, it is said to be "bounded."
|
||||
Not all keys may be known in the type of a record, in which case the record is said to be "unbounded."
|
||||
An unbounded record may contain any property in addition to the properties it is known to contain.
|
||||
|
||||
### Function types
|
||||
A _function type_ represents a set of all functions with the same argument and result types.
|
||||
|
@ -156,33 +163,35 @@ The generated values may be of any other type, but must all be the same type.
|
|||
[IMPL#658](https://github.com/influxdata/platform/query/issues/658) Implement Generators types.
|
||||
{{% /note %}}
|
||||
|
||||
#### Polymorphism
|
||||
Flux types can be polymorphic, meaning that a type may take on many different types.
|
||||
Flux supports let-polymorphism and structural polymorphism.
|
||||
## Polymorphism
|
||||
Flux functions can be polymorphic, meaning a function can be applied to arguments of different types.
|
||||
Flux supports parametric, record, and ad hoc polymorphism.
|
||||
|
||||
##### Let-polymorphism
|
||||
Let-polymorphism is the concept that each time an identifier is referenced, it may take on a different type.
|
||||
### Parametric polymorphism
|
||||
Parametric polymorphism is the notion that a function can be applied uniformly to arguments of any type.
|
||||
For example:
|
||||
|
||||
```js
|
||||
add = (a,b) => a + b
|
||||
add(a:1,b:2) // 3
|
||||
add(a:1.5,b:2.0) // 3.5
|
||||
f = (x) => x
|
||||
f(x: 1)
|
||||
f(x: 1.1)
|
||||
f(x: "1")
|
||||
f(x: true)
|
||||
f(x: f)
|
||||
```
|
||||
|
||||
The identifiers, `a` and `b`, in the body of the `add` function are used as both `int` and `float` types.
|
||||
|
||||
##### Structural polymorphism
|
||||
Structural polymorphism is the concept that structures (objects in Flux) can be
|
||||
used by the same function even if the structures themselves are different.
|
||||
### Record polymorphism
|
||||
Record polymorphism is the notion that a function can be applied to different types of records.
|
||||
For example:
|
||||
|
||||
```js
|
||||
john = {name:"John", lastName:"Smith"}
|
||||
jane = {name:"Jane", age:44}
|
||||
|
||||
// John and Jane are objects with different types.
|
||||
// We can still define a function that can operate on both objects safely.
|
||||
// John and Jane are records with different types.
|
||||
// We can still define a function that can operate on both records safely.
|
||||
|
||||
// name returns the name of a person
|
||||
name = (person) => person.name
|
||||
|
@ -195,7 +204,76 @@ device = {id: 125325, lat: 15.6163, lon: 62.6623}
|
|||
name(person:device) // Type error, "device" does not have a property name.
|
||||
```
|
||||
|
||||
Objects of differing types can be used as the same type so long as they both contain the necessary properties.
|
||||
Necessary properties are determined by the use of the object.
|
||||
This form of polymorphism means that checks are performed during type inference and not during runtime.
|
||||
Type errors are found and reported before runtime.
|
||||
Records of differing types can be passed to the same function as long as they contain the necessary properties.
|
||||
The necessary properties are determined by the use of the record.
|
||||
|
||||
### Ad hoc polymorphism
|
||||
Ad hoc polymorphism is the notion that a function can be applied to arguments of
|
||||
different types with different behavior depending on the type.
|
||||
|
||||
```js
|
||||
add = (a, b) => a + b
|
||||
|
||||
// Integer addition
|
||||
add(a: 1, b: 1)
|
||||
|
||||
// String concatenation
|
||||
add(a: "str", b: "ing")
|
||||
|
||||
// Addition not defined for boolean data types
|
||||
add(a: true, b: false)
|
||||
```
|
||||
|
||||
## Type constraints
|
||||
Type constraints are to implement static ad hoc polymorphism.
|
||||
For example, the following function is defined only for `Addable` types:
|
||||
|
||||
```js
|
||||
add = (a, b) => a + b
|
||||
```
|
||||
|
||||
Passing a record to `add()` results in compile-time type error because records are not addable.
|
||||
|
||||
```js
|
||||
// Records are not Addable and will result in an error.
|
||||
add(a: {}, b: {})
|
||||
```
|
||||
|
||||
Constraints are never explicitly declared but rather inferred from the context.
|
||||
|
||||
### Addable constraint
|
||||
Addable types are those the binary arithmetic operator `+` accepts.
|
||||
Integer, Uinteger, Float, and String types are `Addable`.
|
||||
|
||||
### Subtractable constraint
|
||||
Subtractable types are those the binary arithmetic operator `-` accepts.
|
||||
Integer, Uinteger, and Float types are `Subtractable`.
|
||||
|
||||
### Divisible constraint
|
||||
Divisible types are those the binary arithmetic operator `\` accepts.
|
||||
Integer, Uinteger, and Float types are `Divisible`.
|
||||
|
||||
### Numeric Constraint
|
||||
Integer, Uinteger, and Float types are `Numeric`.
|
||||
|
||||
### Comparable Constraint
|
||||
Comparable types are those the binary comparison operators `<`, `<=`, `>`, or `>=` accept.
|
||||
Integer, Uinteger, Float, String, Duration, and Time types are `Comparable`.
|
||||
|
||||
### Equatable Constraint
|
||||
Equatable types are those that can be compared for equality using the `==` or `!=` operators.
|
||||
Boolean, Integer, Uinteger, Float, String, Duration, Time, Bytes, Array, and Record types are `Equatable`.
|
||||
|
||||
### Nullable Constraint
|
||||
Nullable types are those that can be _null_.
|
||||
Boolean, Integer, Uinteger, Float, String, Duration, and Time types are `Nullable`.
|
||||
|
||||
### Record Constraint
|
||||
Records are the only types that fall under this constraint.
|
||||
|
||||
### Negatable Constraint
|
||||
Negatable types ore those the unary arithmetic operator `-` accepts.
|
||||
Integer, Uinteger, Float, and Duration types are `Negatable`.
|
||||
|
||||
### Timeable Constraint
|
||||
Duration and Time types are `Timeable`.
|
||||
|
|
|
@ -19,7 +19,7 @@ Each unique series is contained within its own table.
|
|||
Each record in the table represents a single point in the series.
|
||||
|
||||
_**Function type:** Input_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
from(
|
||||
|
|
|
@ -14,7 +14,7 @@ draft: true
|
|||
|
||||
The `intervals()` function generates a set of time intervals over a range of time.
|
||||
|
||||
An interval is an object with `start` and `stop` properties that correspond to the inclusive start and exclusive stop times of the time interval.
|
||||
An interval is a record with `start` and `stop` properties that correspond to the inclusive start and exclusive stop times of the time interval.
|
||||
The return value of intervals is another function that accepts start and stop time parameters and returns an interval generator.
|
||||
The generator is then used to produce the set of intervals.
|
||||
The set of intervals includes all intervals that intersect with the initial range of time.
|
||||
|
@ -28,7 +28,7 @@ By default the end boundary of an interval will align with the Unix epoch (zero
|
|||
modified by the offset of the `location` option.
|
||||
|
||||
_**Function type:** Miscellaneous_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
intervals()
|
||||
|
@ -59,7 +59,7 @@ Defaults to `0`, which will align window end boundaries with the `every` duratio
|
|||
_**Data type:** Duration_
|
||||
|
||||
### filter
|
||||
A function that accepts an interval object and returns a boolean value.
|
||||
A function that accepts an interval record and returns a boolean value.
|
||||
Each potential interval is passed to the filter function.
|
||||
When the function returns false, that interval is excluded from the set of intervals.
|
||||
Defaults to include all intervals.
|
||||
|
|
|
@ -27,10 +27,10 @@ sleep(
|
|||
Defines input tables.
|
||||
`sleep()` accepts piped-forward data and passes it on unmodified after the
|
||||
specified [duration](#duration).
|
||||
If data is not piped-forward into `sleep()`, set `v` to specify a stream object.
|
||||
If data is not piped-forward into `sleep()`, set `v` to specify a stream of tables.
|
||||
The examples [below](#examples) illustrate how.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### duration
|
||||
The length of time to delay execution.
|
||||
|
|
|
@ -108,13 +108,13 @@ identified by [`fieldFn`](#fieldfn).
|
|||
_**Data type:** Array of strings_
|
||||
|
||||
### fieldFn
|
||||
Function that takes a record from the input table and returns an object.
|
||||
For each record from the input table, `fieldFn` returns an object that maps the
|
||||
Function that takes a record from the input table and returns a record.
|
||||
For each record from the input table, `fieldFn` returns a record that maps the
|
||||
output field key to the output value.
|
||||
Default is `(r) => ({ [r._field]: r._value })`
|
||||
|
||||
_**Data type:** Function_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
{{% note %}}
|
||||
Make sure `fieldFn` parameter names match each specified parameter.
|
||||
|
|
|
@ -18,7 +18,7 @@ Yield outputs the input stream unmodified.
|
|||
A query may have multiple results, each identified by the name provided to the `yield()` function.
|
||||
|
||||
_**Function type:** Output_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
yield(name: "custom-name")
|
||||
|
|
|
@ -21,7 +21,7 @@ that returns the median `_value` of an input table or all non-null records in th
|
|||
with values that fall within the `0.5` quantile (50th percentile) depending on the [method](#method) used.
|
||||
|
||||
_**Function type:** Selector or Aggregate_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
|
||||
```js
|
||||
|
|
|
@ -20,7 +20,7 @@ a specified quantile or it returns the record with the `_value` that represents
|
|||
Which it returns depends on the [method](#method) used.
|
||||
|
||||
_**Function type:** Aggregate or Selector_
|
||||
_**Output data type:** Float or Object_
|
||||
_**Output data type:** Float | Record_
|
||||
|
||||
```js
|
||||
quantile(
|
||||
|
|
|
@ -19,7 +19,7 @@ related:
|
|||
The `reduce()` function aggregates records in each table according to the reducer,
|
||||
`fn`, providing a way to create custom aggregations.
|
||||
The output for each table is the group key of the table with columns corresponding
|
||||
to each field in the reducer object.
|
||||
to each field in the reducer record.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
|
||||
|
@ -41,7 +41,7 @@ Make sure `fn` parameter names match each specified parameter. To learn why, see
|
|||
{{% /note %}}
|
||||
|
||||
### fn
|
||||
Function to apply to each record with a reducer object ([`identity`](#identity)).
|
||||
Function to apply to each record with a reducer record ([`identity`](#identity)).
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
|
@ -55,27 +55,27 @@ fn: (r, accumulator) => ({ sum: r._value + accumulator.sum })
|
|||
```
|
||||
|
||||
{{% note %}}
|
||||
#### Matching output object keys and types
|
||||
The output object from `fn` must have the same key names and value types as the [`identity`](#identity).
|
||||
After operating on a record, the output object is given back to `fn` as the input accumulator.
|
||||
If the output object keys and value types do not match the `identity` keys and value types,
|
||||
#### Matching output record keys and types
|
||||
The output record from `fn` must have the same key names and value types as the [`identity`](#identity).
|
||||
After operating on a record, the output record is given back to `fn` as the input accumulator.
|
||||
If the output record keys and value types do not match the `identity` keys and value types,
|
||||
it will return a type error.
|
||||
{{% /note %}}
|
||||
|
||||
#### r
|
||||
Object representing each row or record.
|
||||
Record representing each row or record.
|
||||
|
||||
#### accumulator
|
||||
Reducer object defined by [`identity`](#identity).
|
||||
Reducer record defined by [`identity`](#identity).
|
||||
|
||||
### identity
|
||||
Defines the reducer object and provides initial values to use when creating a reducer.
|
||||
Defines the reducer record and provides initial values to use when creating a reducer.
|
||||
May be used more than once in asynchronous processing use cases.
|
||||
_The data type of values in the `identity` object determine the data type of output values._
|
||||
_The data type of values in the `identity` record determine the data type of output values._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
###### identity object syntax
|
||||
###### identity record syntax
|
||||
```js
|
||||
// Pattern
|
||||
identity: {identityKey1: value1, identityKey2: value2}
|
||||
|
|
|
@ -27,12 +27,12 @@ cov(x: table1, y: table2, on: ["_time", "_field"], pearsonr: false)
|
|||
### x
|
||||
One input stream used to calculate the covariance.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### y
|
||||
The other input table used to calculate the covariance.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### on
|
||||
The list of columns on which to join.
|
||||
|
|
|
@ -36,7 +36,7 @@ doubleEMA(n: 5)
|
|||
- `N = n` is the period used to calculate the EMA.
|
||||
- A true double exponential moving average requires at least `2 * n - 1` values.
|
||||
If not enough values exist to calculate the double EMA, it returns a `NaN` value.
|
||||
- `doubleEMA()` inherits all [exponential moving average rules](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/#exponential-moving-average-rules).
|
||||
- `doubleEMA()` inherits all [exponential moving average rules](/v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage/#exponential-moving-average-rules).
|
||||
|
||||
## Parameters
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ When a dropped column is part of the group key, it will be removed from the key.
|
|||
If a specified column is not present in a table, it will return an error.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
drop(columns: ["col1", "col2"])
|
||||
|
|
|
@ -16,7 +16,7 @@ If the specified column is part of the group key, it will be duplicated, but wil
|
|||
not be part of the output table's group key.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
duplicate(column: "column-name", as: "duplicate-name")
|
||||
|
|
|
@ -21,7 +21,7 @@ The `filter()` function filters data based on conditions defined in a predicate
|
|||
The output tables have the same schema as the corresponding input tables.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
filter(
|
||||
|
@ -46,7 +46,7 @@ Records that evaluate to _null_ or false are not included in the output tables.
|
|||
_**Data type:** Function_
|
||||
|
||||
{{% note %}}
|
||||
Objects evaluated in `fn` functions are represented by `r`, short for "record" or "row".
|
||||
Records evaluated in `fn` functions are represented by `r`, short for "record" or "row".
|
||||
{{% /note %}}
|
||||
|
||||
### onEmpty
|
||||
|
|
|
@ -22,7 +22,7 @@ The output table has the same group key as the input table.
|
|||
Columns not part of the group key are removed and an upper bound column and a count column are added.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
histogram(column: "_value", upperBoundColumn: "le", countColumn: "_value", bins: [50.0, 75.0, 90.0], normalize: false)
|
||||
|
|
|
@ -21,7 +21,7 @@ The resulting schema is the union of the input schemas.
|
|||
The resulting group key is the union of the input group keys.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
join(tables: {key1: table1, key2: table2}, on: ["_time", "_field"], method: "inner")
|
||||
|
@ -52,7 +52,7 @@ The resulting group keys for all tables will be: `[_time, _field_d1, _field_d2]`
|
|||
### tables
|
||||
The map of streams to be joined. <span class="required">Required</span>
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
{{% note %}}
|
||||
`join()` currently only supports two input streams.
|
||||
|
|
|
@ -16,7 +16,7 @@ Only columns in the group key that are also specified in the `keep()` function w
|
|||
_It is the inverse of [`drop`](/v2.0/reference/flux/stdlib/built-in/transformations/drop)._
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
keep(columns: ["col1", "col2"])
|
||||
|
|
|
@ -38,12 +38,12 @@ Make sure `fn` parameter names match each specified parameter. To learn why, see
|
|||
### fn
|
||||
|
||||
A single argument function to apply to each record.
|
||||
The return value must be an object.
|
||||
The return value must be a record.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
{{% note %}}
|
||||
Objects evaluated in `fn` functions are represented by `r`, short for "record" or "row".
|
||||
Records evaluated in `fn` functions are represented by `r`, short for "record" or "row".
|
||||
{{% /note %}}
|
||||
|
||||
## Important notes
|
||||
|
@ -57,7 +57,7 @@ By default, `map()` drops any columns that:
|
|||
|
||||
This often results in the `_time` column being dropped.
|
||||
To preserve the `_time` column and other columns that do not meet the criteria above,
|
||||
use the `with` operator to map values in the `r` object.
|
||||
use the `with` operator to map values in the `r` record.
|
||||
The `with` operator updates a column if it already exists,
|
||||
creates a new column if it doesn't exist, and includes all existing columns in
|
||||
the output table.
|
||||
|
|
|
@ -27,12 +27,12 @@ pearsonr(x: stream1, y: stream2, on: ["_time", "_field"])
|
|||
### x
|
||||
First input stream used in the operation.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### y
|
||||
Second input stream used in the operation.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### on
|
||||
The list of columns on which to join.
|
||||
|
|
|
@ -15,7 +15,7 @@ The `pivot()` function collects values stored vertically (column-wise) in a tabl
|
|||
and aligns them horizontally (row-wise) into logical sets.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|
||||
|
|
|
@ -20,7 +20,7 @@ Each input table's group key value is modified to fit within the time bounds.
|
|||
Tables where all records exists outside the time bounds are filtered entirely.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:* Object_
|
||||
_**Output data type:* Record_
|
||||
|
||||
```js
|
||||
range(start: -15m, stop: now())
|
||||
|
@ -31,21 +31,21 @@ range(start: -15m, stop: now())
|
|||
### start
|
||||
The earliest time to include in results.
|
||||
Results **include** points that match the specified start time.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
|
||||
_**Data type:** Duration | Time_
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
||||
### stop
|
||||
The latest time to include in results.
|
||||
Results **exclude** points that match the specified stop time.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
Defaults to `now()`.
|
||||
|
||||
_**Data type:** Duration | Time_
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
||||
{{% note %}}
|
||||
Time values in Flux must be in [RFC3339 format](/v2.0/reference/flux/language/types#timestamp-format).
|
||||
|
@ -56,20 +56,27 @@ Time values in Flux must be in [RFC3339 format](/v2.0/reference/flux/language/ty
|
|||
###### Time range relative to now
|
||||
```js
|
||||
from(bucket:"example-bucket")
|
||||
|> range(start:-12h)
|
||||
|> range(start: -12h)
|
||||
// ...
|
||||
```
|
||||
|
||||
###### Relative time range
|
||||
```js
|
||||
from(bucket:"example-bucket")
|
||||
|> range(start:-12h, stop: -15m)
|
||||
|> range(start: -12h, stop: -15m)
|
||||
// ...
|
||||
```
|
||||
|
||||
###### Absolute time range
|
||||
```js
|
||||
from(bucket:"example-bucket")
|
||||
|> range(start:2018-05-22T23:30:00Z, stop: 2018-05-23T00:00:00Z)
|
||||
|> range(start: 2018-05-22T23:30:00Z, stop: 2018-05-23T00:00:00Z)
|
||||
// ...
|
||||
```
|
||||
|
||||
###### Absolute time range with Unix timestamps
|
||||
```js
|
||||
from(bucket:"example-bucket")
|
||||
|> range(start: 1527031800, stop: 1527033600)
|
||||
// ...
|
||||
```
|
||||
|
|
|
@ -40,7 +40,7 @@ Make sure `fn` parameter names match each specified parameter. To learn why, see
|
|||
A map of columns to rename and their corresponding new names.
|
||||
Cannot be used with `fn`.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### fn
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ related:
|
|||
The `bottom()` function sorts a table by columns and keeps only the bottom `n` records.
|
||||
|
||||
_**Function type:** Selector_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
bottom(n:10, columns: ["_value"])
|
||||
|
|
|
@ -18,7 +18,7 @@ The `_value` of each output record is set to the distinct value in the specified
|
|||
`null` is considered its own distinct value if it is present.
|
||||
|
||||
_**Function type:** Selector_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
distinct(column: "host")
|
||||
|
|
|
@ -17,7 +17,7 @@ related:
|
|||
The `first()` function selects the first non-null record from an input table.
|
||||
|
||||
_**Function type:** Selector_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
first()
|
||||
|
|
|
@ -17,7 +17,7 @@ related:
|
|||
The `last()` function selects the last non-null record from an input table.
|
||||
|
||||
_**Function type:** Selector_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
last()
|
||||
|
|
|
@ -16,7 +16,7 @@ related:
|
|||
The `max()` function selects record with the highest `_value` from the input table.
|
||||
|
||||
_**Function type:** Selector_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
max(column: "_value")
|
||||
|
|
|
@ -16,7 +16,7 @@ related:
|
|||
The `min()` function selects record with the lowest `_value` from the input table.
|
||||
|
||||
_**Function type:** Selector_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
min(column: "_value")
|
||||
|
|
|
@ -16,7 +16,7 @@ related:
|
|||
The `sample()` function selects a subset of the records from the input table.
|
||||
|
||||
_**Function type:** Selector_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
sample(n:5, pos: -1)
|
||||
|
|
|
@ -14,7 +14,7 @@ weight: 501
|
|||
The `top()` function sorts a table by columns and keeps only the top `n` records.
|
||||
|
||||
_**Function type:** Selector_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
top(n:10, columns: ["_value"])
|
||||
|
|
|
@ -15,7 +15,7 @@ The `unique()` function returns all records containing unique values in a specif
|
|||
Group keys, record columns, and values are **not** modified.
|
||||
|
||||
_**Function type:** Selector_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
unique(column: "_value")
|
||||
|
|
|
@ -16,7 +16,7 @@ The key may modify an existing column or add a new column to the tables.
|
|||
If the modified column is part of the group key, the output tables are regrouped as needed.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
set(key: "myKey",value: "myValue")
|
||||
|
|
|
@ -18,7 +18,7 @@ One output table is produced for each input table.
|
|||
The output tables will have the same schema as their corresponding input tables.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
#### Sorting with null values
|
||||
When sorting, `null` values will always be first.
|
||||
|
|
|
@ -14,7 +14,7 @@ related:
|
|||
|
||||
The `findRecord()` function returns a record at a specified index from the first
|
||||
table in a stream of tables where the group key values match the specified predicate.
|
||||
The function returns an empty object if no table is found or if the index is out of bounds.
|
||||
The function returns an empty record if no table is found or if the index is out of bounds.
|
||||
|
||||
_**Function type:** Stream and table_
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ tripleEMA(n: 5)
|
|||
- `EMA_3` is the exponential moving average of `EMA_2`.
|
||||
- A true triple exponential moving average requires at least requires at least `3 * n - 2` values.
|
||||
If not enough values exist to calculate the triple EMA, it returns a `NaN` value.
|
||||
- `tripleEMA()` inherits all [exponential moving average rules](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/#exponential-moving-average-rules).
|
||||
- `tripleEMA()` inherits all [exponential moving average rules](/v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage/#exponential-moving-average-rules).
|
||||
|
||||
## Parameters
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ The output schemas of the `union()` function is the union of all input schemas.
|
|||
A sort operation may be added if a specific sort order is needed.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
union(tables: [table1, table2])
|
||||
|
|
|
@ -25,7 +25,7 @@ By default the start boundary of a window will align with the Unix epoch (zero t
|
|||
modified by the offset of the `location` option.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
window(
|
||||
|
|
|
@ -55,12 +55,12 @@ _**Data type:** String_
|
|||
The output function requires a `mapFn` parameter.
|
||||
|
||||
### mapFn
|
||||
A function that builds the object used to generate the Discord webhook request.
|
||||
A function that builds the record used to generate the Discord webhook request.
|
||||
Requires an `r` parameter.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
`mapFn` accepts a table row (`r`) and returns an object that must include the
|
||||
`mapFn` accepts a table row (`r`) and returns a record that must include the
|
||||
following field:
|
||||
|
||||
- `content`
|
||||
|
|
|
@ -55,19 +55,17 @@ _**Data type:** String_
|
|||
### start
|
||||
<span class="req">Required</span> Earliest time to include in results.
|
||||
Results **include** points that match the specified start time.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
Integers are nanosecond Unix timestamps.
|
||||
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
||||
### stop
|
||||
Latest time to include in results.
|
||||
Results **exclude** points that match the specified stop time.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Integers are nanosecond Unix timestamps.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
|
||||
Defaults to `now()`.
|
||||
|
@ -96,7 +94,7 @@ Defaults to `(r) => true`.
|
|||
_**Data type:** Function_
|
||||
|
||||
{{% note %}}
|
||||
Objects evaluated in `fn` functions are represented by `r`, short for "record" or "row".
|
||||
Records evaluated in `fn` functions are represented by `r`, short for "record" or "row".
|
||||
{{% /note %}}
|
||||
|
||||
### host
|
||||
|
|
|
@ -32,7 +32,7 @@ rows.map( fn: (r) => ({_value: r._value * 100.0}))
|
|||
### fn
|
||||
|
||||
A single argument function to apply to each record.
|
||||
The return value must be an object.
|
||||
The return value must be a record.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
|
|
|
@ -35,12 +35,12 @@ _**Data type:** String_
|
|||
The output function requires a `mapFn` parameter.
|
||||
|
||||
### mapFn
|
||||
A function that builds the object used to generate the POST request.
|
||||
A function that builds the record used to generate the POST request.
|
||||
Requires an `r` parameter.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
`mapFn` accepts a table row (`r`) and returns an object that must include the
|
||||
`mapFn` accepts a table row (`r`) and returns a record that must include the
|
||||
following fields:
|
||||
|
||||
- `title`
|
||||
|
|
|
@ -62,12 +62,12 @@ _**Data type:** Boolean_
|
|||
The output function requires a `mapFn` parameter.
|
||||
|
||||
### mapFn
|
||||
A function that builds the object used to generate the POST request.
|
||||
A function that builds the record used to generate the POST request.
|
||||
Requires an `r` parameter.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
`mapFn` accepts a table row (`r`) and returns an object that must include the
|
||||
`mapFn` accepts a table row (`r`) and returns a record that must include the
|
||||
following fields:
|
||||
|
||||
- `channel`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: array.from() function
|
||||
description: >
|
||||
The experimental `array.from()` function constructs a table from an array of objects.
|
||||
The experimental `array.from()` function constructs a table from an array of records.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: array.from
|
||||
|
@ -9,8 +9,8 @@ menu:
|
|||
weight: 401
|
||||
---
|
||||
|
||||
The experimental `array.from()` function constructs a table from an array of objects.
|
||||
Each object in the array is converted into an output row or record.
|
||||
The experimental `array.from()` function constructs a table from an array of records.
|
||||
Each record in the array is converted into an output row or record.
|
||||
All records must have the same keys and data types.
|
||||
|
||||
_**Function type:** Input_
|
||||
|
@ -31,7 +31,7 @@ array.from(rows: [
|
|||
### rows
|
||||
Array of records to construct a table with.
|
||||
|
||||
_**Data type:** Array of objects_
|
||||
_**Data type:** Array of records_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ Define geographic regions using the following shapes:
|
|||
- [polygon](#polygon)
|
||||
|
||||
### box
|
||||
Define a box-shaped region by specifying an object containing the following properties:
|
||||
Define a box-shaped region by specifying a record containing the following properties:
|
||||
|
||||
- **minLat:** minimum latitude in decimal degrees (WGS 84) _(Float)_
|
||||
- **maxLat:** maximum latitude in decimal degrees (WGS 84) _(Float)_
|
||||
|
@ -110,7 +110,7 @@ Define a box-shaped region by specifying an object containing the following prop
|
|||
```
|
||||
|
||||
### circle
|
||||
Define a circular region by specifying an object containing the following properties:
|
||||
Define a circular region by specifying a record containing the following properties:
|
||||
|
||||
- **lat**: latitude of the circle center in decimal degrees (WGS 84) _(Float)_
|
||||
- **lon**: longitude of the circle center in decimal degrees (WGS 84) _(Float)_
|
||||
|
@ -126,7 +126,7 @@ Define a circular region by specifying an object containing the following proper
|
|||
```
|
||||
|
||||
### point
|
||||
Define a point region by specifying an object containing the following properties:
|
||||
Define a point region by specifying a record containing the following properties:
|
||||
|
||||
- **lat**: latitude in decimal degrees (WGS 84) _(Float)_
|
||||
- **lon**: longitude in decimal degrees (WGS 84) _(Float)_
|
||||
|
@ -140,11 +140,11 @@ Define a point region by specifying an object containing the following propertie
|
|||
```
|
||||
|
||||
### polygon
|
||||
Define a custom polygon region using an object containing the following properties:
|
||||
Define a custom polygon region using a record containing the following properties:
|
||||
|
||||
- **points**: points that define the custom polygon _(Array of objects)_
|
||||
- **points**: points that define the custom polygon _(Array of records)_
|
||||
|
||||
Define each point with an object containing the following properties:
|
||||
Define each point with a record containing the following properties:
|
||||
|
||||
- **lat**: latitude in decimal degrees (WGS 84) _(Float)_
|
||||
- **lon**: longitude in decimal degrees (WGS 84) _(Float)_
|
||||
|
@ -168,7 +168,7 @@ Define GIS geometry using the following:
|
|||
- [linestring](#linestring)
|
||||
|
||||
### linestring
|
||||
Define a geographic linestring path using an object containing the following properties:
|
||||
Define a geographic linestring path using a record containing the following properties:
|
||||
|
||||
- **linestring**: string containing comma-separated longitude and latitude
|
||||
coordinate pairs (`lon lat,`):
|
||||
|
|
|
@ -76,10 +76,10 @@ In most cases, the specified geographic region does not perfectly align with S2
|
|||
|
||||
### region
|
||||
The region containing the desired data points.
|
||||
Specify object properties for the shape.
|
||||
Specify record properties for the shape.
|
||||
_See [Region definitions](/v2.0/reference/flux/stdlib/experimental/geo/#region-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### minSize
|
||||
Minimum number of cells that cover the specified region.
|
||||
|
|
|
@ -80,10 +80,10 @@ In most cases, the specified geographic region does not perfectly align with S2
|
|||
|
||||
### region
|
||||
The region containing the desired data points.
|
||||
Specify object properties for the shape.
|
||||
Specify record properties for the shape.
|
||||
_See [Region definitions](/v2.0/reference/flux/stdlib/experimental/geo/#region-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### minSize
|
||||
Minimum number of cells that cover the specified region.
|
||||
|
|
|
@ -30,9 +30,9 @@ geo.s2CellIDToken(
|
|||
### point
|
||||
Longitude and latitude in **decimal degrees** (WGS 84) to use when generating
|
||||
the S2 cell ID token.
|
||||
Object must contain `lat` and `lon` properties.
|
||||
Record must contain `lat` and `lon` properties.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### token
|
||||
S2 cell ID token to update.
|
||||
|
|
|
@ -20,7 +20,7 @@ Use `geo.shapeData()` to ensure geo-temporal data meets the
|
|||
[requirements of the Geo package](/v2.0/reference/flux/stdlib/experimental/geo/#geo-schema-requirements):
|
||||
|
||||
1. Rename existing latitude and longitude fields to `lat` and `lon`.
|
||||
2. Pivot data into row-wise sets based on the [`correlationKey`](#correlationkey).
|
||||
2. Pivot data into row-wise sets based on `_time`.
|
||||
3. Generate `s2_cell_id` tags using `lat` and `lon` values and a specified
|
||||
[S2 cell level](https://s2geometry.io/resources/s2cell_statistics.html).
|
||||
|
||||
|
|
|
@ -33,17 +33,17 @@ geo.ST_Contains(
|
|||
|
||||
### region
|
||||
The region to test.
|
||||
Specify object properties for the shape.
|
||||
Specify record properties for the shape.
|
||||
_See [Region definitions](/v2.0/reference/flux/stdlib/experimental/geo/#region-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### geometry
|
||||
The GIS geometry to test.
|
||||
Can be either point or linestring geometry.
|
||||
_See [GIS geometry definitions](/v2.0/reference/flux/stdlib/experimental/geo/#gis-geometry-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -34,17 +34,17 @@ geo.ST_Distance(
|
|||
|
||||
### region
|
||||
The region to test.
|
||||
Specify object properties for the shape.
|
||||
Specify record properties for the shape.
|
||||
_See [Region definitions](/v2.0/reference/flux/stdlib/experimental/geo/#region-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### geometry
|
||||
The GIS geometry to test.
|
||||
Can be either point or linestring geometry.
|
||||
_See [GIS geometry definitions](/v2.0/reference/flux/stdlib/experimental/geo/#gis-geometry-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -36,17 +36,17 @@ geo.ST_DWithin(
|
|||
|
||||
### region
|
||||
The region to test.
|
||||
Specify object properties for the shape.
|
||||
Specify record properties for the shape.
|
||||
_See [Region definitions](/v2.0/reference/flux/stdlib/experimental/geo/#region-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### geometry
|
||||
The GIS geometry to test.
|
||||
Can be either point or linestring geometry.
|
||||
_See [GIS geometry definitions](/v2.0/reference/flux/stdlib/experimental/geo/#gis-geometry-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### distance
|
||||
Maximum distance allowed between the region and geometry.
|
||||
|
|
|
@ -33,17 +33,17 @@ geo.ST_Intersects(
|
|||
|
||||
### region
|
||||
The region to test.
|
||||
Specify object properties for the shape.
|
||||
Specify record properties for the shape.
|
||||
_See [Region definitions](/v2.0/reference/flux/stdlib/experimental/geo/#region-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### geometry
|
||||
The GIS geometry to test.
|
||||
Can be either point or linestring geometry.
|
||||
_See [GIS geometry definitions](/v2.0/reference/flux/stdlib/experimental/geo/#gis-geometry-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ Can be either point or linestring geometry.
|
|||
Points will always return `0.0`.
|
||||
_See [GIS geometry definitions](/v2.0/reference/flux/stdlib/experimental/geo/#gis-geometry-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -62,10 +62,10 @@ In most cases, the specified geographic region does not perfectly align with S2
|
|||
|
||||
### region
|
||||
The region containing the desired data points.
|
||||
Specify object properties for the shape.
|
||||
Specify record properties for the shape.
|
||||
_See [Region definitions](/v2.0/reference/flux/stdlib/experimental/geo/#region-definitions)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ _**Data type:** String_
|
|||
### headers
|
||||
Headers to include with the GET request.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### timeout
|
||||
Timeout for the GET request.
|
||||
|
@ -44,7 +44,7 @@ Default is `30s`.
|
|||
_**Data type:** Duration_
|
||||
|
||||
## Response format
|
||||
`http.get` returns an object that contains the following:
|
||||
`http.get` returns a record that contains the following:
|
||||
|
||||
- [statusCode](#statuscode)
|
||||
- [body](#body)
|
||||
|
@ -63,7 +63,7 @@ _**Data type:** Byte Array_
|
|||
### headers
|
||||
Headers included with the response.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -53,9 +53,9 @@ Second of two streams of tables to join.
|
|||
_**Data type:** Stream of tables_
|
||||
|
||||
### fn
|
||||
A function with `left` and `right` arguments that maps a new output object
|
||||
using values from the `left` and `right` input objects.
|
||||
The return value must be an object.
|
||||
A function with `left` and `right` arguments that maps a new output record
|
||||
using values from the `left` and `right` input records.
|
||||
The return value must be a record.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ weight: 401
|
|||
---
|
||||
|
||||
The `json.parse()` function takes JSON data as bytes and returns a value.
|
||||
The function can return lists, objects, strings, booleans, and float values.
|
||||
The function can return lists, records, strings, booleans, and float values.
|
||||
All numeric values are returned as floats.
|
||||
|
||||
_**Function type:** Type conversion_
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: experimental.objectKeys() function
|
||||
description: >
|
||||
The `experimental.objectKeys()` function returns an array of keys in a specified object.
|
||||
The `experimental.objectKeys()` function returns an array of keys in a specified record.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: experimental.objectKeys
|
||||
|
@ -9,7 +9,7 @@ menu:
|
|||
weight: 302
|
||||
---
|
||||
|
||||
The `experimental.objectKeys()` function returns an array of keys in a specified object.
|
||||
The `experimental.objectKeys()` function returns an array of keys in a specified record.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
|
||||
|
@ -26,13 +26,13 @@ experimental.objectKeys(
|
|||
## Parameters
|
||||
|
||||
### o
|
||||
The object to return keys from.
|
||||
The record to return keys from.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
## Examples
|
||||
|
||||
### Return all keys in an object
|
||||
### Return all keys in a record
|
||||
```js
|
||||
import "experimental"
|
||||
|
||||
|
|
|
@ -35,20 +35,18 @@ _**Data type:** String_
|
|||
### start
|
||||
The earliest time to include in results.
|
||||
Results **include** points that match the specified start time.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`..
|
||||
Durations are relative to `now()`.
|
||||
Integers are nanosecond Unix timestamps.
|
||||
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
||||
### stop
|
||||
The latest time to include in results.
|
||||
Results **exclude** points that match the specified stop time.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
Integers are nanosecond Unix timestamps.
|
||||
Defaults to `now()`.
|
||||
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
|
|
@ -38,20 +38,18 @@ _**Data type:** String_
|
|||
### start
|
||||
The earliest time to include in results.
|
||||
Results **include** points that match the specified start time.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
Integers are nanosecond Unix timestamps.
|
||||
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
||||
### stop
|
||||
The latest time to include in results.
|
||||
Results **exclude** points that match the specified stop time.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
Integers are nanosecond Unix timestamps.
|
||||
Defaults to `now()`.
|
||||
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
|
|
@ -31,11 +31,11 @@ experimental.set(
|
|||
## Parameters
|
||||
|
||||
### o
|
||||
An object that defines the columns and values to set.
|
||||
A record that defines the columns and values to set.
|
||||
The key of each key-value pair defines the column name.
|
||||
The value of each key-value pair defines the column value.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ The URL to POST to.
|
|||
_**Data type:** String_
|
||||
|
||||
### mapFn
|
||||
A function that builds the object used to generate the POST request.
|
||||
A function that builds the record used to generate the POST request.
|
||||
|
||||
{{% note %}}
|
||||
_You should rarely need to override the default `mapFn` parameter.
|
||||
|
@ -42,7 +42,7 @@ To see the default `mapFn` value or for insight into possible overrides, view th
|
|||
|
||||
_**Data type:** Function_
|
||||
|
||||
The returned object must include the following fields:
|
||||
The returned record must include the following fields:
|
||||
|
||||
- `headers`
|
||||
- `data`
|
||||
|
|
|
@ -37,7 +37,7 @@ _**Data type:** String_
|
|||
### headers
|
||||
Headers to include with the POST request.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
{{% note %}}
|
||||
##### Header keys with special characters
|
||||
|
|
|
@ -33,7 +33,7 @@ This function encodes [Flux types](/v2.0/reference/flux/language/types/) as foll
|
|||
### v
|
||||
The value to convert.
|
||||
|
||||
_**Data type:** Object | Array | Boolean | Duration | Float | Integer | String | Time | UInteger_
|
||||
_**Data type:** Record | Array | Boolean | Duration | Float | Integer | String | Time | UInteger_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ The `math.frexp()` function breaks `f` into a normalized fraction and an integra
|
|||
It returns `frac` and `exp` satisfying `f == frac × 2**exp`, with the absolute value
|
||||
of `frac` in the interval `[½, 1)`.
|
||||
|
||||
_**Output data type:** Object_
|
||||
_**Output data type:** Record_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
|
|
@ -12,7 +12,7 @@ weight: 301
|
|||
|
||||
The `math.lgamma()` function returns the natural logarithm and sign (-1 or +1) of `math.gamma(x:x)`.
|
||||
|
||||
_**Output data format:** Object_
|
||||
_**Output data format:** Record_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
|
|
@ -15,7 +15,7 @@ weight: 301
|
|||
The `math.modf()` function returns integer and fractional floating-point numbers that sum to `f`.
|
||||
Both values have the same sign as `f`.
|
||||
|
||||
_**Output data format:** Object_
|
||||
_**Output data format:** Record_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
|
|
@ -12,7 +12,7 @@ weight: 301
|
|||
|
||||
The `math.sincos()` function returns the values of `math.sin(x:x)` and `math.cos(x:x)`.
|
||||
|
||||
_**Output data format:** Object_
|
||||
_**Output data format:** Record_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
|
|
@ -70,7 +70,7 @@ Meta data used to identify this check.
|
|||
|
||||
**InfluxDB populates check data.**
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -32,19 +32,17 @@ monitor.from(
|
|||
|
||||
### start
|
||||
The earliest time to include in results.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
Integers are nanosecond Unix timestamps.
|
||||
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
||||
### stop
|
||||
The latest time to include in results.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
Integers are nanosecond Unix timestamps.
|
||||
Defaults to `now()`.
|
||||
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
|
|
@ -31,19 +31,17 @@ monitor.logs(
|
|||
|
||||
### start
|
||||
The earliest time to include in results.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
Integers are nanosecond Unix timestamps.
|
||||
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
||||
### stop
|
||||
The latest time to include in results.
|
||||
Use a relative duration or absolute time.
|
||||
For example, `-1h` or `2019-08-28T22:00:00Z`.
|
||||
Use a relative duration, absolute time, or integer (Unix timestamp in seconds).
|
||||
For example, `-1h`, `2019-08-28T22:00:00Z`, or `1567029600`.
|
||||
Durations are relative to `now()`.
|
||||
Integers are nanosecond Unix timestamps.
|
||||
Defaults to `now()`.
|
||||
|
||||
_**Data type:** Duration | Time | Integer_
|
||||
|
|
|
@ -37,7 +37,7 @@ _**Data type:** Function_
|
|||
Data to append to the output.
|
||||
**InfluxDB populates notification data.**
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
@ -37,12 +37,12 @@ _**Data type:** String_
|
|||
The output function requires a `mapFn` parameter.
|
||||
|
||||
### mapFn
|
||||
A function that builds the object used to generate the POST request.
|
||||
A function that builds the record used to generate the POST request.
|
||||
Requires an `r` parameter.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
The returned object must include the following fields:
|
||||
The returned record must include the following fields:
|
||||
|
||||
- `routingKey`
|
||||
- `client`
|
||||
|
|
|
@ -45,12 +45,12 @@ _**Data type:** String_
|
|||
The output function requires a `mapFn` parameter.
|
||||
|
||||
### mapFn
|
||||
A function that builds the object used to generate the API request.
|
||||
A function that builds the record used to generate the API request.
|
||||
Requires an `r` parameter.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
The returned object must include the following fields (as defined in
|
||||
The returned record must include the following fields (as defined in
|
||||
[`pushbullet.pushNote()`](/v2.0/reference/flux/stdlib/pushbullet/pushnote/#title)):
|
||||
|
||||
- `title`
|
||||
|
|
|
@ -49,7 +49,7 @@ _**Data type:** String_
|
|||
Data to send to the Pushbullet API.
|
||||
The function JSON-encodes data before sending it to Pushbullet.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ _**Data type:** String_
|
|||
The output function requires a `mapFn` parameter.
|
||||
|
||||
### mapFn
|
||||
A function that builds the object used to generate the POST request.
|
||||
A function that builds the record used to generate the POST request.
|
||||
Requires an `r` parameter.
|
||||
|
||||
{{% note %}}
|
||||
|
@ -65,7 +65,7 @@ To see the default `mapFn` value or for insight into possible overrides, view th
|
|||
|
||||
_**Data type:** Function_
|
||||
|
||||
The returned object must include the following fields:
|
||||
The returned record must include the following fields:
|
||||
|
||||
- `username`
|
||||
- `channel`
|
||||
|
|
|
@ -38,12 +38,12 @@ _**Data type:** String_
|
|||
The stream containing data to test.
|
||||
Defaults to piped-forward data (`<-`).
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### want
|
||||
The stream that contains the expected data to test against.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
|
||||
## Examples
|
||||
|
|
|
@ -41,12 +41,12 @@ _The `testing.diff()` function can be used to perform in-line diffs in a query._
|
|||
Stream containing data to test.
|
||||
_Defaults to piped-forward data (`<-`)._
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### want
|
||||
Stream that contains the expected data to test against.
|
||||
|
||||
_**Data type:** Object_
|
||||
_**Data type:** Record_
|
||||
|
||||
### epsilon
|
||||
Specifies how far apart two **float** values can be, but still considered equal.
|
||||
|
|
|
@ -513,7 +513,7 @@ See a list of [Flux keywords](/v2.0/reference/flux/language/lexical-elements/#ke
|
|||
|
||||
### literal
|
||||
|
||||
A literal is value in an expression, a number, character, string, function, object, or array.
|
||||
A literal is value in an expression, a number, character, string, function, record, or array.
|
||||
Literal values are interpreted as defined.
|
||||
|
||||
See examples of [Flux literals](/v2.0/reference/flux/language/expressions/#examples-of-function-literals).
|
||||
|
@ -763,7 +763,7 @@ See [Use the influx CLI's REPL](/v2.0/query-data/get-started/syntax-basics/#use-
|
|||
|
||||
### record
|
||||
|
||||
A tuple of named values represented using an object type.
|
||||
A tuple of named values represented using a record type.
|
||||
|
||||
### regular expressions
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ Because tags are indexed, queries on tags are faster than queries on fields. Thi
|
|||
{{% /note %}}
|
||||
|
||||
{{% note %}}
|
||||
Tags containing highly variable information like UUIDs, hashes, and random strings will lead to a large number of unique series in the database, known as **high series cardinality**. High series cardinality is a primary driver of high memory usage for many database workloads. See [series cardinality](v2.0/reference/glossary/#series-cardinality) for more information.
|
||||
Tags containing highly variable information like UUIDs, hashes, and random strings will lead to a large number of unique series in the database, known as **high series cardinality**. High series cardinality is a primary driver of high memory usage for many database workloads. See [series cardinality](/v2.0/reference/glossary/#series-cardinality) for more information.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,18 @@ Though newer versions of Flux may be available, they will not be included with
|
|||
InfluxDB until the next InfluxDB v2.0 release._
|
||||
{{% /note %}}
|
||||
|
||||
## v0.81.0 [2020-08-17]
|
||||
|
||||
### Features
|
||||
- Delete old parser.
|
||||
- Add function to indicate duplicate option assignments.
|
||||
|
||||
### Bug fixes
|
||||
- Calculate distinct key values.
|
||||
- Handle pipe arguments inside of compiler.
|
||||
|
||||
---
|
||||
|
||||
## v0.80.0 [2020-08-12]
|
||||
|
||||
### Features
|
||||
|
|
|
@ -31,7 +31,7 @@ For more information, see [Automatically configure Telegraf](/v2.0/write-data/no
|
|||
|
||||
Telegraf has an extensive list of plugins for many different technologies and use cases.
|
||||
Not all plugins are available through the InfluxDB UI, but you can
|
||||
[create and upload custom Telegraf configurations](#create-custom-influxdb-telegraf-configuration)
|
||||
[create and upload custom Telegraf configurations](#create-a-custom-telegraf-configuration)
|
||||
that include any of the available [Telegraf plugins](/v2.0/reference/telegraf-plugins).
|
||||
|
||||
## Use the influx CLI
|
||||
|
|
|
@ -18,7 +18,7 @@ Variables are scoped by organization.
|
|||
|
||||
## Use dashboard variables
|
||||
Both [predefined dashboard variables](#predefined-dashboard-variables) and [custom dashboard variables](#custom-dashboard-variables)
|
||||
are stored in a `v` object associated with each dashboard.
|
||||
are stored in a `v` record associated with each dashboard.
|
||||
Reference each variable using dot-notation (e.g. `v.variableName`).
|
||||
|
||||
```js
|
||||
|
|
Loading…
Reference in New Issue