Commit Graph

1097 Commits (c40ad64604f6be9a30ee864a6a34bd1c3ed15fc2)

Author SHA1 Message Date
Edd Robinson 3079b41f00 Implement series cardinality estimation 2017-10-26 16:22:31 +01:00
Edd Robinson 89a0ddf689 Add EXACT CARDINALITY variation 2017-10-26 16:22:31 +01:00
Andrew Hare 4d6672fa66 Merge with master 2017-09-29 11:07:40 -06:00
Jonathan A. Sternberg d474a0ed9c Handle UnsignedLiteral in the Reduce operations 2017-09-27 15:10:30 -05:00
Jonathan A. Sternberg f0fb0174b6 Implement uint64 logic into eval
Any operation between an int64 and uint64 results in the type becoming a
uint64. This is because the most common will usually be an unsigned
cursor being modified by an int literal. Even in cases where we were to
add an unsigned literal to an integer iterator, that would just result
in it being recast back and overflow.
2017-09-27 15:10:16 -05:00
Jonathan A. Sternberg 963cbfd275 Update eval type for unsigned 2017-09-27 11:31:52 -05:00
Jonathan A. Sternberg 0ef94e0cf0 Add unsigned iterators for all types
This allows unsigned data to be queried from the storage engine.

Binary math is not yet implemented for unsigned types.
2017-09-18 15:09:10 -05:00
Jonathan A. Sternberg 6bd2ae05d4 Merge pull request #8838 from influxdata/js-uint-literal-support
Support uint64 literals in the parser
2017-09-15 12:42:43 -05:00
Jonathan A. Sternberg 6e636264f2 Merge pull request #8837 from influxdata/js-unsigned-type-data-type
Unsigned data type parsing and prioritization
2017-09-15 12:42:05 -05:00
Joe LeGasse 14f3c1e3d1 auth: fix required permissions for SHOW MEASUREMENTS
When using `SHOW MEASUREMENTS ON <db>`, the required permissions didn't
take into account `<db>` and would only use the `db` parameters from the
HTTP parameters.
2017-09-14 14:22:37 -04:00
Jonathan A. Sternberg 2228b91b0d Unsigned data type parsing and prioritization 2017-09-14 12:28:13 -05:00
Jonathan A. Sternberg 6e60edc4bd Merge pull request #8771 from influxdata/js-restore-old-timerange-behavior
This restores the old time range behavior
2017-09-14 12:00:50 -05:00
Jonathan A. Sternberg a978b4fd3e Support uint64 literals in the parser
When an integer cannot be parsed, we attempt to parse it as a uint64. If
that succeeds, we then have an unsigned literal that can then be used to
compare unsigned values.

This method allows us not to introduce new syntax to the language and
continue just doing the right thing at the right time. But, it also
delegates a lot of the heavy lifting to implicit casting in Reduce and
Eval.
2017-09-14 11:16:40 -05:00
Jonathan A. Sternberg c8440b4778 This restores the old time range behavior
All time ranges are combined with AND regardless of context and
regardless of whether it makes any logical sense.

