package
0.13.0
Repository: https://github.com/tencentblueking/influxdb.git
Documentation: pkg.go.dev

# README

The Influx Query Language Specification

Introduction

This is a reference for the Influx Query Language ("InfluxQL").

InfluxQL is a SQL-like query language for interacting with InfluxDB. It has been lovingly crafted to feel familiar to those coming from other SQL or SQL-like environments while providing features specific to storing and analyzing time series data.

Notation

The syntax is specified using Extended Backus-Naur Form ("EBNF"). EBNF is the same notation used in the Go programming language specification, which can be found here. Not so coincidentally, InfluxDB is written in Go.

Production  = production_name "=" [ Expression ] "." .
Expression  = Alternative { "|" Alternative } .
Alternative = Term { Term } .
Term        = production_name | token [ "…" token ] | Group | Option | Repetition .
Group       = "(" Expression ")" .
Option      = "[" Expression "]" .
Repetition  = "{" Expression "}" .

Notation operators in order of increasing precedence:

|   alternation
()  grouping
[]  option (0 or 1 times)
{}  repetition (0 to n times)

Query representation

Characters

InfluxQL is Unicode text encoded in UTF-8.

newline             = /* the Unicode code point U+000A */ .
unicode_char        = /* an arbitrary Unicode code point except newline */ .

Letters and digits

Letters are the set of ASCII characters plus the underscore character _ (U+005F) is considered a letter.

Only decimal digits are supported.

letter              = ascii_letter | "_" .
ascii_letter        = "A" … "Z" | "a" … "z" .
digit               = "0" … "9" .

Identifiers

Identifiers are tokens which refer to database names, retention policy names, user names, measurement names, tag keys, and field keys.

The rules:

  • double quoted identifiers can contain any unicode character other than a new line
  • double quoted identifiers can contain escaped " characters (i.e., \")
  • unquoted identifiers must start with an upper or lowercase ASCII character or "_"
  • unquoted identifiers may contain only ASCII letters, decimal digits, and "_"
identifier          = unquoted_identifier | quoted_identifier .
unquoted_identifier = ( letter ) { letter | digit } .
quoted_identifier   = `"` unicode_char { unicode_char } `"` .

Examples:

cpu
_cpu_stats
"1h"
"anything really"
"1_Crazy-1337.identifier>NAME👍"

Keywords

ALL           ALTER         ANY           AS            ASC           BEGIN
BY            CREATE        CONTINUOUS    DATABASE      DATABASES     DEFAULT
DELETE        DESC          DESTINATIONS  DIAGNOSTICS   DISTINCT      DROP
DURATION      END           EVERY         EXISTS        EXPLAIN       FIELD
FOR           FORCE         FROM          GRANT         GRANTS        GROUP
GROUPS        IF            IN            INF           INNER         INSERT
INTO          KEY           KEYS          LIMIT         SHOW          MEASUREMENT
MEASUREMENTS  NAME          NOT           OFFSET        ON            ORDER
PASSWORD      POLICY        POLICIES      PRIVILEGES    QUERIES       QUERY
READ          REPLICATION   RESAMPLE      RETENTION     REVOKE        SELECT
SERIES        SET           SHARD         SHARDS        SLIMIT        SOFFSET
STATS         SUBSCRIPTION  SUBSCRIPTIONS TAG           TO            USER
USERS         VALUES        WHERE         WITH          WRITE

Literals

Integers

InfluxQL supports decimal integer literals. Hexadecimal and octal literals are not currently supported.

int_lit             = ( "1" … "9" ) { digit } .

Floats

InfluxQL supports floating-point literals. Exponents are not currently supported.

float_lit           = int_lit "." int_lit .

Strings

String literals must be surrounded by single quotes. Strings may contain ' characters as long as they are escaped (i.e., \').

string_lit          = `'` { unicode_char } `'` .

Durations

Duration literals specify a length of time. An integer literal followed immediately (with no spaces) by a duration unit listed below is interpreted as a duration literal.

Duration units

UnitsMeaning
u or µmicroseconds (1 millionth of a second)
msmilliseconds (1 thousandth of a second)
ssecond
mminute
hhour
dday
wweek
duration_lit        = int_lit duration_unit .
duration_unit       = "u" | "µ" | "s" | "h" | "d" | "w" | "ms" .

Dates & Times

The date and time literal format is not specified in EBNF like the rest of this document. It is specified using Go's date / time parsing format, which is a reference date written in the format required by InfluxQL. The reference date time is:

InfluxQL reference date time: January 2nd, 2006 at 3:04:05 PM

time_lit            = "2006-01-02 15:04:05.999999" | "2006-01-02" .

Booleans

bool_lit            = TRUE | FALSE .

Regular Expressions

regex_lit           = "/" { unicode_char } "/" .

Queries

A query is composed of one or more statements separated by a semicolon.

query               = statement { ";" statement } .

statement           = alter_retention_policy_stmt |
                      create_continuous_query_stmt |
                      create_database_stmt |
                      create_retention_policy_stmt |
                      create_subscription_stmt |
                      create_user_stmt |
                      delete_stmt |
                      drop_continuous_query_stmt |
                      drop_database_stmt |
                      drop_measurement_stmt |
                      drop_retention_policy_stmt |
                      drop_series_stmt |
                      drop_subscription_stmt |
                      drop_user_stmt |
                      grant_stmt |
                      show_continuous_queries_stmt |
                      show_databases_stmt |
                      show_field_keys_stmt |
                      show_grants_stmt |
                      show_measurements_stmt |
                      show_retention_policies |
                      show_series_stmt |
                      show_shard_groups_stmt |
                      show_shards_stmt |
                      show_subscriptions_stmt|
                      show_tag_keys_stmt |
                      show_tag_values_stmt |
                      show_users_stmt |
                      revoke_stmt |
                      select_stmt .

