From b858fa254bd558430e111181e9994c0462e8fa24 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 29 Mar 2021 13:43:32 -0600 Subject: [PATCH] duplicated array.from to cloud --- .../reference/flux/stdlib/array/_index.md | 15 ++++++ .../cloud/reference/flux/stdlib/array/from.md | 12 +++++ .../flux/stdlib/experimental/array/_index.md | 9 +--- .../flux/stdlib/experimental/array/from.md | 53 +------------------ .../reference/flux/stdlib/array/_index.md | 6 ++- 5 files changed, 34 insertions(+), 61 deletions(-) create mode 100644 content/influxdb/cloud/reference/flux/stdlib/array/_index.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/array/from.md diff --git a/content/influxdb/cloud/reference/flux/stdlib/array/_index.md b/content/influxdb/cloud/reference/flux/stdlib/array/_index.md new file mode 100644 index 000000000..a5110e858 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/array/_index.md @@ -0,0 +1,15 @@ +--- +title: Flux Array package +list_title: Array package +description: > + The Flux Array package provides functions for building tables from Flux arrays. + Import the `array` package. +menu: + influxdb_cloud_ref: + name: Array + parent: Flux standard library +weight: 202 +influxdb/v2.0/tags: [functions, array, package, table] +--- + +{{< duplicate-oss >}} \ No newline at end of file diff --git a/content/influxdb/cloud/reference/flux/stdlib/array/from.md b/content/influxdb/cloud/reference/flux/stdlib/array/from.md new file mode 100644 index 000000000..694a1d7a2 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/array/from.md @@ -0,0 +1,12 @@ +--- +title: array.from() function +description: > + The `array.from()` function constructs a table from an array of records. +menu: + influxdb_cloud_ref: + name: array.from + parent: Array +weight: 401 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/experimental/array/_index.md b/content/influxdb/cloud/reference/flux/stdlib/experimental/array/_index.md index c81d4907b..a4473d40b 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/experimental/array/_index.md +++ b/content/influxdb/cloud/reference/flux/stdlib/experimental/array/_index.md @@ -12,11 +12,4 @@ weight: 301 influxdb/v2.0/tags: [functions, array, package, table] --- -Flux Array functions provide tools for building tables from Flux arrays. -Import the `experimental/array` package: - -```js -import "experimental/array" -``` - -{{< children type="functions" show="pages" >}} +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/experimental/array/from.md b/content/influxdb/cloud/reference/flux/stdlib/experimental/array/from.md index c5aaac88d..7558b353f 100644 --- a/content/influxdb/cloud/reference/flux/stdlib/experimental/array/from.md +++ b/content/influxdb/cloud/reference/flux/stdlib/experimental/array/from.md @@ -9,55 +9,4 @@ menu: weight: 401 --- -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_ - -{{< keep-url >}} -```js -import "experimental/array" - -array.from(rows: [ - {_time: 2020-01-01T00:00:00Z, _field: "exampleField", _value: 3, foo: "bar"}, - {_time: 2020-01-01T00:01:00Z, _field: "exampleField", _value: 4, foo: "bar"}, - {_time: 2020-01-01T00:02:00Z, _field: "exampleField", _value: 1, foo: "bar"} -]) -``` - -## Parameters - -### rows -Array of records to construct a table with. - -_**Data type:** Array of records_ - -## Examples - -##### Build an arbitrary table -```js -import "experimental/array" - -rows = [ - {foo: "bar", baz: 21.2} - {foo: "bar", baz: 23.8} -] - -array.from(rows: rows) -``` - -##### Union custom rows with query results -```js -import "influxdata/influxdb/v1" -import "experimental/array" - -tags = v1.tagValues( - bucket: "example-bucket", - tag: "host" -) - -wildcard_tag = array.from(rows: [{_value: "*"}]) - -union(tables: [tags, wildcard_tag]) -``` +{{< duplicate-oss >}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/array/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/array/_index.md index 202893567..26cd183a2 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/array/_index.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/array/_index.md @@ -3,7 +3,7 @@ title: Flux Array package list_title: Array package description: > The Flux Array package provides functions for building tables from Flux arrays. - Import the `experimental/array` package. + Import the `array` package. menu: influxdb_2_0_ref: name: Array @@ -15,4 +15,8 @@ influxdb/v2.0/tags: [functions, array, package, table] Flux Array functions provide tools for building tables from Flux arrays. Import the `array` package: +```js +import "array" +``` + {{< children type="functions" show="pages" >}}