That was the previous behavior and, unfortunately, a lot of people rely
on it.
2017-09-14 09:10:37 -05:00
Jonathan A. Sternberg 466fc9026e Reduce how long it takes to walk the varrefs in an expression
This is used quite a bit to determine which fields are needed in a
condition. When the condition gets large, the memory usage begins to
slow it down considerably and it doesn't take care of duplicates.
2017-08-31 09:33:45 -05:00
Joe LeGasse 732a0c2eaa Merge pull request #8769 from influxdata/jl-map-cleanup
cleanup: remove poor usage of ',ok' with maps
2017-08-31 09:18:42 -04:00
Ben Johnson 1dbe0662d8
Use system cursors for measurement, series, and tag key meta queries. 2017-08-30 08:35:20 -06:00
Joe LeGasse a95647b720 cleanup: remove poor usage of ',ok' with maps
There are several places in the code where comma-ok map retrieval was
being used poorly. Some were benign, like checking existence before
issuing an unconditional delete with no cleanup. Others were potentially
far more serious: assuming that if 'ok' was true, then the resulting
pointer retrieved from the map would be non-nil. `nil` is a perfectly
valid value to store in a map of pointers, and the comma-ok syntax is
meant for when membership is distinct from having a non-zero value.
There was only one or two cases that I saw that being used correctly for
maps of pointers.
2017-08-30 09:49:31 -04:00
Jonathan A. Sternberg 47fd076b1d Walk through the explain statement 2017-08-28 12:45:39 -05:00
Jonathan A. Sternberg 5593eecda6 Update parser and AST for explain statement 2017-08-28 11:36:06 -05:00
Jonathan A. Sternberg ef0ad3292d Remove unused functions in influxql/ast.go 2017-08-26 17:36:32 -05:00
Jonathan A. Sternberg 905e7fe05e Refactor validation code and move it to the compiler
This refactors the validation code so it is more flexible and performs a
small bit of work to make preparing and executing the query easier.

The general idea is that compilation will eventually do more heavy
lifting in creating the initial plan and prepare will construct an
actual plan rather than just doing some basic field rewriting.

This change at least sets us up for that change in the future and moves
the validation code to the query execution instead of in the parser.

This also frees up the parser to parse the complete AST without worrying
if the query itself is valid. That could be useful for client code that
wants to compile a partial query to an AST and then perform
modifications on the AST for some reason.
2017-08-26 17:36:32 -05:00
Jonathan A. Sternberg 9cba52b675 Add back the protobuf marshaling inside of influxql 2017-08-23 15:37:46 -05:00
Jonathan A. Sternberg 96689e661e Move query engine code from the statement executor to the query engine
The statement rewriting logic should be in the query engine as part of
preparing a query. This creates a shard mapper interface that the query
engine expects and then passes it to the query engine instead of
requiring the query to be preprocessed before being input into the query
engine. This interface is (mostly) the same as the old interface, just
moved to a different package.
2017-08-23 10:07:30 -05:00
Jonathan A. Sternberg 697759613c Remove time comparisons from the inner sections of the storage engine 2017-08-16 16:51:13 -05:00
Jonathan A. Sternberg 8bd04ebe39 Remove TimeRange function and replace with a more accurate ConditionExpr function
The ConditionExpr function is more accurate because it parses the
condition and ensures that time conditions are actually used correctly.
That means that attempting to combine conditions with OR will not result
in the query silently pretending it's an AND and nested conditions work
correctly so there is only one way to read the query.

It also extracts the non-time conditions into a separate condition so we
can stop attempting to parse around the time conditions in lower layers
of the storage engine. This change does not remove those hacks, but a
following commit should be able to sanitize the condition and remove
them.
2017-08-16 16:45:35 -05:00
Jonathan A. Sternberg 9a2357c2c0 Separate the query engine into a separate package
This change provides a clear separation between the query engine
mechanics and the query language so that the language can be parsed and
dealt with separate from the query engine itself.
2017-08-16 13:38:43 -05:00
Ben Johnson e0d8cb0ef3
Cardinality AST, parser, & rewriter fixes. 2017-08-16 09:27:29 -06:00
Ben Johnson 60ab1282ea
Refactor system iterators.
Previously pseudo iterators could be created for meta data such
as series, measurement, and tag data. These iterators were created
at a higher level and lacked a lot of the power of the query engine.

This commit moves system iterators down to the series level and
supports the following:

	- _name
	- _seriesKey
	- _tagKey
	- _tagValue
	- _fieldKey

These can be used as normal fields such as:

	SELECT _seriesKey FROM cpu

