Commit Graph

678 Commits (31a964e890558e0f8507257a592240853410d371)

Author SHA1 Message Date
Jonathan A. Sternberg df4c305012 Merge pull request #5961 from influxdata/js-5959-top-incompatible-with-binary-expr
Forbid using top() or bottom() in a binary expression
2016-03-10 10:45:52 -05:00
Jonathan A. Sternberg a55896a555 Merge pull request #5956 from influxdata/js-2715-allow-regex-for-field-values
Support using field regex comparisons in the WHERE clause
2016-03-09 17:38:39 -05:00
Jonathan A. Sternberg f276c705df Forbid using top() or bottom() in a binary expression
Fixes #5959.
2016-03-09 17:32:17 -05:00
Jonathan A. Sternberg 4ba3386679 Support using field regex comparisons in the WHERE clause
Fixes #2715.
2016-03-09 13:21:24 -05:00
Jonathan A. Sternberg 546de3f7cb Return error message when improper types are used in SELECT
Fixes #5949.
2016-03-09 11:36:18 -05:00
Ben Johnson 41dde61226 SHOW SERIES 2016-03-08 11:47:57 -07:00
Nathaniel Cook 4961a4435b Fix nil comparison for top/bottom 2016-03-07 15:21:22 -07:00
Nathaniel Cook 46fc6e5516 Expose Reduce Functions for Kapacitor 2016-03-07 14:03:14 -07:00
Jonathan A. Sternberg 370f8e4176 Merge pull request #5916 from influxdata/js-refactor-reduce-slice-func
Refactor reduce slice func to use the aggregator and emitter
2016-03-07 15:49:37 -05:00
Jonathan A. Sternberg 9c5bc8ab2b Refactor reduce slice func to use the aggregator and emitter 2016-03-07 13:25:45 -05:00
Jonathan A. Sternberg 2f0e246757 Implemented the tag values iterator for `SHOW TAG VALUES`
`SHOW TAG VALUES` output has been modified to print the measurement name
for every measurement and to return the output in two columns: key and
value. An example output might be:

    > SHOW TAG VALUES WITH KEY IN (host, region)
    name: cpu
    ---------
    key     value
    host    server01
    region  useast

    name: mem
    ---------
    key     value
    host    server02
    region  useast

`measurementsByExpr` has been taught how to handle reserved keys (ones
with an underscore at the beginning) to allow reusing that function and
skipping over expressions that don't matter to the call.

Fixes #5593.
2016-03-06 09:52:34 -05:00
Jonathan A. Sternberg 9113839e4c Fix sorting of `first()` and `last()` calls across shards
Previously the call iterator would normalize the time to the interval
for all calls. This meant that when `first()` or `last()` was called
with no group by interval the value would be found for each shard, the
time was normalized, then it tried to find the value between the shards
(but no longer with any time data as that had already been eliminated).

This removes part of the time logic from the call iterators and makes a
new iterator `IntervalIterator` to normalize the times as they come out
of the underlying iterator.

Fixes #5890.
2016-03-03 21:15:43 -05:00
Jonathan A. Sternberg 8d89a203a2 Fix sorting for distinct by sorting by value when the point time is the same 2016-03-03 19:09:38 -05:00
Jonathan A. Sternberg caee9a475c Merge pull request #5895 from influxdata/js-5886-more-aggregate-iterator-types
Support all iterator types for count(), first(), and last()
2016-03-03 15:23:57 -05:00
Jonathan A. Sternberg fabc41dcfb Have division always return a float in the new query engine
Fixes #5892.
2016-03-03 08:15:54 -05:00
Jonathan A. Sternberg e3660fae93 Support all iterator types for count(), first(), and last()
All three of these iterators are supposed to support all four types of
iterators, but the implementation was never done for string or boolean.

Fixes #5886.
2016-03-02 23:49:55 -05:00
Jonathan A. Sternberg 2440568b27 Merge pull request #5875 from influxdata/js-5852-mean-function-accuracy
Improve mean accuracy while retaining the speedup with a custom iterator
2016-03-02 17:09:58 -05:00
Jonathan A. Sternberg 1c543b28a9 Refactored call iterators to make them public and more usable as a library
This refactor is primarily to support Kapacitor. Kapacitor doesn't care
about the iterators and mostly keeps the points it handles in memory.
The iterator interface is more than Kapacitor cares about.

This commit refactors and opens up the internals of aggregating and
reducing incoming points so it can be used by an outside library with
the same code. It also makes the iterators used by the call iterators
publically usable with new functionality.

Reducers are split into two methods which are separate interfaces that
can be combined for dealing with casting between different types. The
Aggregator interfaces accept points into the aggregator and retain any
internal state they need. The Emitter interface will then create a point
from that aggregated state which can be fed to the iterator. The
Emitters do not fill in the name or tag of the point as that is expected
to be done by the person aggregating the point. While the Emitters do
sometimes fill in the time, that value will also be overwritten by the
iterator. Filling in the time is to allow a future version that will
allow returning the point time instead of just the interval time.
2016-03-02 16:10:49 -05:00
Jonathan A. Sternberg d11bc6182c Improve mean accuracy while retaining the speedup with a custom iterator
Fixes #5852.
2016-03-02 14:48:11 -05:00
Jonathan A. Sternberg 87fc143732 Fix limit iterator with multiple sources
The limit iterator would short circuit if there were no dimensions and
all points had been read. It also needs to consider that multiple
sources will require reading the entire iterator too, so the short
circuit requires only a single source.

Fixes #5871.
2016-03-01 21:44:45 -05:00
Jonathan A. Sternberg aa0b603938 Convert `SHOW FIELD KEYS` to the new query engine
Fixes #5579.
2016-02-25 18:31:02 -05:00
Jonathan A. Sternberg cddc1b2241 Fix remote execution for partially replicated clusters
The RPC handler for remote queries would attempt to reuse a closed
connection for certain commands that didn't use pooling. The RPC
commands that close the connection have been fixed to not try reusing
the connection.

When creating an iterator, if there are no points to return, the points
decoder would hit an EOF that it didn't catch and would return that
error back to the client who made the request. It now properly returns
no points by using a `nilFloatIterator` if there are no points to
return.

This fixes remote execution when a cluster has nothing to return.
2016-02-25 17:46:51 -05:00
Ben Johnson 16eea8eecc add SeriesList marshaling 2016-02-25 15:38:16 -07:00
Ben Johnson 0dda9f6608 add remote execution
This commit adds remote execution to the query engine.
2016-02-25 08:41:20 -07:00
Jonathan A. Sternberg 53056d862b Eliminating dead code in `(*influxql.SelectStatement).RewriteWildcards()`
The dimensions array in `RewriteWildcards` gets emptied by an earlier
section of the code and then tries to iterate over that empty slice to
append it to the list of dimensions.

That makes the loop dead code that can't ever be hit.

Also improve the efficiency of this method by not creating a new slice
when there are no wildcards. We already check at the beginning of the
function if there is a wildcard out of necessity. There's no point in
making a new slice and copying the contents if we know that there will
be no wildcards to expand.

It also improves memory efficiency by assuming that if a wildcard
exists, there is only one and the pre-allocated slice can take advantage
of that. If there are multiple wildcards, then a new slice will have to
be created in the middle of the loop to raise the capacity.
2016-02-23 10:36:01 -05:00
Jonathan A. Sternberg f7ef382596 Remove dimensions from field wildcards
When a wildcard is specified for the field but not the dimensions, the
dimensions get added to the list of fields as part of
`RewriteWildcards()`.

But when a dimension was given with no wildcard, the dimension didn't
get removed from the wildcard in the fields section. This teaches the
rewriter to disclude dimensions explicitly included from being expanded
as a field. Now this statement when a measurement has one tag named host
and a field named value:

    SELECT * FROM cpu GROUP BY host

Would expand to this:

    SELECT value FROM cpu GROUP BY host

Instead of this:

    SELECT host, value FROM cpu GROUP BY host

If you want the latter behavior, you can include it like this:

    SELECT host, * FROM cpu GROUP BY host

Fixes #5770.
2016-02-23 10:22:56 -05:00
Jonathan A. Sternberg 7a03df2af1 Remove the non-unreachable panics in the new query engine
The only panics left are ones that should be unreachable unless there is
a bug.

Fixes #5777.
2016-02-22 12:52:43 -05:00
Jonathan A. Sternberg b6a0b6a65a Merge pull request #5742 from influxdata/js-ensure-non-empty-column-names
Ensure column names get implicitly renamed with conflicts
2016-02-22 08:55:38 -05:00
Jonathan A. Sternberg 6982d5310e Replace a panic with returning an error when an unsupported call is used
Fixes #5773.
2016-02-21 19:39:14 -05:00
Jonathan A. Sternberg a8d637b03c Ensure column names get implicitly renamed with conflicts 2016-02-19 14:35:56 -05:00
Jonathan A. Sternberg f84556fe22 Update binary expressions to handle mixed math between integers and floats
This also changes it so all NumericLiterals are treated as a float
rather than sometimes being cast to an integer.

Fixes #5740.
2016-02-19 14:32:22 -05:00
Jonathan A. Sternberg 8fc6a0f648 Merge pull request #5732 from influxdata/js-5730-binary-expr-column-name
Assign a name to columns with binary expressions in them
2016-02-19 14:30:43 -05:00
Jonathan A. Sternberg e58f66845c Merge pull request #5658 from influxdata/js-mean-iterator
Optimize the mean() call by moving the calculation into the shard iterator
2016-02-18 17:27:46 -05:00
Ben Johnson ae7b027742 Merge pull request #5366 from gabelev/lint_influxql
Refactoring influxql package to enable golint
2016-02-18 14:24:37 -07:00
Gabriel Levine a9fcc3229a Enable golint for influxql package. 2016-02-18 15:52:37 -05:00
Joe LeGasse dc8ed7953d Remove custom binary-conversion functions
Also cleaned up some excess allocations, and other cruft from the code
2016-02-18 13:56:35 -05:00
Jonathan A. Sternberg 983f810539 Assign a name to columns with binary expressions in them
The name of the column will be every measurement located inside of the
math expression in the order they are encountered in within the
expression.

Also handle `*influxql.ParenExpr` in the function
`(*influxql.Field).Name()`

Fixes #5730.
2016-02-18 10:11:28 -05:00
Ben Johnson eb221a5adb Merge pull request #5663 from benbjohnson/query-executor
Refactor QueryExecutor (WIP)
2016-02-17 16:30:20 -07:00
Ben Johnson e3b4b71c13 refactor query executor
This commit moves the `QueryExecutor` to the `cluster` package
and provides an interface to it inside the `influxql` package.
2016-02-17 15:13:56 -07:00
Ben Johnson f7e04abef7 remove NaN from query engine
This commit removes `math.NaN` returns from float iterators.
2016-02-17 14:11:31 -07:00
Jonathan A. Sternberg ceb173c50a Add the aggregated variable to the protobuf definition 2016-02-16 10:32:59 -05:00
Jonathan A. Sternberg 18c7c554ba Optimize the mean() call by moving the calculation into the shard iterator
A new attribute has been added to points to track how many points were
used to calculate that point. This is particularly useful for finding
the mean as we can then split mean calculation into two phases: one at
the shard level and a second at the shards level.

This optimization is now used so we don't have to hold so many points in
memory while calculating the mean.
2016-02-16 10:32:34 -05:00
Jonathan A. Sternberg 559a11d0ab Pass the implicit end time from the query executor to the select call
The select call and the query executor would both calculate the time
range, but in separate ways. The query executor needed some way to pass
in the implicit end time that is placed there by the query executor.

Fixes #5636.
2016-02-12 16:03:24 -05:00
Jonathan A. Sternberg c267e1eb5a Merge pull request #5652 from influxdata/js-5640-derivative-iterator
Support derivative() call for integer fields in the new query engine
2016-02-12 14:59:35 -05:00
Jack Zampolin 30a31d3acf Merge pull request #5654 from influxdata/jz-delete-from
Remove DELETE FROM from query spec
2016-02-12 10:47:57 -08:00
Jack Zampolin 014bbd3ef9 Remove DELETE FROM from query spec 2016-02-12 10:10:47 -08:00
Jonathan A. Sternberg 42b9166000 Support derivative() call for integer fields in the new query engine
Fixes #5640.
2016-02-12 11:36:59 -05:00
Jonathan A. Sternberg b70d83af6a Merge pull request #5633 from seiflotfy/fix5630
Make sure parenthesized SELECT arguments are evaluated properly without panic
2016-02-11 18:57:34 -05:00
Seif Lotfy 18f22a22fb Make sure parenthesized SELECT arguemnts are evaluated properly without panic
Fixes #5630
2016-02-11 17:41:33 -06:00
Jonathan A. Sternberg f5d8a4a6c0 Clear the start and end times for derivative calls
Derivatives rely on the underlying iterator to handle start and end
times. They do not perform them or organize points into groups. In
certain circumstances, the start time or end time that got implicitly
passed could be on an uneven interval with the first point returned by
the aggregate, which caused the entire iterator not to be read.

This fixes #5571.
2016-02-11 16:17:15 -05:00