Statements

ALTER RETENTION POLICY

alter_retention_policy_stmt  = "ALTER RETENTION POLICY" policy_name on_clause
                               retention_policy_option
                               [ retention_policy_option ]
                               [ retention_policy_option ] .

Examples:

-- Set default retention policy for mydb to 1h.cpu.
ALTER RETENTION POLICY "1h.cpu" ON mydb DEFAULT;

-- Change duration and replication factor.
ALTER RETENTION POLICY policy1 ON somedb DURATION 1h REPLICATION 4

CREATE CONTINUOUS QUERY

create_continuous_query_stmt = "CREATE CONTINUOUS QUERY" query_name on_clause
                               [ "RESAMPLE" resample_opts ]
                               "BEGIN" select_stmt "END" .

query_name                   = identifier .

resample_opts                = (every_stmt for_stmt | every_stmt | for_stmt) .
every_stmt                   = "EVERY" duration_lit
for_stmt                     = "FOR" duration_lit

Examples:

-- selects from default retention policy and writes into 6_months retention policy
CREATE CONTINUOUS QUERY "10m_event_count"
ON db_name
BEGIN
  SELECT count(value)
  INTO "6_months".events
  FROM events
  GROUP BY time(10m)
END;

-- this selects from the output of one continuous query in one retention policy and outputs to another series in another retention policy
CREATE CONTINUOUS QUERY "1h_event_count"
ON db_name
BEGIN
  SELECT sum(count) as count
  INTO "2_years".events
  FROM "6_months".events
  GROUP BY time(1h)
END;

-- this customizes the resample interval so the interval is queried every 10s and intervals are resampled until 2m after their start time
-- when resample is used, at least one of "EVERY" or "FOR" must be used
CREATE CONTINUOUS QUERY "cpu_mean"
ON db_name
RESAMPLE EVERY 10s FOR 2m
BEGIN
  SELECT mean(value)
  INTO "cpu_mean"
  FROM "cpu"
  GROUP BY time(1m)
END;

CREATE DATABASE

create_database_stmt = "CREATE DATABASE" db_name .

Example:

CREATE DATABASE foo

CREATE RETENTION POLICY

create_retention_policy_stmt = "CREATE RETENTION POLICY" policy_name on_clause
                               retention_policy_duration
                               retention_policy_replication
                               [ "DEFAULT" ] .

Examples

-- Create a retention policy.
CREATE RETENTION POLICY "10m.events" ON somedb DURATION 10m REPLICATION 2;

-- Create a retention policy and set it as the default.
CREATE RETENTION POLICY "10m.events" ON somedb DURATION 10m REPLICATION 2 DEFAULT;

CREATE SUBSCRIPTION

create_subscription_stmt = "CREATE SUBSCRIPTION" subscription_name "ON" db_name "." retention_policy "DESTINATIONS" ("ANY"|"ALL") host { "," host} .

Examples:

-- Create a SUBSCRIPTION on database 'mydb' and retention policy 'default' that send data to 'example.com:9090' via UDP.
CREATE SUBSCRIPTION sub0 ON "mydb"."default" DESTINATIONS ALL 'udp://example.com:9090' ;

-- Create a SUBSCRIPTION on database 'mydb' and retention policy 'default' that round robins the data to 'h1.example.com:9090' and 'h2.example.com:9090'.
CREATE SUBSCRIPTION sub0 ON "mydb"."default" DESTINATIONS ANY 'udp://h1.example.com:9090', 'udp://h2.example.com:9090';

CREATE USER

create_user_stmt = "CREATE USER" user_name "WITH PASSWORD" password
                   [ "WITH ALL PRIVILEGES" ] .

Examples:

-- Create a normal database user.
CREATE USER jdoe WITH PASSWORD '1337password';

-- Create a cluster admin.
-- Note: Unlike the GRANT statement, the "PRIVILEGES" keyword is required here.
CREATE USER jdoe WITH PASSWORD '1337password' WITH ALL PRIVILEGES;

DELETE

delete_stmt = "DELETE" ( from_clause | where_clause | from_clause where_clause ) .

Example:

DELETE FROM cpu
DELETE FROM cpu WHERE time < '2000-01-01T00:00:00Z'
DELETE WHERE time < '2000-01-01T00:00:00Z'

DROP CONTINUOUS QUERY

drop_continuous_query_stmt = "DROP CONTINUOUS QUERY" query_name on_clause .

Example:

DROP CONTINUOUS QUERY myquery ON mydb;

DROP DATABASE

drop_database_stmt = "DROP DATABASE" db_name .

Example:

DROP DATABASE mydb;

DROP MEASUREMENT

drop_measurement_stmt = "DROP MEASUREMENT" measurement_name .

Examples:

-- drop the cpu measurement
DROP MEASUREMENT cpu;

DROP RETENTION POLICY

drop_retention_policy_stmt = "DROP RETENTION POLICY" policy_name on_clause .

Example:

-- drop the retention policy named 1h.cpu from mydb
DROP RETENTION POLICY "1h.cpu" ON mydb;

DROP SERIES

drop_series_stmt = "DROP SERIES" ( from_clause | where_clause | from_clause where_clause ) .

Example:

DROP SUBSCRIPTION

drop_subscription_stmt = "DROP SUBSCRIPTION" subscription_name "ON" db_name "." retention_policy .

Example:

DROP SUBSCRIPTION sub0 ON "mydb"."default";

DROP USER

drop_user_stmt = "DROP USER" user_name .

Example:

DROP USER jdoe;

GRANT

NOTE: Users can be granted privileges on databases that do not exist.

grant_stmt = "GRANT" privilege [ on_clause ] to_clause .

Examples:

-- grant cluster admin privileges
GRANT ALL TO jdoe;

-- grant read access to a database
GRANT READ ON mydb TO jdoe;

SHOW CONTINUOUS QUERIES

show_continuous_queries_stmt = "SHOW CONTINUOUS QUERIES" .

Example:

-- show all continuous queries
SHOW CONTINUOUS QUERIES;

SHOW DATABASES

show_databases_stmt = "SHOW DATABASES" .

Example:

-- show all databases
SHOW DATABASES;

SHOW FIELD KEYS

show_field_keys_stmt = "SHOW FIELD KEYS" [ from_clause ] .

Examples:

-- show field keys from all measurements
SHOW FIELD KEYS;

-- show field keys from specified measurement
SHOW FIELD KEYS FROM cpu;

SHOW GRANTS

show_grants_stmt = "SHOW GRANTS FOR" user_name .

Example:

-- show grants for jdoe
SHOW GRANTS FOR jdoe;

SHOW MEASUREMENTS

show_measurements_stmt = "SHOW MEASUREMENTS" [ with_measurement_clause ] [ where_clause ] [ limit_clause ] [ offset_clause ] .
-- show all measurements
SHOW MEASUREMENTS;

-- show measurements where region tag = 'uswest' AND host tag = 'serverA'
SHOW MEASUREMENTS WHERE region = 'uswest' AND host = 'serverA';

SHOW RETENTION POLICIES

show_retention_policies = "SHOW RETENTION POLICIES" on_clause .

Example:

-- show all retention policies on a database
SHOW RETENTION POLICIES ON mydb;

SHOW SERIES

show_series_stmt = "SHOW SERIES" [ from_clause ] [ where_clause ] [ limit_clause ] [ offset_clause ] .

Example:

SHOW SHARD GROUPS

show_shard_groups_stmt = "SHOW SHARD GROUPS" .

Example:

SHOW SHARD GROUPS;

SHOW SHARDS

show_shards_stmt = "SHOW SHARDS" .

Example:

SHOW SHARDS;

SHOW SUBSCRIPTIONS

show_subscriptions_stmt = "SHOW SUBSCRIPTIONS" .

Example:

SHOW SUBSCRIPTIONS;

SHOW TAG KEYS

show_tag_keys_stmt = "SHOW TAG KEYS" [ from_clause ] [ where_clause ] [ group_by_clause ]
                     [ limit_clause ] [ offset_clause ] .

Examples:

-- show all tag keys
SHOW TAG KEYS;

-- show all tag keys from the cpu measurement
SHOW TAG KEYS FROM cpu;

-- show all tag keys from the cpu measurement where the region key = 'uswest'
SHOW TAG KEYS FROM cpu WHERE region = 'uswest';

-- show all tag keys where the host key = 'serverA'
SHOW TAG KEYS WHERE host = 'serverA';

SHOW TAG VALUES

show_tag_values_stmt = "SHOW TAG VALUES" [ from_clause ] with_tag_clause [ where_clause ]
                       [ group_by_clause ] [ limit_clause ] [ offset_clause ] .

Examples:

-- show all tag values across all measurements for the region tag
SHOW TAG VALUES WITH TAG = 'region';

-- show tag values from the cpu measurement for the region tag
SHOW TAG VALUES FROM cpu WITH KEY = 'region';

-- show tag values from the cpu measurement for region & host tag keys where service = 'redis'
SHOW TAG VALUES FROM cpu WITH KEY IN (region, host) WHERE service = 'redis';

SHOW USERS

show_users_stmt = "SHOW USERS" .

Example:

-- show all users
SHOW USERS;

REVOKE

revoke_stmt = "REVOKE" privilege [ on_clause ] "FROM" user_name .

Examples:

-- revoke cluster admin from jdoe
REVOKE ALL PRIVILEGES FROM jdoe;

-- revoke read privileges from jdoe on mydb
REVOKE READ ON mydb FROM jdoe;

SELECT

select_stmt = "SELECT" fields from_clause [ into_clause ] [ where_clause ]
              [ group_by_clause ] [ order_by_clause ] [ limit_clause ]
              [ offset_clause ] [ slimit_clause ] [ soffset_clause ] .

Examples:

-- select mean value from the cpu measurement where region = 'uswest' grouped by 10 minute intervals
SELECT mean(value) FROM cpu WHERE region = 'uswest' GROUP BY time(10m) fill(0);

-- select from all measurements beginning with cpu into the same measurement name in the cpu_1h retention policy
SELECT mean(value) INTO cpu_1h.:MEASUREMENT FROM /cpu.*/

Clauses

from_clause     = "FROM" measurements .

group_by_clause = "GROUP BY" dimensions fill(fill_option).

into_clause     = "INTO" ( measurement | back_ref ).

limit_clause    = "LIMIT" int_lit .

offset_clause   = "OFFSET" int_lit .

slimit_clause   = "SLIMIT" int_lit .

soffset_clause  = "SOFFSET" int_lit .

on_clause       = "ON" db_name .

order_by_clause = "ORDER BY" sort_fields .

to_clause       = "TO" user_name .

where_clause    = "WHERE" expr .

with_measurement_clause = "WITH MEASUREMENT" ( "=" measurement | "=~" regex_lit ) .

with_tag_clause = "WITH KEY" ( "=" tag_key | "IN (" tag_keys ")" ) .

Expressions

binary_op        = "+" | "-" | "*" | "/" | "AND" | "OR" | "=" | "!=" | "<" |
                   "<=" | ">" | ">=" .

expr             = unary_expr { binary_op unary_expr } .

unary_expr       = "(" expr ")" | var_ref | time_lit | string_lit | int_lit |
                   float_lit | bool_lit | duration_lit | regex_lit .

Other

alias            = "AS" identifier .

back_ref         = ( policy_name ".:MEASUREMENT" ) |
                   ( db_name "." [ policy_name ] ".:MEASUREMENT" ) .

db_name          = identifier .

dimension        = expr .

dimensions       = dimension { "," dimension } .

field_key        = identifier .

field            = expr [ alias ] .

fields           = field { "," field } .

fill_option      = "null" | "none" | "previous" | int_lit | float_lit .

host             = string_lit .

measurement      = measurement_name |
                   ( policy_name "." measurement_name ) |
                   ( db_name "." [ policy_name ] "." measurement_name ) .

measurements     = measurement { "," measurement } .

measurement_name = identifier | regex_lit .

password         = string_lit .

policy_name      = identifier .

privilege        = "ALL" [ "PRIVILEGES" ] | "READ" | "WRITE" .

query_name       = identifier .

retention_policy = identifier .

retention_policy_option      = retention_policy_duration |
                               retention_policy_replication |
                               "DEFAULT" .

retention_policy_duration    = "DURATION" duration_lit .
retention_policy_replication = "REPLICATION" int_lit

series_id        = int_lit .

sort_field       = field_key [ ASC | DESC ] .

sort_fields      = sort_field { "," sort_field } .

subscription_name = identifier .

tag_key          = identifier .

tag_keys         = tag_key { "," tag_key } .

user_name        = identifier .

var_ref          = measurement .

Query Engine Internals

Once you understand the language itself, it's important to know how these language constructs are implemented in the query engine. This gives you an intuitive sense for how results will be processed and how to create efficient queries.

The life cycle of a query looks like this:

  1. InfluxQL query string is tokenized and then parsed into an abstract syntax tree (AST). This is the code representation of the query itself.

  2. The AST is passed to the QueryExecutor which directs queries to the appropriate handlers. For example, queries related to meta data are executed by the meta service and SELECT statements are executed by the shards themselves.

  3. The query engine then determines the shards that match the SELECT statement's time range. From these shards, iterators are created for each field in the statement.

  4. Iterators are passed to the emitter which drains them and joins the resulting points. The emitter's job is to convert simple time/value points into the more complex result objects that are returned to the client.

Understanding Iterators

Iterators are at the heart of the query engine. They provide a simple interface for looping over a set of points. For example, this is an iterator over Float points:

type FloatIterator interface {
    Next() *FloatPoint
}

These iterators are created through the IteratorCreator interface:

type IteratorCreator interface {
    CreateIterator(opt *IteratorOptions) (Iterator, error)
}

The IteratorOptions provide arguments about field selection, time ranges, and dimensions that the iterator creator can use when planning an iterator. The IteratorCreator interface is used at many levels such as the Shards, Shard, and Engine. This allows optimizations to be performed when applicable such as returning a precomputed COUNT().

Iterators aren't just for reading raw data from storage though. Iterators can be composed so that they provided additional functionality around an input iterator. For example, a DistinctIterator can compute the distinct values for each time window for an input iterator. Or a FillIterator can generate additional points that are missing from an input iterator.

This composition also lends itself well to aggregation. For example, a statement such as this:

SELECT MEAN(value) FROM cpu GROUP BY time(10m)

In this case, MEAN(value) is a MeanIterator wrapping an iterator from the underlying shards. However, if we can add an additional iterator to determine the derivative of the mean:

SELECT DERIVATIVE(MEAN(value), 20m) FROM cpu GROUP BY time(10m)

Understanding Auxiliary Fields

Because InfluxQL allows users to use selector functions such as FIRST(), LAST(), MIN(), and MAX(), the engine must provide a way to return related data at the same time with the selected point.

For example, in this query:

SELECT FIRST(value), host FROM cpu GROUP BY time(1h)

We are selecting the first value that occurs every hour but we also want to retrieve the host associated with that point. Since the Point types only specify a single typed Value for efficiency, we push the host into the auxiliary fields of the point. These auxiliary fields are attached to the point until it is passed to the emitter where the fields get split off to their own iterator.

Built-in Iterators

There are many helper iterators that let us build queries:

  • Merge Iterator - This iterator combines one or more iterators into a single new iterator of the same type. This iterator guarantees that all points within a window will be output before starting the next window but does not provide ordering guarantees within the window. This allows for fast access for aggregate queries which do not need stronger sorting guarantees.

  • Sorted Merge Iterator - This iterator also combines one or more iterators into a new iterator of the same type. However, this iterator guarantees time ordering of every point. This makes it slower than the MergeIterator but this ordering guarantee is required for non-aggregate queries which return the raw data points.

  • Limit Iterator - This iterator limits the number of points per name/tag group. This is the implementation of the LIMIT & OFFSET syntax.

  • Fill Iterator - This iterator injects extra points if they are missing from the input iterator. It can provide null points, points with the previous value, or points with a specific value.

  • Buffered Iterator - This iterator provides the ability to "unread" a point back onto a buffer so it can be read again next time. This is used extensively to provide lookahead for windowing.

  • Reduce Iterator - This iterator calls a reduction function for each point in a window. When the window is complete then all points for that window are output. This is used for simple aggregate functions such as COUNT().

  • Reduce Slice Iterator - This iterator collects all points for a window first and then passes them all to a reduction function at once. The results are returned from the iterator. This is used for aggregate functions such as DERIVATIVE().

  • Transform Iterator - This iterator calls a transform function for each point from an input iterator. This is used for executing binary expressions.

  • Dedupe Iterator - This iterator only outputs unique points. It is resource intensive so it is only used for small queries such as meta query statements.

Call Iterators

Function calls in InfluxQL are implemented at two levels. Some calls can be wrapped at multiple layers to improve efficiency. For example, a COUNT() can be performed at the shard level and then multiple CountIterators can be wrapped with another CountIterator to compute the count of all shards. These iterators can be created using NewCallIterator().

Some iterators are more complex or need to be implemented at a higher level. For example, the DERIVATIVE() needs to retrieve all points for a window first before performing the calculation. This iterator is created by the engine itself and is never requested to be created by the lower levels.

# Functions

AggregateBooleanPoints feeds a slice of BooleanPoint into an aggregator.
AggregateFloatPoints feeds a slice of FloatPoint into an aggregator.
AggregateIntegerPoints feeds a slice of IntegerPoint into an aggregator.
AggregateStringPoints feeds a slice of StringPoint into an aggregator.
No description provided by the author
BooleanCountReduce returns the count of points.
BooleanFirstReduce returns the first point sorted by time.
BooleanLastReduce returns the first point sorted by time.
BooleanMaxReduce returns the minimum value between prev & curr.
BooleanMinReduce returns the minimum value between prev & curr.
CloneExpr returns a deep copy of the expression.
CloneRegexLiteral returns a clone of the RegexLiteral.
ContainsVarRef returns true if expr is a VarRef or contains one.
DrainIterator reads all points from an iterator.
DrainIterators reads all points from all iterators.
ErrDatabaseNotFound returns a database not found error for the given database name.
ErrMeasurementNotFound returns a measurement not found error for the given measurement name.
Eval evaluates expr against a map.
EvalBool evaluates expr and returns true if result is a boolean true.
ExprNames returns a list of non-"time" field names from an expression.
FloatCountReduce returns the count of points.
FloatFirstReduce returns the first point sorted by time.
FloatLastReduce returns the last point sorted by time.
FloatMaxReduce returns the maximum value between prev & curr.
FloatMedianReduceSlice returns the median value within a window.
FloatMinReduce returns the minimum value between prev & curr.
FloatSpreadReduceSlice returns the spread value within a window.
FloatStddevReduceSlice returns the stddev value within a window.
FloatSumReduce returns the sum prev value & curr value.
FormatDuration formats a duration to a string.
HasTimeExpr returns true if the expression has a time term.
IdentNeedsQuotes returns true if the ident string given would require quotes.
InspectDataType returns the data type of a given value.
No description provided by the author
IntegerCountReduce returns the count of points.
IntegerFirstReduce returns the first point sorted by time.
IntegerLastReduce returns the last point sorted by time.
IntegerMaxReduce returns the maximum value between prev & curr.
IntegerMedianReduceSlice returns the median value within a window.
IntegerMinReduce returns the minimum value between prev & curr.
IntegerSpreadReduceSlice returns the spread value within a window.
IntegerStddevReduceSlice returns the stddev value within a window.
IntegerSumReduce returns the sum prev value & curr value.
IsRegexOp returns true if the operator accepts a regex operand.
IsSystemName returns true if name is an internal system name.
LimitTagSets returns a tag set list with SLIMIT and SOFFSET applied.
Lookup returns the token associated with a given string.
MatchSource returns the source name that matches a field name.
MustParseExpr parses an expression string and returns its AST.
MustParseStatement parses a statement string and returns its AST.
NewAuxIterator returns a new instance of AuxIterator.
NewBooleanDistinctReducer creates a new BooleanDistinctReducer.
NewBooleanElapsedReducer creates a new BooleanElapsedReducer.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewBooleanPointDecoder returns a new instance of BooleanPointDecoder that reads from r.
NewBooleanPointEncoder returns a new instance of BooleanPointEncoder that writes to w.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewCallIterator returns a new iterator for a Call.
NewDedupeIterator returns an iterator that only outputs unique points.
NewDistinctIterator returns an iterator for operating on a distinct() call.
NewEmitter returns a new instance of Emitter that pulls from itrs.
NewFillIterator returns an iterator that fills in missing points in an aggregate.
NewFloatBottomReduceSliceFunc returns the bottom values within a window.
NewFloatDerivativeReducer creates a new FloatDerivativeReducer.
NewFloatDifferenceReducer creates a new FloatDifferenceReducer.
NewFloatDistinctReducer creates a new FloatDistinctReducer.
NewFloatElapsedReducer creates a new FloatElapsedReducer.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewFloatMeanReducer creates a new FloatMeanReducer.
NewFloatMovingAverageReducer creates a new FloatMovingAverageReducer.
NewFloatPercentileReduceSliceFunc returns the percentile value within a window.
NewFloatPointDecoder returns a new instance of FloatPointDecoder that reads from r.
NewFloatPointEncoder returns a new instance of FloatPointEncoder that writes to w.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewFloatTopReduceSliceFunc returns the top values within a window.
NewIntegerBottomReduceSliceFunc returns the bottom values within a window.
NewIntegerDerivativeReducer creates a new IntegerDerivativeReducer.
NewIntegerDifferenceReducer creates a new IntegerDifferenceReducer.
NewIntegerDistinctReducer creates a new IntegerDistinctReducer.
NewIntegerElapsedReducer creates a new IntegerElapsedReducer.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewIntegerMeanReducer creates a new IntegerMeanReducer.
NewIntegerMovingAverageReducer creates a new IntegerMovingAverageReducer.
NewIntegerPercentileReduceSliceFunc returns the percentile value within a window.
NewIntegerPointDecoder returns a new instance of IntegerPointDecoder that reads from r.
NewIntegerPointEncoder returns a new instance of IntegerPointEncoder that writes to w.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewIntegerTopReduceSliceFunc returns the top values within a window.
NewInterruptIterator returns an iterator that will stop producing output when a channel has been closed on the passed in channel.
NewIntervalIterator returns an iterator that sets the time on each point to the interval.
NewIteratorEncoder encodes an iterator's points to w.
NewLimitIterator returns an iterator that limits the number of points per grouping.
NewMergeIterator returns an iterator to merge itrs into one.
NewParser returns a new instance of Parser.
NewPointDecoder returns a new instance of PointDecoder that reads from r.
NewPrivilege returns an initialized *Privilege.
NewQueryExecutor returns a new instance of QueryExecutor.
NewReaderIterator returns an iterator that streams from a reader.
NewScanner returns a new instance of Scanner.
NewSortedMergeIterator returns an iterator to merge itrs into one.
NewStringDistinctReducer creates a new StringDistinctReducer.
NewStringElapsedReducer creates a new StringElapsedReducer.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewStringPointDecoder returns a new instance of StringPointDecoder that reads from r.
NewStringPointEncoder returns a new instance of StringPointEncoder that writes to w.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewTags returns a new instance of Tags.
OnlyTimeExpr returns true if the expression only has time constraints.
ParseDuration parses a time duration from a string.
ParseExpr parses an expression string and returns its AST representation.
ParseQuery parses a query string and returns its AST representation.
ParseStatement parses a statement string and returns its AST representation.
PointLimitMonitor is a query monitor that exits when the number of points emitted exceeds a threshold.
QuoteIdent returns a quoted identifier from multiple bare identifiers.
QuoteString returns a quoted string.
ReadOnlyWarning generates a warning message that tells the user the command they are using is being used for writing in a read only context.
Reduce evaluates expr using the available values in valuer.
Rewrite recursively invokes the rewriter to replace each node.
RewriteExpr recursively invokes the function to replace each expr.
RewriteFunc rewrites a node hierarchy.
RewriteStatement rewrites stmt into a new statement, if applicable.
Sanitize attempts to sanitize passwords out of a raw query.
ScanBareIdent reads bare identifier from a rune reader.
ScanDelimited reads a delimited set of runes.
ScanString reads a quoted string from a rune reader.
Select executes stmt against ic and returns a list of iterators to stream from.
StringCountReduce returns the count of points.
StringFirstReduce returns the first point sorted by time.
StringLastReduce returns the first point sorted by time.
StringStddevReduceSlice always returns "".
TimeRange returns the minimum and maximum times specified by an expression.
TimeRangeAsEpochNano returns the minimum and maximum times, as epoch nano, specified by and expression.
Walk traverses a node hierarchy in depth-first order.
WalkFunc traverses a node hierarchy in depth-first order.

# Constants

+.
ALL and the following are InfluxQL Keywords.
AllPrivileges means all privileges required / granted / revoked.
These are a comprehensive list of InfluxQL language tokens.
AND.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
\q.
`.*.
"abc.
These are a comprehensive list of InfluxQL language tokens.
Boolean means the data type is a boolean.
These are a comprehensive list of InfluxQL language tokens.
:.
,.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
DateFormat represents the format for date literals.
DateTimeFormat represents the format for date time literals.
These are a comprehensive list of InfluxQL language tokens.
DefaultQueryTimeout is the default timeout for executing a query.
DefaultStatsInterval is the default value for IteratorEncoder.StatsInterval.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
/.
.
These are a comprehensive list of InfluxQL language tokens.
Duration means the data type is a duration of time.
These are a comprehensive list of InfluxQL language tokens.
13h.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
=.
=~.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
false.
These are a comprehensive list of InfluxQL language tokens.
Float means the data type is a float.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
>.
>=.
main.
These are a comprehensive list of InfluxQL language tokens.
ILLEGAL Token, EOF, WS are Special InfluxQL tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
Integer means the data type is a integer.
12345.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
(.
<.
<=.
MaxTime is used as the maximum time value when computing an unbounded range.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
MinTime is used as the minimum time value when computing an unbounded range.
*.
These are a comprehensive list of InfluxQL language tokens.
!=.
!~.
NoFill means that empty aggregate windows will be purged from the result.
NoPrivileges means no privileges required / granted / revoked.
These are a comprehensive list of InfluxQL language tokens.
NullFill means that empty aggregate windows will just have null values.
12345.67.
NumberFill means that empty aggregate windows will be filled with the given number.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
OR.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
PreviousFill means that empty aggregate windows will be filled with whatever the previous aggregate window had.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
ReadPrivilege means read privilege required / granted / revoked.
Regular expressions.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
).
These are a comprehensive list of InfluxQL language tokens.
;.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
String means the data type is a string of text.
"abc".
-.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
Time means the data type is a time.
These are a comprehensive list of InfluxQL language tokens.
true.
Unknown primitive data type.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
WarningLevel is the message level for a warning.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
These are a comprehensive list of InfluxQL language tokens.
WritePrivilege means write privilege required / granted / revoked.
These are a comprehensive list of InfluxQL language tokens.
ZeroTime is the Unix nanosecond timestamp for time.Time{}.

# Variables

ErrInvalidDuration is returned when parsing a malformatted duration.
ErrInvalidQuery is returned when executing an unknown query type.
ErrMaxConcurrentQueriesReached is an error when a query cannot be run because the maximum number of queries has been reached.
ErrMaxPointsReached is an error when a query hits the maximum number of points.
ErrNotExecuted is returned when a statement is not executed in a query.
ErrQueryEngineShutdown is an error sent when the query cannot be created because the query engine was shutdown.
ErrQueryInterrupted is an error returned when the query is interrupted.
ErrQueryTimeoutReached is an error when a query hits the timeout.
ErrUnknownCall is returned when operating on an unknown function call.

# Structs

AlterRetentionPolicyStatement represents a command to alter an existing retention policy.
BinaryExpr represents an operation between two expressions.
BooleanDistinctReducer returns the distinct points in a series.
BooleanElapsedReducer calculates the elapsed of the aggregated points.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
BooleanLiteral represents a boolean literal.
BooleanPoint represents a point with a bool value.
NewBooleanPointDecoder decodes BooleanPoint points from a reader.
NewBooleanPointEncoder encodes BooleanPoint points to a writer.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Call represents a function call.
CreateContinuousQueryStatement represents a command for creating a continuous query.
CreateDatabaseStatement represents a command for creating a new database.
CreateRetentionPolicyStatement represents a command to create a retention policy.
CreateSubscriptionStatement represents a command to add a subscription to the incoming data stream.
CreateUserStatement represents a command for creating a new user.
DeleteSeriesStatement represents a command for deleting all or part of a series from a database.
DeleteStatement represents a command for removing data from the database.
Dimension represents an expression that a select statement is grouped by.
Distinct represents a DISTINCT expression.
DropContinuousQueryStatement represents a command for removing a continuous query.
DropDatabaseStatement represents a command to drop a database.
DropMeasurementStatement represents a command to drop a measurement.
DropRetentionPolicyStatement represents a command to drop a retention policy from a database.
DropSeriesStatement represents a command for removing a series from the database.
DropShardStatement represents a command for removing a shard from the node.
DropSubscriptionStatement represents a command to drop a subscription to the incoming data stream.
DropUserStatement represents a command for dropping a user.
DurationLiteral represents a duration literal.
Emitter groups values together by name,.
ExecutionContext contains state that the query is currently executing with.
ExecutionPrivilege is a privilege required for a user to execute a statement on a database or resource.
Field represents an expression retrieved from a select statement.
FloatDerivativeReducer calculates the derivative of the aggregated points.
FloatDifferenceReducer calculates the derivative of the aggregated points.
FloatDistinctReducer returns the distinct points in a series.
FloatElapsedReducer calculates the elapsed of the aggregated points.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
FloatMeanReducer calculates the mean of the aggregated points.
FloatMovingAverageReducer calculates the moving average of the aggregated points.
FloatPoint represents a point with a float64 value.
NewFloatPointDecoder decodes FloatPoint points from a reader.
NewFloatPointEncoder encodes FloatPoint points to a writer.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GrantAdminStatement represents a command for granting admin privilege.
GrantStatement represents a command for granting a privilege.
IntegerDerivativeReducer calculates the derivative of the aggregated points.
IntegerDifferenceReducer calculates the derivative of the aggregated points.
IntegerDistinctReducer returns the distinct points in a series.
IntegerElapsedReducer calculates the elapsed of the aggregated points.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
IntegerLiteral represents an integer literal.
IntegerMeanReducer calculates the mean of the aggregated points.
IntegerMovingAverageReducer calculates the moving average of the aggregated points.
IntegerPoint represents a point with a int64 value.
NewIntegerPointDecoder decodes IntegerPoint points from a reader.
NewIntegerPointEncoder encodes IntegerPoint points to a writer.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Interval represents a repeating interval for a query.
IteratorEncoder is an encoder for encoding an iterator's points to w.
IteratorOptions is an object passed to CreateIterator to specify creation options.
IteratorStats represents statistics about an iterator.
No description provided by the author
Measurement represents a single measurement used as a datasource.
Message represents a user-facing message to be included with the result.
NowValuer returns only the value for "now()".
NumberLiteral represents a numeric literal.
ParenExpr represents a parenthesized expression.
ParseError represents an error that occurred during parsing.
Parser represents an InfluxQL parser.
NewPointDecoder decodes generic points from a reader.
Pos specifies the line and character position of a token.
Query represents a collection of ordered statements.
QueryExecutor executes every statement in an Query.
QueryTask is the internal data structure for managing queries.
RegexLiteral represents a regular expression.
Result represents a resultset returned from a single statement.
RevokeAdminStatement represents a command to revoke admin privilege from a user.
RevokeStatement represents a command to revoke a privilege from a user.
Scanner represents a lexical scanner for InfluxQL.
SelectOptions are options that customize the select call.
SelectStatement represents a command for extracting data from the database.
Series represents a series that will be returned by the iterator.
SetPasswordUserStatement represents a command for changing user password.
ShowContinuousQueriesStatement represents a command for listing continuous queries.
ShowDatabasesStatement represents a command for listing all databases in the cluster.
ShowDiagnosticsStatement represents a command for show node diagnostics.
ShowFieldKeysStatement represents a command for listing field keys.
ShowGrantsForUserStatement represents a command for listing user privileges.
ShowMeasurementsStatement represents a command for listing measurements.
SowQueriesStatement represents a command for listing all running queries.
ShowRetentionPoliciesStatement represents a command for listing retention policies.
ShowSeriesStatement represents a command for listing series in the database.
ShowShardGroupsStatement represents a command for displaying shard groups in the cluster.
ShowShardsStatement represents a command for displaying shards in the cluster.
ShowStatsStatement displays statistics for a given module.
ShowSubscriptionsStatement represents a command to show a list of subscriptions.
ShowTagKeysStatement represents a command for listing tag keys.
ShowTagValuesStatement represents a command for listing tag values.
ShowUsersStatement represents a command for listing users.
SortField represents a field to sort results by.
StringDistinctReducer returns the distinct points in a series.
StringElapsedReducer calculates the elapsed of the aggregated points.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
StringLiteral represents a string literal.
StringPoint represents a point with a string value.
NewStringPointDecoder decodes StringPoint points from a reader.
NewStringPointEncoder encodes StringPoint points to a writer.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Tags represent a map of keys and values.
TagSet is a fundamental concept within the query system.
Target represents a target (destination) policy, measurement, and DB.
TimeLiteral represents a point-in-time literal.
VarRef represents a reference to a variable.
Wildcard represents a wild card expression.

# Interfaces

AuxIterator represents an iterator that can split off separate auxilary iterators.
BooleanBulkPointAggregator aggregates multiple points at a time.
BooleanIterator represents a stream of boolean points.
BooleanPointAggregator aggregates points to produce a single point.
BooleanPointEmitter produces a single point from an aggregate.
Expr represents an expression that can be evaluated to a value.
FloatBulkPointAggregator aggregates multiple points at a time.
FloatIterator represents a stream of float points.
FloatPointAggregator aggregates points to produce a single point.
FloatPointEmitter produces a single point from an aggregate.
HasDefaultDatabase provides an interface to get the default database from a Statement.
IntegerBulkPointAggregator aggregates multiple points at a time.
IntegerIterator represents a stream of integer points.
IntegerPointAggregator aggregates points to produce a single point.
IntegerPointEmitter produces a single point from an aggregate.
Iterator represents a generic interface for all Iterators.
IteratorCreator represents an interface for objects that can create Iterators.
Literal represents a static literal.
Node represents a node in the InfluxDB abstract syntax tree.
Point represents a value in a series that occurred at a given time.
Rewriter can be called by Rewrite to replace nodes in the AST hierarchy.
Source represents a source of data for a statement.
Statement represents a single command in InfluxQL.
StatementExecutor executes a statement within the QueryExecutor.
StringBulkPointAggregator aggregates multiple points at a time.
StringIterator represents a stream of string points.
StringPointAggregator aggregates points to produce a single point.
StringPointEmitter produces a single point from an aggregate.
Valuer is the interface that wraps the Value() method.
Visitor can be called by Walk to traverse an AST hierarchy.

# Type aliases

BooleanReduceFloatFunc is the function called by a BooleanPoint reducer.
BooleanReduceFloatSliceFunc is the function called by a BooleanPoint reducer.
BooleanReduceFunc is the function called by a BooleanPoint reducer.
BooleanReduceIntegerFunc is the function called by a BooleanPoint reducer.
BooleanReduceIntegerSliceFunc is the function called by a BooleanPoint reducer.
BooleanReduceSliceFunc is the function called by a BooleanPoint reducer.
BooleanReduceStringFunc is the function called by a BooleanPoint reducer.
BooleanReduceStringSliceFunc is the function called by a BooleanPoint reducer.
DataType represents the primitive data types available in InfluxQL.
Dimensions represents a list of dimensions.
ExecutionPrivileges is a list of privileges required to execute a statement.
Fields represents a list of fields.
FillOption represents different options for aggregate windows.
FloatReduceBooleanFunc is the function called by a FloatPoint reducer.
FloatReduceBooleanSliceFunc is the function called by a FloatPoint reducer.
FloatReduceFunc is the function called by a FloatPoint reducer.
FloatReduceIntegerFunc is the function called by a FloatPoint reducer.
FloatReduceIntegerSliceFunc is the function called by a FloatPoint reducer.
FloatReduceSliceFunc is the function called by a FloatPoint reducer.
FloatReduceStringFunc is the function called by a FloatPoint reducer.
FloatReduceStringSliceFunc is the function called by a FloatPoint reducer.
IntegerReduceBooleanFunc is the function called by a IntegerPoint reducer.
IntegerReduceBooleanSliceFunc is the function called by a IntegerPoint reducer.
IntegerReduceFloatFunc is the function called by a IntegerPoint reducer.
IntegerReduceFloatSliceFunc is the function called by a IntegerPoint reducer.
IntegerReduceFunc is the function called by a IntegerPoint reducer.
IntegerReduceSliceFunc is the function called by a IntegerPoint reducer.
IntegerReduceStringFunc is the function called by a IntegerPoint reducer.
IntegerReduceStringSliceFunc is the function called by a IntegerPoint reducer.
IteratorCreators represents a list of iterator creators.
Iterators represents a list of iterators.
Measurements represents a list of measurements.
Points represents a list of points.
Privilege is a type of action a user can be granted the right to use.
QueryMonitorFunc is a function that will be called to check if a query is currently healthy.
SeriesList is a list of series that will be returned by an iterator.
SortFields represents an ordered list of ORDER BY fields.
Sources represents a list of sources.
Statements represents a list of statements.
StringReduceBooleanFunc is the function called by a StringPoint reducer.
StringReduceBooleanSliceFunc is the function called by a StringPoint reducer.
StringReduceFloatFunc is the function called by a StringPoint reducer.
StringReduceFloatSliceFunc is the function called by a StringPoint reducer.
StringReduceFunc is the function called by a StringPoint reducer.
StringReduceIntegerFunc is the function called by a StringPoint reducer.
StringReduceIntegerSliceFunc is the function called by a StringPoint reducer.
StringReduceSliceFunc is the function called by a StringPoint reducer.
Token is a lexical token of the InfluxQL language.