This will return all the series keys for `cpu`.
2017-08-16 09:27:29 -06:00
Ben Johnson c9b5d60753
Parse SHOW CARDINALITY. 2017-08-16 09:27:15 -06:00
Stuart Carnie f2d0142d83 release io.Reader 2017-08-09 14:56:24 -07:00
Stuart Carnie 91e7aaee09 fixes a memory leak when NewReaderIterator creates a nilFloatIterator 2017-08-09 14:46:44 -07:00
Jonathan A. Sternberg f5345fbaf2 Merge pull request #8557 from influxdata/js-dynamic-influxql
Introduce a new dynamic language mechanism
2017-08-01 15:59:46 -05:00
Jason Wilder de666db481 Merge pull request #8645 from influxdata/jw-cursors
Reduce memory usage when running queries
2017-07-28 11:47:16 -06:00
Jason Wilder e1ec73d08f Fix struct alignment to avoid wasting space
Reduces size from 95 to 87.
2017-07-28 10:53:07 -06:00
Jonathan A. Sternberg 950753d036 Parse time literals using the time zone in the select statement 2017-07-27 13:05:51 -05:00
Jonathan A. Sternberg 343cd2e120 Fix time zone shifts when the shift happens on a time zone boundary
When a time zone shift happened at the edge of a time bucket, the logic
was incorrect. When we added an hour to the day with a time grouping of
2 hours, we took the hour away from the previous bucket instead of the
next bucket so the first bucket of the day would be from midnight to 1
AM and the second bucket would include 1 AM to 4 AM (2 AM to 3 AM does
not exist when shifting forwards). The correct buckets should have been
12 AM to 2 AM for the first bucket of the day and 3 AM to 4 AM for the
second (since 2 AM to 3 AM does not exist).

This also modifies the tests to use table tests and sub tests.
2017-07-25 23:36:03 -05:00
Jonathan A. Sternberg 6b616d57c6 Merge pull request #8616 from influxdata/js-influxql-google-cmp
Switch influxql to use google/go-cmp to compare the point structs
2017-07-24 14:48:03 -05:00
Stuart Carnie eec80692c4 Taught tsm1 storage engine how to read and write uint64 values
* introduced UnsignedValue type
  * leveraged existing int64 compression algorithms (RLE, Simple 8B)
* tsm and WAL can read and write UnsignedValue
* compaction is aware of UnsignedValue
* unsigned support to model, cursors and write points

NOTE: there is no support to create unsigned points, as the line
protocol has not been modified.
2017-07-24 09:03:22 -07:00
Jonathan A. Sternberg 8609c2c02a Switch influxql to use google/go-cmp to compare the point structs
The diff will improve the debug message when a test fails. Right now,
the message is unreadable. The diff message from go-cmp is much better.
2017-07-21 14:05:27 -05:00
Jonathan A. Sternberg 4f5423f90e Regenerate influxql package for #8480 2017-07-19 14:24:40 -05:00
Jonathan A. Sternberg 7d06250c1c Make certain parser function public so they can be used by outside packages 2017-07-03 13:10:00 -05:00
Jonathan A. Sternberg 96516fe6d9 Remove seldom used parseTokenMaybe method 2017-07-02 23:33:19 -05:00
Jonathan A. Sternberg 3e2501cbd1 Introduce a new dynamic language mechanism
The language is now defined in a way similar to many HTTP routers with
the left prefix being placed into a parse tree and then eventually
invoking a function to parse the arguments.

This allows dynamically adding additional components to the parse tree
for either query language extensions or enterprise.
2017-07-02 20:05:46 -05:00
Edd Robinson 12248b7233 Allow panic recovery to be disabled
This commit adds a new environment variable INFLUXDB_PANIC_CRASH, which
when set to a truthy value, e.g., true, TRUE, 1, will prevent the server
from recovering from a panic.

Recover currently occurs in two places: the HTTP handler and the
QueryExecutor. INFLUXDB_PANIC_CRASH will control both.

