Commit Graph

1064 Commits (23679c2375161ddf98bcd1ea13b98432c8a95c87)

Author SHA1 Message Date
Ayan George ca2055c16c
refactor: Replace ctx.Done() with ctx.Err() (#19546)
* refactor: Replace ctx.Done() with ctx.Err()

Prior to this commit we checked for context cancellation with a select
block and context.Context.Done() without multiplexing over any other
channel like:

  select {
    case <-ctx.Done():
      // handle cancellation
    default:
      // fallthrough
  }

This commit replaces those type of blocks with a simple check of
ctx.Err().  This has the following benefits:

* Calling ctx.Err() is much faster than entering a select block.

* ctx.Done() allocates a channel when called for the first time.

* Testing the result of ctx.Err() is a reliable way of determininging if
  a context.Context value has been canceled.

* fix: Fix data race in execDeleteTagValueEntry()
2020-09-16 12:20:09 -04:00
Brett Buddin b917d8d9b0
chore(influxdb): Placate the linter. 2020-08-27 15:46:32 -04:00
Stuart Carnie d20440a09f
fix: go fmt to satisfy go linter 2020-08-26 10:28:35 -07:00
Stuart Carnie 8a7dcc21fb
feat(influxql): Initial implementation of InfluxQL query engine
* Some tests are broken or do not pass; follow up PRs will resolve that
2020-08-14 12:37:30 -07:00
Stuart Carnie b73340a4b1
chore(influxql): Update to latest influxql master-1.x 2020-08-13 11:02:40 -07:00
Stuart Carnie 89532f0c29
refactor: move v2/v1/models to v2/models 2020-08-03 09:20:51 -07:00
Stuart Carnie 92efddbfbe
chore(tsdb): Initial commit of tsdb package
* pulls in 1.x tsdb, compiles and passes test
2020-08-03 09:17:23 -07:00
Stuart Carnie f3d45ba301 influxdata/influxdb/influxql -> influxdata/influxql 2017-10-30 14:40:26 -07:00
Stuart Carnie 7435725e05 move RewriteStatement and neldermead to influxdb/query package 2017-10-30 10:24:15 -07:00
Edd Robinson f7e0e41a94 Simplify representation of statements 2017-10-26 16:22:49 +01:00
Edd Robinson ce00830a29 Typo 2017-10-26 16:22:49 +01:00
Edd Robinson bda6de9817 Add all versions of CARDINALITY commands 2017-10-26 16:22:48 +01:00
Edd Robinson 1342046264 Rewrite sources appropriately 2017-10-26 16:22:31 +01:00
Edd Robinson ba9506764c SHOW FIELD KEY EXACT CARDINALITY 2017-10-26 16:22:31 +01:00
Edd Robinson c57e192984 SHOW TAG VALUES EXACT CARDINALITY 2017-10-26 16:22:31 +01:00
Edd Robinson 47c0840d5b SHOW TAG KEY EXACT CARDINALITY 2017-10-26 16:22:31 +01:00
Edd Robinson f80591bfa1 Implement MEASUREMENT cardinality estimation 2017-10-26 16:22:31 +01:00
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