Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fluxFunctions): add getColumn, getRecord, tableFind #15289

Merged
merged 2 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
1. [15040](https://github.com/influxdata/influxdb/pull/15040): Redesign check builder UI to fill the screen and make more room for composing message templates
1. [14990](https://github.com/influxdata/influxdb/pull/14990): Move Tokens tab from Settings to Load Data page
1. [14990](https://github.com/influxdata/influxdb/pull/14990): Expose all Settings tabs in navigation menu
1. [15289](https://github.com/influxdata/influxdb/pull/15289): Added Stream and table functions to query builder

### Bug Fixes

Expand Down
51 changes: 51 additions & 0 deletions ui/src/shared/constants/fluxFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,40 @@ export const FLUX_FUNCTIONS: FluxToolbarFunction[] = [
'https://v2.docs.influxdata.com/v2.0/reference/flux/stdlib/built-in/transformations/type-conversions/float/',
},
FROM,
{
name: 'getColumn',
args: [
{
name: 'column',
desc: 'The name of the column to extract.',
type: 'String',
},
],
package: '',
desc:
'Extracts a column from a table given its label. If the label is not present in the set of columns, the function errors.',
example: 'getColumn(column: "_value")',
category: 'Transformations',
link:
'https://v2.docs.influxdata.com/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/getcolumn/',
},
{
name: 'getRecord',
args: [
{
name: 'idx',
desc: 'The index of the record to extract.',
type: 'Integer',
},
],
package: '',
desc:
'Extracts a record from a table given the record’s index. If the index is out of bounds, the function errors.',
example: 'getRecord(idx: 0)',
category: 'Transformations',
link:
'https://v2.docs.influxdata.com/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/getrecord/',
},
{
name: 'group',
args: [
Expand Down Expand Up @@ -4054,6 +4088,23 @@ export const FLUX_FUNCTIONS: FluxToolbarFunction[] = [
link:
'https://v2.docs.influxdata.com/v2.0/reference/flux/stdlib/system/time/',
},
{
name: 'tableFind',
args: [
{
name: 'fn',
desc: 'A predicate function for matching keys in a table group key.',
type: 'Function',
},
],
package: '',
desc:
'Extracts the first table in a stream of tables whose group key values match a predicate. If no table is found, the function errors.',
example: 'tableFind(fn: (key) => key._field == "fieldName")',
category: 'Transformations',
link:
'https://v2.docs.influxdata.com/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/tablefind/',
},
{
name: 'tail',
args: [
Expand Down