Commit Graph

52 Commits (fb7388cdfc169921aaac976234d5b7063677afc1)

Author SHA1 Message Date
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
Cory LaNou 1117526873 remove IF EXISTS/IF NOT EXISTS from influxql language 2016-07-29 12:58:05 -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 18fa63fdac Remove unused FORCE and INNER keywords 2016-05-03 13:21:14 -04:00
Ben Johnson 291dd08cd4
remove SHOW SERVERS & DROP SERVER
This commit removes support for `SHOW SERVERS` and `DROP SERVER`
from the `influxql` package. It also removes extraneous cluster
testing code from `cmd/influxd/run`.

Fixes #6465
2016-04-26 10:28:42 -06:00
Jonathan A. Sternberg 3e580bcf04 Allow a query to be killed
While this allows a query to be killed, it doesn't really do anything
yet since the interrupt happens only after the first row gets emitted
(the entire first series).

This section of code will likely have to be refactored to make this work
since we need a way to interrupt a currently running iterator.
2016-03-21 12:07:06 -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
Ben Johnson 5a0d1ab7c1 rename influxdb/influxdb to influxdata/influxdb
This commit changes all the import and URL references from:

    github.com/influxdb/influxdb

to:

    github.com/influxdata/influxdb
2016-02-10 10:26:18 -07:00
Jonathan A. Sternberg 5d4ecf853c Add continuous query option for customizing resampling
This makes the following syntax possible:

    CREATE CONTINUOUS QUERY mycq ON mydb
        RESAMPLE EVERY 1m FOR 1h
        BEGIN
          SELECT mean(value) INTO cpu_mean FROM cpu GROUP BY time(5m)
        END

The RESAMPLE option customizes how often an interval will be sampled and
the duration. The interval is customized with EVERY. Any intervals
within the resampling duration on a multiple of the resample interval
will be updated with the new results from the query.

The duration is customized with FOR. This determines how long an
interval will participate in resampling.

Both options are optional. If RESAMPLE is in the syntax, at least one of
the two needs to be given. The default for both is the interval of the
continuous query.

The service also improves tracking of the last run time and the logic of
when a query for an interval should be run. When determining the oldest
interval to run for a query, the continuous query service determines
what would have been the optimal time to perform the next query based on
the last run time. It then uses this time to determine the oldest
interval that should be run using the resample duration and will
resample all intervals between this time and the current time as opposed
to potentially forgetting about the last run in an interval if the
continuous query service gets delayed for some reason.

This removes the previous config options for customizing continuous
queries since they are no longer relevant and adds a new option of
customizing the run interval. The run interval determines how often the
continuous query service polls for when it should execute a query. This
option defaults to 1s, but can be set to 1m if the least common factor
of all continuous queries' intervals is a higher value (like 1m).
2015-12-28 16:43:49 -05:00
Mateusz Dymiński 8090ba6830 SHOW SHARD GROUPS 2015-11-14 22:27:24 +01:00
David Norton a3d127f797 Revert "add RENAME DATABASE"
This reverts commit 7212bfce83.

Conflicts:
	influxql/parser.go
	influxql/token.go
	meta/internal/meta.pb.go
	meta/internal/meta.proto
2015-10-20 09:01:34 -04:00
linearb 7212bfce83 add RENAME DATABASE 2015-10-09 13:55:38 -04:00
Nick Dawbarn 26f6d00668 Bugfix for #3429 String representations of RegexLiterals generated in influxql/ast.go add the / char as a start and end delimiter, but does not escape any / characters that may exist with the regex 2015-10-08 19:41:36 +10:00
Philip O'Toole 2ac0357406 Support dropping non-Raft nodes 2015-10-04 00:19:52 -07:00
Philip O'Toole d74e0690c7 Revert "Merge pull request #4233 from influxdb/drop-server"
This reverts commit 0bdb36f6dc, reversing
changes made to 3085fbc138.
2015-10-02 08:39:57 -07:00
Cory LaNou 205c7674f6 add drop server tests 2015-10-01 15:39:14 -05:00
Ben Johnson bbc5539517 add SHOW SHARDS statement
This commit adds the ability to list all shards in the cluster
and return their id, start time, end time, expiry time, and
owner ids. Shards are grouped by database.

Fixes #3562
2015-09-03 15:46:52 -06:00
Philip O'Toole 1228c985ea Parser support for CREATE DATABASE IF NOT EXISTS 2015-08-28 19:04:50 -07:00
Josh Horwitz 96938e8a2b Added check for escaped single quote in string 2015-07-22 17:47:48 -04:00
David Norton 775e3d9e55 fix #2281: passthru escapes when parsing regex 2015-05-04 16:04:12 -04:00
Marcos Lilljedahl 2bac1a8097 Add test for REGEX operators 2015-04-20 19:43:06 -03:00
David Norton c2b61af3a1 fix #2224: make influxql keywords case insensitive 2015-04-09 16:08:28 -04:00
David Norton 25cea58635 refactor scanning & parsing of identifiers 2015-04-09 13:21:13 -04:00
Philip O'Toole e07aeaa030 Unit test leading underscore as IDENTs 2015-03-26 13:11:11 -07: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 2cf41d6ea9 influxql: fix WHERE TAG KEY parsing 2015-01-28 05:02:36 -05:00
David Norton 780831bb17 change LIST to SHOW 2015-01-25 22:56:20 -05:00
David Norton ab39d471a3 influxql: add OFFSET 2015-01-25 15:34:49 -05:00
Ben Johnson 3c8c8724ed Implement full ident scanning, single quote strings. 2015-01-19 13:05:38 -07:00
Ben Johnson 10075ea8c5 Remove debugging. 2015-01-19 11:28:31 -07:00
Ben Johnson 81f457907f Add measurement normalization and identifier splitting. 2015-01-18 14:45:22 -07:00
David Norton 9e3ca7b569 influxql: add LIST USERS statement 2015-01-14 11:53:17 -05:00
David Norton d514cd03c8 influxql: add LIST RETENTION POLICIES statement 2015-01-13 15:40:43 -05:00
David Norton 05e2bff6c4 influxql: add LIST DATABASES statement 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 d6aa34e840 influxql: add ALTER RETENTION POLICY statement 2015-01-05 13:24:50 -05:00
David Norton 96e8f96d13 influxql: add CREATE RETENTION POLICY statement 2015-01-04 21:50:56 -05:00
David Norton 87922c4202 influxql: add GRANT statement 2015-01-03 02:06:47 -05:00
David Norton b2a2b73bd9 influxql: add tokens for user & DB admin 2015-01-03 02:06:47 -05:00
Ben Johnson d92d0d4737 Fix NEQ: Change != to <> 2014-12-21 10:43:03 -07:00
Ben Johnson 6c6bb92a1b Add join support.
This commit adds the ability to join multiple measurements together and calculate aggregate
function expressions.
2014-12-19 21:36:52 -07:00
David Norton 3deb2bb132 go fmt 2014-12-16 09:06:51 -05:00
David Norton 6f3ba3efdb influxql: change ORDER BY to accept a field list
Change ORDER BY to accept a field list and change LIST SERIES
statement to allow ORDER BY.
2014-12-16 09:06:51 -05:00
David Norton 74ade8cffb Add LIST related tokens to scanner 2014-12-16 09:06:50 -05:00
Ben Johnson 91f16db3af Add LIST/DROP SERIES and LIST/DROP CONTINUOUS QUERIES. 2014-11-22 16:33:21 -07:00
Ben Johnson 1ca44658e5 Add semicolon, INSERT, INTO to Scanner. 2014-11-20 08:02:47 -07:00