Merge branch 'master' into late-arriving-data
commit
9e95204ca9
File diff suppressed because it is too large
Load Diff
|
@ -2,20 +2,13 @@ openapi: 3.0.0
|
|||
info:
|
||||
title: InfluxDB Cloud v1 compatibility API documentation
|
||||
version: 0.1.0
|
||||
description: >
|
||||
The InfluxDB 1.x compatibility /write and /query endpoints work with
|
||||
InfluxDB 1.x client libraries and third-party integrations like Grafana and
|
||||
others.
|
||||
|
||||
|
||||
If you want to use the latest InfluxDB /api/v2 API instead, see the
|
||||
[InfluxDB v2 API documentation](/influxdb/cloud/api/).
|
||||
description: |
|
||||
The InfluxDB 1.x compatibility /write and /query endpoints work with InfluxDB 1.x client libraries and third-party integrations like Grafana and others.
|
||||
|
||||
If you want to use the latest InfluxDB /api/v2 API instead, see the [InfluxDB v2 API documentation](/influxdb/cloud/api/).
|
||||
|
||||
This documentation is generated from the
|
||||
|
||||
[InfluxDB OpenAPI
|
||||
specification](https://raw.githubusercontent.com/influxdata/openapi/master/contracts/swaggerV1Compat.yml).
|
||||
[InfluxDB OpenAPI specification](https://raw.githubusercontent.com/influxdata/openapi/master/contracts/swaggerV1Compat.yml).
|
||||
servers:
|
||||
- url: /
|
||||
paths:
|
||||
|
@ -41,9 +34,7 @@ paths:
|
|||
schema:
|
||||
type: string
|
||||
required: true
|
||||
description: >-
|
||||
Bucket to write to. If none exists, InfluxDB creates a bucket with a
|
||||
default 3-day retention policy.
|
||||
description: Bucket to write to. If none exists, InfluxDB creates a bucket with a default 3-day retention policy.
|
||||
- in: query
|
||||
name: rp
|
||||
schema:
|
||||
|
@ -56,36 +47,25 @@ paths:
|
|||
description: Write precision.
|
||||
- in: header
|
||||
name: Content-Encoding
|
||||
description: >-
|
||||
When present, its value indicates to the database that compression
|
||||
is applied to the line protocol body.
|
||||
description: When present, its value indicates to the database that compression is applied to the line protocol body.
|
||||
schema:
|
||||
type: string
|
||||
description: >-
|
||||
Specifies that the line protocol in the body is encoded with gzip
|
||||
or not encoded with identity.
|
||||
description: Specifies that the line protocol in the body is encoded with gzip or not encoded with identity.
|
||||
default: identity
|
||||
enum:
|
||||
- gzip
|
||||
- identity
|
||||
responses:
|
||||
'204':
|
||||
description: >-
|
||||
Write data is correctly formatted and accepted for writing to the
|
||||
bucket.
|
||||
description: Write data is correctly formatted and accepted for writing to the bucket.
|
||||
'400':
|
||||
description: >-
|
||||
Line protocol poorly formed and no points were written. Response
|
||||
can be used to determine the first malformed line in the body
|
||||
line-protocol. All data in body was rejected and not written.
|
||||
description: Line protocol poorly formed and no points were written. Response can be used to determine the first malformed line in the body line-protocol. All data in body was rejected and not written.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/LineProtocolError'
|
||||
'401':
|
||||
description: >-
|
||||
Token does not have sufficient permissions to write to this
|
||||
organization and bucket or the organization and bucket do not exist.
|
||||
description: Token does not have sufficient permissions to write to this organization and bucket or the organization and bucket do not exist.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
|
@ -97,35 +77,24 @@ paths:
|
|||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'413':
|
||||
description: >-
|
||||
Write has been rejected because the payload is too large. Error
|
||||
message returns max size supported. All data in body was rejected
|
||||
and not written.
|
||||
description: Write has been rejected because the payload is too large. Error message returns max size supported. All data in body was rejected and not written.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/LineProtocolLengthError'
|
||||
'429':
|
||||
description: >-
|
||||
Token is temporarily over quota. The Retry-After header describes
|
||||
when to try the write again.
|
||||
description: Token is temporarily over quota. The Retry-After header describes when to try the write again.
|
||||
headers:
|
||||
Retry-After:
|
||||
description: >-
|
||||
A non-negative decimal integer indicating the seconds to delay
|
||||
after the response is received.
|
||||
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
'503':
|
||||
description: >-
|
||||
Server is temporarily unavailable to accept writes. The Retry-After
|
||||
header describes when to try the write again.
|
||||
description: Server is temporarily unavailable to accept writes. The Retry-After header describes when to try the write again.
|
||||
headers:
|
||||
Retry-After:
|
||||
description: >-
|
||||
A non-negative decimal integer indicating the seconds to delay
|
||||
after the response is received.
|
||||
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
|
@ -155,10 +124,7 @@ paths:
|
|||
name: Accept
|
||||
schema:
|
||||
type: string
|
||||
description: >-
|
||||
Specifies how query results should be encoded in the response.
|
||||
**Note:** With `application/csv`, query results include epoch
|
||||
timestamps instead of RFC3339 timestamps.
|
||||
description: Specifies how query results should be encoded in the response. **Note:** With `application/csv`, query results include epoch timestamps instead of RFC3339 timestamps.
|
||||
default: application/json
|
||||
enum:
|
||||
- application/json
|
||||
|
@ -167,15 +133,10 @@ paths:
|
|||
- application/x-msgpack
|
||||
- in: header
|
||||
name: Accept-Encoding
|
||||
description: >-
|
||||
The Accept-Encoding request HTTP header advertises which content
|
||||
encoding, usually a compression algorithm, the client is able to
|
||||
understand.
|
||||
description: The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand.
|
||||
schema:
|
||||
type: string
|
||||
description: >-
|
||||
Specifies that the query response in the body should be encoded
|
||||
with gzip or not encoded with identity.
|
||||
description: Specifies that the query response in the body should be encoded with gzip or not encoded with identity.
|
||||
default: identity
|
||||
enum:
|
||||
- gzip
|
||||
|
@ -207,23 +168,16 @@ paths:
|
|||
description: Query results
|
||||
headers:
|
||||
Content-Encoding:
|
||||
description: >-
|
||||
The Content-Encoding entity header is used to compress the
|
||||
media-type. When present, its value indicates which encodings
|
||||
were applied to the entity-body
|
||||
description: The Content-Encoding entity header is used to compress the media-type. When present, its value indicates which encodings were applied to the entity-body
|
||||
schema:
|
||||
type: string
|
||||
description: >-
|
||||
Specifies that the response in the body is encoded with gzip
|
||||
or not encoded with identity.
|
||||
description: Specifies that the response in the body is encoded with gzip or not encoded with identity.
|
||||
default: identity
|
||||
enum:
|
||||
- gzip
|
||||
- identity
|
||||
Trace-Id:
|
||||
description: >-
|
||||
The Trace-Id header reports the request's trace ID, if one was
|
||||
generated.
|
||||
description: The Trace-Id header reports the request's trace ID, if one was generated.
|
||||
schema:
|
||||
type: string
|
||||
description: Specifies the request's trace ID.
|
||||
|
@ -242,14 +196,10 @@ paths:
|
|||
type: string
|
||||
format: binary
|
||||
'429':
|
||||
description: >-
|
||||
Token is temporarily over quota. The Retry-After header describes
|
||||
when to try the read again.
|
||||
description: Token is temporarily over quota. The Retry-After header describes when to try the read again.
|
||||
headers:
|
||||
Retry-After:
|
||||
description: >-
|
||||
A non-negative decimal integer indicating the seconds to delay
|
||||
after the response is received.
|
||||
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
|
@ -330,11 +280,8 @@ components:
|
|||
items: {}
|
||||
InfluxQLCSVResponse:
|
||||
type: string
|
||||
example: >
|
||||
name,tags,time,test_field,test_tag
|
||||
test_measurement,,1603740794286107366,1,tag_value
|
||||
test_measurement,,1603740870053205649,2,tag_value
|
||||
test_measurement,,1603741221085428881,3,tag_value
|
||||
example: |
|
||||
name,tags,time,test_field,test_tag test_measurement,,1603740794286107366,1,tag_value test_measurement,,1603740870053205649,2,tag_value test_measurement,,1603741221085428881,3,tag_value
|
||||
Error:
|
||||
properties:
|
||||
code:
|
||||
|
@ -379,15 +326,11 @@ components:
|
|||
type: string
|
||||
op:
|
||||
readOnly: true
|
||||
description: >-
|
||||
Op describes the logical code operation during error. Useful for
|
||||
debugging.
|
||||
description: Op describes the logical code operation during error. Useful for debugging.
|
||||
type: string
|
||||
err:
|
||||
readOnly: true
|
||||
description: >-
|
||||
Err is a stack of errors that occurred during processing of the
|
||||
request. Useful for debugging.
|
||||
description: Err is a stack of errors that occurred during processing of the request. Useful for debugging.
|
||||
type: string
|
||||
line:
|
||||
readOnly: true
|
||||
|
@ -425,30 +368,21 @@ components:
|
|||
type: apiKey
|
||||
name: Authorization
|
||||
in: header
|
||||
description: >
|
||||
Use the [Token
|
||||
authentication](#section/Authentication/TokenAuthentication)
|
||||
|
||||
description: |
|
||||
Use the [Token authentication](#section/Authentication/TokenAuthentication)
|
||||
scheme to authenticate to the InfluxDB API.
|
||||
|
||||
|
||||
|
||||
In your API requests, send an `Authorization` header.
|
||||
|
||||
For the header value, provide the word `Token` followed by a space and
|
||||
an InfluxDB API token.
|
||||
|
||||
For the header value, provide the word `Token` followed by a space and an InfluxDB API token.
|
||||
The word `Token` is case-sensitive.
|
||||
|
||||
|
||||
|
||||
### Syntax
|
||||
|
||||
|
||||
`Authorization: Token YOUR_INFLUX_TOKEN`
|
||||
|
||||
|
||||
|
||||
For examples and more information, see the following:
|
||||
- [`/authorizations`](#tag/Authorizations) endpoint.
|
||||
- [Authorize API requests](/influxdb/cloud/api-guide/api_intro/#authentication).
|
||||
|
@ -456,54 +390,37 @@ components:
|
|||
BasicAuthentication:
|
||||
type: http
|
||||
scheme: basic
|
||||
description: >
|
||||
Use the HTTP [Basic
|
||||
authentication](#section/Authentication/BasicAuthentication)
|
||||
|
||||
scheme with clients that support the InfluxDB 1.x convention of username
|
||||
and password (that don't support the `Authorization: Token` scheme):
|
||||
description: |
|
||||
Use the HTTP [Basic authentication](#section/Authentication/BasicAuthentication)
|
||||
scheme with clients that support the InfluxDB 1.x convention of username and password (that don't support the `Authorization: Token` scheme):
|
||||
|
||||
|
||||
|
||||
For examples and more information, see how to [authenticate with a
|
||||
username and password](/influxdb/cloud/reference/api/influxdb-1x/).
|
||||
For examples and more information, see how to [authenticate with a username and password](/influxdb/cloud/reference/api/influxdb-1x/).
|
||||
QuerystringAuthentication:
|
||||
type: apiKey
|
||||
in: query
|
||||
name: u=&p=
|
||||
description: >
|
||||
Use the [Querystring
|
||||
authentication](#section/Authentication/QuerystringAuthentication)
|
||||
|
||||
scheme with InfluxDB 1.x API parameters to provide credentials through
|
||||
the query string.
|
||||
description: |
|
||||
Use the [Querystring authentication](#section/Authentication/QuerystringAuthentication)
|
||||
scheme with InfluxDB 1.x API parameters to provide credentials through the query string.
|
||||
|
||||
|
||||
|
||||
For examples and more information, see how to [authenticate with a
|
||||
username and password](/influxdb/cloud/reference/api/influxdb-1x/).
|
||||
For examples and more information, see how to [authenticate with a username and password](/influxdb/cloud/reference/api/influxdb-1x/).
|
||||
security:
|
||||
- TokenAuthentication: []
|
||||
- BasicAuthentication: []
|
||||
- QuerystringAuthentication: []
|
||||
tags:
|
||||
- name: Authentication
|
||||
description: >
|
||||
description: |
|
||||
The InfluxDB 1.x API requires authentication for all requests.
|
||||
|
||||
InfluxDB Cloud uses InfluxDB API tokens to authenticate requests.
|
||||
|
||||
|
||||
|
||||
For more information, see the following:
|
||||
|
||||
- [Token authentication](#section/Authentication/TokenAuthentication)
|
||||
|
||||
- [Basic authentication](#section/Authentication/BasicAuthentication)
|
||||
|
||||
- [Querystring
|
||||
authentication](#section/Authentication/QuerystringAuthentication)
|
||||
|
||||
- [Querystring authentication](#section/Authentication/QuerystringAuthentication)
|
||||
|
||||
<!-- ReDoc-Inject: <security-definitions> -->
|
||||
x-traitTag: true
|
||||
|
|
|
@ -14,78 +14,13 @@ function replaceDocsUrl(field) {
|
|||
/** @type {import('@redocly/openapi-cli').OasDecorator} */
|
||||
function docsUrl() {
|
||||
return {
|
||||
DefinitionRoot: {
|
||||
Example: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
},
|
||||
},
|
||||
ExternalDocs: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
},
|
||||
},
|
||||
Header: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
},
|
||||
},
|
||||
Info: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
},
|
||||
},
|
||||
Operation: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
},
|
||||
},
|
||||
Parameter: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
any: {
|
||||
leave(node, ctx) {
|
||||
if(node.description && typeof(node.description) === 'string') {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
}
|
||||
},
|
||||
PathItem: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
}
|
||||
},
|
||||
RequestBody: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
}
|
||||
},
|
||||
Response: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
}
|
||||
},
|
||||
Schema: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
}
|
||||
},
|
||||
SecurityScheme: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
}
|
||||
},
|
||||
Server: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
}
|
||||
},
|
||||
Tag: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
}
|
||||
},
|
||||
XCodeSample: {
|
||||
leave(node, ctx) {
|
||||
node.description = replaceDocsUrl(node.description);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,20 +2,13 @@ openapi: 3.0.0
|
|||
info:
|
||||
title: InfluxDB OSS v1 compatibility API documentation
|
||||
version: 2.4.0 v1 compatibility
|
||||
description: >
|
||||
The InfluxDB 1.x compatibility /write and /query endpoints work with
|
||||
InfluxDB 1.x client libraries and third-party integrations like Grafana and
|
||||
others.
|
||||
|
||||
|
||||
If you want to use the latest InfluxDB /api/v2 API instead, see the
|
||||
[InfluxDB v2 API documentation](/influxdb/v2.4/api/).
|
||||
description: |
|
||||
The InfluxDB 1.x compatibility /write and /query endpoints work with InfluxDB 1.x client libraries and third-party integrations like Grafana and others.
|
||||
|
||||
If you want to use the latest InfluxDB /api/v2 API instead, see the [InfluxDB v2 API documentation](/influxdb/v2.4/api/).
|
||||
|
||||
This documentation is generated from the
|
||||
|
||||
[InfluxDB OpenAPI
|
||||
specification](https://github.com/influxdata/openapi/blob/influxdb-oss-v2.4.0/contracts/swaggerV1Compat.yml).
|
||||
[InfluxDB OpenAPI specification](https://github.com/influxdata/openapi/blob/influxdb-oss-v2.4.0/contracts/swaggerV1Compat.yml).
|
||||
servers:
|
||||
- url: /
|
||||
paths:
|
||||
|
@ -41,9 +34,7 @@ paths:
|
|||
schema:
|
||||
type: string
|
||||
required: true
|
||||
description: >-
|
||||
Bucket to write to. If none exists, InfluxDB creates a bucket with a
|
||||
default 3-day retention policy.
|
||||
description: Bucket to write to. If none exists, InfluxDB creates a bucket with a default 3-day retention policy.
|
||||
- in: query
|
||||
name: rp
|
||||
schema:
|
||||
|
@ -56,36 +47,25 @@ paths:
|
|||
description: Write precision.
|
||||
- in: header
|
||||
name: Content-Encoding
|
||||
description: >-
|
||||
When present, its value indicates to the database that compression
|
||||
is applied to the line protocol body.
|
||||
description: When present, its value indicates to the database that compression is applied to the line protocol body.
|
||||
schema:
|
||||
type: string
|
||||
description: >-
|
||||
Specifies that the line protocol in the body is encoded with gzip
|
||||
or not encoded with identity.
|
||||
description: Specifies that the line protocol in the body is encoded with gzip or not encoded with identity.
|
||||
default: identity
|
||||
enum:
|
||||
- gzip
|
||||
- identity
|
||||
responses:
|
||||
'204':
|
||||
description: >-
|
||||
Write data is correctly formatted and accepted for writing to the
|
||||
bucket.
|
||||
description: Write data is correctly formatted and accepted for writing to the bucket.
|
||||
'400':
|
||||
description: >-
|
||||
Line protocol poorly formed and no points were written. Response
|
||||
can be used to determine the first malformed line in the body
|
||||
line-protocol. All data in body was rejected and not written.
|
||||
description: Line protocol poorly formed and no points were written. Response can be used to determine the first malformed line in the body line-protocol. All data in body was rejected and not written.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/LineProtocolError'
|
||||
'401':
|
||||
description: >-
|
||||
Token does not have sufficient permissions to write to this
|
||||
organization and bucket or the organization and bucket do not exist.
|
||||
description: Token does not have sufficient permissions to write to this organization and bucket or the organization and bucket do not exist.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
|
@ -97,35 +77,24 @@ paths:
|
|||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'413':
|
||||
description: >-
|
||||
Write has been rejected because the payload is too large. Error
|
||||
message returns max size supported. All data in body was rejected
|
||||
and not written.
|
||||
description: Write has been rejected because the payload is too large. Error message returns max size supported. All data in body was rejected and not written.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/LineProtocolLengthError'
|
||||
'429':
|
||||
description: >-
|
||||
Token is temporarily over quota. The Retry-After header describes
|
||||
when to try the write again.
|
||||
description: Token is temporarily over quota. The Retry-After header describes when to try the write again.
|
||||
headers:
|
||||
Retry-After:
|
||||
description: >-
|
||||
A non-negative decimal integer indicating the seconds to delay
|
||||
after the response is received.
|
||||
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
'503':
|
||||
description: >-
|
||||
Server is temporarily unavailable to accept writes. The Retry-After
|
||||
header describes when to try the write again.
|
||||
description: Server is temporarily unavailable to accept writes. The Retry-After header describes when to try the write again.
|
||||
headers:
|
||||
Retry-After:
|
||||
description: >-
|
||||
A non-negative decimal integer indicating the seconds to delay
|
||||
after the response is received.
|
||||
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
|
@ -155,10 +124,7 @@ paths:
|
|||
name: Accept
|
||||
schema:
|
||||
type: string
|
||||
description: >-
|
||||
Specifies how query results should be encoded in the response.
|
||||
**Note:** With `application/csv`, query results include epoch
|
||||
timestamps instead of RFC3339 timestamps.
|
||||
description: Specifies how query results should be encoded in the response. **Note:** With `application/csv`, query results include epoch timestamps instead of RFC3339 timestamps.
|
||||
default: application/json
|
||||
enum:
|
||||
- application/json
|
||||
|
@ -167,15 +133,10 @@ paths:
|
|||
- application/x-msgpack
|
||||
- in: header
|
||||
name: Accept-Encoding
|
||||
description: >-
|
||||
The Accept-Encoding request HTTP header advertises which content
|
||||
encoding, usually a compression algorithm, the client is able to
|
||||
understand.
|
||||
description: The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand.
|
||||
schema:
|
||||
type: string
|
||||
description: >-
|
||||
Specifies that the query response in the body should be encoded
|
||||
with gzip or not encoded with identity.
|
||||
description: Specifies that the query response in the body should be encoded with gzip or not encoded with identity.
|
||||
default: identity
|
||||
enum:
|
||||
- gzip
|
||||
|
@ -207,23 +168,16 @@ paths:
|
|||
description: Query results
|
||||
headers:
|
||||
Content-Encoding:
|
||||
description: >-
|
||||
The Content-Encoding entity header is used to compress the
|
||||
media-type. When present, its value indicates which encodings
|
||||
were applied to the entity-body
|
||||
description: The Content-Encoding entity header is used to compress the media-type. When present, its value indicates which encodings were applied to the entity-body
|
||||
schema:
|
||||
type: string
|
||||
description: >-
|
||||
Specifies that the response in the body is encoded with gzip
|
||||
or not encoded with identity.
|
||||
description: Specifies that the response in the body is encoded with gzip or not encoded with identity.
|
||||
default: identity
|
||||
enum:
|
||||
- gzip
|
||||
- identity
|
||||
Trace-Id:
|
||||
description: >-
|
||||
The Trace-Id header reports the request's trace ID, if one was
|
||||
generated.
|
||||
description: The Trace-Id header reports the request's trace ID, if one was generated.
|
||||
schema:
|
||||
type: string
|
||||
description: Specifies the request's trace ID.
|
||||
|
@ -242,14 +196,10 @@ paths:
|
|||
type: string
|
||||
format: binary
|
||||
'429':
|
||||
description: >-
|
||||
Token is temporarily over quota. The Retry-After header describes
|
||||
when to try the read again.
|
||||
description: Token is temporarily over quota. The Retry-After header describes when to try the read again.
|
||||
headers:
|
||||
Retry-After:
|
||||
description: >-
|
||||
A non-negative decimal integer indicating the seconds to delay
|
||||
after the response is received.
|
||||
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
|
@ -330,11 +280,8 @@ components:
|
|||
items: {}
|
||||
InfluxQLCSVResponse:
|
||||
type: string
|
||||
example: >
|
||||
name,tags,time,test_field,test_tag
|
||||
test_measurement,,1603740794286107366,1,tag_value
|
||||
test_measurement,,1603740870053205649,2,tag_value
|
||||
test_measurement,,1603741221085428881,3,tag_value
|
||||
example: |
|
||||
name,tags,time,test_field,test_tag test_measurement,,1603740794286107366,1,tag_value test_measurement,,1603740870053205649,2,tag_value test_measurement,,1603741221085428881,3,tag_value
|
||||
Error:
|
||||
properties:
|
||||
code:
|
||||
|
@ -379,15 +326,11 @@ components:
|
|||
type: string
|
||||
op:
|
||||
readOnly: true
|
||||
description: >-
|
||||
Op describes the logical code operation during error. Useful for
|
||||
debugging.
|
||||
description: Op describes the logical code operation during error. Useful for debugging.
|
||||
type: string
|
||||
err:
|
||||
readOnly: true
|
||||
description: >-
|
||||
Err is a stack of errors that occurred during processing of the
|
||||
request. Useful for debugging.
|
||||
description: Err is a stack of errors that occurred during processing of the request. Useful for debugging.
|
||||
type: string
|
||||
line:
|
||||
readOnly: true
|
||||
|
@ -425,30 +368,21 @@ components:
|
|||
type: apiKey
|
||||
name: Authorization
|
||||
in: header
|
||||
description: >
|
||||
Use the [Token
|
||||
authentication](#section/Authentication/TokenAuthentication)
|
||||
|
||||
description: |
|
||||
Use the [Token authentication](#section/Authentication/TokenAuthentication)
|
||||
scheme to authenticate to the InfluxDB API.
|
||||
|
||||
|
||||
|
||||
In your API requests, send an `Authorization` header.
|
||||
|
||||
For the header value, provide the word `Token` followed by a space and
|
||||
an InfluxDB API token.
|
||||
|
||||
For the header value, provide the word `Token` followed by a space and an InfluxDB API token.
|
||||
The word `Token` is case-sensitive.
|
||||
|
||||
|
||||
|
||||
### Syntax
|
||||
|
||||
|
||||
`Authorization: Token YOUR_INFLUX_TOKEN`
|
||||
|
||||
|
||||
|
||||
For examples and more information, see the following:
|
||||
- [`/authorizations`](#tag/Authorizations) endpoint.
|
||||
- [Authorize API requests](/influxdb/cloud/api-guide/api_intro/#authentication).
|
||||
|
@ -456,54 +390,37 @@ components:
|
|||
BasicAuthentication:
|
||||
type: http
|
||||
scheme: basic
|
||||
description: >
|
||||
Use the HTTP [Basic
|
||||
authentication](#section/Authentication/BasicAuthentication)
|
||||
|
||||
scheme with clients that support the InfluxDB 1.x convention of username
|
||||
and password (that don't support the `Authorization: Token` scheme):
|
||||
description: |
|
||||
Use the HTTP [Basic authentication](#section/Authentication/BasicAuthentication)
|
||||
scheme with clients that support the InfluxDB 1.x convention of username and password (that don't support the `Authorization: Token` scheme):
|
||||
|
||||
|
||||
|
||||
For examples and more information, see how to [authenticate with a
|
||||
username and password](/influxdb/cloud/reference/api/influxdb-1x/).
|
||||
For examples and more information, see how to [authenticate with a username and password](/influxdb/cloud/reference/api/influxdb-1x/).
|
||||
QuerystringAuthentication:
|
||||
type: apiKey
|
||||
in: query
|
||||
name: u=&p=
|
||||
description: >
|
||||
Use the [Querystring
|
||||
authentication](#section/Authentication/QuerystringAuthentication)
|
||||
|
||||
scheme with InfluxDB 1.x API parameters to provide credentials through
|
||||
the query string.
|
||||
description: |
|
||||
Use the [Querystring authentication](#section/Authentication/QuerystringAuthentication)
|
||||
scheme with InfluxDB 1.x API parameters to provide credentials through the query string.
|
||||
|
||||
|
||||
|
||||
For examples and more information, see how to [authenticate with a
|
||||
username and password](/influxdb/cloud/reference/api/influxdb-1x/).
|
||||
For examples and more information, see how to [authenticate with a username and password](/influxdb/cloud/reference/api/influxdb-1x/).
|
||||
security:
|
||||
- TokenAuthentication: []
|
||||
- BasicAuthentication: []
|
||||
- QuerystringAuthentication: []
|
||||
tags:
|
||||
- name: Authentication
|
||||
description: >
|
||||
description: |
|
||||
The InfluxDB 1.x API requires authentication for all requests.
|
||||
|
||||
InfluxDB Cloud uses InfluxDB API tokens to authenticate requests.
|
||||
|
||||
|
||||
|
||||
For more information, see the following:
|
||||
|
||||
- [Token authentication](#section/Authentication/TokenAuthentication)
|
||||
|
||||
- [Basic authentication](#section/Authentication/BasicAuthentication)
|
||||
|
||||
- [Querystring
|
||||
authentication](#section/Authentication/QuerystringAuthentication)
|
||||
|
||||
- [Querystring authentication](#section/Authentication/QuerystringAuthentication)
|
||||
|
||||
<!-- ReDoc-Inject: <security-definitions> -->
|
||||
x-traitTag: true
|
||||
|
|
|
@ -200,29 +200,16 @@ $('.tooltip').each( function(){
|
|||
$(this).prepend($toolTipElement);
|
||||
});
|
||||
|
||||
/////////////////// Style time columns in tables to not wrap ///////////////////
|
||||
//////////////////// Style time cells in tables to not wrap ////////////////////
|
||||
|
||||
$('.article--content table').each(function() {
|
||||
var table = $(this);
|
||||
var timeColumns = ['_time', '*_time', '_start', '*_start', '_stop', '*_stop'];
|
||||
let header = [];
|
||||
let timeColumnIndexes = [];
|
||||
|
||||
// Return an array of column headers
|
||||
table.find('th').each(function () {
|
||||
header.push($(this)[0].innerHTML);
|
||||
});
|
||||
|
||||
// Return indexes of time columns
|
||||
header.forEach(function(value, i) {
|
||||
if ( timeColumns.includes(value) ) { timeColumnIndexes.push(i) };
|
||||
});
|
||||
|
||||
// Add the nowrap class to cells with time column indexes
|
||||
table.find('td').each(function() {
|
||||
if (timeColumnIndexes.includes( $(this)[0].cellIndex )) {
|
||||
$(this).addClass('nowrap');
|
||||
let cellContent = $(this)[0].innerText
|
||||
|
||||
if (/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.*Z/.test(cellContent)) {
|
||||
$(this).addClass('nowrap')
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
@ -7,19 +7,20 @@
|
|||
}
|
||||
|
||||
.flex-container {
|
||||
margin-right: 1rem;
|
||||
margin-right: 1.5rem;
|
||||
|
||||
&.half { width: calc(50% - 1rem); }
|
||||
&.third { width: calc(33.33% - 1rem); }
|
||||
&.quarter { width: calc(25% - 1rem); }
|
||||
&.half { width: calc(50% - 1.5rem); }
|
||||
&.third { width: calc(33.33% - 1.5rem); }
|
||||
&.quarter { width: calc(25% - 1.5rem); }
|
||||
&.two-thirds { width: calc(66% - 2rem);}
|
||||
|
||||
&.half, &.third, &.quarter {
|
||||
table:not(:last-child) {margin-right: 1rem;}
|
||||
table:not(:last-child) {margin-right: 1.5rem;}
|
||||
}
|
||||
|
||||
img { margin-bottom: 0;}
|
||||
table { display: table; }
|
||||
p:last-child {margin-bottom: 0.5rem;}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -32,5 +33,6 @@
|
|||
&.third,
|
||||
&.two-thirds { width: calc(100% - 1rem); }
|
||||
&.quarter { width: calc(50% - 1rem); }
|
||||
p:last-child {margin-bottom: 1.5rem;}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,35 @@ svg {
|
|||
.st1 {fill: $article-text;}
|
||||
.st2 {font-family: $rubik; font-weight: $medium}
|
||||
}
|
||||
|
||||
//////////////////////////////// Join Diagram ////////////////////////////////
|
||||
&#join-diagram {
|
||||
$fill-color: rgba($article-text, .35);
|
||||
display: block;
|
||||
max-width: 250px;
|
||||
margin: 1rem 0 2rem;
|
||||
|
||||
&.center {margin: 0 auto 2rem auto;}
|
||||
&.small {max-width: 125px; path{stroke-width: 3;} }
|
||||
|
||||
path {
|
||||
stroke: $article-text;
|
||||
stroke-width:2;
|
||||
stroke-miterlimit:10;
|
||||
fill: none;
|
||||
}
|
||||
&.inner {path { &#center {fill:$fill-color; }}}
|
||||
&.left {path { &#left, &#center {fill:$fill-color; }}}
|
||||
&.right {path { &#center, &#right {fill:$fill-color; }}}
|
||||
&.full {path { &#left, &#center, &#right {fill:$fill-color; }}}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@include media(small) {
|
||||
svg {
|
||||
&#join-diagram {margin: 1rem auto 2rem; }
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////// Styles for SVG legends ////////////////////////////
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
table {
|
||||
display: inline-block;
|
||||
margin: 1rem 0 3rem;
|
||||
margin: 1rem 1rem 3rem 0;
|
||||
border-spacing: 0;
|
||||
color: $article-text;
|
||||
max-width: 100%;
|
||||
|
|
|
@ -39,16 +39,22 @@ that contains one value for each [row](#row).
|
|||
A **row** is a collection of associated [column](#column) values.
|
||||
|
||||
#### Group key
|
||||
A **group key** defines which columns and specific column values to include in a table.
|
||||
All rows in a table contain the same values in group key columns.
|
||||
All tables in a stream of tables have a unique group key, but group key
|
||||
modifications are applied to a stream of tables.
|
||||
A **group key** defines which columns to use to group tables in a stream of tables.
|
||||
Each table in a stream of tables represents a unique **group key instance**.
|
||||
All rows in a table contain the same values for each group key column.
|
||||
|
||||
##### Example group keys
|
||||
Group keys contain key-value pairs, where each key represents a column name and
|
||||
each value represents the column value included in the table.
|
||||
The following are examples of group keys in a stream of tables with three separate tables.
|
||||
Each group key represents a table containing data for a unique location:
|
||||
##### Example group key
|
||||
A group key can be represented by an array of column labels.
|
||||
|
||||
```
|
||||
[_measurement, facility, _field]
|
||||
```
|
||||
|
||||
##### Example group key instances
|
||||
Group key instances (unique to each table) include key-value pairs that identify
|
||||
each column name in the table that has the same value.
|
||||
The following are examples of group key instances in a stream of tables with three separate tables.
|
||||
Each represents a table containing data for a unique location:
|
||||
|
||||
```
|
||||
[_measurement: "production", facility: "us-midwest", _field: "apq"]
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
---
|
||||
title: Join data
|
||||
seotitle: Join data with Flux
|
||||
description: >
|
||||
Flux supports inner, full outer, left outer, and right outer joins.
|
||||
Learn how to use the `join` package to join two data sets with common values.
|
||||
menu:
|
||||
flux_0_x:
|
||||
name: Join data
|
||||
weight: 8
|
||||
related:
|
||||
- /flux/v0.x/stdlib/join/
|
||||
- /flux/v0.x/stdlib/join/inner/
|
||||
- /flux/v0.x/stdlib/join/left/
|
||||
- /flux/v0.x/stdlib/join/right/
|
||||
- /flux/v0.x/stdlib/join/full/
|
||||
- /flux/v0.x/stdlib/join/time/
|
||||
---
|
||||
|
||||
Use the Flux [`join` package](/flux/v0.x/stdlib/join/) to join two data sets based on common values.
|
||||
Learn how join two data sets using the following join methods:
|
||||
|
||||
{{< flex >}}
|
||||
{{< flex-content "quarter" >}}
|
||||
<a href="#perform-an-inner-join">
|
||||
<p style="text-align:center"><strong>Inner join</strong></p>
|
||||
{{< svg svg="static/svgs/join-diagram.svg" class="inner small center" >}}
|
||||
</a>
|
||||
{{< /flex-content >}}
|
||||
{{< flex-content "quarter" >}}
|
||||
<a href="#perform-a-left-outer-join">
|
||||
<p style="text-align:center"><strong>Left outer join</strong></p>
|
||||
{{< svg svg="static/svgs/join-diagram.svg" class="left small center" >}}
|
||||
</a>
|
||||
{{< /flex-content >}}
|
||||
{{< flex-content "quarter" >}}
|
||||
<a href="#perform-a-right-outer-join">
|
||||
<p style="text-align:center"><strong>Right outer join</strong></p>
|
||||
{{< svg svg="static/svgs/join-diagram.svg" class="right small center" >}}
|
||||
</a>
|
||||
{{< /flex-content >}}
|
||||
{{< flex-content "quarter" >}}
|
||||
<a href="#perform-a-full-outer-join">
|
||||
<p style="text-align:center"><strong>Full outer join</strong></p>
|
||||
{{< svg svg="static/svgs/join-diagram.svg" class="full small center" >}}
|
||||
</a>
|
||||
{{< /flex-content >}}
|
||||
{{< /flex >}}
|
||||
|
||||
{{% note %}}
|
||||
#### When to use the join package
|
||||
|
||||
We recommend using the `join` package to join streams that have mostly different
|
||||
schemas or that come from two separate data sources.
|
||||
If you're joining data from the same data source with the same schema, using
|
||||
[`union()`](/flux/v0.x/stdlib/universe/union/) and [`pivot()`](/flux/v0.x/stdlib/universe/pivot/)
|
||||
to combine the data will likely be more performant.
|
||||
|
||||
For more information, see
|
||||
[When to use union and pivot instead of join functions](/{{< latest "influxdb" >}}/query-data/flux/join/#when-to-use-union-and-pivot-instead-of-join-functions).
|
||||
{{% /note %}}
|
||||
|
||||
- [How join functions work](#how-join-functions-work)
|
||||
- [Input streams](#input-streams)
|
||||
- [Join predicate function (on)](#join-predicate-function-on)
|
||||
- [Join output function (as)](#join-output-function-as)
|
||||
- [Perform join operations](#perform-join-operations)
|
||||
{{< children type="anchored-list" filterOut="Troubleshoot join operations" >}}
|
||||
- [Troubleshoot join operations](#troubleshoot-join-operations)
|
||||
|
||||
## How join functions work
|
||||
|
||||
`join` functions join _two_ streams of tables together based
|
||||
on common values in each input stream.
|
||||
|
||||
- [Input streams](#input-streams)
|
||||
- [Join predicate function (on)](#join-predicate-function-on)
|
||||
- [Join output function (as)](#join-output-function-as)
|
||||
|
||||
### Input streams
|
||||
|
||||
Each input stream is assigned to the `left` or `right` parameter.
|
||||
Input streams can be defined from any valid data source.
|
||||
For more information, see:
|
||||
|
||||
- [Query data sources](/flux/v0.x/query-data/)
|
||||
- Define ad hoc tables with [`array.from()`](/flux/v0.x/stdlib/array/from/)
|
||||
|
||||
#### Data requirements
|
||||
|
||||
To join data, each input stream must have the following:
|
||||
|
||||
- **One or more columns with common values to join on**.
|
||||
Columns do not need identical labels, but they do need to have comparable values.
|
||||
- **Identical [group keys](/flux/v0.x/get-started/data-model/#group-key)**.
|
||||
Functions in the `join` package use group keys to quickly determine what tables
|
||||
from each input stream should be paired and evaluated for the join operation.
|
||||
_Both input streams should have the same group key._
|
||||
If they don't, your join operation may not find any matching tables and will
|
||||
return unexpected output.
|
||||
If the group keys of your input streams are not identical, use
|
||||
[`group()`](/flux/v0.x/stdlib/universe/group/) to regroup each input
|
||||
stream before joining them together.
|
||||
|
||||
{{% note %}}
|
||||
Only tables with the same [group key instance](/flux/v0.x/get-started/data-model/#example-group-key-instances)
|
||||
are joined.
|
||||
{{% /note %}}
|
||||
|
||||
### Join predicate function (on)
|
||||
|
||||
`join` package functions require the `on` parameter to compare values from each input stream (represented by `l` (left) and `r` (right))
|
||||
and returns `true` or `false`.
|
||||
Rows that return `true` are joined.
|
||||
This parameter is a [predicate function](/flux/v0.x/get-started/syntax-basics/#predicate-functions).
|
||||
|
||||
|
||||
```js
|
||||
(l, r) => l.column == r.column
|
||||
```
|
||||
|
||||
### Join output function (as)
|
||||
|
||||
`join` package functions _(except [`join.time()`](/flux/v0.x/stdlib/join/time/))_
|
||||
require the `as` parameter to define the output schema of the join.
|
||||
The `as` parameter returns a new record using values from
|
||||
joined rows–left (`l`) and right (`r`).
|
||||
|
||||
```js
|
||||
(l, r) => ({l with name: r.name, location: r.location})
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
#### Do not modify group key columns
|
||||
|
||||
Do not modify group key columns. The `as` function must return the same group key as both input streams to successfully perform a join.
|
||||
{{% /note %}}
|
||||
|
||||
## Perform join operations
|
||||
|
||||
The `join` package supports the following join types and special use cases:
|
||||
|
||||
{{< children type="anchored-list" filterOut="Troubleshoot join operations" >}}
|
||||
|
||||
{{< children readmore=true filterOut="Troubleshoot join operations" >}}
|
||||
|
||||
## Troubleshoot join operations
|
||||
|
||||
For information about unexpected behaviors and errors when using the `join` package,
|
||||
see [Troubleshoot join operations](/flux/v0.x/join-data/troubleshoot-joins/).
|
|
@ -0,0 +1,252 @@
|
|||
---
|
||||
title: Perform a full outer join
|
||||
description: >
|
||||
Use [`join.full()`](/flux/v0.x/stdlib/join/full/) to perform an full outer join of two streams of data.
|
||||
Full outer joins output a row for all rows in both the **left** and **right** input streams
|
||||
and join rows that match according to the `on` predicate.
|
||||
menu:
|
||||
flux_0_x:
|
||||
name: Full outer join
|
||||
parent: Join data
|
||||
weight: 103
|
||||
related:
|
||||
- /flux/v0.x/join-data/troubleshoot-joins/
|
||||
- /flux/v0.x/stdlib/join/
|
||||
- /flux/v0.x/stdlib/join/full/
|
||||
list_code_example: |
|
||||
```js
|
||||
import "join"
|
||||
|
||||
left = from(bucket: "example-bucket-1") |> //...
|
||||
right = from(bucket: "example-bucket-2") |> //...
|
||||
|
||||
join.full(
|
||||
left: left,
|
||||
right: right,
|
||||
on: (l, r) => l.id== r.id,
|
||||
as: (l, r) => {
|
||||
id = if exists l.id then l.id else r.id
|
||||
|
||||
return {name: l.name, location: r.location, id: id}
|
||||
},
|
||||
)
|
||||
```
|
||||
---
|
||||
|
||||
Use [`join.full()`](/flux/v0.x/stdlib/join/full/) to perform an full outer join of two streams of data.
|
||||
Full outer joins output a row for all rows in both the **left** and **right** input streams
|
||||
and join rows that match according to the `on` predicate.
|
||||
|
||||
{{< svg svg="static/svgs/join-diagram.svg" class="full" >}}
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View table illustration of a full outer join" %}}
|
||||
{{< flex >}}
|
||||
{{% flex-content "third" %}}
|
||||
#### left
|
||||
| | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> |
|
||||
| r2 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> |
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content "third" %}}
|
||||
#### right
|
||||
| | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r3 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r4 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content "third" %}}
|
||||
#### Full outer join result
|
||||
|
||||
| | | | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r2 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> | | |
|
||||
| r3 | | | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r4 | | | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
{{% /flex-content %}}
|
||||
{{< /flex >}}
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
## Use join.full to join your data
|
||||
|
||||
1. Import the `join` package.
|
||||
2. Define the **left** and **right** data streams to join:
|
||||
|
||||
- Each stream must have one or more columns with common values.
|
||||
Column labels do not need to match, but column values do.
|
||||
- Each stream should have identical [group keys](/flux/v0.x/get-started/data-model/#group-key).
|
||||
|
||||
_For more information, see [join data requirements](/flux/v0.x/join-data/#data-requirements)._
|
||||
|
||||
3. Use `join.full()` to join the two streams together.
|
||||
Provide the following required parameters:
|
||||
|
||||
- `left`: Stream of data representing the left side of the join.
|
||||
- `right`: Stream of data representing the right side of the join.
|
||||
- `on`: [Join predicate](/flux/v0.x/join-data/#join-predicate-function-on).
|
||||
For example: `(l, r) => l.column == r.column`.
|
||||
- `as`: [Join output function](/flux/v0.x/join-data/#join-output-function-as)
|
||||
that returns a record with values from each input stream.
|
||||
|
||||
##### Account for missing, non-group-key values
|
||||
|
||||
In a full outer join, it’s possible for either the left (`l`) or right (`r`)
|
||||
to contain _null_ values for the columns used in the join operation
|
||||
and default to a default record (group key columns are populated and
|
||||
other columns are _null_).
|
||||
`l` and `r` will never both use default records at the same time.
|
||||
|
||||
To ensure non-null values are included in the output for non-group-key columns,
|
||||
check for the existence of a value in the `l` or `r` record, and return
|
||||
the value that exists:
|
||||
|
||||
```js
|
||||
(l, r) => {
|
||||
id = if exists l.id then l.id else r.id
|
||||
|
||||
return {_time: l.time, location: r.location, id: id}
|
||||
}
|
||||
```
|
||||
|
||||
The following example uses a filtered selection from the
|
||||
[**machineProduction** sample data set](/flux/v0.x/stdlib/influxdata/influxdb/sample/data/#set)
|
||||
as the **left** data stream and an ad-hoc table created with [`array.from()`](/flux/v0.x/stdlib/array/from/)
|
||||
as the **right** data stream.
|
||||
|
||||
{{% note %}}
|
||||
#### Example data grouping
|
||||
|
||||
The example below ungroups the **left** stream to match the grouping of the **right** stream.
|
||||
After the two streams are joined together, the joined data is grouped by `stationID`
|
||||
and sorted by `_time`.
|
||||
{{% /note %}}
|
||||
|
||||
```js
|
||||
import "array"
|
||||
import "influxdata/influxdb/sample"
|
||||
import "join"
|
||||
|
||||
left =
|
||||
sample.data(set: "machineProduction")
|
||||
|> filter(fn: (r) => r.stationID == "g1" or r.stationID == "g2" or r.stationID == "g3")
|
||||
|> filter(fn: (r) => r._field == "oil_temp")
|
||||
|> limit(n: 5)
|
||||
|
||||
right =
|
||||
array.from(
|
||||
rows: [
|
||||
{station: "g1", opType: "auto", last_maintained: 2021-07-15T00:00:00Z},
|
||||
{station: "g2", opType: "manned", last_maintained: 2021-07-02T00:00:00Z},
|
||||
{station: "g4", opType: "auto", last_maintained: 2021-08-04T00:00:00Z},
|
||||
],
|
||||
)
|
||||
|
||||
join.full(
|
||||
left: left |> group(),
|
||||
right: right,
|
||||
on: (l, r) => l.stationID == r.station,
|
||||
as: (l, r) => {
|
||||
stationID = if exists l.stationID then l.stationID else r.station
|
||||
|
||||
return {
|
||||
stationID: stationID,
|
||||
_time: l._time,
|
||||
_field: l._field,
|
||||
_value: l._value,
|
||||
opType: r.opType,
|
||||
maintained: r.last_maintained,
|
||||
}
|
||||
},
|
||||
)
|
||||
|> group(columns: ["stationID"])
|
||||
|> sort(columns: ["_time"])
|
||||
```
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View example input and output" %}}
|
||||
|
||||
### Input
|
||||
|
||||
#### left {#left-input}
|
||||
|
||||
{{% note %}}
|
||||
_`_start` and `_stop` columns have been omitted._
|
||||
{{% /note %}}
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g1 | oil_temp | 39.1 |
|
||||
| 2021-08-01T00:00:11.51Z | machinery | g1 | oil_temp | 40.3 |
|
||||
| 2021-08-01T00:00:19.53Z | machinery | g1 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:00:25.1Z | machinery | g1 | oil_temp | 40.72 |
|
||||
| 2021-08-01T00:00:36.88Z | machinery | g1 | oil_temp | 40.8 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:00:27.93Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:00:54.96Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:01:17.27Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:01:41.84Z | machinery | g2 | oil_temp | 40.6 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g3 | oil_temp | 41.4 |
|
||||
| 2021-08-01T00:00:14.46Z | machinery | g3 | oil_temp | 41.36 |
|
||||
| 2021-08-01T00:00:25.29Z | machinery | g3 | oil_temp | 41.4 |
|
||||
| 2021-08-01T00:00:38.77Z | machinery | g3 | oil_temp | 41.4 |
|
||||
| 2021-08-01T00:00:51.2Z | machinery | g3 | oil_temp | 41.4 |
|
||||
|
||||
#### right {#right-input}
|
||||
|
||||
| station | opType | last_maintained |
|
||||
| :------ | :----- | -------------------: |
|
||||
| g1 | auto | 2021-07-15T00:00:00Z |
|
||||
| g2 | manned | 2021-07-02T00:00:00Z |
|
||||
| g4 | auto | 2021-08-04T00:00:00Z |
|
||||
|
||||
### Output {#example-output}
|
||||
|
||||
| _time | stationID | _field | _value | maintained | opType |
|
||||
| :---------------------- | :-------- | :------- | -----: | :------------------- | :----- |
|
||||
| 2021-08-01T00:00:00Z | g1 | oil_temp | 39.1 | 2021-07-15T00:00:00Z | auto |
|
||||
| 2021-08-01T00:00:11.51Z | g1 | oil_temp | 40.3 | 2021-07-15T00:00:00Z | auto |
|
||||
| 2021-08-01T00:00:19.53Z | g1 | oil_temp | 40.6 | 2021-07-15T00:00:00Z | auto |
|
||||
| 2021-08-01T00:00:25.1Z | g1 | oil_temp | 40.72 | 2021-07-15T00:00:00Z | auto |
|
||||
| 2021-08-01T00:00:36.88Z | g1 | oil_temp | 40.8 | 2021-07-15T00:00:00Z | auto |
|
||||
|
||||
| _time | stationID | _field | _value | maintained | opType |
|
||||
| :---------------------- | :-------- | :------- | -----: | :------------------- | :----- |
|
||||
| 2021-08-01T00:00:00Z | g2 | oil_temp | 40.6 | 2021-07-02T00:00:00Z | manned |
|
||||
| 2021-08-01T00:00:27.93Z | g2 | oil_temp | 40.6 | 2021-07-02T00:00:00Z | manned |
|
||||
| 2021-08-01T00:00:54.96Z | g2 | oil_temp | 40.6 | 2021-07-02T00:00:00Z | manned |
|
||||
| 2021-08-01T00:01:17.27Z | g2 | oil_temp | 40.6 | 2021-07-02T00:00:00Z | manned |
|
||||
| 2021-08-01T00:01:41.84Z | g2 | oil_temp | 40.6 | 2021-07-02T00:00:00Z | manned |
|
||||
|
||||
| _time | stationID | _field | _value | maintained | opType |
|
||||
| :---------------------- | :-------- | :------- | -----: | :--------- | :----- |
|
||||
| 2021-08-01T00:00:00Z | g3 | oil_temp | 41.4 | | |
|
||||
| 2021-08-01T00:00:14.46Z | g3 | oil_temp | 41.36 | | |
|
||||
| 2021-08-01T00:00:25.29Z | g3 | oil_temp | 41.4 | | |
|
||||
| 2021-08-01T00:00:38.77Z | g3 | oil_temp | 41.4 | | |
|
||||
| 2021-08-01T00:00:51.2Z | g3 | oil_temp | 41.4 | | |
|
||||
|
||||
| _time | stationID | _field | _value | maintained | opType |
|
||||
| :---- | :-------- | :----- | -----: | :------------------- | :----- |
|
||||
| | g4 | | | 2021-08-04T00:00:00Z | auto |
|
||||
|
||||
#### Things to note about the join output
|
||||
- Because the [right stream](#right-input) does not have rows with the `g3` stationID tag,
|
||||
the joined output includes rows with the `g3` stationID tag from the [left stream](#left-input)
|
||||
with _null_ values in columns populated from the **right** stream.
|
||||
- Because the [left stream](#left-input) does not have rows with the `g4` stationID tag,
|
||||
the joined output includes rows with the `g4` stationID tag from the [right stream](#right-input)
|
||||
with _null_ values in columns populated from the **left** stream.
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
---
|
||||
title: Perform an inner join
|
||||
description: >
|
||||
Use [`join.inner()`](/flux/v0.x/stdlib/join/inner/) to perform an inner join of two streams of data.
|
||||
Inner joins drop any rows from both input streams that do not have a matching
|
||||
row in the other stream.
|
||||
menu:
|
||||
flux_0_x:
|
||||
name: Inner join
|
||||
parent: Join data
|
||||
weight: 101
|
||||
related:
|
||||
- /flux/v0.x/join-data/troubleshoot-joins/
|
||||
- /flux/v0.x/stdlib/join/
|
||||
- /flux/v0.x/stdlib/join/inner/
|
||||
list_code_example: |
|
||||
```js
|
||||
import "join"
|
||||
|
||||
left = from(bucket: "example-bucket-1") |> //...
|
||||
right = from(bucket: "example-bucket-2") |> //...
|
||||
|
||||
join.inner(
|
||||
left: left,
|
||||
right: right,
|
||||
on: (l, r) => l.column == r.column,
|
||||
as: (l, r) => ({l with name: r.name, location: r.location}),
|
||||
)
|
||||
```
|
||||
---
|
||||
|
||||
Use [`join.inner()`](/flux/v0.x/stdlib/join/inner/) to perform an inner join of two streams of data.
|
||||
Inner joins drop any rows from both input streams that do not have a matching
|
||||
row in the other stream.
|
||||
|
||||
{{< svg svg="static/svgs/join-diagram.svg" class="inner" >}}
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View table illustration of an inner join" %}}
|
||||
{{< flex >}}
|
||||
{{% flex-content "third" %}}
|
||||
#### left
|
||||
| | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> |
|
||||
| r2 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> |
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content "third" %}}
|
||||
#### right
|
||||
| | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r3 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r4 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content "third" %}}
|
||||
#### Inner join result
|
||||
|
||||
| | | | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
{{% /flex-content %}}
|
||||
{{< /flex >}}
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
## Use join.inner to join your data
|
||||
|
||||
1. Import the `join` package.
|
||||
2. Define the **left** and **right** data streams to join:
|
||||
|
||||
- Each stream must have one or more columns with common values.
|
||||
Column labels do not need to match, but column values do.
|
||||
- Each stream should have identical [group keys](/flux/v0.x/get-started/data-model/#group-key).
|
||||
|
||||
_For more information, see [join data requirements](/flux/v0.x/join-data/#data-requirements)._
|
||||
|
||||
3. Use `join.inner()` to join the two streams together.
|
||||
Provide the following required parameters:
|
||||
|
||||
- `left`: Stream of data representing the left side of the join.
|
||||
- `right`: Stream of data representing the right side of the join.
|
||||
- `on`: [Join predicate](/flux/v0.x/join-data/#join-predicate-function-on).
|
||||
For example: `(l, r) => l.column == r.column`.
|
||||
- `as`: [Join output function](/flux/v0.x/join-data/#join-output-function-as)
|
||||
that returns a record with values from each input stream.
|
||||
For example: `(l, r) => ({l with column1: r.column1, column2: r.column2})`.
|
||||
|
||||
The following example uses a filtered selection from the
|
||||
[**machineProduction** sample data set](/flux/v0.x/stdlib/influxdata/influxdb/sample/data/#set)
|
||||
as the **left** data stream and an ad-hoc table created with [`array.from()`](/flux/v0.x/stdlib/array/from/)
|
||||
as the **right** data stream.
|
||||
|
||||
{{% note %}}
|
||||
#### Example data grouping
|
||||
|
||||
The example below ungroups the **left** stream to match the grouping of the **right** stream.
|
||||
After the two streams are joined together, the joined data is grouped by `stationID`.
|
||||
{{% /note %}}
|
||||
|
||||
```js
|
||||
import "array"
|
||||
import "influxdata/influxdb/sample"
|
||||
import "join"
|
||||
|
||||
left =
|
||||
sample.data(set: "machineProduction")
|
||||
|> filter(fn: (r) => r.stationID == "g1" or r.stationID == "g2" or r.stationID == "g3")
|
||||
|> filter(fn: (r) => r._field == "oil_temp")
|
||||
|> limit(n: 5)
|
||||
|
||||
right =
|
||||
array.from(
|
||||
rows: [
|
||||
{station: "g1", opType: "auto", last_maintained: 2021-07-15T00:00:00Z},
|
||||
{station: "g2", opType: "manned", last_maintained: 2021-07-02T00:00:00Z},
|
||||
],
|
||||
)
|
||||
|
||||
join.inner(
|
||||
left: left |> group(),
|
||||
right: right,
|
||||
on: (l, r) => l.stationID == r.station,
|
||||
as: (l, r) => ({l with opType: r.opType, maintained: r.last_maintained}),
|
||||
)
|
||||
|> group(columns: ["stationID"])
|
||||
```
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View example input and output" %}}
|
||||
|
||||
{{% note %}}
|
||||
_`_start` and `_stop` columns have been omitted from example input and output._
|
||||
{{% /note %}}
|
||||
|
||||
### Input
|
||||
|
||||
#### left {#left-input}
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g1 | oil_temp | 39.1 |
|
||||
| 2021-08-01T00:00:11.51Z | machinery | g1 | oil_temp | 40.3 |
|
||||
| 2021-08-01T00:00:19.53Z | machinery | g1 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:00:25.1Z | machinery | g1 | oil_temp | 40.72 |
|
||||
| 2021-08-01T00:00:36.88Z | machinery | g1 | oil_temp | 40.8 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:00:27.93Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:00:54.96Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:01:17.27Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:01:41.84Z | machinery | g2 | oil_temp | 40.6 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g3 | oil_temp | 41.4 |
|
||||
| 2021-08-01T00:00:14.46Z | machinery | g3 | oil_temp | 41.36 |
|
||||
| 2021-08-01T00:00:25.29Z | machinery | g3 | oil_temp | 41.4 |
|
||||
| 2021-08-01T00:00:38.77Z | machinery | g3 | oil_temp | 41.4 |
|
||||
| 2021-08-01T00:00:51.2Z | machinery | g3 | oil_temp | 41.4 |
|
||||
|
||||
#### right {#right-input}
|
||||
|
||||
| station | opType | last_maintained |
|
||||
| :------ | :----- | -------------------: |
|
||||
| g1 | auto | 2021-07-15T00:00:00Z |
|
||||
| g2 | manned | 2021-07-02T00:00:00Z |
|
||||
|
||||
### Output {#example-output}
|
||||
|
||||
| _time | _measurement | stationID | _field | _value | opType | maintained |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: | :----- | :------------------- |
|
||||
| 2021-08-01T00:00:00Z | machinery | g1 | oil_temp | 39.1 | auto | 2021-07-15T00:00:00Z |
|
||||
| 2021-08-01T00:00:11.51Z | machinery | g1 | oil_temp | 40.3 | auto | 2021-07-15T00:00:00Z |
|
||||
| 2021-08-01T00:00:19.53Z | machinery | g1 | oil_temp | 40.6 | auto | 2021-07-15T00:00:00Z |
|
||||
| 2021-08-01T00:00:25.1Z | machinery | g1 | oil_temp | 40.72 | auto | 2021-07-15T00:00:00Z |
|
||||
| 2021-08-01T00:00:36.88Z | machinery | g1 | oil_temp | 40.8 | auto | 2021-07-15T00:00:00Z |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value | opType | maintained |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: | :----- | :------------------- |
|
||||
| 2021-08-01T00:00:00Z | machinery | g2 | oil_temp | 40.6 | manned | 2021-07-02T00:00:00Z |
|
||||
| 2021-08-01T00:00:27.93Z | machinery | g2 | oil_temp | 40.6 | manned | 2021-07-02T00:00:00Z |
|
||||
| 2021-08-01T00:00:54.96Z | machinery | g2 | oil_temp | 40.6 | manned | 2021-07-02T00:00:00Z |
|
||||
| 2021-08-01T00:01:17.27Z | machinery | g2 | oil_temp | 40.6 | manned | 2021-07-02T00:00:00Z |
|
||||
| 2021-08-01T00:01:41.84Z | machinery | g2 | oil_temp | 40.6 | manned | 2021-07-02T00:00:00Z |
|
||||
|
||||
#### Things to note about the join output
|
||||
- Because the [right stream](#right-input) does not have a row with the `g3` station tag,
|
||||
the joined output drops all rows with the `g3` stationID tag from the [left stream](#left-input).
|
||||
`join.inner()` drops any rows that do not have a matching row in the other
|
||||
data stream.
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
|
@ -0,0 +1,207 @@
|
|||
---
|
||||
title: Perform a left outer join
|
||||
description: >
|
||||
Use [`join.left()`](/flux/v0.x/stdlib/join/left/) to perform an outer left join of two streams of data.
|
||||
Left joins output a row for each row in the **left** data stream with data matching
|
||||
from the **right** data stream. If there is no matching data in the **right**
|
||||
data stream, non-group-key columns with values from the **right** data stream are _null_.
|
||||
menu:
|
||||
flux_0_x:
|
||||
name: Left outer join
|
||||
parent: Join data
|
||||
weight: 102
|
||||
related:
|
||||
- /flux/v0.x/join-data/troubleshoot-joins/
|
||||
- /flux/v0.x/stdlib/join/
|
||||
- /flux/v0.x/stdlib/join/left/
|
||||
list_code_example: |
|
||||
```js
|
||||
import "join"
|
||||
|
||||
left = from(bucket: "example-bucket-1") |> //...
|
||||
right = from(bucket: "example-bucket-2") |> //...
|
||||
|
||||
join.left(
|
||||
left: left,
|
||||
right: right,
|
||||
on: (l, r) => l.column == r.column,
|
||||
as: (l, r) => ({l with name: r.name, location: r.location}),
|
||||
)
|
||||
```
|
||||
---
|
||||
|
||||
Use [`join.left()`](/flux/v0.x/stdlib/join/left/) to perform an left outer join of two streams of data.
|
||||
Left joins output a row for each row in the **left** data stream with data matching
|
||||
from the **right** data stream. If there is no matching data in the **right**
|
||||
data stream, non-group-key columns with values from the **right** data stream are _null_.
|
||||
|
||||
{{< svg svg="static/svgs/join-diagram.svg" class="left" >}}
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View table illustration of a left outer join" %}}
|
||||
{{< flex >}}
|
||||
{{% flex-content "third" %}}
|
||||
#### left
|
||||
| | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> |
|
||||
| r2 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> |
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content "third" %}}
|
||||
#### right
|
||||
| | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r3 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r4 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content "third" %}}
|
||||
#### Left outer join result
|
||||
|
||||
| | | | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r2 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> | | |
|
||||
{{% /flex-content %}}
|
||||
{{< /flex >}}
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
## Use join.left to join your data
|
||||
|
||||
1. Import the `join` package.
|
||||
2. Define the **left** and **right** data streams to join:
|
||||
|
||||
- Each stream must have one or more columns with common values.
|
||||
Column labels do not need to match, but column values do.
|
||||
- Each stream should have identical [group keys](/flux/v0.x/get-started/data-model/#group-key).
|
||||
|
||||
_For more information, see [join data requirements](/flux/v0.x/join-data/#data-requirements)._
|
||||
|
||||
3. Use `join.left()` to join the two streams together.
|
||||
Provide the following parameters:
|
||||
|
||||
- `left`: Stream of data representing the left side of the join.
|
||||
- `right`: Stream of data representing the right side of the join.
|
||||
- `on`: [Join predicate](/flux/v0.x/join-data/#join-predicate-function-on).
|
||||
For example: `(l, r) => l.column == r.column`.
|
||||
- `as`: [Join output function](/flux/v0.x/join-data/#join-output-function-as)
|
||||
that returns a record with values from each input stream.
|
||||
For example: `(l, r) => ({l with column1: r.column1, column2: r.column2})`.
|
||||
|
||||
The following example uses a filtered selection from the
|
||||
[**machineProduction** sample data set](/flux/v0.x/stdlib/influxdata/influxdb/sample/data/#set)
|
||||
as the **left** data stream and an ad-hoc table created with [`array.from()`](/flux/v0.x/stdlib/array/from/)
|
||||
as the **right** data stream.
|
||||
|
||||
{{% note %}}
|
||||
#### Example data grouping
|
||||
|
||||
The example below ungroups the **left** stream to match the grouping of the **right** stream.
|
||||
After the two streams are joined together, the joined data is grouped by `stationID`.
|
||||
{{% /note %}}
|
||||
|
||||
```js
|
||||
import "array"
|
||||
import "influxdata/influxdb/sample"
|
||||
import "join"
|
||||
|
||||
left =
|
||||
sample.data(set: "machineProduction")
|
||||
|> filter(fn: (r) => r.stationID == "g1" or r.stationID == "g2" or r.stationID == "g3")
|
||||
|> filter(fn: (r) => r._field == "oil_temp")
|
||||
|> limit(n: 5)
|
||||
|
||||
right =
|
||||
array.from(
|
||||
rows: [
|
||||
{station: "g1", opType: "auto", last_maintained: 2021-07-15T00:00:00Z},
|
||||
{station: "g2", opType: "manned", last_maintained: 2021-07-02T00:00:00Z},
|
||||
],
|
||||
)
|
||||
|
||||
join.left(
|
||||
left: left |> group(),
|
||||
right: right,
|
||||
on: (l, r) => l.stationID == r.station,
|
||||
as: (l, r) => ({l with opType: r.opType, maintained: r.last_maintained}),
|
||||
)
|
||||
|> group(columns: ["stationID"])
|
||||
```
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View example input and output" %}}
|
||||
|
||||
{{% note %}}
|
||||
_`_start` and `_stop` columns have been omitted from example input and output._
|
||||
{{% /note %}}
|
||||
|
||||
### Input
|
||||
|
||||
#### left {#left-input}
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g1 | oil_temp | 39.1 |
|
||||
| 2021-08-01T00:00:11.51Z | machinery | g1 | oil_temp | 40.3 |
|
||||
| 2021-08-01T00:00:19.53Z | machinery | g1 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:00:25.1Z | machinery | g1 | oil_temp | 40.72 |
|
||||
| 2021-08-01T00:00:36.88Z | machinery | g1 | oil_temp | 40.8 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:00:27.93Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:00:54.96Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:01:17.27Z | machinery | g2 | oil_temp | 40.6 |
|
||||
| 2021-08-01T00:01:41.84Z | machinery | g2 | oil_temp | 40.6 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g3 | oil_temp | 41.4 |
|
||||
| 2021-08-01T00:00:14.46Z | machinery | g3 | oil_temp | 41.36 |
|
||||
| 2021-08-01T00:00:25.29Z | machinery | g3 | oil_temp | 41.4 |
|
||||
| 2021-08-01T00:00:38.77Z | machinery | g3 | oil_temp | 41.4 |
|
||||
| 2021-08-01T00:00:51.2Z | machinery | g3 | oil_temp | 41.4 |
|
||||
|
||||
#### right {#right-input}
|
||||
|
||||
| station | opType | last_maintained |
|
||||
| :------ | :----- | -------------------: |
|
||||
| g1 | auto | 2021-07-15T00:00:00Z |
|
||||
| g2 | manned | 2021-07-02T00:00:00Z |
|
||||
|
||||
### Output {#example-output}
|
||||
|
||||
| _time | _measurement | stationID | _field | _value | opType | maintained |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: | :----- | :------------------- |
|
||||
| 2021-08-01T00:00:00Z | machinery | g1 | oil_temp | 39.1 | auto | 2021-07-15T00:00:00Z |
|
||||
| 2021-08-01T00:00:11.51Z | machinery | g1 | oil_temp | 40.3 | auto | 2021-07-15T00:00:00Z |
|
||||
| 2021-08-01T00:00:19.53Z | machinery | g1 | oil_temp | 40.6 | auto | 2021-07-15T00:00:00Z |
|
||||
| 2021-08-01T00:00:25.1Z | machinery | g1 | oil_temp | 40.72 | auto | 2021-07-15T00:00:00Z |
|
||||
| 2021-08-01T00:00:36.88Z | machinery | g1 | oil_temp | 40.8 | auto | 2021-07-15T00:00:00Z |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value | opType | maintained |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: | :----- | :------------------- |
|
||||
| 2021-08-01T00:00:00Z | machinery | g2 | oil_temp | 40.6 | manned | 2021-07-02T00:00:00Z |
|
||||
| 2021-08-01T00:00:27.93Z | machinery | g2 | oil_temp | 40.6 | manned | 2021-07-02T00:00:00Z |
|
||||
| 2021-08-01T00:00:54.96Z | machinery | g2 | oil_temp | 40.6 | manned | 2021-07-02T00:00:00Z |
|
||||
| 2021-08-01T00:01:17.27Z | machinery | g2 | oil_temp | 40.6 | manned | 2021-07-02T00:00:00Z |
|
||||
| 2021-08-01T00:01:41.84Z | machinery | g2 | oil_temp | 40.6 | manned | 2021-07-02T00:00:00Z |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value | opType | maintained |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: | :----- | :--------- |
|
||||
| 2021-08-01T00:00:00Z | machinery | g3 | oil_temp | 41.4 | | |
|
||||
| 2021-08-01T00:00:14.46Z | machinery | g3 | oil_temp | 41.3 | | |
|
||||
| 2021-08-01T00:00:25.29Z | machinery | g3 | oil_temp | 41.4 | | |
|
||||
| 2021-08-01T00:00:38.77Z | machinery | g3 | oil_temp | 41.4 | | |
|
||||
| 2021-08-01T00:00:51.2Z | machinery | g3 | oil_temp | 41.4 | | |
|
||||
|
||||
#### Things to note about the join output
|
||||
- Because the [right stream](#right-input) does not have a row with the `g3` station tag,
|
||||
rows from the [left stream](#left-input) with the `g3` stationID tag include
|
||||
_null_ values in columns that are populated from the right stream (`r`) in the
|
||||
`as` parameter.
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
---
|
||||
title: Perform a right outer join
|
||||
description: >
|
||||
Use [`join.right()`](/flux/v0.x/stdlib/join/right/) to perform an right outer join of two streams of data.
|
||||
Right joins output a row for each row in the **right** data stream with data matching
|
||||
from the **left** data stream. If there is no matching data in the **left**
|
||||
data stream, non-group-key columns with values from the **left** data stream are _null_.
|
||||
menu:
|
||||
flux_0_x:
|
||||
name: Right outer join
|
||||
parent: Join data
|
||||
weight: 102
|
||||
related:
|
||||
- /flux/v0.x/join-data/troubleshoot-joins/
|
||||
- /flux/v0.x/stdlib/join/
|
||||
- /flux/v0.x/stdlib/join/right/
|
||||
list_code_example: |
|
||||
```js
|
||||
import "join"
|
||||
|
||||
left = from(bucket: "example-bucket-1") |> //...
|
||||
right = from(bucket: "example-bucket-2") |> //...
|
||||
|
||||
join.right(
|
||||
left: left,
|
||||
right: right,
|
||||
on: (l, r) => l.column == r.column,
|
||||
as: (l, r) => ({r with name: l.name, location: l.location}),
|
||||
)
|
||||
```
|
||||
---
|
||||
|
||||
Use [`join.right()`](/flux/v0.x/stdlib/join/right/) to perform an right outer join of two streams of data.
|
||||
Right joins output a row for each row in the **right** data stream with data matching
|
||||
from the **left** data stream. If there is no matching data in the **left**
|
||||
data stream, non-group-key columns with values from the **left** data stream are _null_.
|
||||
|
||||
{{< svg svg="static/svgs/join-diagram.svg" class="right" >}}
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View table illustration of a right outer join" %}}
|
||||
{{< flex >}}
|
||||
{{% flex-content "third" %}}
|
||||
#### left
|
||||
| | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> |
|
||||
| r2 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> |
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content "third" %}}
|
||||
#### right
|
||||
| | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r3 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r4 | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content "third" %}}
|
||||
#### Right outer join result
|
||||
|
||||
| | | | | |
|
||||
| :-- | :----------------------------------- | :----------------------------------- | :----------------------------------- | :----------------------------------- |
|
||||
| r1 | <span style="color:#9b2aff">●</span> | <span style="color:#9b2aff">●</span> | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r3 | | | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
| r4 | | | <span style="color:#d30971">▲</span> | <span style="color:#d30971">▲</span> |
|
||||
|
||||
{{% /flex-content %}}
|
||||
{{< /flex >}}
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
## Use join.right to join your data
|
||||
|
||||
1. Import the `join` package.
|
||||
2. Define the **left** and **right** data streams to join:
|
||||
|
||||
- Each stream must have one or more columns with common values.
|
||||
Column labels do not need to match, but column values do.
|
||||
- Each stream should have identical [group keys](/flux/v0.x/get-started/data-model/#group-key).
|
||||
|
||||
_For more information, see [join data requirements](/flux/v0.x/join-data/#data-requirements)._
|
||||
|
||||
3. Use `join.right()` to join the two streams together.
|
||||
Provide the following required parameters:
|
||||
|
||||
- `left`: Stream of data representing the left side of the join.
|
||||
- `right`: Stream of data representing the right side of the join.
|
||||
- `on`: [Join predicate](/flux/v0.x/join-data/#join-predicate-function-on).
|
||||
For example: `(l, r) => l.column == r.column`.
|
||||
- `as`: [Join output function](/flux/v0.x/join-data/#join-output-function-as)
|
||||
that returns a record with values from each input stream.
|
||||
For example: `(l, r) => ({r with column1: l.column1, column2: l.column2})`.
|
||||
|
||||
The following example uses a filtered selection from the
|
||||
[**machineProduction** sample data set](/flux/v0.x/stdlib/influxdata/influxdb/sample/data/#set)
|
||||
as the **left** data stream and an ad-hoc table created with [`array.from()`](/flux/v0.x/stdlib/array/from/)
|
||||
as the **right** data stream.
|
||||
|
||||
{{% note %}}
|
||||
#### Example data grouping
|
||||
|
||||
The example below ungroups the **left** stream to match the grouping of the **right** stream.
|
||||
{{% /note %}}
|
||||
|
||||
```js
|
||||
import "array"
|
||||
import "influxdata/influxdb/sample"
|
||||
import "join"
|
||||
|
||||
left =
|
||||
sample.data(set: "machineProduction")
|
||||
|> filter(fn: (r) => r.stationID == "g1" or r.stationID == "g2" or r.stationID == "g3")
|
||||
|> filter(fn: (r) => r._field == "oil_temp")
|
||||
|> last()
|
||||
|
||||
right =
|
||||
array.from(
|
||||
rows: [
|
||||
{station: "g1", opType: "auto", last_maintained: 2021-07-15T00:00:00Z},
|
||||
{station: "g2", opType: "manned", last_maintained: 2021-07-02T00:00:00Z},
|
||||
],
|
||||
)
|
||||
|
||||
join.right(
|
||||
left: left |> group(),
|
||||
right: right,
|
||||
on: (l, r) => l.stationID == r.station,
|
||||
as: (l, r) => ({r with last_reported_val: l._value, last_reported_time: l._time}),
|
||||
)
|
||||
```
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View example input and output" %}}
|
||||
|
||||
### Input
|
||||
|
||||
#### left {#left-input}
|
||||
|
||||
{{% note %}}
|
||||
_`_start` and `_stop` columns have been omitted._
|
||||
{{% /note %}}
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T23:59:46.17Z | machinery | g1 | oil_temp | 40.6 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T23:59:34.57Z | machinery | g2 | oil_temp | 41.34 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -----: |
|
||||
| 2021-08-01T23:59:41.96Z | machinery | g3 | oil_temp | 41.26 |
|
||||
|
||||
#### right {#right-input}
|
||||
|
||||
| station | opType | last_maintained |
|
||||
| :------ | :----- | -------------------: |
|
||||
| g1 | auto | 2021-07-15T00:00:00Z |
|
||||
| g2 | manned | 2021-07-02T00:00:00Z |
|
||||
|
||||
### Output {#example-output}
|
||||
|
||||
| station | opType | last_maintained | last_reported_time | last_reported_val |
|
||||
| :------ | :----- | :------------------- | :---------------------- | ----------------: |
|
||||
| g1 | auto | 2021-07-15T00:00:00Z | 2021-08-01T23:59:46.17Z | 40.6 |
|
||||
| g2 | manned | 2021-07-02T00:00:00Z | 2021-08-01T23:59:34.57Z | 41.34 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
|
@ -0,0 +1,205 @@
|
|||
---
|
||||
title: Join on time
|
||||
description: >
|
||||
Use [`join.time()`](/flux/v0.x/stdlib/join/time/) to join two streams of data
|
||||
based on time values in the `_time` column.
|
||||
This type of join operation is common when joining two streams of
|
||||
[time series data](/influxdb/latest/reference/glossary/#time-series-data).
|
||||
menu:
|
||||
flux_0_x:
|
||||
parent: Join data
|
||||
weight: 104
|
||||
related:
|
||||
- /flux/v0.x/join-data/troubleshoot-joins/
|
||||
- /flux/v0.x/stdlib/join/
|
||||
- /flux/v0.x/stdlib/join/time/
|
||||
list_code_example: |
|
||||
```js
|
||||
import "join"
|
||||
|
||||
left = from(bucket: "example-bucket-1") |> //...
|
||||
right = from(bucket: "example-bucket-2") |> //...
|
||||
|
||||
join.time(
|
||||
left: left,
|
||||
right: right,
|
||||
as: (l, r) => ({l with field1: l._value, field2: r._value_}),
|
||||
)
|
||||
```
|
||||
---
|
||||
|
||||
Use [`join.time()`](/flux/v0.x/stdlib/join/time/) to join two streams of data
|
||||
based on time values in the `_time` column.
|
||||
This type of join operation is common when joining two streams of
|
||||
[time series data](/influxdb/latest/reference/glossary/#time-series-data).
|
||||
|
||||
`join.time()` can use any of the available join methods.
|
||||
Which method you use depends on your desired behavior:
|
||||
|
||||
- **inner** _(Default)_:
|
||||
Drop any rows from both input streams that do not have a matching
|
||||
row in the other stream.
|
||||
|
||||
- **left**:
|
||||
Output a row for each row in the **left** data stream with data matching
|
||||
from the **right** data stream. If there is no matching data in the **right**
|
||||
data stream, non-group-key columns with values from the **right** data stream
|
||||
are _null_.
|
||||
|
||||
- **right**:
|
||||
Output a row for each row in the **right** data stream with data matching
|
||||
from the **left** data stream. If there is no matching data in the **left**
|
||||
data stream, non-group-key columns with values from the **left** data stream
|
||||
are _null_.
|
||||
|
||||
- **full**:
|
||||
Output a row for all rows in both the **left** and **right** input streams
|
||||
and join rows that match based on their `_time` value.
|
||||
|
||||
## Use join.time to join your data
|
||||
|
||||
1. Import the `join` package.
|
||||
2. Define the **left** and **right** data streams to join:
|
||||
|
||||
- Each stream must also have a `_time` column.
|
||||
- Each stream must have one or more columns with common values.
|
||||
Column labels do not need to match, but column values do.
|
||||
- Each stream should have identical [group keys](/flux/v0.x/get-started/data-model/#group-key).
|
||||
|
||||
_For more information, see [join data requirements](/flux/v0.x/join-data/#data-requirements)._
|
||||
|
||||
3. Use `join.time()` to join the two streams together based on time values.
|
||||
Provide the following parameters:
|
||||
|
||||
- `left`: ({{< req >}}) Stream of data representing the left side of the join.
|
||||
- `right`: ({{< req >}}) Stream of data representing the right side of the join.
|
||||
- `as`: ({{< req >}}) [Join output function](/flux/v0.x/join-data/#join-output-function-as)
|
||||
that returns a record with values from each input stream.
|
||||
For example: `(l, r) => ({r with column1: l.column1, column2: l.column2})`.
|
||||
- `method`: Join method to use. Default is `inner`.
|
||||
|
||||
The following example uses a filtered selections from the
|
||||
[**machineProduction** sample data set](/flux/v0.x/stdlib/influxdata/influxdb/sample/data/#set)
|
||||
as the **left** and **right** data streams.
|
||||
|
||||
{{% note %}}
|
||||
#### Example data grouping
|
||||
|
||||
The example below regroups both the left and right streams to remove the
|
||||
`_field` column from the group key.
|
||||
Because `join.time()` only compares tables with matching
|
||||
[group key instances](/flux/v0.x/get-started/data-model/#example-group-key-instances),
|
||||
to join streams with different `_field` column values, `_field` cannot be part
|
||||
of the group key.
|
||||
{{% /note %}}
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/sample"
|
||||
import "join"
|
||||
|
||||
left =
|
||||
sample.data(set: "machineProduction")
|
||||
|> filter(fn: (r) => r.stationID == "g1" or r.stationID == "g2" or r.stationID == "g3")
|
||||
|> filter(fn: (r) => r._field == "pressure")
|
||||
|> limit(n: 5)
|
||||
|> group(columns: ["_time", "_value", "_field"], mode: "except")
|
||||
|
||||
right =
|
||||
sample.data(set: "machineProduction")
|
||||
|> filter(fn: (r) => r.stationID == "g1" or r.stationID == "g2" or r.stationID == "g3")
|
||||
|> filter(fn: (r) => r._field == "pressure_target")
|
||||
|> limit(n: 5)
|
||||
|> group(columns: ["_time", "_value", "_field"], mode: "except")
|
||||
|
||||
join.time(method: "left", left: left, right: right, as: (l, r) => ({l with target: r._value}))
|
||||
```
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View example input and output" %}}
|
||||
|
||||
### Input
|
||||
|
||||
{{% note %}}
|
||||
_`_start` and `_stop` columns have been omitted from input examples._
|
||||
{{% /note %}}
|
||||
|
||||
#### left {#left-input}
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -------: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g1 | pressure | 110.2617 |
|
||||
| 2021-08-01T00:00:11.51Z | machinery | g1 | pressure | 110.3506 |
|
||||
| 2021-08-01T00:00:19.53Z | machinery | g1 | pressure | 110.1836 |
|
||||
| 2021-08-01T00:00:25.1Z | machinery | g1 | pressure | 109.6387 |
|
||||
| 2021-08-01T00:00:36.88Z | machinery | g1 | pressure | 110.5021 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -------: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g2 | pressure | 105.392 |
|
||||
| 2021-08-01T00:00:27.93Z | machinery | g2 | pressure | 105.3786 |
|
||||
| 2021-08-01T00:00:54.96Z | machinery | g2 | pressure | 105.4801 |
|
||||
| 2021-08-01T00:01:17.27Z | machinery | g2 | pressure | 105.5656 |
|
||||
| 2021-08-01T00:01:41.84Z | machinery | g2 | pressure | 105.5495 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -------: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g3 | pressure | 110.5309 |
|
||||
| 2021-08-01T00:00:14.46Z | machinery | g3 | pressure | 110.3746 |
|
||||
| 2021-08-01T00:00:25.29Z | machinery | g3 | pressure | 110.3719 |
|
||||
| 2021-08-01T00:00:38.77Z | machinery | g3 | pressure | 110.5362 |
|
||||
| 2021-08-01T00:00:51.2Z | machinery | g3 | pressure | 110.4514 |
|
||||
|
||||
#### right {#right-input}
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :-------------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g1 | pressure_target | 110 |
|
||||
| 2021-08-01T00:00:11.51Z | machinery | g1 | pressure_target | 110 |
|
||||
| 2021-08-01T00:00:19.53Z | machinery | g1 | pressure_target | 110 |
|
||||
| 2021-08-01T00:00:25.1Z | machinery | g1 | pressure_target | 110 |
|
||||
| 2021-08-01T00:00:36.88Z | machinery | g1 | pressure_target | 110 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :-------------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g2 | pressure_target | 105 |
|
||||
| 2021-08-01T00:00:27.93Z | machinery | g2 | pressure_target | 105 |
|
||||
| 2021-08-01T00:00:54.96Z | machinery | g2 | pressure_target | 105 |
|
||||
| 2021-08-01T00:01:17.27Z | machinery | g2 | pressure_target | 105 |
|
||||
| 2021-08-01T00:01:41.84Z | machinery | g2 | pressure_target | 105 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value |
|
||||
| :---------------------- | :----------- | :-------- | :-------------- | -----: |
|
||||
| 2021-08-01T00:00:00Z | machinery | g3 | pressure_target | 110 |
|
||||
| 2021-08-01T00:00:14.46Z | machinery | g3 | pressure_target | 110 |
|
||||
| 2021-08-01T00:00:25.29Z | machinery | g3 | pressure_target | 110 |
|
||||
| 2021-08-01T00:00:38.77Z | machinery | g3 | pressure_target | 110 |
|
||||
| 2021-08-01T00:00:51.2Z | machinery | g3 | pressure_target | 110 |
|
||||
|
||||
### Output {#example-output}
|
||||
|
||||
| _time | _measurement | stationID | _field | _value | target |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -------: | :----- |
|
||||
| 2021-08-01T00:00:00Z | machinery | g1 | pressure | 110.2617 | 110 |
|
||||
| 2021-08-01T00:00:11.51Z | machinery | g1 | pressure | 110.3506 | 110 |
|
||||
| 2021-08-01T00:00:19.53Z | machinery | g1 | pressure | 110.1836 | 110 |
|
||||
| 2021-08-01T00:00:25.1Z | machinery | g1 | pressure | 109.6387 | 110 |
|
||||
| 2021-08-01T00:00:36.88Z | machinery | g1 | pressure | 110.5021 | 110 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value | target |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -------: | :----- |
|
||||
| 2021-08-01T00:00:00Z | machinery | g2 | pressure | 105.392 | 105 |
|
||||
| 2021-08-01T00:00:27.93Z | machinery | g2 | pressure | 105.3786 | 105 |
|
||||
| 2021-08-01T00:00:54.96Z | machinery | g2 | pressure | 105.4801 | 105 |
|
||||
| 2021-08-01T00:01:17.27Z | machinery | g2 | pressure | 105.5656 | 105 |
|
||||
| 2021-08-01T00:01:41.84Z | machinery | g2 | pressure | 105.5495 | 105 |
|
||||
|
||||
| _time | _measurement | stationID | _field | _value | target |
|
||||
| :---------------------- | :----------- | :-------- | :------- | -------: | :----- |
|
||||
| 2021-08-01T00:00:00Z | machinery | g3 | pressure | 110.5309 | 110 |
|
||||
| 2021-08-01T00:00:14.46Z | machinery | g3 | pressure | 110.3746 | 110 |
|
||||
| 2021-08-01T00:00:25.29Z | machinery | g3 | pressure | 110.3719 | 110 |
|
||||
| 2021-08-01T00:00:38.77Z | machinery | g3 | pressure | 110.5362 | 110 |
|
||||
| 2021-08-01T00:00:51.2Z | machinery | g3 | pressure | 110.4514 | 110 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
|
@ -0,0 +1,186 @@
|
|||
---
|
||||
title: Troubleshoot join operations
|
||||
description: >
|
||||
Learn how to troubleshoot common behaviors and errors that may occur when using
|
||||
the [`join` package](/flux/v0.x/stdlib/join).
|
||||
menu:
|
||||
flux_0_x:
|
||||
name: Troubleshoot joins
|
||||
parent: Join data
|
||||
weight: 105
|
||||
---
|
||||
|
||||
Learn how to troubleshoot common behaviors and errors that may occur when using
|
||||
the [`join` package](/flux/v0.x/stdlib/join).
|
||||
|
||||
{{% note %}}
|
||||
#### Submit issues for unexplained behaviors or errors
|
||||
|
||||
This is a "living" document that may be updated with common issues
|
||||
that users may run into when using the [`join` package](/flux/v0.x/stdlib/join).
|
||||
If you have questions about a behavior or error that is not documented here,
|
||||
please submit an issue to either the InfluxData Documentation or Flux GitHub repositories:
|
||||
|
||||
- [Submit a documentation issue](https://github.com/influxdata/docs-v2/issues/new/choose)
|
||||
- [Submit a Flux issue](https://github.com/influxdata/flux/issues/new/choose)
|
||||
{{% /note %}}
|
||||
|
||||
- [Troubleshoot join behaviors](#troubleshoot-join-behaviors)
|
||||
- [Troubleshoot join error messages](#troubleshoot-join-error-messages)
|
||||
|
||||
## Troubleshoot join behaviors
|
||||
|
||||
### Columns explicitly mapped in the join are null
|
||||
|
||||
In some cases, your join output may include _null_ values in
|
||||
columns where you expect non-null values. This may be caused by one of the following issues:
|
||||
|
||||
---
|
||||
|
||||
{{< flex class="troubleshoot-row" >}}
|
||||
{{% flex-content %}}
|
||||
#### Cause {#cause-b1}
|
||||
|
||||
**The group keys of each input stream aren't the same.**
|
||||
Functions in the `join` package use group keys to quickly identify what tables
|
||||
should be compared.
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content %}}
|
||||
#### Solution {#solution-b1}
|
||||
|
||||
Use [`group()`](/flux/v0.x/stdlib/universe/group/) to regroup
|
||||
your two input streams so their group keys match before attempting to join
|
||||
them together.
|
||||
{{% /flex-content %}}
|
||||
{{< /flex >}}
|
||||
|
||||
---
|
||||
|
||||
{{< flex >}}
|
||||
{{% flex-content %}}
|
||||
#### Cause {#cause-b2}
|
||||
|
||||
**There are no matching _group key instances_ in your data streams**.
|
||||
Functions in the `join` package only compare tables with matching
|
||||
[group key instances](/flux/v0.x/get-started/data-model/#example-group-key-instances).
|
||||
Input streams may have matching group keys, but there are no matching group
|
||||
key instances in your stream.
|
||||
|
||||
This may happen when joining two separate fields
|
||||
queried from InfluxDB. By default, InfluxDB returns data with `_field` as part
|
||||
of the group key. If each stream contains a different field, tables in the two
|
||||
streams won't be compared because they won't have any matching _group key instances_.
|
||||
{{% /flex-content %}}
|
||||
|
||||
{{% flex-content %}}
|
||||
#### Solution {#solution-b2}
|
||||
|
||||
Use [`group()`](/flux/v0.x/stdlib/universe/group/) to remove
|
||||
any columns from the group keys of each input stream that would prevent
|
||||
group key instances from matching.
|
||||
{{% /flex-content %}}
|
||||
{{< /flex >}}
|
||||
|
||||
---
|
||||
|
||||
## Troubleshoot join error messages
|
||||
|
||||
- [table is missing column \'\<column\>\'](#table-is-missing-column-column)
|
||||
- [table is missing label \<label\>](#table-is-missing-label-label)
|
||||
- [record is missing label \<label\>](#record-is-missing-label-label)
|
||||
|
||||
### table is missing column `'<column>'`
|
||||
|
||||
##### Error message
|
||||
```js
|
||||
cannot set join columns in left table stream: table is missing column '<column>'
|
||||
```
|
||||
|
||||
{{< flex >}}
|
||||
{{% flex-content %}}
|
||||
#### Cause {#cause-e1}
|
||||
|
||||
**Your `on` join predicate uses a column that doesn't exist**.
|
||||
In the `on` predicate function, you're trying to compare a column
|
||||
that doesn't exist in one of your input streams.
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content %}}
|
||||
#### Solution {#solution-e1}
|
||||
|
||||
Ensure the columns that you're comparing in the `on` predicate
|
||||
function exist in the input streams.
|
||||
If necessary, update column names in the predicate function.
|
||||
{{% /flex-content %}}
|
||||
{{< /flex >}}
|
||||
|
||||
---
|
||||
|
||||
### table is missing label `<label>`
|
||||
|
||||
##### Error message
|
||||
```js
|
||||
table is missing label <label>
|
||||
```
|
||||
|
||||
{{< flex >}}
|
||||
{{% flex-content %}}
|
||||
#### Cause {#cause-e2}
|
||||
|
||||
**Your `on` join predicate uses a column that doesn't exist**.
|
||||
In the `on` predicate function for an outer join, you're trying to use a value
|
||||
from a column that doesn't exist in the "primary" input stream
|
||||
(`left` for `join.left()` and `right` for `join.right()`).
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content %}}
|
||||
#### Solution {#solution-e2}
|
||||
|
||||
Ensure the columns that you're comparing in the `on` predicate
|
||||
function actually exist in the input streams.
|
||||
If necessary, update column names in the predicate function.
|
||||
{{% /flex-content %}}
|
||||
{{< /flex >}}
|
||||
|
||||
---
|
||||
|
||||
### record is missing label `<label>`
|
||||
|
||||
##### Error message
|
||||
```js
|
||||
record is missing label <label> (argument <left or right>)
|
||||
```
|
||||
|
||||
{{< flex >}}
|
||||
{{% flex-content %}}
|
||||
#### Cause {#cause-e3}
|
||||
|
||||
**Your `on` join predicate uses a column that doesn't exist**.
|
||||
In the `on` predicate function, you're trying to compare a column
|
||||
that doesn't exist in one of your input streams.
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content %}}
|
||||
#### Solution {#solution-e3}
|
||||
|
||||
Ensure the columns that you're comparing in the `on` predicate
|
||||
function actually exist in the input streams.
|
||||
If necessary, update column names in the predicate function.
|
||||
{{% /flex-content %}}
|
||||
{{< /flex >}}
|
||||
|
||||
---
|
||||
|
||||
{{< flex >}}
|
||||
{{% flex-content %}}
|
||||
#### Cause {#cause-e4}
|
||||
|
||||
**Your `as` output schema function uses a column that doesn't exist**.
|
||||
If using an **outer join**, the `as` is trying to use a value
|
||||
from a column that doesn't exist in the "primary" input stream
|
||||
(`left` for `join.left()` and `right` for `join.right()`).
|
||||
{{% /flex-content %}}
|
||||
{{% flex-content %}}
|
||||
#### Solution {#solution-e4}
|
||||
|
||||
Ensure the columns that you're using in the `as` output function to assign
|
||||
values to the output actually exist in the input streams.
|
||||
{{% /flex-content %}}
|
||||
{{< /flex >}}
|
|
@ -105,7 +105,7 @@ Given the following **example_table** in a MySQL database:
|
|||
import "sql"
|
||||
|
||||
sql.from(
|
||||
driver: "mysql",
|
||||
driverName: "mysql",
|
||||
dataSourceName: "username:passwOrd@tcp(localhost:3306)/db",
|
||||
query: "SELECT ID, Name FROM example_table",
|
||||
)
|
||||
|
|
|
@ -10,6 +10,26 @@ aliases:
|
|||
- /influxdb/cloud/reference/release-notes/flux/
|
||||
---
|
||||
|
||||
## v0.184.0 [2022-09-21]
|
||||
|
||||
### Breaking changes
|
||||
- Update logical _null_ handling and align all logical operator implementations
|
||||
(vectorized, row-based, as well as "in the interpreter") to be consistent and
|
||||
representative of the Flux SPEC.
|
||||
|
||||
### Features
|
||||
- Add array type conversion functions to the
|
||||
[experimental `array` package](/flux/v0.x/stdlib/experimental/array/).
|
||||
|
||||
### Bug fixes
|
||||
- Update SPEC and fix some inconsistencies.
|
||||
- Update `sort limit` to skips chunks with no rows.
|
||||
- Don't report an error about testcases in the LSP.
|
||||
- Prevent the metadata map from being concurrently mutated.
|
||||
- Don't stackoverflow on deeply nested expressions.
|
||||
|
||||
---
|
||||
|
||||
## v0.183.0 [2022-09-12]
|
||||
|
||||
### Features
|
||||
|
|
|
@ -16,12 +16,6 @@ flux/v0.x/tags: [flux]
|
|||
|
||||
The following documents specify the Flux language and query execution.
|
||||
|
||||
{{% note %}}
|
||||
This document is a living document and may not represent the current implementation of Flux.
|
||||
Any section that is not currently implemented is commented with a **[IMPL#XXX]** where
|
||||
**XXX** is an issue number tracking discussion and progress towards implementation.
|
||||
{{% /note %}}
|
||||
|
||||
{{< children >}}
|
||||
|
||||
{{< page-nav next="/flux/v0.x/spec/notation/" >}}
|
||||
|
|
|
@ -14,12 +14,6 @@ aliases:
|
|||
- /influxdb/cloud/reference/flux/language/data-model/
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
This document is a living document and may not represent the current implementation of Flux.
|
||||
Any section that is not currently implemented is commented with a **[IMPL#XXX]** where
|
||||
**XXX** is an issue number tracking discussion and progress towards implementation.
|
||||
{{% /note %}}
|
||||
|
||||
Flux employs a basic data model built from basic data types.
|
||||
The data model consists of tables, records, columns and streams.
|
||||
|
||||
|
@ -54,20 +48,14 @@ These common values are referred to as the "group key value" and can be represen
|
|||
|
||||
A tables schema consists of its group key and its columns' labels and types.
|
||||
|
||||
{{% note %}}
|
||||
[IMPL#463](https://github.com/influxdata/flux/issues/463) Specify the primitive types that make up stream and table types
|
||||
{{% /note %}}
|
||||
|
||||
## Stream of tables
|
||||
|
||||
A **stream** represents a potentially unbounded set of tables.
|
||||
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
|
||||
{{% /note %}}
|
||||
A stream is represented using the stream type `stream[A] where A: Record`.
|
||||
The group key is not explicity modeled in the Flux type system.
|
||||
|
||||
## Missing values (null)
|
||||
|
||||
|
|
|
@ -131,6 +131,17 @@ mul = (a,b) => a * b
|
|||
Function literals are _closures_ and may refer to variables defined in a surrounding block.
|
||||
Those variables are shared between the function literal and the surrounding block.
|
||||
|
||||
Function arguments are named. There are no positional arguments.
|
||||
Values implementing a function type must use the same argument names.
|
||||
|
||||
```js
|
||||
apply = (f, x) => f(x: x)
|
||||
|
||||
apply(f: (x) => x + 1, x: 2) // 3
|
||||
apply(f: (a) => a + 1, x: 2) // error, function must use the same argument name `x`.
|
||||
apply(f: (x, a=3) => a + x, x: 2) // 5, extra default arguments are allowed
|
||||
```
|
||||
|
||||
## Call expressions
|
||||
|
||||
A _call expression_ invokes a function with the provided arguments.
|
||||
|
|
|
@ -11,12 +11,6 @@ aliases:
|
|||
- /influxdb/cloud/reference/flux/language/lexical-elements/
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
This document is a living document and may not represent the current implementation of Flux.
|
||||
Any section that is not currently implemented is commented with a **[IMPL#XXX]** where
|
||||
**XXX** is an issue number tracking discussion and progress towards implementation.
|
||||
{{% /note %}}
|
||||
|
||||
## Comments
|
||||
|
||||
Comment serve as documentation.
|
||||
|
@ -63,15 +57,11 @@ longIdentifierName
|
|||
The following keywords are reserved and may not be used as identifiers:
|
||||
|
||||
```
|
||||
and import not return option test
|
||||
empty in or package builtin
|
||||
and import option if
|
||||
or package builtin then
|
||||
not return testcase else exists
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
[IMPL#764](https://github.com/influxdata/flux/issues/764) Add `in` and `empty` operator support.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
## Operators
|
||||
|
||||
The following character sequences represent operators:
|
||||
|
@ -79,26 +69,11 @@ The following character sequences represent operators:
|
|||
```
|
||||
+ == != ( ) =>
|
||||
- < !~ [ ] ^
|
||||
* > =~ { }
|
||||
/ <= = , :
|
||||
* > =~ { } ?
|
||||
/ <= = , : "
|
||||
% >= <- . |>
|
||||
```
|
||||
|
||||
## Numeric literals
|
||||
|
||||
Numeric literals may be integers or floating point values.
|
||||
Literals have arbitrary precision and are coerced to a specific type when used.
|
||||
|
||||
The following coercion rules apply to numeric literals:
|
||||
|
||||
* An integer literal can be coerced to an "int", "uint", or "float" type,
|
||||
* A float literal can be coerced to a "float" type.
|
||||
* An error will occur if the coerced type cannot represent the literal value.
|
||||
|
||||
{{% note %}}
|
||||
[IMPL#476](https://github.com/influxdata/flux/issues/476) Allow numeric literal coercion.
|
||||
{{% /note %}}
|
||||
|
||||
### Integer literals
|
||||
|
||||
An integer literal is a sequence of digits representing an integer value.
|
||||
|
@ -196,63 +171,55 @@ These operations are performed on each time unit independently.
|
|||
5w
|
||||
1mo5d // 1 month and 5 days
|
||||
-1mo5d // negative 1 month and 5 days
|
||||
5w * 2 // 10 weeks
|
||||
```
|
||||
Durations can be added to date times to produce a new date time.
|
||||
|
||||
Addition and subtraction of durations to date times do not commute and are left associative.
|
||||
Addition and subtraction of durations to date times applies months, days and seconds in that order.
|
||||
Durations can be added to date times to produce a new date time.
|
||||
Addition and subtraction of durations to date times applies months and nanoseconds in that order.
|
||||
When months are added to a date times and the resulting date is past the end of the month, the day is rolled back to the last day of the month.
|
||||
Of note is that addition and subtraction of durations to date times does not commute.
|
||||
|
||||
##### Examples of duration literals
|
||||
|
||||
```js
|
||||
2018-01-01T00:00:00Z + 1d // 2018-01-02T00:00:00Z
|
||||
2018-01-01T00:00:00Z + 1mo // 2018-02-01T00:00:00Z
|
||||
2018-01-01T00:00:00Z + 2mo // 2018-03-01T00:00:00Z
|
||||
2018-01-31T00:00:00Z + 2mo // 2018-03-31T00:00:00Z
|
||||
2018-02-28T00:00:00Z + 2mo // 2018-04-28T00:00:00Z
|
||||
2018-01-31T00:00:00Z + 1mo // 2018-02-28T00:00:00Z, February 31th is rolled back to the last day of the month, February 28th in 2018.
|
||||
import "date"
|
||||
|
||||
// Addition and subtraction of durations to date times does not commute
|
||||
2018-02-28T00:00:00Z + 1mo + 1d // 2018-03-29T00:00:00Z
|
||||
2018-02-28T00:00:00Z + 1mo + 1d // 2018-03-29T00:00:00Z
|
||||
2018-02-28T00:00:00Z + 1d + 1mo // 2018-04-01T00:00:00Z
|
||||
2018-01-01T00:00:00Z + 2mo - 1d // 2018-02-28T00:00:00Z
|
||||
2018-01-01T00:00:00Z - 1d + 3mo // 2018-03-31T00:00:00Z
|
||||
2018-01-31T00:00:00Z + 1mo + 1mo // 2018-03-28T00:00:00Z
|
||||
2018-01-31T00:00:00Z + 2mo // 2018-03-31T00:00:00Z
|
||||
date.add(d: 1d, to: 2018-01-01T00:00:00Z) // 2018-01-02T00:00:00Z
|
||||
date.add(d: 1mo, to: 2018-01-01T00:00:00Z) // 2018-02-01T00:00:00Z
|
||||
date.add(d: 2mo, to: 2018-01-01T00:00:00Z) // 2018-03-01T00:00:00Z
|
||||
date.add(d: 2mo, to: 2018-01-31T00:00:00Z) // 2018-03-31T00:00:00Z
|
||||
date.add(d: 2mo, to: 2018-02-28T00:00:00Z) // 2018-04-28T00:00:00Z
|
||||
date.add(d: 1mo, to: 2018-01-31T00:00:00Z) // 2018-02-28T00:00:00Z, February 31th is rolled back to the last day of the month, February 28th in 2018.
|
||||
|
||||
// Addition and subtraction of durations to date times applies months, days and seconds in that order.
|
||||
2018-01-28T00:00:00Z + 1mo + 2d // 2018-03-02T00:00:00Z
|
||||
2018-01-28T00:00:00Z + 1mo2d // 2018-03-02T00:00:00Z
|
||||
2018-01-28T00:00:00Z + 2d + 1mo // 2018-02-28T00:00:00Z, explicit left associative add of 2d first changes the result
|
||||
2018-02-01T00:00:00Z + 2mo2d // 2018-04-03T00:00:00Z
|
||||
2018-01-01T00:00:00Z + 1mo30d // 2018-03-02T00:00:00Z, Months are applied first to get February 1st, then days are added resulting in March 2 in 2018.
|
||||
2018-01-31T00:00:00Z + 1mo1d // 2018-03-01T00:00:00Z, Months are applied first to get February 28th, then days are added resulting in March 1 in 2018.
|
||||
date.add(d: 1d, to: date.add(d: 1mo, to: 2018-02-28T00:00:00Z)) // 2018-03-29T00:00:00Z
|
||||
date.add(d: 1mo, to: date.add(d: 1d, to: 2018-02-28T00:00:00Z)) // 2018-04-01T00:00:00Z
|
||||
date.sub(d: 1d, from: date.add(d: 2mo, to: 2018-01-01T00:00:00Z)) // 2018-02-28T00:00:00Z
|
||||
date.add(d: 3mo, to: date.sub(d: 1d, from: 2018-01-01T00:00:00Z)) // 2018-03-31T00:00:00Z
|
||||
date.add(d: 1mo, to: date.add(d: 1mo, to: 2018-01-31T00:00:00Z)) // 2018-03-28T00:00:00Z
|
||||
date.add(d: 2mo, to: 2018-01-31T00:00:00Z) // 2018-03-31T00:00:00Z
|
||||
|
||||
// Multiplication works
|
||||
2018-01-01T00:00:00Z + 1mo * 1 // 2018-02-01T00:00:00Z
|
||||
2018-01-01T00:00:00Z + 1mo * 2 // 2018-03-01T00:00:00Z
|
||||
2018-01-01T00:00:00Z + 1mo * 3 // 2018-04-01T00:00:00Z
|
||||
2018-01-31T00:00:00Z + 1mo * 1 // 2018-02-28T00:00:00Z
|
||||
2018-01-31T00:00:00Z + 1mo * 2 // 2018-03-31T00:00:00Z
|
||||
2018-01-31T00:00:00Z + 1mo * 3 // 2018-04-30T00:00:00Z
|
||||
// Addition and subtraction of durations to date times applies months and nanoseconds in that order.
|
||||
date.add(d: 2d, to: date.add(d: 1mo, to: 2018-01-28T00:00:00Z)) // 2018-03-02T00:00:00Z
|
||||
date.add(d: 1mo2d, to: 2018-01-28T00:00:00Z) // 2018-03-02T00:00:00Z
|
||||
date.add(d: 1mo, to: date.add(d: 2d, to: 2018-01-28T00:00:00Z)) // 2018-02-28T00:00:00Z, explicit add of 2d first changes the result
|
||||
date.add(d: 2mo2d, to: 2018-02-01T00:00:00Z) // 2018-04-03T00:00:00Z
|
||||
date.add(d: 1mo30d, to: 2018-01-01T00:00:00Z) // 2018-03-03T00:00:00Z, Months are applied first to get February 1st, then days are added resulting in March 3 in 2018.
|
||||
date.add(d: 1mo1d, to: 2018-01-31T00:00:00Z) // 2018-03-01T00:00:00Z, Months are applied first to get February 28th, then days are added resulting in March 1 in 2018.
|
||||
|
||||
// Multiplication and addition of durations to date times
|
||||
date.add(d: date.scale(d:1mo, n:1), to: 2018-01-01T00:00:00Z) // 2018-02-01T00:00:00Z
|
||||
date.add(d: date.scale(d:1mo, n:2), to: 2018-01-01T00:00:00Z) // 2018-03-01T00:00:00Z
|
||||
date.add(d: date.scale(d:1mo, n:3), to: 2018-01-01T00:00:00Z) // 2018-04-01T00:00:00Z
|
||||
date.add(d: date.scale(d:1mo, n:1), to: 2018-01-31T00:00:00Z) // 2018-02-28T00:00:00Z
|
||||
date.add(d: date.scale(d:1mo, n:2), to: 2018-01-31T00:00:00Z) // 2018-03-31T00:00:00Z
|
||||
date.add(d: date.scale(d:1mo, n:3), to: 2018-01-31T00:00:00Z) // 2018-04-30T00:00:00Z
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
[IMPL#413](https://github.com/influxdata/flux/issues/413) Implement Duration vectors.
|
||||
{{% /note %}}
|
||||
|
||||
## Date and time literals
|
||||
|
||||
A _date and time literal_ represents a specific moment in time.
|
||||
It has a date part, a time part and a time offset part.
|
||||
The format follows the [RFC 3339](https://tools.ietf.org/html/rfc3339) specification.
|
||||
The time is optional.
|
||||
When it is omitted, the time is assumed to be midnight for the default location.
|
||||
The `time_offset` is optional.
|
||||
When it is omitted, the location option is used to determine the offset.
|
||||
The time is optional. When it is omitted the time is assumed to be midnight UTC.
|
||||
|
||||
```js
|
||||
date_time_lit = date [ "T" time ] .
|
||||
|
@ -260,7 +227,7 @@ date = year "-" month "-" day .
|
|||
year = decimal_digit decimal_digit decimal_digit decimal_digit .
|
||||
month = decimal_digit decimal_digit .
|
||||
day = decimal_digit decimal_digit .
|
||||
time = hour ":" minute ":" second [ fractional_second ] [ time_offset ] .
|
||||
time = hour ":" minute ":" second [ fractional_second ] time_offset .
|
||||
hour = decimal_digit decimal_digit .
|
||||
minute = decimal_digit decimal_digit .
|
||||
second = decimal_digit decimal_digit .
|
||||
|
@ -273,14 +240,9 @@ time_offset = "Z" | ("+" | "-" ) hour ":" minute .
|
|||
```js
|
||||
1952-01-25T12:35:51Z
|
||||
2018-08-15T13:36:23-07:00
|
||||
2009-10-15T09:00:00 // October 15th 2009 at 9 AM in the default location
|
||||
2018-01-01 // midnight on January 1st 2018 in the default location
|
||||
2018-01-01 // midnight on January 1st 2018 UTC
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
[IMPL#152](https://github.com/influxdata/flux/issues/152) Implement shorthand time literals.
|
||||
{{% /note %}}
|
||||
|
||||
### String literals
|
||||
|
||||
A _string literal_ represents a sequence of characters enclosed in double quotes.
|
||||
|
@ -297,6 +259,7 @@ String literals support several escape sequences.
|
|||
```
|
||||
|
||||
Additionally, any byte value may be specified via a hex encoding using `\x` as the prefix.
|
||||
The hex encoding of values must result in a valid UTF-8 sequence.
|
||||
|
||||
```
|
||||
string_lit = `"` { unicode_value | byte_value | StringExpression | newline } `"` .
|
||||
|
@ -322,13 +285,8 @@ Embedded expressions are enclosed in a dollar sign and curly braces (`${}`).
|
|||
The expressions are evaluated in the scope containing the string literal.
|
||||
The result of an expression is formatted as a string and replaces the string content between the braces.
|
||||
All types are formatted as strings according to their literal representation.
|
||||
A function `printf` exists to allow more precise control over formatting of various types.
|
||||
To include the literal `${` within a string, it must be escaped.
|
||||
|
||||
{{% note %}}
|
||||
[IMPL#731](https://github.com/influxdata/flux/issues/731) Add printf function.
|
||||
{{% /note %}}
|
||||
|
||||
##### Example: Interpolation
|
||||
|
||||
```js
|
||||
|
@ -344,16 +302,17 @@ A _regular expression literal_ represents a regular expression pattern, enclosed
|
|||
Within the forward slashes, any unicode character may appear except for an unescaped forward slash.
|
||||
The `\x` hex byte value representation from string literals may also be present.
|
||||
|
||||
Regular expression literals support only the following escape sequences:
|
||||
In addition to standard escape sequences, regular expression literals also
|
||||
support the following escape sequences:
|
||||
|
||||
```
|
||||
\/ U+002f forward slash
|
||||
\\ U+005c backslash
|
||||
```
|
||||
|
||||
```
|
||||
regexp_lit = "/" { unicode_char | byte_value | regexp_escape_char } "/" .
|
||||
regexp_escape_char = `\` (`/` | `\`)
|
||||
regexp_lit = "/" regexp_char { regexp_char } "/" .
|
||||
regexp_char = unicode_char | byte_value | regexp_escape_char .
|
||||
regexp_escape_char = `\/`
|
||||
```
|
||||
|
||||
##### Examples of regular expression literals
|
||||
|
@ -363,7 +322,8 @@ regexp_escape_char = `\` (`/` | `\`)
|
|||
/http:\/\/localhost:8086/
|
||||
/^\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e(ZZ)?$/
|
||||
/^日本語(ZZ)?$/ // the above two lines are equivalent
|
||||
/\\xZZ/ // this becomes the literal pattern "\xZZ"
|
||||
/a\/b\s\w/ // escape sequences and character class shortcuts are supported
|
||||
/(?:)/ // the empty regular expression
|
||||
```
|
||||
|
||||
The regular expression syntax is defined by [RE2](https://github.com/google/re2/wiki/Syntax).
|
||||
|
|
|
@ -23,6 +23,10 @@ Below is a list of built-in options currently implemented in the Flux language:
|
|||
- [task](#task)
|
||||
- [location](#location)
|
||||
|
||||
Options are not closed, meaning new options may be defined and consumed within packages and scripts.
|
||||
Changing the value of an option for a package changes the value for all references
|
||||
to that option from any other package.
|
||||
|
||||
#### now
|
||||
The `now` option is a function that returns a time value used as a proxy for the current system time.
|
||||
|
||||
|
@ -51,10 +55,10 @@ The default value is [`timezone.utc`](/flux/v0.x/stdlib/timezone/#constants).
|
|||
```js
|
||||
import "timezone"
|
||||
|
||||
// Set timezone to be 5 hours west of UTC.
|
||||
// Set timezone to be 5 hours west of UTC
|
||||
option location = timezone.fixed(offset: -5h)
|
||||
|
||||
// Set location to be America/Denver.
|
||||
// Set location to be America/Denver
|
||||
option location = timezone.location(name: "America/Denver")
|
||||
```
|
||||
|
||||
|
|
|
@ -11,12 +11,6 @@ aliases:
|
|||
- /influxdb/cloud/reference/flux/language/statements/
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
This document is a living document and may not represent the current implementation of Flux.
|
||||
Any section that is not currently implemented is commented with a **[IMPL#XXX]** where
|
||||
**XXX** is an issue number tracking discussion and progress towards implementation.
|
||||
{{% /note %}}
|
||||
|
||||
A _statement_ controls execution.
|
||||
|
||||
```js
|
||||
|
|
|
@ -23,10 +23,12 @@ All such values must have a corresponding builtin statement to declare the exist
|
|||
BuiltinStatement = "builtin" identifier ":" TypeExpression .
|
||||
TypeExpression = MonoType ["where" Constraints] .
|
||||
|
||||
MonoType = Tvar | BasicType | ArrayType | RecordType | FunctionType .
|
||||
MonoType = Tvar | BasicType | ArrayType | StreamType | VectorType | RecordType | FunctionType .
|
||||
Tvar = "A" … "Z" .
|
||||
BasicType = "int" | "uint" | "float" | "string" | "bool" | "time" | "duration" | "bytes" | "regexp" .
|
||||
ArrayType = "[" MonoType "]" .
|
||||
StreamType = "stream" "[" MonoType "]" .
|
||||
VectorType = "vector" "[" MonoType "]" .
|
||||
RecordType = ( "{" [RecordTypeProperties] "}" ) | ( "{" Tvar "with" RecordTypeProperties "}" ) .
|
||||
FunctionType = "(" [FunctionTypeParameters] ")" "=>" MonoType .
|
||||
|
||||
|
@ -45,7 +47,7 @@ Kinds = identifier { "+" identifier } .
|
|||
##### Example
|
||||
|
||||
```js
|
||||
builtin filter : (<-tables: [T], fn: (r: T) => bool) => [T]
|
||||
builtin filter : (<-tables: stream[T], fn: (r: T) => bool) => stream[T]
|
||||
```
|
||||
|
||||
{{< page-nav prev="/flux/v0.x/spec/side-effects/" next="/flux/v0.x/spec/data-model/" >}}
|
||||
|
|
|
@ -11,12 +11,6 @@ aliases:
|
|||
- /influxdb/cloud/reference/flux/language/types/
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
This document is a living document and may not represent the current implementation of Flux.
|
||||
Any section that is not currently implemented is commented with a **[IMPL#XXX]** where
|
||||
**XXX** is an issue number tracking discussion and progress towards implementation.
|
||||
{{% /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](/flux/v0.x/spec/system-built-ins/).
|
||||
Types are always inferred from the usage of the value.
|
||||
|
@ -88,9 +82,7 @@ Flux supports [RFC3339 timestamps](/influxdb/cloud/reference/glossary/#rfc3339-t
|
|||
### 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.
|
||||
The duration type is nullable.
|
||||
|
||||
##### Examples of duration types
|
||||
```js
|
||||
|
@ -108,10 +100,6 @@ Durations can be added to times to produce a new time.
|
|||
3d12h4m25s // 3 days, 12 hours, 4 minutes, and 25 seconds
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
[IMPL#2026](https://github.com/influxdata/flux/issues/2026) Operator for time arithmetic
|
||||
{{% /note %}}
|
||||
|
||||
### String types
|
||||
A _string type_ represents a possibly empty sequence of characters.
|
||||
Strings are immutable and cannot be modified once created.
|
||||
|
@ -122,9 +110,6 @@ The string type is nullable.
|
|||
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.
|
||||
|
||||
### Bytes types
|
||||
A _bytes type_ represents a sequence of byte values.
|
||||
The bytes type name is `bytes`.
|
||||
|
@ -162,14 +147,12 @@ Values must also be of the same type.
|
|||
|
||||
### Function types
|
||||
A _function type_ represents a set of all functions with the same argument and result types.
|
||||
Functions arguments are always named (there are no positional arguments).
|
||||
Therefore implementing a function type requires that the arguments be named the same.
|
||||
|
||||
### 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.
|
||||
|
||||
{{% note %}}
|
||||
[IMPL#412](https://github.com/influxdata/flux/issues/412) Implement Generators types.
|
||||
{{% /note %}}
|
||||
### Stream types
|
||||
A _stream type_ represents an unbounded collection of values.
|
||||
The values must be records and those records may only hold int, uint, float, string, time or bool types.
|
||||
|
||||
## Polymorphism
|
||||
Flux functions can be polymorphic, meaning a function can be applied to arguments of different types.
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
---
|
||||
title: array.toBool() function
|
||||
description: >
|
||||
`array.toBool()` converts all values in an array to booleans.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: array.toBool
|
||||
parent: experimental/array
|
||||
identifier: experimental/array/toBool
|
||||
weight: 201
|
||||
flux/v0.x/tags: [type-conversions]
|
||||
introduced: 0.184.0
|
||||
---
|
||||
|
||||
<!------------------------------------------------------------------------------
|
||||
|
||||
IMPORTANT: This page was generated from comments in the Flux source code. Any
|
||||
edits made directly to this page will be overwritten the next time the
|
||||
documentation is generated.
|
||||
|
||||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L176-L176
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
||||
------------------------------------------------------------------------------->
|
||||
|
||||
`array.toBool()` converts all values in an array to booleans.
|
||||
|
||||
#### Supported array types
|
||||
|
||||
- `[string]` with values `true` or `false`
|
||||
- `[int]` with values `1` or `0`
|
||||
- `[uint]` with values `1` or `0`
|
||||
- `[float]` with values `1.0` or `0.0`
|
||||
|
||||
##### Function type signature
|
||||
|
||||
```js
|
||||
(<-arr: [A]) => [bool]
|
||||
```
|
||||
|
||||
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
|
||||
|
||||
## Parameters
|
||||
|
||||
### arr
|
||||
|
||||
Array of values to convert. Default is the piped-forward array (`<-`).
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Convert an array of integers to booleans
|
||||
|
||||
```js
|
||||
import "experimental/array"
|
||||
|
||||
arr = [
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
]
|
||||
|
||||
array.toBool(arr: arr)// Returns [true, true, false, true, false]
|
||||
|
||||
|
||||
```
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
title: array.toDuration() function
|
||||
description: >
|
||||
`array.toDuration()` converts all values in an array to durations.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: array.toDuration
|
||||
parent: experimental/array
|
||||
identifier: experimental/array/toDuration
|
||||
weight: 201
|
||||
flux/v0.x/tags: [type-conversions]
|
||||
introduced: 0.184.0
|
||||
---
|
||||
|
||||
<!------------------------------------------------------------------------------
|
||||
|
||||
IMPORTANT: This page was generated from comments in the Flux source code. Any
|
||||
edits made directly to this page will be overwritten the next time the
|
||||
documentation is generated.
|
||||
|
||||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L205-L205
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
||||
------------------------------------------------------------------------------->
|
||||
|
||||
`array.toDuration()` converts all values in an array to durations.
|
||||
|
||||
#### Supported array types and behaviors
|
||||
|
||||
- `[int]` (parsed as nanosecond epoch timestamps)
|
||||
- `[string]` with values that use [duration literal](/flux/v0.x/data-types/basic/duration/#duration-syntax) representation.
|
||||
- `[uint]` (parsed as nanosecond epoch timestamps)
|
||||
|
||||
##### Function type signature
|
||||
|
||||
```js
|
||||
(<-arr: [A]) => [duration]
|
||||
```
|
||||
|
||||
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
|
||||
|
||||
## Parameters
|
||||
|
||||
### arr
|
||||
|
||||
Array of values to convert. Default is the piped-forward array (`<-`).
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Convert an array of integers to durations
|
||||
|
||||
```js
|
||||
import "experimental/array"
|
||||
|
||||
arr = [80000000000, 56000000000, 132000000000]
|
||||
|
||||
array.toDuration(arr: arr)// Returns [1m20s, 56s, 2m12s]
|
||||
|
||||
|
||||
```
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
---
|
||||
title: array.toFloat() function
|
||||
description: >
|
||||
`array.toFloat()` converts all values in an array to floats.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: array.toFloat
|
||||
parent: experimental/array
|
||||
identifier: experimental/array/toFloat
|
||||
weight: 201
|
||||
flux/v0.x/tags: [type-conversions]
|
||||
introduced: 0.184.0
|
||||
---
|
||||
|
||||
<!------------------------------------------------------------------------------
|
||||
|
||||
IMPORTANT: This page was generated from comments in the Flux source code. Any
|
||||
edits made directly to this page will be overwritten the next time the
|
||||
documentation is generated.
|
||||
|
||||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L245-L245
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
||||
------------------------------------------------------------------------------->
|
||||
|
||||
`array.toFloat()` converts all values in an array to floats.
|
||||
|
||||
#### Supported array types
|
||||
|
||||
- `[string]` (numeric, scientific notation, ±Inf, or NaN)
|
||||
- `[bool]`
|
||||
- `[int]`
|
||||
- `[uint]`
|
||||
|
||||
##### Function type signature
|
||||
|
||||
```js
|
||||
(<-arr: [A]) => [float]
|
||||
```
|
||||
|
||||
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
|
||||
|
||||
## Parameters
|
||||
|
||||
### arr
|
||||
|
||||
Array of values to convert. Default is the piped-forward array (`<-`).
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
- [Convert an array of integers to floats](#convert-an-array-of-integers-to-floats)
|
||||
- [Convert an array of strings to floats](#convert-an-array-of-strings-to-floats)
|
||||
|
||||
### Convert an array of integers to floats
|
||||
|
||||
```js
|
||||
import "experimental/array"
|
||||
|
||||
arr = [12, 24, 36, 48]
|
||||
|
||||
array.toFloat(arr: arr)// Returns [12.0, 24.0, 36.0, 48.0]
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Convert an array of strings to floats
|
||||
|
||||
```js
|
||||
import "experimental/array"
|
||||
|
||||
arr = ["12", "1.23e+4", "NaN", "24.2"]
|
||||
|
||||
array.toFloat(arr: arr)// Returns [12.0, 1.2300, NaN, 24.2]
|
||||
|
||||
|
||||
```
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
---
|
||||
title: array.toInt() function
|
||||
description: >
|
||||
`array.toInt()` converts all values in an array to integers.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: array.toInt
|
||||
parent: experimental/array
|
||||
identifier: experimental/array/toInt
|
||||
weight: 201
|
||||
flux/v0.x/tags: [type-conversions]
|
||||
introduced: 0.184.0
|
||||
---
|
||||
|
||||
<!------------------------------------------------------------------------------
|
||||
|
||||
IMPORTANT: This page was generated from comments in the Flux source code. Any
|
||||
edits made directly to this page will be overwritten the next time the
|
||||
documentation is generated.
|
||||
|
||||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L279-L279
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
||||
------------------------------------------------------------------------------->
|
||||
|
||||
`array.toInt()` converts all values in an array to integers.
|
||||
|
||||
#### Supported array types and behaviors
|
||||
|
||||
| Array type | Returned array values |
|
||||
| :----------- | :----------------------------------------- |
|
||||
| `[bool]` | 1 (true) or 0 (false) |
|
||||
| `[duration]` | Number of nanoseconds in the duration |
|
||||
| `[float]` | Value truncated at the decimal |
|
||||
| `[string]` | Integer equivalent of the numeric string |
|
||||
| `[time]` | Equivalent nanosecond epoch timestamp |
|
||||
| `[uint]` | Integer equivalent of the unsigned integer |
|
||||
|
||||
##### Function type signature
|
||||
|
||||
```js
|
||||
(<-arr: [A]) => [int]
|
||||
```
|
||||
|
||||
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
|
||||
|
||||
## Parameters
|
||||
|
||||
### arr
|
||||
|
||||
Array of values to convert. Default is the piped-forward array (`<-`).
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Convert an array of floats to integers
|
||||
|
||||
```js
|
||||
import "experimental/array"
|
||||
|
||||
arr = [12.1, 24.2, 36.3, 48.4]
|
||||
|
||||
array.toInt(arr: arr)// Returns [12, 24, 36, 48]
|
||||
|
||||
|
||||
```
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
title: array.toString() function
|
||||
description: >
|
||||
`array.toString()` converts all values in an array to strings.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: array.toString
|
||||
parent: experimental/array
|
||||
identifier: experimental/array/toString
|
||||
weight: 201
|
||||
flux/v0.x/tags: [type-conversions]
|
||||
introduced: 0.184.0
|
||||
---
|
||||
|
||||
<!------------------------------------------------------------------------------
|
||||
|
||||
IMPORTANT: This page was generated from comments in the Flux source code. Any
|
||||
edits made directly to this page will be overwritten the next time the
|
||||
documentation is generated.
|
||||
|
||||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L311-L311
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
||||
------------------------------------------------------------------------------->
|
||||
|
||||
`array.toString()` converts all values in an array to strings.
|
||||
|
||||
#### Supported array types
|
||||
|
||||
- `[bool]`
|
||||
- `[duration]`
|
||||
- `[float]`
|
||||
- `[int]`
|
||||
- `[time]`
|
||||
- `[uint]`
|
||||
|
||||
##### Function type signature
|
||||
|
||||
```js
|
||||
(<-arr: [A]) => [string]
|
||||
```
|
||||
|
||||
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
|
||||
|
||||
## Parameters
|
||||
|
||||
### arr
|
||||
|
||||
Array of values to convert. Default is the piped-forward array (`<-`).
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Convert an array of floats to strings
|
||||
|
||||
```js
|
||||
import "experimental/array"
|
||||
|
||||
arr = [12.0, 1.23, NaN, 24.2]
|
||||
|
||||
array.toString(arr: arr)// Returns ["12.0", "1.2300", "NaN", "24.2"]
|
||||
|
||||
|
||||
```
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
title: array.toTime() function
|
||||
description: >
|
||||
`array.toTime()` converts all values in an array to times.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: array.toTime
|
||||
parent: experimental/array
|
||||
identifier: experimental/array/toTime
|
||||
weight: 201
|
||||
flux/v0.x/tags: [type-conversions]
|
||||
introduced: 0.184.0
|
||||
---
|
||||
|
||||
<!------------------------------------------------------------------------------
|
||||
|
||||
IMPORTANT: This page was generated from comments in the Flux source code. Any
|
||||
edits made directly to this page will be overwritten the next time the
|
||||
documentation is generated.
|
||||
|
||||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L341-L341
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
||||
------------------------------------------------------------------------------->
|
||||
|
||||
`array.toTime()` converts all values in an array to times.
|
||||
|
||||
#### Supported array types
|
||||
|
||||
- `[int]` (parsed as nanosecond epoch timestamps)
|
||||
- `[string]` with values that use [time literal](/flux/v0.x/data-types/basic/time/#time-syntax)
|
||||
representation (RFC3339 timestamps).
|
||||
- `[uint]` (parsed as nanosecond epoch timestamps)
|
||||
|
||||
##### Function type signature
|
||||
|
||||
```js
|
||||
(<-arr: [A]) => [time]
|
||||
```
|
||||
|
||||
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
|
||||
|
||||
## Parameters
|
||||
|
||||
### arr
|
||||
|
||||
Array of values to convert. Default is the piped-forward array (`<-`).
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Convert an array of integers to time values
|
||||
|
||||
```js
|
||||
import "experimental/array"
|
||||
|
||||
arr = [1640995200000000000, 1643673600000000000, 1646092800000000000]
|
||||
|
||||
array.toTime(arr: arr)// Returns [2022-01-01T00:00:00Z, 2022-02-01T00:00:00Z, 2022-03-01T00:00:00Z]
|
||||
|
||||
|
||||
```
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
---
|
||||
title: array.toUInt() function
|
||||
description: >
|
||||
`array.toUInt()` converts all values in an array to unsigned integers.
|
||||
menu:
|
||||
flux_0_x_ref:
|
||||
name: array.toUInt
|
||||
parent: experimental/array
|
||||
identifier: experimental/array/toUInt
|
||||
weight: 201
|
||||
flux/v0.x/tags: [type-conversions]
|
||||
introduced: 0.184.0
|
||||
---
|
||||
|
||||
<!------------------------------------------------------------------------------
|
||||
|
||||
IMPORTANT: This page was generated from comments in the Flux source code. Any
|
||||
edits made directly to this page will be overwritten the next time the
|
||||
documentation is generated.
|
||||
|
||||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/experimental/array/array.flux#L375-L375
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
||||
------------------------------------------------------------------------------->
|
||||
|
||||
`array.toUInt()` converts all values in an array to unsigned integers.
|
||||
|
||||
#### Supported array types and behaviors
|
||||
|
||||
| Array type | Returned array values |
|
||||
| :----------- | :----------------------------------------- |
|
||||
| `[bool]` | 1 (true) or 0 (false) |
|
||||
| `[duration]` | Number of nanoseconds in the duration |
|
||||
| `[float]` | Value truncated at the decimal |
|
||||
| `[int]` | Unsigned integer equivalent of the integer |
|
||||
| `[string]` | Integer equivalent of the numeric string |
|
||||
| `[time]` | Equivalent nanosecond epoch timestamp |
|
||||
|
||||
##### Function type signature
|
||||
|
||||
```js
|
||||
(<-arr: [A]) => [uint]
|
||||
```
|
||||
|
||||
{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}
|
||||
|
||||
## Parameters
|
||||
|
||||
### arr
|
||||
|
||||
Array of values to convert. Default is the piped-forward array (`<-`).
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Convert an array of floats to usigned integers
|
||||
|
||||
```js
|
||||
import "experimental/array"
|
||||
|
||||
arr = [-12.1, 24.2, -36.3, 48.4]
|
||||
|
||||
array.toInt(arr: arr)// Returns [18446744073709551604, 24, 18446744073709551580, 48]
|
||||
|
||||
|
||||
```
|
||||
|
|
@ -20,7 +20,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/experimental/geo/geo.flux#L982-L985
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/experimental/geo/geo.flux#L1008-L1011
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
@ -52,7 +52,7 @@ Default is `["id","tid"]`.
|
|||
|
||||
Columns to order results by. Default is `["_time"]`.
|
||||
|
||||
|
||||
Sort precedence is determined by list order (left to right).
|
||||
|
||||
### tables
|
||||
|
||||
|
@ -63,6 +63,9 @@ Input data. Default is piped-forward data (`<-`).
|
|||
|
||||
## Examples
|
||||
|
||||
- [Group geotemporal data into tracks](#group-geotemporal-data-into-tracks)
|
||||
- [Group geotemporal data into tracks and sort by specified columns](#group-geotemporal-data-into-tracks-and-sort-by-specified-columns)
|
||||
|
||||
### Group geotemporal data into tracks
|
||||
|
||||
```js
|
||||
|
@ -104,3 +107,45 @@ data
|
|||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
### Group geotemporal data into tracks and sort by specified columns
|
||||
|
||||
```js
|
||||
import "experimental/geo"
|
||||
|
||||
data
|
||||
|> geo.asTracks(orderBy: ["lat", "lon"])
|
||||
|
||||
```
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View example input and ouput" %}}
|
||||
|
||||
#### Input data
|
||||
|
||||
| _time | id | lat | lon |
|
||||
| -------------------- | ----- | -------- | -------- |
|
||||
| 2021-01-01T00:00:00Z | a213b | 14.01433 | -14.5464 |
|
||||
| 2021-01-02T01:00:00Z | a213b | 13.9228 | -13.3338 |
|
||||
| 2021-01-03T02:00:00Z | a213b | 15.08433 | -12.0433 |
|
||||
| 2021-01-01T00:00:00Z | b546c | 14.01433 | 39.7515 |
|
||||
| 2021-01-02T01:00:00Z | b546c | 13.9228 | 38.3527 |
|
||||
| 2021-01-03T02:00:00Z | b546c | 15.08433 | 36.9978 |
|
||||
|
||||
|
||||
#### Output data
|
||||
|
||||
| _time | *id | lat | lon |
|
||||
| -------------------- | ----- | -------- | -------- |
|
||||
| 2021-01-02T01:00:00Z | a213b | 13.9228 | -13.3338 |
|
||||
| 2021-01-01T00:00:00Z | a213b | 14.01433 | -14.5464 |
|
||||
| 2021-01-03T02:00:00Z | a213b | 15.08433 | -12.0433 |
|
||||
|
||||
| _time | *id | lat | lon |
|
||||
| -------------------- | ----- | -------- | ------- |
|
||||
| 2021-01-02T01:00:00Z | b546c | 13.9228 | 38.3527 |
|
||||
| 2021-01-01T00:00:00Z | b546c | 14.01433 | 39.7515 |
|
||||
| 2021-01-03T02:00:00Z | b546c | 15.08433 | 36.9978 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
|
|
@ -133,7 +133,7 @@ array.from(rows: [{name: data.name, age: data.age}])
|
|||
|
||||
| name | age |
|
||||
| --------- | ---- |
|
||||
| nathaniel | 30 |
|
||||
| nathaniel | 60 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
|
|
@ -78,22 +78,23 @@ requests.peek(response: requests.get(url: "https://api.agify.io", params: ["name
|
|||
|
||||
#### Output data
|
||||
|
||||
| body | duration | headers | statusCode |
|
||||
| ----------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
|
||||
| {"name":"natalie","age":34,"count":20959} | 100000000 | [
|
||||
Access-Control-Allow-Headers: Content-Type, X-Genderize-Source,
|
||||
Access-Control-Allow-Methods: GET,
|
||||
| body | duration | headers | statusCode |
|
||||
| ----------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
|
||||
| {"age":48,"count":25082,"name":"natalie"} | 100000000 | [
|
||||
Access-Control-Allow-Credentials: true,
|
||||
Access-Control-Allow-Origin: *,
|
||||
Access-Control-Expose-Headers: x-rate-limit-limit,x-rate-limit-remaining,x-rate-limit-reset,
|
||||
Cache-Control: max-age=0, private, must-revalidate,
|
||||
Connection: keep-alive,
|
||||
Content-Length: 41,
|
||||
Content-Type: application/json; charset=utf-8,
|
||||
Date: Mon, 12 Sep 2022 19:26:11 GMT,
|
||||
Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI",
|
||||
Date: Wed, 21 Sep 2022 10:08:38 GMT,
|
||||
Server: nginx/1.16.1,
|
||||
X-Rate-Limit-Limit: 1000,
|
||||
X-Rate-Limit-Remaining: 998,
|
||||
X-Rate-Reset: 16429
|
||||
] | 200 |
|
||||
X-Rate-Limit-Reset: 49882,
|
||||
X-Request-Id: FxbYSI-0Y_v6ACsAkbHS
|
||||
] | 200 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
|
|
@ -107,44 +107,44 @@ data
|
|||
|
||||
| _time | _value |
|
||||
| -------------------- | ------------------- |
|
||||
| 2022-09-12T19:23:30Z | 10.56555566168836 |
|
||||
| 2022-09-12T19:23:40Z | -29.76098586714259 |
|
||||
| 2022-09-12T19:23:50Z | -67.50435038579738 |
|
||||
| 2022-09-12T19:24:00Z | -16.758669047964453 |
|
||||
| 2022-09-12T19:24:10Z | -47.25865245658065 |
|
||||
| 2022-09-12T19:24:20Z | 66.16082461651365 |
|
||||
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
|
||||
| 2022-09-12T19:24:40Z | -56.89169240573004 |
|
||||
| 2022-09-12T19:24:50Z | 11.358605472976624 |
|
||||
| 2022-09-12T19:25:00Z | 28.71147881415803 |
|
||||
| 2022-09-12T19:25:10Z | -30.928830759588756 |
|
||||
| 2022-09-12T19:25:20Z | -22.411848631056067 |
|
||||
| 2022-09-12T19:25:30Z | 17.05503606764129 |
|
||||
| 2022-09-12T19:25:40Z | 9.834382683760559 |
|
||||
| 2022-09-12T19:25:50Z | -12.62058579127679 |
|
||||
| 2022-09-12T19:26:00Z | -44.44668391211515 |
|
||||
| 2022-09-21T10:05:50Z | 10.56555566168836 |
|
||||
| 2022-09-21T10:06:00Z | -29.76098586714259 |
|
||||
| 2022-09-21T10:06:10Z | -67.50435038579738 |
|
||||
| 2022-09-21T10:06:20Z | -16.758669047964453 |
|
||||
| 2022-09-21T10:06:30Z | -47.25865245658065 |
|
||||
| 2022-09-21T10:06:40Z | 66.16082461651365 |
|
||||
| 2022-09-21T10:06:50Z | -0.9179216017921821 |
|
||||
| 2022-09-21T10:07:00Z | -56.89169240573004 |
|
||||
| 2022-09-21T10:07:10Z | 11.358605472976624 |
|
||||
| 2022-09-21T10:07:20Z | 28.71147881415803 |
|
||||
| 2022-09-21T10:07:30Z | -30.928830759588756 |
|
||||
| 2022-09-21T10:07:40Z | -22.411848631056067 |
|
||||
| 2022-09-21T10:07:50Z | 17.05503606764129 |
|
||||
| 2022-09-21T10:08:00Z | 9.834382683760559 |
|
||||
| 2022-09-21T10:08:10Z | -12.62058579127679 |
|
||||
| 2022-09-21T10:08:20Z | -44.44668391211515 |
|
||||
|
||||
|
||||
#### Output data
|
||||
|
||||
| _time | _value |
|
||||
| -------------------- | ------------------- |
|
||||
| 2022-09-12T19:23:30Z | 10.56555566168836 |
|
||||
| 2022-09-12T19:23:40Z | -29.76098586714259 |
|
||||
| 2022-09-12T19:23:50Z | -67.50435038579738 |
|
||||
| 2022-09-12T19:24:00Z | -16.758669047964453 |
|
||||
| 2022-09-12T19:24:10Z | -47.25865245658065 |
|
||||
| 2022-09-12T19:24:20Z | 66.16082461651365 |
|
||||
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
|
||||
| 2022-09-12T19:24:40Z | -56.89169240573004 |
|
||||
| 2022-09-12T19:24:50Z | 11.358605472976624 |
|
||||
| 2022-09-12T19:25:00Z | 28.71147881415803 |
|
||||
| 2022-09-12T19:25:10Z | -30.928830759588756 |
|
||||
| 2022-09-12T19:25:20Z | -22.411848631056067 |
|
||||
| 2022-09-12T19:25:30Z | 17.05503606764129 |
|
||||
| 2022-09-12T19:25:40Z | 9.834382683760559 |
|
||||
| 2022-09-12T19:25:50Z | -12.62058579127679 |
|
||||
| 2022-09-12T19:26:00Z | -44.44668391211515 |
|
||||
| 2022-09-21T10:05:50Z | 10.56555566168836 |
|
||||
| 2022-09-21T10:06:00Z | -29.76098586714259 |
|
||||
| 2022-09-21T10:06:10Z | -67.50435038579738 |
|
||||
| 2022-09-21T10:06:20Z | -16.758669047964453 |
|
||||
| 2022-09-21T10:06:30Z | -47.25865245658065 |
|
||||
| 2022-09-21T10:06:40Z | 66.16082461651365 |
|
||||
| 2022-09-21T10:06:50Z | -0.9179216017921821 |
|
||||
| 2022-09-21T10:07:00Z | -56.89169240573004 |
|
||||
| 2022-09-21T10:07:10Z | 11.358605472976624 |
|
||||
| 2022-09-21T10:07:20Z | 28.71147881415803 |
|
||||
| 2022-09-21T10:07:30Z | -30.928830759588756 |
|
||||
| 2022-09-21T10:07:40Z | -22.411848631056067 |
|
||||
| 2022-09-21T10:07:50Z | 17.05503606764129 |
|
||||
| 2022-09-21T10:08:00Z | 9.834382683760559 |
|
||||
| 2022-09-21T10:08:10Z | -12.62058579127679 |
|
||||
| 2022-09-21T10:08:20Z | -44.44668391211515 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
@ -166,43 +166,43 @@ data
|
|||
|
||||
| _time | _value |
|
||||
| -------------------- | ------------------- |
|
||||
| 2022-09-12T19:23:30Z | 10.56555566168836 |
|
||||
| 2022-09-12T19:23:40Z | -29.76098586714259 |
|
||||
| 2022-09-12T19:23:50Z | -67.50435038579738 |
|
||||
| 2022-09-12T19:24:00Z | -16.758669047964453 |
|
||||
| 2022-09-12T19:24:10Z | -47.25865245658065 |
|
||||
| 2022-09-12T19:24:20Z | 66.16082461651365 |
|
||||
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
|
||||
| 2022-09-12T19:24:40Z | -56.89169240573004 |
|
||||
| 2022-09-12T19:24:50Z | 11.358605472976624 |
|
||||
| 2022-09-12T19:25:00Z | 28.71147881415803 |
|
||||
| 2022-09-12T19:25:10Z | -30.928830759588756 |
|
||||
| 2022-09-12T19:25:20Z | -22.411848631056067 |
|
||||
| 2022-09-12T19:25:30Z | 17.05503606764129 |
|
||||
| 2022-09-12T19:25:40Z | 9.834382683760559 |
|
||||
| 2022-09-12T19:25:50Z | -12.62058579127679 |
|
||||
| 2022-09-12T19:26:00Z | -44.44668391211515 |
|
||||
| 2022-09-21T10:05:50Z | 10.56555566168836 |
|
||||
| 2022-09-21T10:06:00Z | -29.76098586714259 |
|
||||
| 2022-09-21T10:06:10Z | -67.50435038579738 |
|
||||
| 2022-09-21T10:06:20Z | -16.758669047964453 |
|
||||
| 2022-09-21T10:06:30Z | -47.25865245658065 |
|
||||
| 2022-09-21T10:06:40Z | 66.16082461651365 |
|
||||
| 2022-09-21T10:06:50Z | -0.9179216017921821 |
|
||||
| 2022-09-21T10:07:00Z | -56.89169240573004 |
|
||||
| 2022-09-21T10:07:10Z | 11.358605472976624 |
|
||||
| 2022-09-21T10:07:20Z | 28.71147881415803 |
|
||||
| 2022-09-21T10:07:30Z | -30.928830759588756 |
|
||||
| 2022-09-21T10:07:40Z | -22.411848631056067 |
|
||||
| 2022-09-21T10:07:50Z | 17.05503606764129 |
|
||||
| 2022-09-21T10:08:00Z | 9.834382683760559 |
|
||||
| 2022-09-21T10:08:10Z | -12.62058579127679 |
|
||||
| 2022-09-21T10:08:20Z | -44.44668391211515 |
|
||||
|
||||
|
||||
#### Output data
|
||||
|
||||
| _time | _value |
|
||||
| -------------------- | ------------------- |
|
||||
| 2022-09-12T19:23:30Z | 10.56555566168836 |
|
||||
| 2022-09-12T19:23:50Z | -67.50435038579738 |
|
||||
| 2022-09-12T19:24:00Z | -16.758669047964453 |
|
||||
| 2022-09-12T19:24:10Z | -47.25865245658065 |
|
||||
| 2022-09-12T19:24:20Z | 66.16082461651365 |
|
||||
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
|
||||
| 2022-09-12T19:24:40Z | -56.89169240573004 |
|
||||
| 2022-09-12T19:24:50Z | 11.358605472976624 |
|
||||
| 2022-09-12T19:25:00Z | 28.71147881415803 |
|
||||
| 2022-09-12T19:25:10Z | -30.928830759588756 |
|
||||
| 2022-09-12T19:25:20Z | -22.411848631056067 |
|
||||
| 2022-09-12T19:25:30Z | 17.05503606764129 |
|
||||
| 2022-09-12T19:25:40Z | 9.834382683760559 |
|
||||
| 2022-09-12T19:25:50Z | -12.62058579127679 |
|
||||
| 2022-09-12T19:26:00Z | -44.44668391211515 |
|
||||
| 2022-09-21T10:05:50Z | 10.56555566168836 |
|
||||
| 2022-09-21T10:06:10Z | -67.50435038579738 |
|
||||
| 2022-09-21T10:06:20Z | -16.758669047964453 |
|
||||
| 2022-09-21T10:06:30Z | -47.25865245658065 |
|
||||
| 2022-09-21T10:06:40Z | 66.16082461651365 |
|
||||
| 2022-09-21T10:06:50Z | -0.9179216017921821 |
|
||||
| 2022-09-21T10:07:00Z | -56.89169240573004 |
|
||||
| 2022-09-21T10:07:10Z | 11.358605472976624 |
|
||||
| 2022-09-21T10:07:20Z | 28.71147881415803 |
|
||||
| 2022-09-21T10:07:30Z | -30.928830759588756 |
|
||||
| 2022-09-21T10:07:40Z | -22.411848631056067 |
|
||||
| 2022-09-21T10:07:50Z | 17.05503606764129 |
|
||||
| 2022-09-21T10:08:00Z | 9.834382683760559 |
|
||||
| 2022-09-21T10:08:10Z | -12.62058579127679 |
|
||||
| 2022-09-21T10:08:20Z | -44.44668391211515 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
@ -224,42 +224,42 @@ data
|
|||
|
||||
| _time | _value |
|
||||
| -------------------- | ------------------- |
|
||||
| 2022-09-12T19:23:30Z | 10.56555566168836 |
|
||||
| 2022-09-12T19:23:40Z | -29.76098586714259 |
|
||||
| 2022-09-12T19:23:50Z | -67.50435038579738 |
|
||||
| 2022-09-12T19:24:00Z | -16.758669047964453 |
|
||||
| 2022-09-12T19:24:10Z | -47.25865245658065 |
|
||||
| 2022-09-12T19:24:20Z | 66.16082461651365 |
|
||||
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
|
||||
| 2022-09-12T19:24:40Z | -56.89169240573004 |
|
||||
| 2022-09-12T19:24:50Z | 11.358605472976624 |
|
||||
| 2022-09-12T19:25:00Z | 28.71147881415803 |
|
||||
| 2022-09-12T19:25:10Z | -30.928830759588756 |
|
||||
| 2022-09-12T19:25:20Z | -22.411848631056067 |
|
||||
| 2022-09-12T19:25:30Z | 17.05503606764129 |
|
||||
| 2022-09-12T19:25:40Z | 9.834382683760559 |
|
||||
| 2022-09-12T19:25:50Z | -12.62058579127679 |
|
||||
| 2022-09-12T19:26:00Z | -44.44668391211515 |
|
||||
| 2022-09-21T10:05:50Z | 10.56555566168836 |
|
||||
| 2022-09-21T10:06:00Z | -29.76098586714259 |
|
||||
| 2022-09-21T10:06:10Z | -67.50435038579738 |
|
||||
| 2022-09-21T10:06:20Z | -16.758669047964453 |
|
||||
| 2022-09-21T10:06:30Z | -47.25865245658065 |
|
||||
| 2022-09-21T10:06:40Z | 66.16082461651365 |
|
||||
| 2022-09-21T10:06:50Z | -0.9179216017921821 |
|
||||
| 2022-09-21T10:07:00Z | -56.89169240573004 |
|
||||
| 2022-09-21T10:07:10Z | 11.358605472976624 |
|
||||
| 2022-09-21T10:07:20Z | 28.71147881415803 |
|
||||
| 2022-09-21T10:07:30Z | -30.928830759588756 |
|
||||
| 2022-09-21T10:07:40Z | -22.411848631056067 |
|
||||
| 2022-09-21T10:07:50Z | 17.05503606764129 |
|
||||
| 2022-09-21T10:08:00Z | 9.834382683760559 |
|
||||
| 2022-09-21T10:08:10Z | -12.62058579127679 |
|
||||
| 2022-09-21T10:08:20Z | -44.44668391211515 |
|
||||
|
||||
|
||||
#### Output data
|
||||
|
||||
| _time | _value |
|
||||
| -------------------- | ------------------- |
|
||||
| 2022-09-12T19:23:30Z | 10.56555566168836 |
|
||||
| 2022-09-12T19:23:50Z | -67.50435038579738 |
|
||||
| 2022-09-12T19:24:00Z | -16.758669047964453 |
|
||||
| 2022-09-12T19:24:10Z | -47.25865245658065 |
|
||||
| 2022-09-12T19:24:20Z | 66.16082461651365 |
|
||||
| 2022-09-12T19:24:30Z | -0.9179216017921821 |
|
||||
| 2022-09-12T19:24:40Z | -56.89169240573004 |
|
||||
| 2022-09-12T19:24:50Z | 11.358605472976624 |
|
||||
| 2022-09-12T19:25:00Z | 28.71147881415803 |
|
||||
| 2022-09-12T19:25:10Z | -30.928830759588756 |
|
||||
| 2022-09-12T19:25:20Z | -22.411848631056067 |
|
||||
| 2022-09-12T19:25:30Z | 17.05503606764129 |
|
||||
| 2022-09-12T19:25:40Z | 9.834382683760559 |
|
||||
| 2022-09-12T19:26:00Z | -44.44668391211515 |
|
||||
| 2022-09-21T10:05:50Z | 10.56555566168836 |
|
||||
| 2022-09-21T10:06:10Z | -67.50435038579738 |
|
||||
| 2022-09-21T10:06:20Z | -16.758669047964453 |
|
||||
| 2022-09-21T10:06:30Z | -47.25865245658065 |
|
||||
| 2022-09-21T10:06:40Z | 66.16082461651365 |
|
||||
| 2022-09-21T10:06:50Z | -0.9179216017921821 |
|
||||
| 2022-09-21T10:07:00Z | -56.89169240573004 |
|
||||
| 2022-09-21T10:07:10Z | 11.358605472976624 |
|
||||
| 2022-09-21T10:07:20Z | 28.71147881415803 |
|
||||
| 2022-09-21T10:07:30Z | -30.928830759588756 |
|
||||
| 2022-09-21T10:07:40Z | -22.411848631056067 |
|
||||
| 2022-09-21T10:07:50Z | 17.05503606764129 |
|
||||
| 2022-09-21T10:08:00Z | 9.834382683760559 |
|
||||
| 2022-09-21T10:08:20Z | -44.44668391211515 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
|
|
@ -130,7 +130,7 @@ array.from(rows: [{name: data.name, age: data.age}])
|
|||
|
||||
| name | age |
|
||||
| --------- | ---- |
|
||||
| nathaniel | 30 |
|
||||
| nathaniel | 60 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
|
|
@ -73,22 +73,23 @@ requests.peek(response: requests.get(url: "https://api.agify.io", params: ["name
|
|||
|
||||
#### Output data
|
||||
|
||||
| body | duration | headers | statusCode |
|
||||
| ----------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
|
||||
| {"name":"natalie","age":34,"count":20959} | 100000000 | [
|
||||
Access-Control-Allow-Headers: Content-Type, X-Genderize-Source,
|
||||
Access-Control-Allow-Methods: GET,
|
||||
| body | duration | headers | statusCode |
|
||||
| ----------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
|
||||
| {"age":48,"count":25082,"name":"natalie"} | 100000000 | [
|
||||
Access-Control-Allow-Credentials: true,
|
||||
Access-Control-Allow-Origin: *,
|
||||
Access-Control-Expose-Headers: x-rate-limit-limit,x-rate-limit-remaining,x-rate-limit-reset,
|
||||
Cache-Control: max-age=0, private, must-revalidate,
|
||||
Connection: keep-alive,
|
||||
Content-Length: 41,
|
||||
Content-Type: application/json; charset=utf-8,
|
||||
Date: Mon, 12 Sep 2022 19:26:13 GMT,
|
||||
Etag: W/"29-klDahUESBLxHyQ7NiaetCn2CvCI",
|
||||
Date: Wed, 21 Sep 2022 10:08:39 GMT,
|
||||
Server: nginx/1.16.1,
|
||||
X-Rate-Limit-Limit: 1000,
|
||||
X-Rate-Limit-Remaining: 996,
|
||||
X-Rate-Reset: 16427
|
||||
] | 200 |
|
||||
X-Rate-Limit-Reset: 49881,
|
||||
X-Request-Id: FxbYSObVA-veXYEAkbRi
|
||||
] | 200 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
|
|
@ -189,12 +189,12 @@ requests.peek(response: response)
|
|||
Cache-Control: max-age=604800,
|
||||
Content-Length: 1256,
|
||||
Content-Type: text/html; charset=UTF-8,
|
||||
Date: Mon, 12 Sep 2022 19:26:13 GMT,
|
||||
Date: Wed, 21 Sep 2022 10:08:40 GMT,
|
||||
Etag: "3147526947",
|
||||
Expires: Mon, 19 Sep 2022 19:26:13 GMT,
|
||||
Expires: Wed, 28 Sep 2022 10:08:40 GMT,
|
||||
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT,
|
||||
Server: EOS (vny/0451)
|
||||
] | 97664868 |
|
||||
Server: EOS (vny/0453)
|
||||
] | 147139602 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3852-L3875
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3866-L3889
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3116-L3116
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3130-L3130
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4122-L4124
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4136-L4138
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3134-L3134
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3148-L3148
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3539-L3539
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3553-L3553
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3677-L3679
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3691-L3693
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3512-L3512
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3526-L3526
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -23,7 +23,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4439-L4445
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4453-L4459
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3184-L3184
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3198-L3198
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -117,12 +117,12 @@ sampledata.int()
|
|||
| 2021-01-01T00:00:40Z | 13 | t2 |
|
||||
| 2021-01-01T00:00:50Z | 1 | t2 |
|
||||
|
||||
| _time | _value | *tag |
|
||||
| ------ | ------- | ---- |
|
||||
|
||||
|
||||
#### Output data
|
||||
|
||||
| _time | _value | *tag |
|
||||
| ------ | ------- | ---- |
|
||||
|
||||
| _time | _value | *tag |
|
||||
| -------------------- | ------- | ---- |
|
||||
| 2021-01-01T00:00:00Z | 19 | t2 |
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3031-L3034
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3045-L3048
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3068-L3071
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3082-L3085
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3228-L3228
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3242-L3242
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2970-L2970
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2984-L2984
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2997-L2997
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3011-L3011
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4207-L4215
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4221-L4229
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4242-L4250
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4256-L4264
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4170-L4180
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4184-L4194
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3902-L3905
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3916-L3919
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3288-L3288
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3302-L3302
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4472-L4475
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4486-L4489
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3562-L3562
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3576-L3576
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3585-L3585
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3599-L3599
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3608-L3608
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3622-L3622
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4314-L4322
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4328-L4336
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4349-L4357
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4363-L4371
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4277-L4287
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4291-L4301
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -59,7 +59,7 @@ Input data. Default is piped-forward data (`<-`).
|
|||
|
||||
## Examples
|
||||
|
||||
### Return the row with the maximum value
|
||||
### Return the row with the maximum value from each input table
|
||||
|
||||
```js
|
||||
import "sampledata"
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3965-L3967
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3979-L3981
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3708-L3708
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3722-L3722
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -61,7 +61,7 @@ Durations are relative to `now()`.
|
|||
|
||||
Latest time to include in results. Default is `now()`.
|
||||
|
||||
Results _exclude_ rows with `_time` values that match the specified start time.
|
||||
Results _exclude_ rows with `_time` values that match the specified stop time.
|
||||
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()`.
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2264-L2268
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2278-L2282
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
@ -30,7 +30,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
|||
|
||||
`rename()` renames columns in a table.
|
||||
|
||||
If a column in group key is renamed, the column name in the group key is updated.
|
||||
If a column in the group key is renamed, the column name in the group key is updated.
|
||||
|
||||
##### Function type signature
|
||||
|
||||
|
@ -64,10 +64,11 @@ Input data. Default is piped-forward data (`<-`).
|
|||
|
||||
## Examples
|
||||
|
||||
- [Map column names to new column names](#map-column-names-to-new-column-names)
|
||||
- [Explicitly map column names to new column names](#explicitly-map-column-names-to-new-column-names)
|
||||
- [Rename columns using a function](#rename-columns-using-a-function)
|
||||
- [Conditionally rename columns using a function](#conditionally-rename-columns-using-a-function)
|
||||
|
||||
### Map column names to new column names
|
||||
### Explicitly map column names to new column names
|
||||
|
||||
```js
|
||||
import "sampledata"
|
||||
|
@ -180,3 +181,66 @@ sampledata.int()
|
|||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
### Conditionally rename columns using a function
|
||||
|
||||
```js
|
||||
import "sampledata"
|
||||
|
||||
sampledata.int()
|
||||
|> rename(
|
||||
fn: (column) => {
|
||||
_newColumnName = if column =~ /^_/ then "${column} (Reserved)" else column
|
||||
|
||||
return _newColumnName
|
||||
},
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View example input and ouput" %}}
|
||||
|
||||
#### Input data
|
||||
|
||||
| _time | _value | *tag |
|
||||
| -------------------- | ------- | ---- |
|
||||
| 2021-01-01T00:00:00Z | -2 | t1 |
|
||||
| 2021-01-01T00:00:10Z | 10 | t1 |
|
||||
| 2021-01-01T00:00:20Z | 7 | t1 |
|
||||
| 2021-01-01T00:00:30Z | 17 | t1 |
|
||||
| 2021-01-01T00:00:40Z | 15 | t1 |
|
||||
| 2021-01-01T00:00:50Z | 4 | t1 |
|
||||
|
||||
| _time | _value | *tag |
|
||||
| -------------------- | ------- | ---- |
|
||||
| 2021-01-01T00:00:00Z | 19 | t2 |
|
||||
| 2021-01-01T00:00:10Z | 4 | t2 |
|
||||
| 2021-01-01T00:00:20Z | -3 | t2 |
|
||||
| 2021-01-01T00:00:30Z | 19 | t2 |
|
||||
| 2021-01-01T00:00:40Z | 13 | t2 |
|
||||
| 2021-01-01T00:00:50Z | 1 | t2 |
|
||||
|
||||
|
||||
#### Output data
|
||||
|
||||
| _time (Reserved) | _value (Reserved) | *tag |
|
||||
| -------------------- | ------------------ | ---- |
|
||||
| 2021-01-01T00:00:00Z | -2 | t1 |
|
||||
| 2021-01-01T00:00:10Z | 10 | t1 |
|
||||
| 2021-01-01T00:00:20Z | 7 | t1 |
|
||||
| 2021-01-01T00:00:30Z | 17 | t1 |
|
||||
| 2021-01-01T00:00:40Z | 15 | t1 |
|
||||
| 2021-01-01T00:00:50Z | 4 | t1 |
|
||||
|
||||
| _time (Reserved) | _value (Reserved) | *tag |
|
||||
| -------------------- | ------------------ | ---- |
|
||||
| 2021-01-01T00:00:00Z | 19 | t2 |
|
||||
| 2021-01-01T00:00:10Z | 4 | t2 |
|
||||
| 2021-01-01T00:00:20Z | -3 | t2 |
|
||||
| 2021-01-01T00:00:30Z | 19 | t2 |
|
||||
| 2021-01-01T00:00:40Z | 13 | t2 |
|
||||
| 2021-01-01T00:00:50Z | 1 | t2 |
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2298-L2300
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2312-L2314
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2327-L2327
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2341-L2341
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2420-L2420
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2434-L2434
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2477-L2477
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2491-L2491
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
@ -50,7 +50,7 @@ When `desc: true`, null values are first in the sort order.
|
|||
|
||||
### columns
|
||||
|
||||
List of columns to sort by. Default is ["_value"].
|
||||
List of columns to sort by. Default is `["_value"]`.
|
||||
|
||||
Sort precedence is determined by list order (left to right).
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2443-L2443
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2457-L2457
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3997-L3999
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4011-L4013
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4048-L4056
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4062-L4070
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2546-L2556
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2560-L2570
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2588-L2591
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2602-L2605
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3325-L3325
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3339-L3339
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2613-L2613
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2627-L2627
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2927-L2930
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2941-L2944
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2364-L2364
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2378-L2378
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3367-L3367
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3381-L3381
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4402-L4407
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4416-L4421
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2398-L2398
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2412-L2412
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3638-L3648
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L3652-L3662
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4749-L4749
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4763-L4763
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4804-L4804
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4818-L4818
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4722-L4722
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4736-L4736
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4638-L4638
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4652-L4652
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4091-L4093
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4105-L4107
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4589-L4589
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4603-L4603
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4780-L4780
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4794-L4794
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -21,7 +21,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4687-L4687
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4701-L4701
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4512-L4520
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4526-L4534
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
|
@ -22,7 +22,7 @@ documentation is generated.
|
|||
To make updates to this documentation, update the function comments above the
|
||||
function definition in the Flux source code:
|
||||
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2661-L2667
|
||||
https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L2675-L2681
|
||||
|
||||
Contributing to Flux: https://github.com/influxdata/flux#contributing
|
||||
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue