Commit Graph

31 Commits (bd8db8e3a2c7f6028c6b05de26cf257ff76a4d45)

Author SHA1 Message Date
jlapacik 17391d6924
fix: call Next on read cursor at end of loop (#19012) 2020-07-23 15:06:17 -07:00
Jonathan A. Sternberg 8678a22ee3
feat(storage/flux): add tests for min/max pushdowns (#19028) 2020-07-23 16:07:30 -05:00
Christopher M. Wolff 8b106bcee1
feat(storage): add mean aggregate array cursor and tests (#19019) 2020-07-23 09:49:53 -07:00
Jonathan A. Sternberg f854762cac
fix(storage/flux): do not wait for empty tables in the windower (#19008)
When splitting windows into their own individual tables, do not wait for
empty tables to be read. Empty tables may never be read so waiting for
them can result in a deadlock.

This was found while writing a test case for in progress work and so a
test case for this condition will follow in a future commit.
2020-07-21 17:38:33 -05:00
jlapacik 36987bec0f feat: add offset parameter to window cursors 2020-07-20 12:23:37 -07:00
jlapacik 3b50d08cd9 fix: window tables are empty if cursor is empty
Previously windowed aggregate tables would construct the _start and
_stop arrays before checking if the underlying array cursor was empty.
The table would therefore report itself as non-empty even though
there were no points within the table's time range. Now we check if
the underlying array cursor is empty before we construct any output
arrays. If the cursor is empty, meaning the series is empty, the
table will be dropped.

Fixes https://github.com/influxdata/influxdb/issues/18704.
2020-07-01 16:58:50 -07:00
Jonathan A. Sternberg ec6e610cd5
fix(storage/flux): use the correct constant for CountKind in the reader (#18755) 2020-06-26 16:02:53 -05:00
Jonathan A. Sternberg 58bd5b9854
fix(storage/flux): the count aggregate will fill in zero values instead of null (#18735) 2020-06-26 15:43:03 -05:00
jlapacik f1c557ccd8 fix(storage): remove libflux dependency from storage
Storage should not have a dependency on libflux. This commit removes
some constants that were used from the flux universe package and
replaces them with local copies so that storage no longer has a
dependecy on the universe package.
2020-06-26 09:50:39 -07:00
jlapacik 5e4dd3f77a feat: flux table iterators for windowed selectors 2020-06-25 14:37:07 -07:00
jlapacik 0b52a48f83 test: table iterator tests for window first 2020-06-25 14:37:07 -07:00
Jonathan A. Sternberg 1d5a7bf9c8
fix(storage/flux): fix the empty call for storage/flux (#18446)
The tables produced by `storage/flux` didn't previously pass our table
tests. The `Empty()` call is supposed to return false if the table was
ever not empty, but reading the table or calling `Done()` would cause
the table implementations here to return that they were always empty.
This messes up the csv encoder which then believes that it just emitted
an empty table.

The table tests for valid table implementations states that this is an
error for the table implementation. This change introduces a simple test
for `ReadFilter` and also runs the table tests on the filter iterator.
2020-06-11 09:32:27 -05:00
Jonathan A. Sternberg db686349e7
feat(storage/flux): support full aggregate window push down (#18399)
This enables a new rule that will push down the full `aggregateWindow`
query including the `duplicate` and `window(every: inf)` that recombines
the tables. When the full rule is used, the table is not split into
tables for each window and instead retains itself as a single table. The
start or stop column is renamed to `_time` and `_start` and `_stop` will
be the boundaries of the query.
2020-06-10 13:21:41 -05:00
jlapacik eba496d1bd
feat: grouped aggregate rewrite rules (#18342)
* feat: flags for pushing down new aggregates

* refactor: grouped aggregate rewrite rules

The storage operation ReadGroup aggregates per series on the storage
side. The planner will rewrite grouped aggregate queries to call
ReadGroup, which will perform a partial aggregation, followed by
another operation that will perform the rest of the aggregation on
the compute side.

* feat: storage capabilities for grouped aggregates

* fix: changes from review

* feat: group read operation name should include aggregate
2020-06-04 14:36:15 -07:00
Jonathan A. Sternberg efbc4ae7c1
feat(storage/flux): implement create empty for the window table reader (#18288)
This implements create empty for the window table reader and allows this
table read function to be used when it is specified. It will pass down
the create empty flag from the original window call into the storage
read function.

This also fixes the window table reader so it properly creates
individual tables for each window. Previously, it was constructing one
table for an entire series instead of one table per window.

Tests have been added to verify three edge case behaviors. The first is
the normal read operation where all values are present. The second is
when create empty is specified so null values may be created. The third
is with truncated boundaries to ensure that storage is read from and the
start and stop timestamps get correctly truncated.
2020-06-01 17:57:50 -05:00
Yiqun (Ethan) Zhang 41156ca646
feat(query): implement window count aggregate pushdown (#18043) 2020-05-28 13:42:38 -05:00
Jonathan A. Sternberg 7379e784ab
fix(storage/flux): fix a race condition in the tags cache (#17977)
The tags cache was not thread safe when called from multiple goroutines
at the same time. It was intended that it would be, but the locking was
done incorrectly and in too complicated a way. There was an assumption
that the LRU would only be updated from a single thread which wasn't
true at all.

The tags cache has now been updated to include some test cases that test
for race conditions and data validity. The tags cache itself has been
changed to follow a simpler algorithm.

1. Obtain a read lock.
2. Check if the cached array can be used.
3. Release the read lock.
4. If the above was unusable or did not exist, create an array for the
   tag.
5. Obtain a write lock.
6. Check if the cached array should be replaced and replace if needed.
7. Move the entry to the front of the LRU.
8. Release the write lock.

This simpler algorithm should ensure that this code is correct and that
creating the array is still done outside of the lock since creating the
array is the most expensive operation of the ones above.
2020-05-07 15:01:48 -05:00
jlapacik 7cb599c582 feat(storage): convert ResultSet to table stream for aggregate window 2020-05-05 10:50:15 -07:00
Yiqun (Ethan) Zhang 8bb5065769 refactor: unify WindowAggregateCapability (#17901) 2020-05-05 01:35:02 -05:00
jlapacik 6d885c7112 Merge branch 'master' into chore/update-flux 2020-04-29 10:02:19 -07:00
Yiqun (Ethan) Zhang 3c2ab1b681
feat(query): Reader implementation for WindowAggregate (#17885) 2020-04-29 10:42:16 -05:00
jlapacik 7541af8414 chore: merge master into algow 2020-04-15 14:42:03 -07:00
kun 80e71d6ee0 fix(storageflux): fix data race on tags map (#17702) 2020-04-11 18:40:50 +08:00
jlapacik 5fe5da4ec7
fix(flux): return internal influxdb error for cursor conflict (#17697)
* fix(flux): return internal influxdb error for cursor conflict

Closes https://github.com/influxdata/influxdb/issues/17680.

* refactor: update error code from EInternal to EInvalid
2020-04-09 14:40:41 -07:00
Jonathan A. Sternberg 1bb08ceaf8
refactor(query/stdlib): modify storage filters to use the predicate directly (#17650)
The storage filters are modified to use the predicates directly so we do
not have to pass `semantic.FunctionExpression` around. Instead, since
simple expressions are all that are supported anyway, we transform
suitable function expressions into predicates as part of the push down
rule and this simplifies the influxdb reader code.

This also moves the storage predicate conversion code into the standard
library package as it is the only location that uses this code now that
the predicate conversion is done as part of the push down rule.

This refactor was prompted by another refactor of the
`semantic.FunctionExpression` that would cause it to always contain a
`semantic.Block`. Since the push down filter needs the expressions and
to combine them, this refactor allows us not do construct a combined
filter inside of blocks which allows us to have better type safety.
2020-04-07 10:45:08 -05:00
Jonathan A. Sternberg d3fa60991f
Merge branch 'master' into chore/merge-master 2020-04-06 12:17:47 -05:00
Jonathan A. Sternberg 6e4cf7ffef
refactor: fix imports from go template files (#17615) 2020-04-03 17:40:36 -05:00
Jonathan A. Sternberg 0ae8bebd75
refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
Jonathan A. Sternberg 469c5849c4
Merge branch 'master' into feat/use-algo-w 2020-04-03 09:30:04 -05:00
Sebastian Borza eeece73675
chore(storageflux): update failing tests 2020-03-10 17:54:07 -05:00
Sebastian Borza a50e69451e
feat(storageflux): move flux components out to separate package 2020-03-10 17:54:04 -05:00