Move things around
parent
0a0b14ba23
commit
2c55e04188
|
@ -11,6 +11,13 @@ import (
|
||||||
"github.com/influxdb/influxdb/protocol"
|
"github.com/influxdb/influxdb/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type SeriesState struct {
|
||||||
|
started bool
|
||||||
|
trie *Trie
|
||||||
|
pointsRange *PointRange
|
||||||
|
lastTimestamp int64
|
||||||
|
}
|
||||||
|
|
||||||
type AggregatorEngine struct {
|
type AggregatorEngine struct {
|
||||||
// query information
|
// query information
|
||||||
ascending bool
|
ascending bool
|
||||||
|
|
|
@ -2,13 +2,6 @@ package engine
|
||||||
|
|
||||||
import "github.com/influxdb/influxdb/parser"
|
import "github.com/influxdb/influxdb/parser"
|
||||||
|
|
||||||
type SeriesState struct {
|
|
||||||
started bool
|
|
||||||
trie *Trie
|
|
||||||
pointsRange *PointRange
|
|
||||||
lastTimestamp int64
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewQueryEngine(next Processor, query *parser.SelectQuery) (Processor, error) {
|
func NewQueryEngine(next Processor, query *parser.SelectQuery) (Processor, error) {
|
||||||
limit := query.Limit
|
limit := query.Limit
|
||||||
|
|
||||||
|
@ -17,7 +10,7 @@ func NewQueryEngine(next Processor, query *parser.SelectQuery) (Processor, error
|
||||||
var err error
|
var err error
|
||||||
if query.HasAggregates() {
|
if query.HasAggregates() {
|
||||||
engine, err = NewAggregatorEngine(query, engine)
|
engine, err = NewAggregatorEngine(query, engine)
|
||||||
} else if containsArithmeticOperators(query) {
|
} else if query.ContainsArithmeticOperators() {
|
||||||
engine, err = NewArithmeticEngine(query, engine)
|
engine, err = NewArithmeticEngine(query, engine)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,12 +26,3 @@ func NewQueryEngine(next Processor, query *parser.SelectQuery) (Processor, error
|
||||||
}
|
}
|
||||||
return engine, nil
|
return engine, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func containsArithmeticOperators(query *parser.SelectQuery) bool {
|
|
||||||
for _, column := range query.GetColumnNames() {
|
|
||||||
if column.Type == parser.ValueExpression {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
|
@ -102,6 +102,16 @@ func (self *SelectQuery) revertAlias(mapping map[string][]string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if the query has some expression in the select clause
|
||||||
|
func (self *SelectQuery) ContainsArithmeticOperators() bool {
|
||||||
|
for _, column := range self.GetColumnNames() {
|
||||||
|
if column.Type == ValueExpression {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// Returns true if the query has aggregate functions applied to the
|
// Returns true if the query has aggregate functions applied to the
|
||||||
// columns
|
// columns
|
||||||
func (self *SelectQuery) HasAggregates() bool {
|
func (self *SelectQuery) HasAggregates() bool {
|
||||||
|
|
Loading…
Reference in New Issue