Commit Graph

12 Commits (0fcb240ebb5729b8719833ff0bb8c3b0827a796e)

Author SHA1 Message Date
Jonathan A. Sternberg 865e6a05f0
Marked functions that always return floats as always returning floats
These functions, when used on non-float types in subqueries, would
return incorrect results as the type system thought they would return a
different type than the actual implementation would return.
2019-01-09 16:56:29 -06:00
Jonathan A. Sternberg 1cf1a23361
Merge pull request #9860 from phemmer/ta-rename
rename "triple_exponential_average" -> "triple_exponential_derivative"
2018-05-17 14:42:26 -05:00
Jonathan A. Sternberg 8a2bc63d3c Return the correct auxiliary values for top/bottom
When `top()` or `bottom()` were used and selected auxiliary values, they
would return the wrong values that would be equal to the last point
selected. This is because the aggregators saved the memory address of
the auxiliary fields instead of copying them over. Since the same
auxiliary fields memory location is used for every value returned by the
storage engine, this resulted in the values being incorrect because they
were overwritten with incorrect values.

This fixes that so the auxiliary fields are copied out when they are
saved rather than only the memory location.
2018-05-17 10:25:40 -05:00
Patrick Hemmer 7dc7efd501 rename "triple_exponential_average" -> "triple_exponential_derivative" 2018-05-16 19:40:12 -04:00
Jonathan A. Sternberg 9d049c4b62 Optimize the spread function to process points iteratively instead of in batch 2018-04-30 11:25:29 -05:00
Jonathan A. Sternberg d42062def2 Add technical analysis algorithms
This adds numerous technical analysis algorithms:

* exponential_moving_average
* double_exponential_moving_average
* triple_exponential_moving_average
* relative_strength_index
* triple_exponential_average
* kaufmans_efficiency_ratio (commonly referred to as just "Efficiency Ratio")
* kaufmans_adaptive_moving_average
* chande_momentum_oscillator (both the common 'smoothed' version, and the ta-lib version)
2018-04-23 22:27:21 -04:00
Jonathan A. Sternberg f8d60a881d Refactor the math engine to compile the query and use eval
This change makes it so that we simplify the math engine so it doesn't
use a complicated set of nested iterators. That way, we have to change
math in one fewer place.

It also greatly simplifies the query engine as now we can create the
necessary iterators, join them by time, name, and tags, and then use the
cursor interface to read them and use eval to compute the result. It
makes it so the auxiliary iterators and all of their complexity can be
removed.

This also makes use of the new eval functionality that was recently
added to the influxql package.

No math functions have been added, but the scaffolding has been included
so things like trigonometry functions are just a single commit away.

This also introduces a small breaking change. Because of the call
optimization, it is now possible to use the same selector multiple times
as a selector. So if you do this:

    SELECT max(value) * 2, max(value) / 2 FROM cpu

This will now return the timestamp of the max value rather than zero
since this query is considered to have only a single selector rather
than multiple separate selectors. If any aspect of the selector is
different, such as different selector functions or different arguments,
it will consider the selectors to be aggregates like the old behavior.
2018-03-19 15:01:15 -05:00
Jonathan A. Sternberg c8b0c6e166 Update influxql to include the function type evaluators in the query package 2018-03-14 15:42:28 -05: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
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 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