Merge pull request #291 from influxdata/alpha-14

Alpha 14
pull/322/head
noramullen1 2019-06-28 10:41:18 -07:00 committed by GitHub
commit 6eb11b6e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
84 changed files with 2468 additions and 185 deletions

View File

@ -27,7 +27,7 @@ This article describes how to get started with InfluxDB OSS. To get started with
### Download and install InfluxDB v2.0 alpha
Download InfluxDB v2.0 alpha for macOS.
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.13_darwin_amd64.tar.gz" download>InfluxDB v2.0 alpha (macOS)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.14_darwin_amd64.tar.gz" download>InfluxDB v2.0 alpha (macOS)</a>
### Unpackage the InfluxDB binaries
Unpackage the downloaded archive.
@ -36,7 +36,7 @@ _**Note:** The following commands are examples. Adjust the file paths to your ow
```sh
# Unpackage contents to the current working directory
gunzip -c ~/Downloads/influxdb_2.0.0-alpha.13_darwin_amd64.tar.gz | tar xopf -
gunzip -c ~/Downloads/influxdb_2.0.0-alpha.14_darwin_amd64.tar.gz | tar xopf -
```
If you choose, you can place `influx` and `influxd` in your `$PATH`.
@ -44,7 +44,7 @@ You can also prefix the executables with `./` to run then in place.
```sh
# (Optional) Copy the influx and influxd binary to your $PATH
sudo cp influxdb_2.0.0-alpha.13_darwin_amd64/{influx,influxd} /usr/local/bin/
sudo cp influxdb_2.0.0-alpha.14_darwin_amd64/{influx,influxd} /usr/local/bin/
```
{{% note %}}
@ -90,8 +90,8 @@ influxd --reporting-disabled
### Download and install InfluxDB v2.0 alpha
Download the InfluxDB v2.0 alpha package appropriate for your chipset.
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.13_linux_amd64.tar.gz" download >InfluxDB v2.0 alpha (amd64)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.13_linux_arm64.tar.gz" download >InfluxDB v2.0 alpha (arm)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.14_linux_amd64.tar.gz" download >InfluxDB v2.0 alpha (amd64)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.14_linux_arm64.tar.gz" download >InfluxDB v2.0 alpha (arm)</a>
### Place the executables in your $PATH
Unpackage the downloaded archive and place the `influx` and `influxd` executables in your system `$PATH`.
@ -100,10 +100,10 @@ _**Note:** The following commands are examples. Adjust the file names, paths, an
```sh
# Unpackage contents to the current working directory
tar xvzf path/to/influxdb_2.0.0-alpha.13_linux_amd64.tar.gz
tar xvzf path/to/influxdb_2.0.0-alpha.14_linux_amd64.tar.gz
# Copy the influx and influxd binary to your $PATH
sudo cp influxdb_2.0.0-alpha.13_linux_amd64/{influx,influxd} /usr/local/bin/
sudo cp influxdb_2.0.0-alpha.14_linux_amd64/{influx,influxd} /usr/local/bin/
```
{{% note %}}

View File

@ -7,7 +7,7 @@ description: >
menu:
v2_0:
name: Process data
weight: 5
weight: 4
v2.0/tags: [tasks]
---

View File

@ -38,9 +38,9 @@ The InfluxDB UI provides multiple ways to create a task:
3. Select the **Task** option.
4. Specify the task options. See [Task options](/v2.0/process-data/task-options)
for detailed information about each option.
5. Click **Save as Task**.
5. Select a token to use from the **Token** dropdown.
6. Click **Save as Task**.
{{< img-hd src="/img/2-0-data-explorer-save-as-task.png" title="Add a task from the Data Explorer"/>}}
### Create a task in the Task UI
1. Click on the **Tasks** icon in the left navigation menu.
@ -51,8 +51,9 @@ The InfluxDB UI provides multiple ways to create a task:
3. Select **New Task**.
4. In the left panel, specify the task options.
See [Task options](/v2.0/process-data/task-options) for detailed information about each option.
5. In the right panel, enter your task script.
6. Click **Save** in the upper right.
5. Select a token to use from the **Token** dropdown.
6. In the right panel, enter your task script.
7. Click **Save** in the upper right.
{{< img-hd src="/img/2-0-tasks-create-edit.png" title="Create a task" />}}

View File

@ -17,13 +17,14 @@ To view your tasks, click the **Tasks** icon in the left navigation menu.
{{< nav-icon "tasks" >}}
Click on the name of a task to update it.
#### Update a task's Flux script
1. In the list of tasks, click the **Name** of the task you want to update.
2. In the left panel, modify the task options.
3. In the right panel, modify the task script.
4. Click **Save** in the upper right.
{{< img-hd src="/img/2-0-tasks-create-edit.png" alt="Update a task" />}}
#### Update the status of a task
In the list of tasks, click the {{< icon "toggle" >}} toggle to the left of the

View File

