Commit Graph

40 Commits (643b2eb30cd4726e58a9052ee6f15ec9bea759cf)

Author SHA1 Message Date
Tom Young d2fd3f50aa Add bitwise AND, OR and XOR operators to InfluxQL. 2017-03-31 21:02:02 +01:00
Jonathan A. Sternberg ccf0cb8371 Fix query parser when using addition and subtraction without spaces
Additionally, support unary addition and subtraction for variables,
calls, and parenthesis expressions. Doing `-value` will be the
equivalent of doing `-1 * value` now.
2017-03-24 12:52:19 -05:00
Jonathan A. Sternberg 208d8507f1 Implement both single and multiline comments in influxql
A single line comment will read until the end of a line and is started
with `--` (just like SQL). A multiline comment is with `/* */`. You
cannot nest multiline comments.
2017-03-15 14:24:09 -05:00
Jonathan A. Sternberg a0d8c1ca9f Add modulo operator to the query language 2017-02-10 10:16:37 -06:00
Edd Robinson 7374e48999 Remove dead code from influxql 2017-01-17 09:47:34 -08:00
Mark Rushakoff 88b8bd2465 Update godoc for package influxql
I did not look at any of the .gen.go files.
2016-12-30 18:02:52 -08:00
Jonathan A. Sternberg 04c59b8941 Fix the dollar sign so it properly handles reserved keywords
The dollar sign would sometimes be accepted as whitespace if it was
immediately followed by a reserved keyword or an invalid character. It
now reads these properly as a bound parameter rather than ignoring the
dollar sign.
2016-09-02 15:32:46 -05:00
Jonathan A. Sternberg ab049d7f0a Support mixed duration units
It is now possible to use a mixed duration unit like `1h30m`. The
duration units can be in whatever order as long as they are connected to
each other.

There is a change to the scanner. A token such as `10x` will be scanned
as a duration literal, but will then fail to parse as an invalid
duration. This should not be a breaking change as there is no situation
where `10m10` was a valid order of tokens for the parser.

Fixes #3634.
2016-08-10 13:34:19 -05:00
Jonathan A. Sternberg 451a5205ef Support bound parameters in the parser
The parser can be passed a map of keys to literal values to be replaced
into the query. Parameters are preceded by a dollar sign (`$`). If a
parameter key is missing, an error is thrown by the parser.

Fixes #2926.
2016-05-18 20:10:15 -04:00
Jonathan A. Sternberg 23f6a706bb Support cast syntax for selecting a specific type
Casting syntax is done with the PostgreSQL syntax `field1::float` to
specify which type should be used when selecting a field. You can also
do `field1::field` or `tag1::tag` to specify that a field or tag should
be selected.

This makes it possible to select a tag when a field key and a tag key
conflict with each other in a measurement. It also means it's possible
to choose a field with a specific type if multiple shards disagree. If
no types are given, the same ordering for how a type is chosen is used
to determine which type to return.

The FieldDimensions method has been updated to return the data type for
the fields that get returned. The SeriesKeys function has also been
removed since it is no longer needed. SeriesKeys was originally used for
the fill iterator, but then expanded to be used by auxiliary iterators
for determining the channel iterator types. The fill iterator doesn't
need it anymore and the auxiliary types are better served by
FieldDimensions implementing that functionality, so SeriesKeys is no
longer needed.

Fixes #6519.
2016-05-16 12:08:29 -04:00
Jonathan A. Sternberg e47426ff6e Support integer literals in the query language
Numbers in the query without any decimal will now be emitted as integers
instead and be parsed as an IntegerLiteral. This ensures we keep the
original context that a query was issued with and allows us to act more
similar to how programming languages are typically structured when it
comes to floats and ints.

This adds functionality for dealing with integers promoting to floats in
the various different places where math are used.

Fixes #5744 and #5629.
2016-03-17 10:37:34 -04:00
Gabriel Levine a9fcc3229a Enable golint for influxql package. 2016-02-18 15:52:37 -05:00
David Norton 99a22c174b fix #2555: add backreference in CQs
Add new query syntax to allow the following in CQs:

INTO "1hPolicy".:MEASUREMENT
2015-09-03 07:12:15 -04:00
Josh Horwitz 96938e8a2b Added check for escaped single quote in string 2015-07-22 17:47:48 -04:00
Ben Johnson b925e1c1af Multi-node clustering.
This commit adds the ability to cluster multiple nodes together to share
the same metadata through raft consensus.
2015-06-05 14:41:19 -06:00
David Norton 775e3d9e55 fix #2281: passthru escapes when parsing regex 2015-05-04 16:04:12 -04:00
David Norton 25cea58635 refactor scanning & parsing of identifiers 2015-04-09 13:21:13 -04:00
Philip O'Toole 6627257f44 Allow leading underscores for IDENTs 2015-03-26 13:11:06 -07:00
David Norton 9d6d36f2e9 fix #1799: change regex delim to '/' & RHS only 2015-03-03 09:32:15 -05:00
David Norton 08796bd6af fix #1799: make scanner recognize regex
Change the regex delimiter from single quotes to back ticks (`) and make
the scanner recognize regex tokens.

Single quotes are used for string literals. Using a unique delimiter for
regular expression literals allows the scanner to recognize regular
expression tokens, which is inline with the way the rest of the
scanner / parser work.
2015-03-03 09:32:15 -05:00
Joseph Rothrock bcad98c902 malformed identifiers get through
Issue: 1768

We weren't checking return codes from scanString.
Added text descriptions for BADSTRING and BADESCAPE tokens.
2015-02-27 13:33:36 -08:00
David Norton 9bff9cdeee issue #1431: wire up regex queries 2015-02-21 15:38:35 -05:00
David Norton 12bed3e74f issue #1430: add where regex to influxql 2015-02-21 15:37:52 -05:00
Ben Johnson 0a73416e4d Use the last ident segment for result names. 2015-01-28 03:57:38 -05:00
Ben Johnson 1eda0ffcb9 Refactoring query engine. 2015-01-27 20:26:31 -05:00
Ben Johnson 3c8c8724ed Implement full ident scanning, single quote strings. 2015-01-19 13:05:38 -07:00
Ben Johnson 81f457907f Add measurement normalization and identifier splitting. 2015-01-18 14:45:22 -07:00
David Norton 5ea393f5ac influxql: fix scanner bug caused by double unread 2015-01-09 18:21:12 -05:00
David Norton 3b649d3e63 influxql: add CREATE CONTINUOUS QUERY (WIP) 2015-01-09 18:21:12 -05:00
David Norton f23417fa5a influxql: add CREATE CONTINUOUS QUERY, : separator 2015-01-09 18:21:12 -05:00
David Norton 96e8f96d13 influxql: add CREATE RETENTION POLICY statement 2015-01-04 21:50:56 -05:00
Ben Johnson d92d0d4737 Fix NEQ: Change != to <> 2014-12-21 10:43:03 -07:00
Ben Johnson d34bc1f57f Add AST string encoding, substatement extraction. 2014-12-06 11:17:58 -07:00
Ben Johnson 91f16db3af Add LIST/DROP SERIES and LIST/DROP CONTINUOUS QUERIES. 2014-11-22 16:33:21 -07:00
Ben Johnson 6ef8d4634a Add influxql parser. 2014-11-21 21:12:48 -07:00
Ben Johnson 1ca44658e5 Add semicolon, INSERT, INTO to Scanner. 2014-11-20 08:02:47 -07:00
Ben Johnson bac1b48cf7 Fix Scanner.Scan() comment. 2014-11-19 21:11:56 -07:00
Ben Johnson f94b588013 Fix EQ token scanning. 2014-11-19 17:16:38 -07:00
Ben Johnson 3d612fafbf Add InfluxQL scanner.
This commit adds a pure Go implementation of the InfluxQL scanner. It includes support for:

- Identifiers
- Numbers
- Strings
- Durations
- Booleans
- Numeric and logical operators
- InfluxQL keywords
2014-11-19 16:47:46 -07:00
Ben Johnson 0e9a74294e Add InfluxQL AST and tokens. 2014-11-15 12:04:30 -07:00