Further, this commit adds _internal stats that will monitor the
occurrence of panics all the time (regardless of if INFLUXDB_PANIC_CRASH
has been set to true or not).

The recovered panic frequency can be inspected with the following
queries:

SELECT "recoveredPanics" FROM "_internal"."monitor"."httpd";
SELECT "recoveredPanics" FROM "_internal"."monitor"."queryExecutor";
2017-06-29 19:44:25 +01:00
Jonathan A. Sternberg f7382982fd Change the default stats interval to 1 second instead of 10 seconds 2017-06-12 13:15:25 -05:00
Ryan Betts 19ef39d947 Merge pull request #8437 from influxdata/jl-points-auth
Fine Grained Authorization
2017-05-31 10:23:49 -04:00
Jonathan A. Sternberg 78a32cba0e Queries for `bottom()` with no tags got messed up while changing the implementation
It didn't properly pass the variable reference when creating the
variable iterator so a null iterator got passed back instead.

Duplicate the `top()` tests in TopInt to also test `bottom()` with the
same queries so `bottom()` stops getting neglected so often.
2017-05-30 11:28:41 -05:00
Stuart Carnie 47f97ea134 use parsed measurement and models.Tags 2017-05-26 13:21:59 -07:00
Joe LeGasse 815f740f4c initial fga work
wip

wip

fix tests / build
2017-05-26 13:16:27 -07:00
Jonathan A. Sternberg 9edf236cc8 Maintain the tags of points selected by top() or bottom() when writing the results
When a `SELECT ... INTO ...` is used with `top()` or `bottom()` used
with tags, the points will be written with the tags still intact instead
of converted to fields.
2017-05-23 15:00:21 -05:00
Jonathan A. Sternberg 7b9b55bfc0 Optimize top() and bottom() using an incremental aggregator
The previous version of `top()` and `bottom()` would gather all of the
points to use in a slice, filter them (if necessary), then use a
slightly modified heap sort to retrieve the top or bottom values.

This performed horrendously from the standpoint of memory. Since it
consumed so much memory and spent so much time in allocations (along
with sorting a potentially very large slice), this affected speed too.

These calls have now been modified so they keep the top or bottom points
in a min or max heap. For `top()`, a new point will read the minimum
value from the heap. If the new point is greater than the minimum point,
it will replace the minimum point and fix the heap with the new value.
If the new point is smaller, it discards that point. For `bottom()`, the
process is the opposite.

It will then sort the final result to ensure the correct ordering of the
selected points.

When `top()` or `bottom()` contain a tag to select, they have now been
modified so this query:

    SELECT top(value, host, 2) FROM cpu

Essentially becomes this query:

    SELECT top(value, 2), host FROM (
        SELECT max(value) FROM cpu GROUP BY host
    )

This should drastically increase the performance of all `top()` and
`bottom()` queries.
2017-05-19 11:56:46 -05:00
Jonathan A. Sternberg 7d043dbc61 Add nanosecond duration literal support 2017-05-19 10:44:11 -05:00
rw-influxdata 67279ccc64 Fix AST rewriting panic due to a nil Condition. 2017-05-04 14:51:53 -07:00
Jonathan A. Sternberg df30a4d9c9 Refactor the subquery code and fix outer condition queries
This change refactors the subquery code into a separate builder class to
help allow for more reuse and make the functions smaller and easier to
read.

The previous function that handled most of the code was too big and
impossible to reason through.

This also goes and replaces the complicated logic of aggregates that had
a subquery source with the simpler IteratorMapper. I think the overhead
from the IteratorMapper will be more, but I also believe that the actual
code is simpler and more robust to produce more accurate answers. It
might be a future project to optimize that section of code, but I don't
have any actual numbers for the efficiency of one method and I believe
accuracy and code clarity may be more important at the moment since I am
otherwise incapable of reading my own code.
2017-04-28 17:12:32 -05:00
Jonathan A. Sternberg addc12561f Fix LIMIT and OFFSET for certain aggregate queries
When LIMIT and OFFSET were used with any functions that were not handled
directly by the query engine (anything other than count, max, min, mean,
first, or last), the input to the function would be limited instead of
receiving the full stream of values it was supposed to receive.

This also fixes a bug that caused the server to hang when LIMIT and
OFFSET were used with a selector. When using a selector, the limit and
offset should be handled before the points go to the auxiliary iterator
to be split into different iterators. Limiting happened afterwards which
caused the auxiliary iterator to hang forever.
2017-04-28 15:55:06 -05:00
Ben Johnson 3a46e5dd9e
Remove default upper time bound for DELETE queries. 2017-04-28 12:26:26 -06:00
Jonathan A. Sternberg be3bce5212 top() and bottom() now returns the time for every point
`top()` and `bottom()` will now organize the points by time and also
keep the points original time even when a time grouping is used. At the
same time, `top()` and `bottom()` will no longer honor any fill options
that are present since they don't really make sense for these specific
functions.

This also fixes the aggregate and selectors to honor the ordered
iterator option so iterator remain ordered and to also respect the
buckets that are created by the final dimensions of the query so that
two buckets don't overlap each other within the same reducer. A test has
been added for this situation. This should clarify and encourage the use
of the ordered attribute within the query engine.
2017-04-26 15:07:10 -05:00
Jonathan A. Sternberg 57a2abbc87 Restrict top() and bottom() selectors to be used with no other functions 2017-04-14 10:23:07 -05:00
Cory LaNou 9060a2a5ff
Add HasDefaultDatabase interface to several statements 2017-04-12 13:41:28 -05:00
Jonathan A. Sternberg d653b76b5b Merge pull request #8282 from influxdata/js-8281-influxql-select-tests
Fix influxql select tests
2017-04-11 15:05:08 -05:00
Jonathan A. Sternberg c6e1b83906 Fix influxql select tests
The inputs are now sent to the tested iterator in the correct order so
we can more accurately test each individual select statement.
2017-04-10 20:51:14 -05:00
Jonathan A. Sternberg a550d323c4 Restrict fill(none) and fill(linear) to be usable only with aggregate queries 2017-04-10 15:58:05 -05:00
Jonathan A. Sternberg 0a5e4bd92b Implicitly cast null to false in binary expressions with a boolean
Also more consistently treat a binary expression with strings so it
produces the same value no matter the direction of the expression.
2017-04-06 12:26:04 -05:00
Jason Wilder 8da84e6144 Merge branch 'master' into tsi 2017-04-03 11:21:02 -06:00
Tom Young d2fd3f50aa Add bitwise AND, OR and XOR operators to InfluxQL. 2017-03-31 21:02:02 +01:00
Jonathan A. Sternberg 211e7ea65d Merge pull request #8234 from influxdata/js-8230-fix-window-computation-overflow
Prevent overflowing or underflowing during window computation
2017-03-31 11:09:30 -05:00
zhexuany 232fdae6dd introduce a new function non_negative_difference 2017-03-31 23:08:36 +08:00
Jonathan A. Sternberg 64fb1db5f5 Prevent overflowing or underflowing during window computation
The Window function will now check before it adjusts the offset whether
it is going to overflow or underflow. If it is going to do either, it
sets the start or end time to MinTime or MaxTime.
2017-03-30 16:35:22 -05:00
Jonathan A. Sternberg 2ea805c928 Interpolate between different intervals to find the whole area under the curve 2017-03-30 12:51:52 -05:00
Tom Young cac94a1fc7 Add "integral" function to InfluxQL 2017-03-30 12:07:26 -05:00
Edd Robinson fddaff2cc8 Merge master in 2017-03-29 18:00:28 +01:00
Jonathan A. Sternberg 7e0ed1f5e5 Ensure the input for certain functions in the query engine are ordered
The following functions require ordered input but were not guaranteed to
received ordered input:

* `distinct()`
* `sample()`
* `holt_winters()`
* `holt_winters_with_fit()`
* `derivative()`
* `non_negative_derivative()`
* `difference()`
* `moving_average()`
* `elapsed()`
* `cumulative_sum()`
* `top()`
* `bottom()`

These function calls have now been modified to request that their input
be ordered by the query engine. This will prevent the improper output
that could have been caused by multiple series being merged together or
multiple shards being merged together potentially incorrectly when no
time grouping was specified.

Two additional functions were already correct to begin with (so there
are no bugs with these two, but I'm including their names for
completeness).

* `median()`
* `percentile()`
2017-03-28 13:55:37 -05:00
Jonathan A. Sternberg 24109468c3 Merge pull request #8168 from influxdata/js-8167-math-with-multiple-selectors
Fix a regression when math was used with selectors
2017-03-28 13:31:57 -05:00
Jonathan A. Sternberg 3e52ec7ca2 Merge pull request #7762 from influxdata/js-6541-timezone-support
Support timezone offsets for queries
2017-03-28 10:39:07 -05:00
Jonathan A. Sternberg b14c292cba Fix a regression when math was used with selectors
If there were multiple selectors and math, the query engine would
mistakenly think it was the only selector in the query and would not
match their timestamps.

Fixed the query engine to pass whether the selector should be treated as
a selector so queries like `max(value) * 1, min(value) * 1` will match
the timestamps of the result.
2017-03-27 14:12:15 -05: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 347b01814e Support timezone offsets for queries
The timezone for a query can now be added to the end with something like
`TZ("America/Los_Angeles")` and it will localize the results of the
query to be in that timezone. The offset will automatically be set to
the offset for that timezone and offsets will automatically adjust for
daylight savings time so grouping by a day will result in a 25 hour day
once a year and a 23 hour day another day of the year.

The automatic adjustment of intervals for timezone offsets changing will
only happen if the group by period is greater than the timezone offset
would be. That means grouping by an hour or less will not be affected by
daylight savings time, but a 2 hour or 1 day interval will be.

The default timezone is UTC and existing queries are unaffected by this
change.

When times are returned as strings (when `epoch=1` is not used), the
results will be returned using the requested timezone format in RFC3339
format.
2017-03-22 15:09:41 -05:00
Jonathan A. Sternberg 33981277bc Fix the time range when an exact timestamp is selected
There is a lot of confusion in the code if the range is [start, end) or
[start, end]. This is not made easier because it is acts one way in some
areas and in another way in some other areas, but it is usually [start,
end]. The `time = ?` syntax assumed that it was [start, end) and added
an extra nanosecond to the end time to accomodate for that, but the
range was actually [start, end] and that caused it to include one extra
nanosecond when it shouldn't have.

This change fixes it so exactly one timestamp is selected when `time = ?`
is used.
2017-03-21 14:55:31 -05:00
Jonathan A. Sternberg a6c09e58a0 Return an error when an invalid duration literal is parsed 2017-03-21 12:10:41 -05:00
Jason Wilder 8f7b251afd Merge branch 'master' into jw-tsi 2017-03-20 17:17:26 -06:00
Jason Wilder 86ad0a45b6 Ensure iterators are closed when query is killed
The underlying iterators were not closed when a query was kill so
although the client would receive an error, the query would continue
on until completion.
2017-03-17 16:00:39 -06:00
Jonathan A. Sternberg 41c8370bbc Fix fill(linear) when multiple series exist and there are null values
When there were multiple series and anything other than the last series
had any null values, the series would start using the first point from
the next series to interpolate points.

Interpolation should not cross between series. Now, the linear fill
checks to make sure the next point is within the same series before
using it to perform interpolation.
2017-03-16 15:54:20 -05:00
Jonathan A. Sternberg 5072db40c2 Forbid wildcards in binary expressions
When rewriting fields, wildcards within binary expressions were skipped.
This now throws an error whenever it finds a wildcard within a binary
expression in order to prevent the panic that occurs.
2017-03-16 14:26:10 -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
Ben Johnson 358b1e0b05
Merge remote-tracking branch 'upstream/master' into tsi 2017-03-15 10:13:32 -06:00
Jason Wilder b9e5375043 Merge branch '1.2' into jw-merge-12 2017-03-08 13:16:50 -07:00
Jonathan A. Sternberg 83cf8893e1 Include IsRawQuery in the rewritten statement for meta queries 2017-03-06 14:46:33 -06:00
Jason Wilder 675d7c9d65 Merge branch '1.2' into jw-merge12 2017-03-06 11:09:05 -07:00
Jonathan A. Sternberg c5970b59b4 Map types correctly when selecting a field with multiple measurements where one of the measurements is empty 2017-03-01 11:47:26 -06:00
Jonathan A. Sternberg 1fb34e3eef Dividing aggregate functions with different outputs doesn't panic 2017-02-23 18:38:29 -06:00
Jonathan A. Sternberg 72e4dd01b9 Properly select a tag within a subquery
Previously, subqueries would only be able to select tag fields within a
subquery if the subquery used a selector. But, it didn't filter out
aggregates like `mean()` so it would panic instead.

Now it is possible to select the tag directly instead of rewriting the
query in an invalid way.

Some queries in this form will still not work though. For example, the
following still does not function (but also doesn't panic):

    SELECT count(host) FROM (SELECT mean, host FROM (SELECT mean(value) FROM cpu GROUP BY host))
2017-02-23 11:16:22 -06:00
Jonathan A. Sternberg 5a2b458180 Reduce the expression in a subquery to avoid a panic
The builder used for subqueries does not handle parenthesis, but a set
of parenthesis wrapping a field would cause it to panic. This code now
reduces the expression so the parenthesis are removed before being
processed.
2017-02-23 10:14:05 -06:00
Mark Rushakoff 601cbcd084 Merge branch '1.2' into mr-merge-12 2017-02-17 16:14:22 -08:00
Jonathan A. Sternberg 2fe48d6781 Rename zap import back to github.com/uber-go/zap
They rebased a revision we were previously relying upon that allowed us
to use the vanity name so we are reverting back to an older version with
the old import path.
2017-02-17 17:17:22 -06:00
Jonathan A. Sternberg 71f62d33e6 Map types correctly when using a regex and one of the measurements is empty 2017-02-13 18:14:29 -06:00
Mark Rushakoff c762ab49ee Merge pull request #7974 from influxdata/mr-4785-show-databases
Allow non-admin users to execute SHOW DATABASES
2017-02-13 15:04:00 -08:00
Jason Wilder f45a58937c Merge pull request #7998 from influxdata/jw-merge-12
Merge 1.2.1-rc3 to master
2017-02-13 14:24:17 -07:00
Jason Wilder c3de210ded Merge branch '1.2' into jw-merge-12 2017-02-13 11:45:27 -07:00
Mark Rushakoff 53699aa24f Allow non-admin users to execute SHOW DATABASES
This commit introduces a new interface type, influxql.Authorizer, that
is passed as part of a statement's execution context and determines
whether the context is permitted to access a given database. In the
future, the Authorizer interface may be expanded to other resources
besides databases. In this commit, the Authorizer interface is
specifically used to determine which databases are returned when
executing SHOW DATABASES.

When HTTP authentication is enabled, the existing meta.UserInfo struct
implements Authorizer, meaning admin users can SHOW every database, and
non-admin users can SHOW only databases for which they have read and/or
write permission.

When HTTP authentication is disabled, all databases are visible through
SHOW DATABASES.

This addresses a long-standing issue where Chronograf or Grafana would
be unable to list databases if the logged-in user did not have admin
privileges.

Fixes #4785.
2017-02-13 08:59:16 -08:00