@ -87,8 +87,7 @@ from(bucket: "example-bucket")
|> range(start: -5m)
|> filter(fn: (r) => r._measurement == "mem" and r._field == "used_percent" )
|> map(fn: (r) => ({
_time: r._time,
_value: r._value,
r with
level:
if r._value >= 95.0000001 and r._value <= 100.0 then "critical"
else if r._value >= 85.0000001 and r._value <= 95.0 then "warning"
@ -104,10 +103,8 @@ from(bucket: "example-bucket")
|> range(start: -5m)
|> filter(fn: (r) => r._measurement == "mem" and r._field == "used_percent" )
|> map(fn: (r) => ({
// Retain the _time column in the mapped row
_time: r._time,
// Retain the _value column in the mapped row
_value: r._value,
// Retain all existing columns in the mapped row
r with
// Set the level column value based on the _value column
level:
if r._value >= 95.0000001 and r._value <= 100.0 then "critical"

View File

@ -49,6 +49,11 @@ in an input table.
)
```
{{% note %}}
To preserve existing columns, [use the `with` operator](/v2.0/reference/flux/functions/built-in/transformations/aggregates/reduce/#preserve-columns)
when mapping values in the `r` object.
{{% /note %}}
To illustrate how this function works, take this simplified table for example:
```txt

View File

@ -213,9 +213,10 @@ new `_value` column.
```js
join(tables: {mem:memUsed, proc:procTotal}, on: ["_time", "_stop", "_start", "host"])
|> map(fn: (r) => ({
_time: r._time,
_value: r._value_mem / r._value_proc
}))
_time: r._time,
_value: r._value_mem / r._value_proc
})
)
```
{{% truncate %}}

View File

@ -89,14 +89,14 @@ The example `multiplyByX()` function below includes:
- A `tables` parameter that represents the input data stream (`<-`).
- An `x` parameter which is the number by which values in the `_value` column are multiplied.
- A `map()` function that iterates over each row in the input stream.
It uses the `_time` value of the input stream to define the `_time` value in the output stream.
It uses the `with` operator to preserve existing columns in each row.
It also multiples the `_value` column by `x`.
```js
multiplyByX = (x, tables=<-) =>
tables
|> map(fn: (r) => ({
_time: r._time,
r with
_value: r._value * x
})
)
@ -115,17 +115,17 @@ The `map()` function iterates over each row in the piped-forward data and define
a new `_value` by dividing the original `_value` by 1073741824.
```js
from(bucket: "default")
from(bucket: "example-bucket")
|> range(start: -10m)
|> filter(fn: (r) =>
r._measurement == "mem" and
r._field == "active"
)
|> map(fn: (r) => ({
_time: r._time,
_value: r._value / 1073741824
})
)
r with
_value: r._value / 1073741824
})
)
```
You could turn that same calculation into a function:
@ -134,7 +134,7 @@ You could turn that same calculation into a function:
bytesToGB = (tables=<-) =>
tables
|> map(fn: (r) => ({
_time: r._time,
r with
_value: r._value / 1073741824
})
)
@ -153,7 +153,7 @@ and format the denominator in the division operation as a float.
bytesToGB = (tables=<-) =>
tables
|> map(fn: (r) => ({
_time: r._time,
r with
_value: float(v: r._value) / 1073741824.0
})
)
@ -195,7 +195,7 @@ usageToFloat = (tables=<-) =>
// Define the data source and filter user and system CPU usage
// from 'cpu-total' in the 'cpu' measurement
from(bucket: "default")
from(bucket: "example-bucket")
|> range(start: -1h)
|> filter(fn: (r) =>
r._measurement == "cpu" and
@ -213,7 +213,8 @@ from(bucket: "default")
// Map over each row and calculate the percentage of
// CPU used by the user vs the system
|> map(fn: (r) => ({
_time: r._time,
// Preserve existing columns in each row
r with
usage_user: r.usage_user / (r.usage_user + r.usage_system) * 100.0,
usage_system: r.usage_system / (r.usage_user + r.usage_system) * 100.0
})
@ -232,7 +233,7 @@ usageToFloat = (tables=<-) =>
})
)
from(bucket: "default")
from(bucket: "example-bucket")
|> range(start: timeRangeStart, stop: timeRangeStop)
|> filter(fn: (r) =>
r._measurement == "cpu" and
@ -243,7 +244,7 @@ from(bucket: "default")
|> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")
|> usageToFloat()
|> map(fn: (r) => ({
_time: r._time,
r with
usage_user: r.usage_user / (r.usage_user + r.usage_system) * 100.0,
usage_system: r.usage_system / (r.usage_user + r.usage_system) * 100.0
})

View File

@ -2,14 +2,13 @@
title: Annotated CSV syntax
description: >
Annotated CSV format is used to encode HTTP responses and results returned to the Flux `csv.from()` function.
weight: 6
menu:
v2_0_ref:
name: Annotated CSV
weight: 2
---
Annotated CSV (comma-separated values) format is used to encode HTTP responses and results returned to the Flux [`csv.from()` function](https://v2.docs.influxdata.com/v2.0/reference/flux/functions/csv/from/).
Annotated CSV (comma-separated values) format is used to encode HTTP responses and results returned to the Flux [`csv.from()` function](https://v2.docs.influxdata.com/v2.0/reference/flux/functions/csv/from/).
CSV tables must be encoded in UTF-8 and Unicode Normal Form C as defined in [UAX15](http://www.unicode.org/reports/tr15/). Line endings must be CRLF (Carriage Return Line Feed) as defined by the `text/csv` MIME type in [RFC 4180](https://tools.ietf.org/html/rfc4180).
@ -30,7 +29,7 @@ Flux supports encodings listed below.
A table may have the following rows and columns.
#### Rows
- **Annotation rows**: describe column properties.
- **Annotation rows**: describe column properties.
- **Header row**: defines column labels (one header row per table).
@ -74,11 +73,11 @@ In addition to the data columns, a table may include the following columns:
### Multiple tables and results
If a file or data stream contains multiple tables or results, the following requirements must be met:
- A table column indicates which table a row belongs to.
- A table column indicates which table a row belongs to.
- All rows in a table are contiguous.
- An empty row delimits a new table boundary in the following cases:
- Between tables in the same result that do not share a common table schema.
- Between tables in the same result that do not share a common table schema.
- Between concatenated CSV files.
- Each new table boundary starts with new annotation and header rows.
@ -214,12 +213,12 @@ If a table has no rows, the `default` annotation provides the group key values.
| duration | duration | a length of time represented as an unsigned 64-bit integer number of nanoseconds |
## Errors
If an error occurs during execution, a table returns with:
If an error occurs during execution, a table returns with:
- An error column that contains an error message.
- A reference column with a unique reference code to identify more information about the error.
- A second row with error properties.
- A second row with error properties.
If an error occurs:
- Before results materialize, the HTTP status code indicates an error. Error details are encoded in the csv table.
@ -243,4 +242,4 @@ Encoding for an error that occurs after a valid table has been encoded:
```js
#datatype,string,long
,error,reference,query terminated: reached maximum allowed memory limits,576
```
```

View File

@ -16,9 +16,10 @@ influxd inspect [command]
```
## Subcommands
| Subcommand | Description |
|:---------- |:----------- |
| [report-tsm](/v2.0/reference/cli/influxd/inspect/report-tsm/) | Run TSM report |
| Subcommand | Description |
|:---------- |:----------- |
| [report-tsm](/v2.0/reference/cli/influxd/inspect/report-tsm/) | Run TSM report |
| [verify-wal](/v2.0/reference/cli/influxd/inspect/verify-wal/) | Check for corrupt WAL files |
## Flags
| Flag | Description |

View File

@ -0,0 +1,39 @@
---
title: influxd inspect verify-wal
description: >
The `influxd inspect verify-wal` command analyzes the Write-Ahead Log (WAL)
to check if there are any corrupt files.
v2.0/tags: [wal, inspect]
menu:
v2_0_ref:
parent: influxd inspect
weight: 301
---
The `influxd inspect verify-wal` command analyze the Write-Ahead Log (WAL)
to check if there are any corrupt files.
If it finds corrupt files, the command returns the names of those files.
It also returns the total number of entries in each scanned WAL file.
## Usage
```sh
influxd inspect verify-wal [flags]
```
## Output details
`influxd inspect verify-wal` outputs the following for each file:
- The file name.
- The first position of any identified corruption or "clean" if no corruption is found.
After the verification is complete, it returns a summary with:
- The number of WAL files scanned.
- The number of WAL entries scanned.
- A list of files found to be corrupt.
## Flags
| Flag | Description | Input Type |
|:---- |:----------- |:----------:|
| `--data-dir` | The data directory to scan (default `~/.influxdbv2/engine/wal`). | string |
| `-h`, `--help` | Help for `verify-wal`. | |

View File

@ -3,7 +3,7 @@ title: InfluxDB client libraries
description: >
InfluxDB client libraries are language-specific tools that integrate with the InfluxDB v2 API.
View the list of available client libraries.
weight: 6
weight: 3
menu:
v2_0_ref:
name: Client libraries
@ -18,5 +18,5 @@ These client libraries are in active development and may not be feature-complete
This list will continue to grow as more client libraries are released.
{{% /note %}}
<!-- - [Go](https://github.com/influxdata/influxdb-client-go) -->
- [Go](https://github.com/influxdata/influxdb-client-go)
- [JavaScript/Node.js](https://github.com/influxdata/influxdb-client-js)

View File

@ -74,6 +74,26 @@ identity: {identityKey1: value1, identityKey2: value2}
identity: {sum: 0.0, count: 0.0}
```
## Important notes
#### Preserve columns
By default, `reduce()` drops any columns that:
1. Are not part of the input table's group key.
2. Are not explicitly mapped in the `reduce()` function.
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.
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.
```js
recduce(fn: (r) => ({ r with newColumn: r._value * 2 }))
```
## Examples
##### Compute the sum of the value column
@ -126,3 +146,19 @@ from(bucket:"example-bucket")
identity: {prod: 1.0}
)
```
##### Calculate the average and preserve existing columns
```js
from(bucket: "example-bucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "mem" and r._field == "used_percent")
|> window(every: 5m)
|> reduce(fn: (r, accumulator) => ({
r with
count: accumulator.count + 1,
total: accumulator.total + r._value,
avg: (accumulator.total + r._value) / float(v: accumulator.count)
}),
identity: {count: 1, total: 0.0, avg: 0.0}
)
```

View File

@ -23,9 +23,10 @@ filter(fn: (r) => r._measurement == "cpu")
## Parameters
### fn
A single argument function that evaluates true or false.
A single argument predicate function that evaluates true or false.
Records are passed to the function.
Those that evaluate to true are included in the output tables.
Records that evaluate to _null_ or false are not included in the output tables.
_**Data type:** Function_

View File

@ -24,25 +24,6 @@ _**Output data type:** Object_
map(fn: (r) => r._value * r._value), mergeKey: true)
```
{{% note %}}
#### Dropped columns
`map()` drops any columns that:
1. Are not part of the input table's group key
2. Are not explicitly mapped in the `map()` function.
This often results in the `_time` column being dropped.
To preserve the `_time` column, include it in your column mapping.
```js
map(fn: (r) => ({
_time: r._time,
...
})
)
```
{{% /note %}}
## Parameters
### fn
@ -63,6 +44,25 @@ Defaults to `true`.
_**Data type:** Boolean_
## Important notes
#### Preserve columns
By default, `map()` drops any columns that:
1. Are not part of the input table's group key.
2. Are not explicitly mapped in the `map()` function.
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.
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.
```js
map(fn: (r) => ({ r with newColumn: r._value * 2 }))
```
## Examples
###### Square the value of each record
@ -87,7 +87,23 @@ from(bucket:"example-bucket")
|> range(start:-12h)
// create a new table by copying each row into a new format
|> map(fn: (r) => ({
_time: r._time,
time: r._time,
app_server: r.host
}))
```
###### Add new columns and preserve existing columns
```js
from(bucket:"example-bucket")
|> filter(fn: (r) =>
r._measurement == "cpu" and
r._field == "usage_system"
)
|> range(start:-12h)
// create a new table by copying each row into a new format
|> map(fn: (r) => ({
r with
app_server: r.host,
valueInt: int(v: r._value)
}))
```

View File

@ -28,5 +28,5 @@ from(bucket: "sensor-data")
|> filter(fn:(r) =>
r._measurement == "system" and
)
|> map(fn:(r) => bool(v: r.responsive))
|> map(fn:(r) => ({ r with responsive: bool(v: r.responsive) }))
```

View File

@ -28,5 +28,5 @@ from(bucket: "sensor-data")
|> filter(fn:(r) =>
r._measurement == "system" and
)
|> map(fn:(r) => duration(v: r.uptime))
|> map(fn:(r) => ({ r with uptime: duration(v: r.uptime) }))
```

View File

@ -28,5 +28,5 @@ from(bucket: "sensor-data")
|> filter(fn:(r) =>
r._measurement == "camera" and
)
|> map(fn:(r) => float(v: r.aperature))
|> map(fn:(r) => ({ r with aperature: float(v: r.aperature) }))
```

View File

@ -28,5 +28,5 @@ from(bucket: "sensor-data")
|> filter(fn:(r) =>
r._measurement == "camera" and
)
|> map(fn:(r) => int(v: r.exposures))
|> map(fn:(r) => ({ r with exposures: int(v: r.exposures) }))
```

View File

@ -28,5 +28,5 @@ from(bucket: "sensor-data")
|> filter(fn:(r) =>
r._measurement == "system" and
)
|> map(fn:(r) => string(v: r.model_number))
|> map(fn:(r) => ({ r with model_number string(v: r.model_number) }))
```

View File

@ -28,5 +28,5 @@ from(bucket: "sensor-data")
|> filter(fn:(r) =>
r._measurement == "system" and
)
|> map(fn:(r) => time(v: r.timestamp))
|> map(fn:(r) => ({ r with timestamp: time(v: r.timestamp) }))
```

View File

@ -28,5 +28,5 @@ from(bucket: "sensor-data")
|> filter(fn:(r) =>
r._measurement == "camera" and
)
|> map(fn:(r) => uint(v: r.exposures))
|> map(fn:(r) => ({ r with exposures: uint(v: r.exposures) }))
```

View File

@ -9,7 +9,7 @@ menu:
v2_0_ref:
name: InfluxDB v1
parent: Flux packages and functions
weight: 203
weight: 202
v2.0/tags: [functions, influxdb-v1, package]
---

View File

@ -0,0 +1,22 @@
---
title: Flux regular expressions package
list_title: Regular expressions package
description: >
The Flux regular expressions package includes functions that provide enhanced
regular expression functionality. Import the `regexp` package.
menu:
v2_0_ref:
name: Regular expressions
parent: Flux packages and functions
weight: 202
v2.0/tags: [regex, functions]
---
The Flux regular expressions package includes functions that provide enhanced
regular expression functionality. Import the `regexp` package.
```js
import "regexp"
```
{{< children type="functions" show="pages" >}}

View File

@ -0,0 +1,50 @@
---
title: regexp.compile() function
description: >
The `regexp.compile()` function parses a regular expression and, if successful,
returns a Regexp object that can be used to match against text.
menu:
v2_0_ref:
name: regexp.compile
parent: Regular expressions
weight: 301
---
The `regexp.compile()` function parses a regular expression and, if successful,
returns a Regexp object that can be used to match against text.
_**Output data type:** Regexp_
```js
import "regexp"
regexp.compile(v: "abcd")
// Returns the regexp object `abcd`
```
## Parameters
### v
The string value to parse into a regular expression.
_**Data type:** String_
## Examples
###### Use a string value as a regular expression
```js
import "regexp"
data
|> map(fn: (r) => ({
r with
regexStr: r.regexStr,
_value: r._value,
firstRegexMatch: findString(
r: regexp.compile(v: regexStr),
v: r._value
)
})
)
```

View File

@ -0,0 +1,51 @@
---
title: regexp.findString() function
description: The `regexp.findString()` function returns the left-most regular expression match in a string.
menu:
v2_0_ref:
name: regexp.findString
parent: Regular expressions
weight: 301
related:
- /v2.0/reference/flux/functions/regexp/splitregexp
---
The `regexp.findString()` function returns the left-most regular expression match in a string.
_**Output data type:** String_
```js
import "regexp"
findString(r: /foo.?/, v: "seafood fool")
// Returns "food"
```
## Parameters
### r
The regular expression used to search `v`.
_**Data type:** Regexp_
### v
The string value to search.
_**Data type:** String_
## Examples
###### Find the first regular expression match in each row
```js
import "regexp"
data
|> map(fn: (r) => ({
r with
message: r.message,
regexp: r.regexp,
match: regexp.findString(r: r.regexp, v: r.message)
})
)
```

View File

@ -0,0 +1,57 @@
---
title: regexp.findStringIndex() function
description: >
The `regexp.findStringIndex()` function returns a two-element array of integers defining
the beginning and ending indexes of the left-most regular expression match in a string.
menu:
v2_0_ref:
name: regexp.findStringIndex
parent: Regular expressions
weight: 301
related:
- /v2.0/reference/flux/functions/regexp/compile
---
The `regexp.findStringIndex()` function returns a two-element array of integers defining
the beginning and ending indexes of the left-most regular expression match in a string.
_**Output data type:** Array of Integers_
```js
import "regexp"
regexp.findStringIndex(r: /ab?/, v: "tablet")
// Returns [1, 3]
```
## Parameters
### r
The regular expression used to search `v`.
_**Data type:** Regexp_
### v
The string value to search.
_**Data type:** String_
## Examples
###### Index the bounds of first regular expression match in each row
```js
import "regexp"
data
|> map(fn: (r) => ({
r with
regexStr: r.regexStr,
_value: r._value,
matchIndex: regexp.findStringIndex(
r: regexp.compile(r.regexStr),
v: r._value
)
})
)
```

View File

@ -0,0 +1,45 @@
---
title: regexp.getString() function
description: The `regexp.getString()` function returns the source string used to compile a regular expression.
menu:
v2_0_ref:
name: regexp.getString
parent: Regular expressions
weight: 301
related:
- /v2.0/reference/flux/functions/regexp/compile
---
The `regexp.getString()` function returns the source string used to compile a regular expression.
_**Output data type:** String_
```js
import "regexp"
regexp.getString(r: /[a-zA-Z]/)
// Returns "[a-zA-Z]"
```
## Parameters
### r
The regular expression object to convert to a string.
_**Data type:** Regexp_
## Examples
###### Convert regular expressions into strings in each row
```js
import "regexp"
data
|> map(fn: (r) => ({
r with
regex: r.regex,
regexStr: regexp.getString(r: r.regex)
})
)
```

View File

@ -0,0 +1,51 @@
---
title: regexp.matchRegexpString() function
description: >
The `regexp.matchRegexpString()` function tests if a string contains any match
to a regular expression.
menu:
v2_0_ref:
name: regexp.matchRegexpString
parent: Regular expressions
weight: 301
---
The `regexp.matchRegexpString()` function tests if a string contains any match
to a regular expression.
_**Output data type:** Boolean_
```js
import "regexp"
regexp.matchRegexpString(r: /(gopher){2}/, v: "gophergophergopher")
// Returns true
```
## Parameters
### r
The regular expression used to search `v`.
_**Data type:** Regexp_
### v
The string value to search.
_**Data type:** String_
## Examples
###### Filter by columns that contain matches to a regular expression
```js
import "regexp"
data
|> filter(fn: (r) =>
regexp.matchRegexpString(
r: /Alert\:/,
v: r.message
)
)
```

View File

@ -0,0 +1,44 @@
---
title: regexp.quoteMeta() function
description: >
The `regexp.quoteMeta()` function escapes all regular expression metacharacters inside of a string.
menu:
v2_0_ref:
name: regexp.quoteMeta
parent: Regular expressions
weight: 301
---
The `regexp.quoteMeta()` function escapes all regular expression metacharacters inside of a string.
_**Output data type:** String_
```js
import "regexp"
regexp.quoteMeta(v: ".+*?()|[]{}^$")
// Returns "\.\+\*\?\(\)\|\[\]\{\}\^\$"
```
## Parameters
### v
The string that contains regular expression metacharacters to escape.
_**Data type:** String_
## Examples
###### Escape regular expression meta characters in column values
```js
import "regexp"
data
|> map(fn: (r) => ({
r with
notes: r.notes,
notes_escaped: regexp.quoteMeta(v: r.notes)
})
)
```

View File

@ -0,0 +1,59 @@
---
title: regexp.replaceAllString() function
description: >
The `regexp.replaceAllString()` function replaces all regular expression matches
in a string with a specified replacement.
menu:
v2_0_ref:
name: regexp.replaceAllString
parent: Regular expressions
weight: 301
---
The `regexp.replaceAllString()` function replaces all regular expression matches
in a string with a specified replacement.
_**Output data type:** String_
```js
import "regexp"
regexp.replaceAllString(r: /a(x*)b/, v: "-ab-axxb-", t: "T")
// Returns "-T-T-"
```
## Parameters
### r
The regular expression used to search `v`.
_**Data type:** Regexp_
### v
The string value to search.
_**Data type:** String_
### t
The replacement for matches to `r`.
_**Data type:** String_
## Examples
###### Replace regular expression matches in string column values
```js
import "regexp"
data
|> map(fn: (r) => ({
r with
message: r.message,
updated_message: regexp.replaceAllString(
r: /cat|bird|ferret/,
v: r.message,
t: "dog"
)
}))
```

View File

@ -0,0 +1,41 @@
---
title: regexp.splitRegexp() function
description: >
The `regexp.splitRegexp()` function splits a string into substrings separated by
regular expression matches and returns an array of `i` substrings between matches.
menu:
v2_0_ref:
name: regexp.splitRegexp
parent: Regular expressions
weight: 301
---
The `regexp.splitRegexp()` function splits a string into substrings separated by
regular expression matches and returns an array of `i` substrings between matches.
_**Output data type:** Array of Strings_
```js
import "regexp"
regexp.splitRegexp(r: /a*/, v: "abaabaccadaaae", i: 5)
// Returns ["", "b", "b", "c", "cadaaae"]
```
## Parameters
### r
The regular expression used to search `v`.
_**Data type:** Regexp_
### v
The string value to search.
_**Data type:** String_
### i
The number of substrings to return.
_**Data type:** Integer_

View File

@ -0,0 +1,22 @@
---
title: Flux SQL package
list_title: SQL package
description: >
The Flux SQL package provides tools for working with data in SQL databases such as MySQL and PostgreSQL.
Import the `sql` package.
menu:
v2_0_ref:
name: SQL
parent: Flux packages and functions
weight: 202
v2.0/tags: [functions, sql, package, mysql, postgres]
---
SQL Flux functions provide tools for working with data in SQL databases such as MySQL and PostgreSQL.
Import the `sql` package:
```js
import "sql"
```
{{< children type="functions" show="pages" >}}

View File

@ -0,0 +1,79 @@
---
title: sql.from() function
description: The `sql.from()` function retrieves data from a SQL data source.
menu:
v2_0_ref:
name: sql.from
parent: SQL
weight: 202
---
The `sql.from()` function retrieves data from a SQL data source.
_**Function type:** Input_
```js
import "sql"
sql.from(
driverName: "postgres",
dataSourceName: "postgresql://user:password@localhost",
query:"SELECT * FROM TestTable"
)
```
## Parameters
### driverName
The driver used to connect to the SQL database.
_**Data type:** String_
The following drivers are available:
- mysql
- postgres
### dataSourceName
The connection string used to connect to the SQL database.
The string's form and structure depend on the [driver](#drivername) used.
_**Data type:** String_
##### Driver dataSourceName examples
```sh
# Postgres Driver:
postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
# MySQL Driver:
username:password@tcp(localhost:3306)/dbname?param=value
```
### query
The query to run against the SQL database.
_**Data type:** String_
## Examples
### Query a MySQL database
```js
import "sql"
sql.from(
driverName: "mysql",
dataSourceName: "user:password@tcp(localhost:3306)/db",
query:"SELECT * FROM ExampleTable"
)
```
### Query a Postgres database
```js
import "sql"
sql.from(
driverName: "postgres",
dataSourceName: "postgresql://user:password@localhost",
query:"SELECT * FROM ExampleTable"
)
```

View File

@ -0,0 +1,80 @@
---
title: sql.to() function
description: The `sql.to()` function writes data to a SQL database.
menu:
v2_0_ref:
name: sql.to
parent: SQL
weight: 202
draft: true
---
The `sql.to()` function writes data to a SQL database.
_**Function type:** Output_
```js
import "sql"
sql.to(
driverName: "mysql",
dataSourceName: "username:password@tcp(localhost:3306)/dbname?param=value",
table: "ExampleTable"
)
```
## Parameters
### driverName
The driver used to connect to the SQL database.
_**Data type:** String_
The following drivers are available:
- mysql
- postgres
### dataSourceName
The connection string used to connect to the SQL database.
The string's form and structure depend on the [driver](#drivername) used.
_**Data type:** String_
##### Driver dataSourceName examples
```sh
# Postgres Driver
postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
# MySQL Driver
username:password@tcp(localhost:3306)/dbname?param=value
```
### table
The destination table.
_**Data type:** String_
## Examples
### Write data to a MySQL database
```js
import "sql"
sql.to(
driverName: "mysql",
dataSourceName: "user:password@tcp(localhost:3306)/db",
table: "ExampleTable"
)
```
### Write data to a Postgres database
```js
import "sql"
sql.to(
driverName: "postgres",
dataSourceName: "postgresql://user:password@localhost",
table: "ExampleTable"
)
```

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref:
name: Strings
parent: Flux packages and functions
weight: 204
weight: 202
v2.0/tags: [strings, functions, package]
---

View File

@ -0,0 +1,54 @@
---
title: strings.compare() function
description: The strings.compare() function compares the lexicographical order of two strings.
menu:
v2_0_ref:
name: strings.compare
parent: Strings
weight: 301
---
The `strings.compare()` function compares the lexicographical order of two strings.
_**Output data type:** Integer_
```js
import "strings"
strings.compare(v: "a", t: "b")
// returns -1
```
#### Return values
| Comparison | Return value |
|:----------:|:------------:|
| `v < t` | `-1` |
| `v == t` | `0` |
| `v > t` | `1` |
## Parameters
### v
The string value to compare.
_**Data type:** String_
### t
The string value to compare against.
_**Data type:** String_
## Examples
###### Compare the lexicographical order of column values
```js
import "strings"
data
|> map(fn: (r) => ({
r with
_value: strings.compare(v: r.tag1, t: r.tag2)
})
)
```

View File

@ -0,0 +1,52 @@
---
title: strings.containsAny() function
description: >
The strings.containsAny() function reports whether a specified string contains
any characters from from another string.
menu:
v2_0_ref:
name: strings.containsAny
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/containsstr
---
The `strings.containsAny()` function reports whether a specified string contains
characters from another string.
_**Output data type:** Boolean_
```js
import "strings"
strings.containsAny(v: "abc", chars: "and")
// returns true
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### chars
Characters to search for.
_**Data type:** String_
## Examples
###### Report if a string contains specific characters
```js
import "strings"
data
|> map(fn: (r) => ({
r with
_value: strings.containsAny(v: r.price, chars: "£$¢")
})
)
```

View File

@ -0,0 +1,49 @@
---
title: strings.containsStr() function
description: The strings.containsStr() function reports whether a string contains a specified substring.
menu:
v2_0_ref:
name: strings.containsStr
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/containsany
---
The `strings.containsStr()` function reports whether a string contains a specified substring.
_**Output data type:** Boolean_
```js
import "strings"
strings.containsStr(v: "This and that", substr: "and")
// returns true
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### substr
The substring value to search for.
_**Data type:** String_
## Examples
###### Report if a string contains a specific substring
```js
import "strings"
data
|> map(fn: (r) => ({
r with
_value: strings.containsStr(v: r.author, substr: "John")
})
)
```

View File

@ -0,0 +1,61 @@
---
title: strings.countStr() function
description: >
The strings.countStr() function counts the number of non-overlapping instances
of a substring appears in a string.
menu:
v2_0_ref:
name: strings.countStr
parent: Strings
weight: 301
---
The `strings.countStr()` function counts the number of non-overlapping instances
of a substring appears in a string.
_**Output data type:** Integer_
```js
import "strings"
strings.countStr(v: "Hello mellow fellow", substr: "ello")
// returns 3
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### substr
The substring to count.
_**Data type:** String_
{{% note %}}
The function counts only non-overlapping instances of `substr`.
For example:
```js
strings.coutnStr(v: "ooooo", substr: "oo")
// Returns 2 -- (oo)(oo)o
```
{{% /note %}}
## Examples
###### Count instances of a substring within a string
```js
import "strings"
data
|> map(fn: (r) => ({
r with
_value: strings.countStr(v: r.message, substr: "uh")
})
)
```

View File

@ -0,0 +1,52 @@
---
title: strings.equalFold() function
description: >
The strings.equalFold() function reports whether two UTF-8 strings are equal
under Unicode case-folding.
menu:
v2_0_ref:
name: strings.equalFold
parent: Strings
weight: 301
---
The `strings.equalFold()` function reports whether two UTF-8 strings are equal
under Unicode case-folding.
_**Output data type:** Boolean_
```js
import "strings"
strings.equalFold(v: "Go", t: "go")
// returns true
```
## Parameters
### v
The string value to compare.
_**Data type:** String_
### t
The string value to compare against.
_**Data type:** String_
## Examples
###### Ignore case when testing if two strings are the same
```js
import "strings"
data
|> map(fn: (r) => ({
r with
string1: r.string1,
string2: r.string2,
same: strings.equalFold(v: r.string1, t: r.string2)
})
)
```

View File

@ -0,0 +1,43 @@
---
title: strings.hasPrefix() function
description: The strings.hasPrefix() function indicates if a string begins with a specific prefix.
menu:
v2_0_ref:
name: strings.hasPrefix
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/hassuffix
---
The `strings.hasPrefix()` function indicates if a string begins with a specified prefix.
_**Output data type:** Boolean_
```js
import "strings"
strings.hasPrefix(v: "go gopher", t: "go")
// returns true
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### t
The prefix to search for.
_**Data type:** String_
###### Filter based on the presence of a prefix in a column value
```js
import "strings"
data
|> filter(fn:(r) => strings.hasPrefix(v: r.metric, t: "int_" ))
```

View File

@ -0,0 +1,43 @@
---
title: strings.hasSuffix() function
description: The strings.hasSuffix() function indicates if a string ends with a specified suffix.
menu:
v2_0_ref:
name: strings.hasSuffix
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/hasprefix
---
The `strings.hasSuffix()` function indicates if a string ends with a specified suffix.
_**Output data type:** Boolean_
```js
import "strings"
strings.hasSuffix(v: "go gopher", t: "go")
// returns false
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### t
The suffix to search for.
_**Data type:** String_
###### Filter based on the presence of a suffix in a column value
```js
import "strings"
data
|> filter(fn:(r) => strings.hasSuffix(v: r.metric, t: "_count" ))
```

View File

@ -0,0 +1,54 @@
---
title: strings.index() function
description: >
The strings.index() function returns the index of the first instance of a substring
in another string.
menu:
v2_0_ref:
name: strings.index
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/indexany/
- /v2.0/reference/flux/functions/strings/lastindex/
- /v2.0/reference/flux/functions/strings/lastindexany/
---
The `strings.index()` function returns the index of the first instance of a substring
in a string. If the substring is not present, it returns `-1`.
_**Output data type:** Integer_
```js
import "strings"
strings.index(v: "go gopher", substr: "go")
// returns 0
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### substr
The substring to search for.
_**Data type:** String_
## Examples
###### Find the first occurrence of a substring
```js
import "strings"
data
|> map(fn: (r) => ({
r with
the_index: strings.index(v: r.pageTitle, substr: "the")
})
)
```

View File

@ -0,0 +1,53 @@
---
title: strings.indexAny() function
description: >
The strings.indexAny() function returns the index of the first instance of specified characters in a string.
menu:
v2_0_ref:
name: strings.indexAny
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/index-func/
- /v2.0/reference/flux/functions/strings/lastindex/
- /v2.0/reference/flux/functions/strings/lastindexany/
---
The `strings.indexAny()` function returns the index of the first instance of specified characters in a string.
If none of the specified characters are present, it returns `-1`.
_**Output data type:** Integer_
```js
import "strings"
strings.indexAny(v: "chicken", chars: "aeiouy")
// returns 2
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### chars
Characters to search for.
_**Data type:** String_
## Examples
###### Find the first occurrence of characters from a string
```js
import "strings"
data
|> map(fn: (r) => ({
r with
charIndex: strings.indexAny(v: r._field, chars: "_-")
})
)
```

View File

@ -0,0 +1,40 @@
---
title: strings.isDigit() function
description: The strings.isDigit() function tests if a single character string is a digit (0-9).
menu:
v2_0_ref:
name: strings.isDigit
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/isletter/
---
The `strings.isDigit()` function tests if a single-character string is a digit (0-9).
_**Output data type:** Boolean_
```js
import "strings"
strings.isDigit(v: "A")
// returns false
```
## Parameters
### v
The single-character string to test.
_**Data type:** String_
## Examples
###### Filter by columns with digits as values
```js
import "strings"
data
|> filter(fn: (r) => strings.isDigit(v: r.serverRef))
```

View File

@ -0,0 +1,40 @@
---
title: strings.isLetter() function
description: The strings.isLetter() function tests if a single character string is a letter (a-z, A-Z).
menu:
v2_0_ref:
name: strings.isLetter
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/isdigit/
---
The `strings.isLetter()` function tests if a single character string is a letter (a-z, A-Z).
_**Output data type:** Boolean_
```js
import "strings"
strings.isLetter(v: "A")
// returns true
```
## Parameters
### v
The single character string to test.
_**Data type:** String_
## Examples
###### Filter by columns with single-letter values
```js
import "strings"
data
|> filter(fn: (r) => strings.isLetter(v: r.serverRef))
```

View File

@ -0,0 +1,40 @@
---
title: strings.isLower() function
description: The strings.isLower() function tests if a single-character string is lowercase.
menu:
v2_0_ref:
name: strings.isLower
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/isupper
---
The `strings.isLower()` function tests if a single-character string is lowercase.
_**Output data type:** Boolean_
```js
import "strings"
strings.isLower(v: "a")
// returns true
```
## Parameters
### v
The single-character string value to test.
_**Data type:** String_
## Examples
###### Filter by columns with single-letter lowercase values
```js
import "strings"
data
|> filter(fn: (r) => strings.isLower(v: r.host))
```

View File

@ -0,0 +1,40 @@
---
title: strings.isUpper() function
description: The strings.isUpper() function tests if a single character string is uppercase.
menu:
v2_0_ref:
name: strings.isUpper
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/islower
---
The `strings.isUpper()` function tests if a single character string is uppercase.
_**Output data type:** Boolean_
```js
import "strings"
strings.isUpper(v: "A")
// returns true
```
## Parameters
### v
The single-character string value to test.
_**Data type:** String_
## Examples
###### Filter by columns with single-letter uppercase values
```js
import "strings"
data
|> filter(fn: (r) => strings.isUpper(v: r.host))
```

View File

@ -0,0 +1,47 @@
---
title: strings.joinStr() function
description: >
The strings.joinStr() function concatenates the elements of a string array into
a single string using a specified separator.
menu:
v2_0_ref:
name: strings.joinStr
parent: Strings
weight: 301
---
The `strings.joinStr()` function concatenates elements of a string array into
a single string using a specified separator.
_**Output data type:** String_
```js
import "strings"
strings.joinStr(arr: ["a", "b", "c"], v: ",")
// returns "a,b,c"
```
## Parameters
### arr
The array of strings to concatenate.
_**Data type:** Array of strings_
### v
The separator to use in the concatenated value.
_**Data type:** String_
## Examples
###### Join a list of strings into a single string
```js
import "strings"
searchTags = ["tag1", "tag2", "tag3"]
strings.joinStr(arr: searchTags, v: ","))
```

View File

@ -0,0 +1,54 @@
---
title: strings.lastIndex() function
description: >
The strings.lastIndex() function returns the index of the last instance of a substring
in a string or `-1` if substring is not present.
menu:
v2_0_ref:
name: strings.lastIndex
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/index/
- /v2.0/reference/flux/functions/strings/indexany/
- /v2.0/reference/flux/functions/strings/lastindexany/
---
The `strings.lastIndex()` function returns the index of the last instance of a substring
in a string. If the substring is not present, the function returns `-1`.
_**Output data type:** Integer_
```js
import "strings"
strings.lastIndex(v: "go gopher", t: "go")
// returns 3
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### substr
The substring to search for.
_**Data type:** String_
## Examples
###### Find the last occurrence of a substring
```js
import "strings"
data
|> map(fn: (r) => ({
r with
the_index: strings.lastIndex(v: r.pageTitle, substr: "the")
})
)
```

View File

@ -0,0 +1,52 @@
---
title: strings.lastIndexAny() function
description: The `strings.lastIndexAny()` function returns the index of the last instance of any specified characters in a string.
menu:
v2_0_ref:
name: strings.lastIndexAny
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/index/
- /v2.0/reference/flux/functions/strings/indexany/
- /v2.0/reference/flux/functions/strings/lastindex/
---
The `strings.lastIndexAny()` function returns the index of the last instance of any specified characters in a string.
If none of the specified characters are present, the function returns `-1`.
_**Output data type:** Integer_
```js
import "strings"
strings.lastIndexAny(v: "chicken", chars: "aeiouy")
// returns 5
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### chars
Characters to search for.
_**Data type:** String_
## Examples
###### Find the last occurrence of characters from a string
```js
import "strings"
data
|> map(fn: (r) => ({
r with
charLastIndex: strings.lastIndexAny(v: r._field, chars: "_-")
})
)
```

View File

@ -0,0 +1,48 @@
---
title: strings.repeat() function
description: The strings.repeat() function returns a string consisting of `i` copies of a specified string.
menu:
v2_0_ref:
name: strings.repeat
parent: Strings
weight: 301
---
The `strings.repeat()` function returns a string consisting of `i` copies of a specified string.
_**Output data type:** String_
```js
import "strings"
strings.repeat(v: "ha", i: 3)
// returns "hahaha"
```
## Parameters
### v
The string value to repeat.
_**Data type:** String_
### i
The number of times to repeat `v`.
_**Data type:** Integer_
## Examples
###### Repeat a string based on existing columns
```js
import "strings"
data
|> map(fn: (r) => ({
laugh: r.laugh
intensity: r.intensity
laughter: strings.repeat(v: r.laugh, i: r.intensity)
})
)
```

View File

@ -0,0 +1,62 @@
---
title: strings.replace() function
description: >
The strings.replace() function replaces the first `i` non-overlapping instances
of a substring with a specified replacement.
menu:
v2_0_ref:
name: strings.replace
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/replaceall
---
The `strings.replace()` function replaces the first `i` non-overlapping instances
of a substring with a specified replacement.
_**Output data type:** String_
```js
import "strings"
strings.replace(v: "oink oink oink", t: "oink", u: "moo", i: 2)
// returns "moo moo oink"
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### t
The substring value to replace.
_**Data type:** String_
### u
The replacement for `i` instances of `t`.
_**Data type:** String_
### i
The number of non-overlapping `t` matches to replace.
_**Data type:** Integer_
## Examples
###### Replace a specific number of string matches
```js
import "strings"
data
|> map(fn: (r) => ({
r with
content: strings.replace(v: r.content, t: "he", u: "her", i: 3)
})
)
```

View File

@ -0,0 +1,57 @@
---
title: strings.replaceAll() function
description: >
The strings.replaceAll() function replaces all non-overlapping instances of a
substring with a specified replacement.
menu:
v2_0_ref:
name: strings.replaceAll
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/replace
---
The `strings.replaceAll()` function replaces all non-overlapping instances of a
substring with a specified replacement.
_**Output data type:** String_
```js
import "strings"
strings.replaceAll(v: "oink oink oink", t: "oink", u: "moo")
// returns "moo moo moo"
```
## Parameters
### v
The string value to search.
_**Data type:** String_
### t
The substring to replace.
_**Data type:** String_
### u
The replacement for all instances of `t`.
_**Data type:** String_
## Examples
###### Replace string matches
```js
import "strings"
data
|> map(fn: (r) => ({
r with
content: strings.replaceAll(v: r.content, t: "he", u: "her")
})
)
```

View File

@ -0,0 +1,50 @@
---
title: strings.split() function
description: >
The strings.split() function splits a string on a specified separator and returns
an array of substrings.
menu:
v2_0_ref:
name: strings.split
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/splitafter
- /v2.0/reference/flux/functions/strings/splitaftern
- /v2.0/reference/flux/functions/strings/splitn
---
The `strings.split()` function splits a string on a specified separator and returns
an array of substrings.
_**Output data type:** Array of strings_
```js
import "strings"
strings.split(v: "a flux of foxes", t: " ")
// returns ["a", "flux", "of", "foxes"]
```
## Parameters
### v
The string value to split.
_**Data type:** String_
### t
The string value that acts as the separator.
_**Data type:** String_
## Examples
###### Split a string into an array of substrings
```js
import "strings"
data
|> map (fn:(r) => strings.split(v: r.searchTags, t: ","))
```

View File

@ -0,0 +1,50 @@
---
title: strings.splitAfter() function
description: >
The strings.splitAfter() function splits a string after a specified separator and returns
an array of substrings.
menu:
v2_0_ref:
name: strings.splitAfter
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/split
- /v2.0/reference/flux/functions/strings/splitaftern
- /v2.0/reference/flux/functions/strings/splitn
---
The `strings.splitAfter()` function splits a string after a specified separator and returns
an array of substrings.
_**Output data type:** Array of strings_
```js
import "strings"
strings.splitAfter(v: "a flux of foxes", t: " ")
// returns ["a ", "flux ", "of ", "foxes"]
```
## Parameters
### v
The string value to split.
_**Data type:** String_
### t
The string value that acts as the separator.
_**Data type:** String_
## Examples
###### Split a string into an array of substrings
```js
import "strings"
data
|> map (fn:(r) => strings.splitAfter(v: r.searchTags, t: ","))
```

View File

@ -0,0 +1,55 @@
---
title: strings.splitAfterN() function
description: >
The strings.splitAfterN() function splits a string after a specified separator and returns
an array of `i` substrings.
menu:
v2_0_ref:
name: strings.splitAfterN
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/split
- /v2.0/reference/flux/functions/strings/splitafter
- /v2.0/reference/flux/functions/strings/splitn
---
The `strings.splitAfterN()` function splits a string after a specified separator and returns
an array of `i` substrings.
_**Output data type:** Array of strings_
```js
import "strings"
strings.splitAfterN(v: "a flux of foxes", t: " ", i: 2)
// returns ["a ", "flux ", "of foxes"]
```
## Parameters
### v
The string value to split.
_**Data type:** String_
### t
The string value that acts as the separator.
_**Data type:** String_
### i
The number of substrings to return.
_**Data type:** Integer_
## Examples
###### Split a string into an array of substrings
```js
import "strings"
data
|> map (fn:(r) => strings.splitAfterN(v: r.searchTags, t: ","))
```

View File

@ -0,0 +1,55 @@
---
title: strings.splitN() function
description: >
The strings.splitN() function splits a string on a specified separator and returns
an array of `i` substrings.
menu:
v2_0_ref:
name: strings.splitN
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/split
- /v2.0/reference/flux/functions/strings/splitafter
- /v2.0/reference/flux/functions/strings/splitaftern
---
The `strings.splitN()` function splits a string on a specified separator and returns
an array of `i` substrings.
_**Output data type:** Array of strings_
```js
import "strings"
strings.splitN(v: "a flux of foxes", t: " ", i: 2)
// returns ["a", "flux", "of foxes"]
```
## Parameters
### v
The string value to split.
_**Data type:** String_
### t
The string value that acts as the separator.
_**Data type:** String_
### i
The number of substrings to return.
_**Data type:** Integer_
## Examples
###### Split a string into an array of substrings
```js
import "strings"
data
|> map (fn:(r) => strings.splitN(v: r.searchTags, t: ","))
```

View File

@ -6,6 +6,10 @@ menu:
name: strings.title
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/tolower
- /v2.0/reference/flux/functions/strings/totitle
- /v2.0/reference/flux/functions/strings/toupper
---
The `strings.title()` function converts a string to title case.
@ -20,7 +24,7 @@ strings.title(v: "a flux of foxes")
// returns "A Flux Of Foxes"
```
## Paramters
## Parameters
### v
The string value to convert.
@ -34,5 +38,5 @@ _**Data type:** String_
import "strings"
data
|> map(fn:(r) => strings.title(v: r.pageTitle))
|> map(fn: (r) => ({ r with pageTitle: strings.title(v: r.pageTitle) }))
```

View File

@ -1,14 +1,18 @@
---
title: strings.toLower() function
description: The strings.toLower() function converts a string to lower case.
description: The strings.toLower() function converts a string to lowercase.
menu:
v2_0_ref:
name: strings.toLower
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/totitle
- /v2.0/reference/flux/functions/strings/toupper
- /v2.0/reference/flux/functions/strings/title
---
The `strings.toLower()` function converts a string to lower case.
The `strings.toLower()` function converts a string to lowercase.
_**Output data type:** String_
@ -20,7 +24,7 @@ strings.toLower(v: "KOALA")
// returns "koala"
```
## Paramters
## Parameters
### v
The string value to convert.
@ -34,5 +38,8 @@ _**Data type:** String_
import "strings"
data
|> map(fn:(r) => strings.toLower(v: r.exclamation))
|> map(fn: (r) => ({
r with exclamation: strings.toLower(v: r.exclamation)
})
)
```

View File

@ -0,0 +1,55 @@
---
title: strings.toTitle() function
description: The strings.toTitle() function converts all characters in a string to title case.
menu:
v2_0_ref:
name: strings.toTitle
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/toupper
- /v2.0/reference/flux/functions/strings/tolower
- /v2.0/reference/flux/functions/strings/title
---
The `strings.toTitle()` function converts all characters in a string to title case.
_**Output data type:** String_
```js
import "strings"
strings.toTitle(v: "a flux of foxes")
// returns "A FLUX OF FOXES"
```
## Parameters
### v
The string value to convert.
_**Data type:** String_
## Examples
###### Covert characters in a string to title case
```js
import "strings"
data
|> map(fn: (r) => ({ r with pageTitle: strings.toTitle(v: r.pageTitle) }))
```
{{% note %}}
#### The difference between toTitle and toUpper
The results of `toTitle()` and `toUpper` are often the same, however the difference
is visible with special characters:
```js
str = "dz"
strings.toTitle(v: str) // Returns Dz
strings.toUpper(v: str) // Returns DZ
```
{{% /note %}}

View File

@ -1,14 +1,18 @@
---
title: strings.toUpper() function
description: The strings.toUpper() function converts a string to upper case.
description: The strings.toUpper() function converts a string to uppercase.
menu:
v2_0_ref:
name: strings.toUpper
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/totitle
- /v2.0/reference/flux/functions/strings/tolower
- /v2.0/reference/flux/functions/strings/title
---
The `strings.toUpper()` function converts a string to upper case.
The `strings.toUpper()` function converts a string to uppercase.
_**Output data type:** String_
@ -20,7 +24,7 @@ strings.toUpper(v: "koala")
// returns "KOALA"
```
## Paramters
## Parameters
### v
The string value to convert.
@ -34,5 +38,18 @@ _**Data type:** String_
import "strings"
data
|> map(fn:(r) => strings.toUpper(v: r.envVars))
|> map(fn: (r) => ({ r with envVars: strings.toUpper(v: r.envVars) }))
```
{{% note %}}
#### The difference between toTitle and toUpper
The results of `toUpper()` and `toTitle` are often the same, however the difference
is visible when using special characters:
```js
str = "dz"
strings.toUpper(v: str) // Returns DZ
strings.toTitle(v: str) // Returns Dz
```
{{% /note %}}

View File

@ -8,6 +8,12 @@ menu:
name: strings.trim
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/trimleft
- /v2.0/reference/flux/functions/strings/trimright
- /v2.0/reference/flux/functions/strings/trimprefix
- /v2.0/reference/flux/functions/strings/trimsuffix
- /v2.0/reference/flux/functions/strings/trimspace
---
The `strings.trim()` function removes leading and trailing characters specified
@ -23,15 +29,15 @@ strings.trim(v: ".abc.", cutset: ".")
// returns "abc"
```
## Paramters
## Parameters
### v
The string value from which to trim characters.
String to remove characters from.
_**Data type:** String_
### cutset
The leading and trailing characters to trim from the string value.
The leading and trailing characters to remove from the string.
Only characters that match the `cutset` string exactly are trimmed.
_**Data type:** String_
@ -43,5 +49,9 @@ _**Data type:** String_
import "strings"
data
|> map(fn:(r) => strings.trim(v: r.variables, cutset: "."))
|> map(fn: (r) => ({
r with
variables: strings.trim(v: r.variables, cutset: ".")
})
)
```

View File

@ -0,0 +1,55 @@
---
title: strings.trimLeft() function
description: >
The strings.trimLeft() function removes specified leading characters from a string.
menu:
v2_0_ref:
name: strings.trimLeft
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/trim
- /v2.0/reference/flux/functions/strings/trimright
- /v2.0/reference/flux/functions/strings/trimprefix
- /v2.0/reference/flux/functions/strings/trimsuffix
- /v2.0/reference/flux/functions/strings/trimspace
---
The `strings.trimLeft()` function removes specified leading characters from a string.
_**Output data type:** String_
```js
import "strings"
strings.trimLeft(v: ".abc.", cutset: ".")
// returns "abc."
```
## Parameters
### v
String to remove characters from.
_**Data type:** String_
### cutset
The leading characters to remove from the string.
Only characters that match the `cutset` string exactly are removed.
_**Data type:** String_
## Examples
###### Trim leading periods from all values in a column
```js
import "strings"
data
|> map(fn: (r) => ({
r with
variables: strings.trimLeft(v: r.variables, cutset: ".")
})
)
```

View File

@ -8,6 +8,12 @@ menu:
name: strings.trimPrefix
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/trim
- /v2.0/reference/flux/functions/strings/trimleft
- /v2.0/reference/flux/functions/strings/trimright
- /v2.0/reference/flux/functions/strings/trimsuffix
- /v2.0/reference/flux/functions/strings/trimspace
---
The `strings.trimPrefix()` function removes a prefix from a string.
@ -23,7 +29,7 @@ strings.trimPrefix(v: "123_abc", prefix: "123")
// returns "_abc"
```
## Paramters
## Parameters
### v
The string value to trim.
@ -42,5 +48,9 @@ _**Data type:** String_
import "strings"
data
|> map(fn:(r) => strings.trimPrefix(v: r.sensorId, prefix: "s12_"))
|> map(fn: (r) => ({
r with
sensorID: strings.trimPrefix(v: r.sensorId, prefix: "s12_")
})
)
```

View File

@ -0,0 +1,56 @@
---
title: strings.trimRight() function
description: >
The strings.trimRight() function removes trailing characters specified in the cutset from a string.
menu:
v2_0_ref:
name: strings.trimRight
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/trim
- /v2.0/reference/flux/functions/strings/trimleft
- /v2.0/reference/flux/functions/strings/trimprefix
- /v2.0/reference/flux/functions/strings/trimsuffix
- /v2.0/reference/flux/functions/strings/trimspace
---
The `strings.trimRight()` function removes trailing characters specified in the
[`cutset`](#cutset) from a string.
_**Output data type:** String_
```js
import "strings"
strings.trimRight(v: ".abc.", cutset: ".")
// returns "abc."
```
## Parameters
### v
String to remove characters from.
_**Data type:** String_
### cutset
The trailing characters to trim from the string.
Only characters that match the `cutset` string exactly are trimmed.
_**Data type:** String_
## Examples
###### Trim trailing periods from all values in a column
```js
import "strings"
data
|> map(fn: (r) => ({
r with
variables: strings.trimRight(v: r.variables, cutset: ".")
})
)
```

View File

@ -6,6 +6,12 @@ menu:
name: strings.trimSpace
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/trim
- /v2.0/reference/flux/functions/strings/trimleft
- /v2.0/reference/flux/functions/strings/trimright
- /v2.0/reference/flux/functions/strings/trimprefix
- /v2.0/reference/flux/functions/strings/trimsuffix
---
The `strings.trimSpace()` function removes leading and trailing spaces from a string.
@ -20,10 +26,10 @@ strings.trimSpace(v: " abc ")
// returns "abc"
```
## Paramters
## Parameters
### v
The string value from which to trim spaces.
String to remove spaces from.
_**Data type:** String_
@ -34,5 +40,5 @@ _**Data type:** String_
import "strings"
data
|> map(fn:(r) => strings.trimSpace(v: r.userInput))
|> map(fn: (r) => ({ r with userInput: strings.trimSpace(v: r.userInput) }))
```

View File

@ -8,6 +8,12 @@ menu:
name: strings.trimSuffix
parent: Strings
weight: 301
related:
- /v2.0/reference/flux/functions/strings/trim
- /v2.0/reference/flux/functions/strings/trimleft
- /v2.0/reference/flux/functions/strings/trimright
- /v2.0/reference/flux/functions/strings/trimprefix
- /v2.0/reference/flux/functions/strings/trimspace
---
The `strings.trimSuffix()` function removes a suffix from a string.
@ -23,7 +29,7 @@ strings.trimSuffix(v: "123_abc", suffix: "abc")
// returns "123_"
```
## Paramters
## Parameters
### v
The string value to trim.
@ -42,5 +48,9 @@ _**Data type:** String_
import "strings"
data
|> map(fn:(r) => strings.trimSuffix(v: r.sensorId, suffix: "_s12"))
|> map(fn: (r) => ({
r with
sensorID: strings.trimSuffix(v: r.sensorId, suffix: "_s12")
})
)
```

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref:
name: System
parent: Flux packages and functions
weight: 204
weight: 202
v2.0/tags: [system, functions, package]
---

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref:
name: Testing
parent: Flux packages and functions
weight: 205
weight: 202
v2.0/tags: [testing, functions, package]
---

View File

@ -55,16 +55,49 @@ A stream is grouped into individual tables using their respective group keys.
Tables within a stream each have a unique group key value.
{{% note %}}
[IMPL#463](https://github.com/influxdata/flux/issues/463) Specify the primitive types that make up stream and table types
[IMPL#463](https://github.com/influxdata/flux/issues/463) Specify the primitive
types that make up stream and table types
{{% /note %}}
## Missing values
A record may be missing a value for a specific column.
Missing values are represented with a special `null` value.
The `null` value can be of any data type.
## Missing values (null)
`null` is a predeclared identifier representing a missing or unknown value.
`null` is the only value comprising the _null type_.
Any non-boolean operator that operates on basic types returns _null_ when at least one of its operands is _null_.
Think of _null_ as an unknown value.
The following table explains how _null_ values behave in expressions:
| Expression | Evaluates To | Because |
| ---------------- | ------------ | ----------------------------------------------------------------------------------- |
| `null + 5` | `null` | Adding 5 to an unknown value is still unknown |
| `null * 5` | `null` | Multiplying an unknown value by 5 is still unknown |
| `null == 5` | `null` | We don't know if an unknown value is equal to 5 |
| `null < 5` | `null` | We don't know if an unknown value is less than 5 |
| `null == null` | `null` | We don't know if something unknown is equal to something else that is also unknown |
Operating on something unknown produces something that is still unknown.
The only place where this is not the case is in boolean logic.
Because boolean types are nullable, Flux implements ternary logic as a way of handling boolean operators with _null_ operands.
By interpreting a _null_ operand as an unknown value, we have the following definitions:
- not _null_ = _null_
- _null_ or false = _null_
- _null_ or true = true
- _null_ or _null_ = _null_
- _null_ and false = false
- _null_ and true = _null_
- _null_ and _null_ = _null_
Because records are represented using object types, attempting to access a column
whose value is unknown or missing from a record will also return _null_.
{{% note %}}
[IMPL#723](https://github.com/influxdata/platform/issues/723) Design how nulls behave
According to the definitions above, it is not possible to check if an expression is _null_ using the `==` and `!=` operators.
These operators will return _null_ if any of their operands are _null_.
In order to perform such a check, Flux provides a built-in `exists` operator:
- `exists x` returns false if `x` is _null_
- `exists x` returns true if `x` is not _null_
{{% /note %}}
## Transformations

View File

@ -40,10 +40,20 @@ Literal = int_lit
Object literals construct a value with the object type.
```js
ObjectLiteral = "{" PropertyList "}" .
PropertyList = [ Property { "," Property } ] .
Property = identifier [ ":" Expression ]
| string_lit ":" Expression .
ObjectLiteral = "{" ObjectBody "}" .
ObjectBody = WithProperties | PropertyList .
WithProperties = identifier "with" PropertyList .
PropertyList = [ Property { "," Property } ] .
Property = identifier [ ":" Expression ]
| string_lit ":" Expression .
```
**Examples**
```js
{a: 1, b: 2, c: 3}
{a, b, c}
{o with x: 5, y: 5}
{o with a, b}
```
### Array literals
@ -142,10 +152,21 @@ IndexExpression = "[" Expression "]" .
## Member expressions
Member expressions access a property of an object.
They are specified using an expression in one of the following forms:
```js
obj.k
// or
obj["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.
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_.
```js
MemberExpression = DotExpression | MemberBracketExpression
DotExpression = "." identifer
@ -167,6 +188,11 @@ ConditionalExpression = "if" Expression "then" Expression "else" Expression .
color = if code == 0 then "green" else if code == 1 then "yellow" else "red"
```
{{% note %}}
According to the definition above, if a condition evaluates to a _null_ or unknown value,
the _else_ branch is evaluated.
{{% /note %}}
## Operators
Operators combine operands into expressions.
The precedence of the operators is given in the table below.
@ -183,7 +209,8 @@ Operators with a lower number have higher precedence.
| | `<` `<=` | |
| | `>` `>=` | |
| |`=~` `!~` | |
| 5 | `not` | Unary logical expression |
| 5 | `not` | Unary logical operator |
| | `exists` | Null check operator |
| 6 | `and` | Logical AND |
| 7 | `or` | Logical OR |
| 8 | `if` `then` `else` | Conditional |
@ -199,7 +226,7 @@ LogicalExpression = UnaryLogicalExpression
LogicalOperator = "and" | "or" .
UnaryLogicalExpression = ComparisonExpression
| UnaryLogicalOperator UnaryLogicalExpression .
UnaryLogicalOperator = "not" .
UnaryLogicalOperator = "not" | "exists".
ComparisonExpression = MultiplicativeExpression
| ComparisonExpression ComparisonOperator MultiplicativeExpression .
ComparisonOperator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "=~" | "!~" .

View File

@ -129,17 +129,19 @@ Literal constructors define fixed values.
The table below outlines operator precedence.
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` | Logical AND |
| 7 | `or` | Logical OR |
| 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 operator |
| | `exists` | Null check operator |
| 6 | `and` | Logical AND |
| 7 | `or` | Logical OR |
| 8 | `if` `then` `else` | Conditional |

View File

@ -18,89 +18,122 @@ A _type_ defines the set of values and operations on those values.
Types are never explicitly declared as part of the syntax.
Types are always inferred from the usage of the value.
{{% note %}}
[IMPL#249](https://github.com/influxdata/platform/issues/249) Specify type inference rules.
{{% /note %}}
## Union types
A union type defines a set of types.
In the examples below, a union type is specified as follows:
## Boolean types
```js
T = t1 | t2 | ... | tn
```
where `t1`, `t2`, ..., and `tn` are types.
In the example above a value of type `T` is either of type `t1`, type `t2`, ..., or type `tn`.
## Basic types
All Flux data types are constructed from the following types:
### Null types
The **null type** represents a missing or unknown value.
The **null type** name is `null`.
There is only one value that comprises the _null type_ and that is the _null_ value.
A type `t` is nullable if it can be expressed as follows:
```js
t = {s} | null
```
where `{s}` defines a set of values.
### Boolean types
A _boolean type_ represents a truth value, corresponding to the preassigned variables `true` and `false`.
The boolean type name is `bool`.
The boolean type is nullable and can be formally specified as follows:
## Numeric types
```js
bool = {true, false} | null
```
### Numeric types
A _numeric type_ represents sets of integer or floating-point values.
The following numeric types exist:
```
uint the set of all unsigned 64-bit integers
int the set of all signed 64-bit integers
float the set of all IEEE-754 64-bit floating-point numbers
uint the set of all unsigned 64-bit integers | null
int the set of all signed 64-bit integers | null
float the set of all IEEE-754 64-bit floating-point numbers | null
```
## Time types
{{% note %}}
All numeric types are nullable.
{{% /note %}}
### Time types
A _time type_ represents a single point in time with nanosecond precision.
The time type name is `time`.
The time type is nullable.
### Timestamp format
#### Timestamp format
Flux supports [RFC3339](https://tools.ietf.org/html/rfc3339#section-5.6) timestamps:
- `YYYY-MM-DD`
- `YYYY-MM-DDT00:00:00Z`
- `YYYY-MM-DDT00:00:00.000Z`
## Duration types
### Duration types
A _duration type_ represents a length of time with nanosecond precision.
The duration type name is `duration`.
The duration type is nullable
Durations can be added to times to produce a new time.
##### Examples of duration types
```js
2018-07-01T00:00:00Z + 1mo // 2018-08-01T00:00:00Z
2018-07-01T00:00:00Z + 2y // 2020-07-01T00:00:00Z
2018-07-01T00:00:00Z + 5h // 2018-07-01T05:00:00Z
```
## String types
### String types
A _string type_ represents a possibly empty sequence of characters.
Strings are immutable and cannot be modified once created.
The string type name is `string`.
The string type is nullable.
{{% note %}}
An empty string is **not** a _null_ value.
{{% /note %}}
The length of a string is its size in bytes, not the number of characters, since a single character may be multiple bytes.
## Regular expression types
A _regular expression type_ represents the set of all patterns for regular expressions.
The regular expression type name is `regexp`.
The regular expression type is **not** nullable.
## Array types
## Composite types
These are types constructed from basic types.
Composite types are not nullable.
### Array types
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
### Object types
An _object 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.
## Function types
### Function types
A _function type_ represents a set of all functions with the same argument and result types.
{{% note %}}
[IMPL#249](https://github.com/influxdata/platform/issues/249) Specify type inference rules.
{{% /note %}}
## Generator types
### Generator types
A _generator type_ represents a value that produces an unknown number of other values.
The generated values may be of any other type, but must all be the same type.

View File

@ -2,14 +2,14 @@
title: Glossary
description: >
Terms related to InfluxData products and platforms.
weight: 6
weight: 7
menu:
v2_0_ref:
name: Glossary
v2.0/tags: [glossary]
---
[A](#a) | [B](#b) | [C](#c) | [D](#d) | [E](#e) | [F](#f) |[G](#g) | [H](#h) | [I](#i) | [J](#j) | [K](#k) | [L](#l) | [M](#m) | [N](#n) | [O](#o) | [P](#p) | [Q](#q) | [R](#r) | [S](#s) | [T](#t) | [U](#u) | [V](#v) | [W](#w) | [X](#x) | [Y](#y) | [Z](#z)
[A](#a) | [B](#b) | [C](#c) | [D](#d) | [E](#e) | [F](#f) | [G](#g) | [H](#h) | [I](#i) | [J](#j) | [K](#k) | [L](#l) | [M](#m) | [N](#n) | [O](#o) | [P](#p) | [Q](#q) | [R](#r) | [S](#s) | [T](#t) | [U](#u) | [V](#v) | [W](#w) | [X](#x) | [Y](#y) | [Z](#z)
## A
@ -44,7 +44,7 @@ InfluxData typically recommends batch sizes of 5,000-10,000 points. In some use
Related entries: [line protocol](/v2.0/reference/line-protocol/), [point](#point)
### batch size
### batch size
The number of lines or individual data points in a line protocol batch. The Telegraf agent sends metrics to output plugins in batches rather than individually.
Batch size controls the size of each write batch that Telegraf sends to the output plugins.
@ -239,11 +239,11 @@ Related entries: [flush interval](#flush-interval), [output plugin](#output-plug
### Flux
A lightweight scripting language for querying databases (like InfluxDB) and working with data.
A lightweight scripting language for querying databases (like InfluxDB) and working with data.
### function
Flux functions aggregate, select, and transform time series data. For a complete list of Flux functions, see [Flux functions](/v2.0/reference/flux/functions/all-functions/).
Flux functions aggregate, select, and transform time series data. For a complete list of Flux functions, see [Flux functions](/v2.0/reference/flux/functions/all-functions/).
<!--Or opt to use Flux functions' predecessor, InfluxQL functions. See [InfluxQL functions](/influxdb/v1.7/query_language/functions/) for a complete list. -->
Related entries: [aggregation](#aggregation), [selector](#selector), [transformation](#transformation)
@ -439,7 +439,7 @@ Related entries: [aggregator plugin](/telegraf/v1.10/concepts/glossary/#aggregat
### parameter
A key-value pair used to pass information to functions.
<!--
<!--
### pipe
-->
### pipe-forward operator
@ -787,8 +787,8 @@ If you are transitioning from the Enterprise Web Console to Chronograf and helpf
### windowing
The process of partitioning data based on equal windows of time.
<!--
## X
<!--
## X
## Y

View File

@ -0,0 +1,12 @@
---
title: Release notes
description: Find important information about what's included in new versions of InfluxData products.
menu:
v2_0_ref:
name: Release notes
weight: 1
---
Find important information about what's included in new versions of our products:
{{< children >}}

View File

@ -1,24 +1,86 @@
---
title: Flux release notes
description: Important changes and notes introduced in each version of Flux.
description: Important changes and and what's new in each version of Flux.
weight: 102
menu:
v2_0_ref:
parent: Flux query language
name: Flux release notes
weight: 101
parent: Release notes
name: Flux
aliases:
- /v2.0/reference/flux/release-notes
---
{{% note %}}
_The latest release of InfluxDB v2.0 alpha includes **Flux v0.32.1**.
_The latest release of InfluxDB v2.0 alpha includes **Flux v0.34.2**.
Though newer versions of Flux may be available, they will not be included with
InfluxDB until the next InfluxDB v2.0 release._
{{% /note %}}
## v0.34.2 [2019-06-27]
### Bug fixes
- Parse float types with PostgreSQL.
---
## v0.34.1 [2019-06-26]
### Features
- Add custom PostgreSQL type support.
- Added MySQL type support.
- Nulls work in table and row functions.
### Bug fixes
- Fixed boolean literal type conversion problem and added tests.
- Diff should track memory allocations when it copies the table.
- Copy table will report if it is empty correctly.
---
## v0.33.2 [2019-06-25]
### Bug fixes
- Use `strings.Replace` instead of `strings.ReplaceAll` for compatibility.
---
## v0.33.1 [2019-06-20]
### Bug fixes
- Copy table will report if it is empty correctly.
---
## v0.33.0 [2019-06-18]
### Breaking changes
- Implement nulls in the compiler runtime.
### Features
- Add Go `regexp` functions to Flux.
- Add the exists operator to the compiler runtime.
- Implement nulls in the compiler runtime.
- Add nullable kind.
- Support "with" syntax for objects in row functions.
- Port several string functions from go `strings` library to Flux.
- Add exists unary operator.
### Bug fixes
- Add range to map_extension_with.flux.
- Row function resets records map with each call to prepare.
- Fix `joinStr`, including adding an EndToEnd Test.
- Fix `string_trimLeft` and `string_trimRight` so that they pass in InfluxDB.
- Add length check for empty tables in fill.
---
## v0.32.1 [2019-06-10]
### Bug fixes
- Identify memory limit exceeded errors in dispatcher.
---
## v0.32.0 [2019-06-05]
### Breaking changes
@ -28,11 +90,15 @@ InfluxDB until the next InfluxDB v2.0 release._
- Changelog generator now handles merge commits better.
- Return count of errors when checking AST.
---
## v0.31.1 [2019-05-29]
### Bug fixes
- Do not call done after calling the function.
---
## v0.31.0 [2019-05-28]
### Breaking changes
@ -44,6 +110,8 @@ InfluxDB until the next InfluxDB v2.0 release._
### Bug fixes
- Copy the table when a table is used multiple times.
---
## v0.30.0 [2019-05-16]
### Features

View File

@ -1,11 +1,13 @@
---
title: InfluxDB Cloud release notes
description: Important changes and notes introduced in each InfluxDB Cloud 2.0 update.
description: Important changes and and what's new in each InfluxDB Cloud 2.0 update.
weight: 101
menu:
v2_0_cloud:
parent: About InfluxDB Cloud
name: Release notes
v2_0_ref:
parent: Release notes
name: InfluxDB Cloud
aliases:
- /cloud/about/release-notes
---
## 2019-05-06 _Public Beta_
@ -28,7 +30,7 @@ menu:
### Features
- **InfluxDB 2.0 alpha-9**
_See the [alpha-9 release notes](/v2.0/reference/release-notes/#v2-0-0-alpha-9-2019-05-01) for details._
_See the [alpha-9 release notes](/v2.0/reference/release-notes/influxdb/#v2-0-0-alpha-9-2019-05-01) for details._
### Bug fixes
@ -45,7 +47,7 @@ _See the [alpha-9 release notes](/v2.0/reference/release-notes/#v2-0-0-alpha-9-2
### Features
- **InfluxDB 2.0 alpha-7**
_See the [alpha-7 release notes](/v2.0/reference/release-notes/#v2-0-0-alpha-7-2019-03-28) for details._
_See the [alpha-7 release notes](/v2.0/reference/release-notes/influxdb/#v2-0-0-alpha-7-2019-03-28) for details._
### Bug fixes

View File

@ -1,10 +1,29 @@
---
title: InfluxDB v2.0 release notes
description:
description: Important changes and and what's new in each version of InfluxDB.
menu:
v2_0_ref:
name: Release notes
weight: 1
name: InfluxDB
parent: Release notes
weight: 101
---
## v2.0.0-alpha.14 [2019-06-28]
### Features
- Add `influxd inspect verify-wal` tool.
- Move to [Flux 0.34.2](/v2.0/reference/release-notes/flux/#v0-34-2-2019-06-27) -
includes new string functions and initial multi-datasource support with `sql.from()`.
- Only click save once to save cell.
- Enable selecting more columns for line visualizations.
### UI Improvements
- Draw gauges correctly on HiDPI displays.
- Clamp gauge position to gauge domain.
- Improve display of error messages.
- Remove rendering bottleneck when streaming Flux responses.
- Prevent variable dropdown from clipping.
---
## v2.0.0-alpha.13 [2019-06-13]
@ -12,21 +31,27 @@ menu:
### Features
- Add static templates for system, Docker, Redis, Kubernetes.
---
## v2.0.0-alpha.12 [2019-06-13]
## Features
### Features
- Enable formatting line graph y ticks with binary prefix.
- Add x and y column pickers to graph types.
- Add option to shade area below line graphs.
## Bug Fixes
### Bug Fixes
- Fix performance regression in graph tooltips.
---
## v2.0.0-alpha.11 [2019-05-31]
## Bug Fixes
### Bug Fixes
- Correctly check if columnKeys include xColumn in heatmap.
---
## v2.0.0-alpha.10 [2019-05-30]
### Features
@ -51,8 +76,9 @@ menu:
- Change scrapers in scrapers list to be resource cards.
- Export and download resource with formatted resource name with no spaces.
## v2.0.0-alpha.9 [2019-05-01]
---
## v2.0.0-alpha.9 [2019-05-01]
{{% warn %}}
**This will remove all tasks from your InfluxDB v2.0 instance.**

View File

@ -7,7 +7,7 @@ v2.0/tags: [visualize]
menu:
v2_0:
name: Visualize data
weight: 4
weight: 5
---
The InfluxDB user interface (UI) provides tools for building custom dashboards to visualize your data.

View File

@ -26,7 +26,7 @@ can be created from the Data Explorer.
{{< nav-icon "data-explorer" >}}
2. Click **Script Editor** on the lower right.
3. Build the query for your variable using the [Table visualization type](/v2.0/visualize-data/visualization-types/#table) or enable the **View Raw Data** option.
3. Build the query for your variable using the [Table visualization type](/v2.0/visualize-data/visualization-types/table/) or enable the **View Raw Data** option.
4. Click **Save As** in the upper right.
5. In the window that appears, select **Variable**.
6. Enter a name for your variable in the **Name** field.

View File

@ -23,14 +23,14 @@
<h3>Query Data</h3>
</a>
<a class="card quarter" href="visualize-data">
<h3>Visualize Data</h3>
</a>
<a class="card quarter" href="process-data">
<h3>Process Data</h3>
</a>
<a class="card quarter" href="visualize-data">
<h3>Visualize Data</h3>
</a>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB