Move things around
parent
0a0b14ba23
commit
2c55e04188
|
@ -11,6 +11,13 @@ import (
|
|||
"github.com/influxdb/influxdb/protocol"
|
||||
)
|
||||
|
||||
type SeriesState struct {
|
||||
started bool
|
||||
trie *Trie
|
||||
pointsRange *PointRange
|
||||
lastTimestamp int64
|
||||
}
|
||||
|
||||
type AggregatorEngine struct {
|
||||
// query information
|
||||
ascending bool
|
||||
|
|
|
@ -2,13 +2,6 @@ package engine
|
|||
|
||||
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) {
|
||||
limit := query.Limit
|
||||
|
||||
|
@ -17,7 +10,7 @@ func NewQueryEngine(next Processor, query *parser.SelectQuery) (Processor, error
|
|||
var err error
|
||||
if query.HasAggregates() {
|
||||
engine, err = NewAggregatorEngine(query, engine)
|
||||
} else if containsArithmeticOperators(query) {
|
||||
} else if query.ContainsArithmeticOperators() {
|
||||
engine, err = NewArithmeticEngine(query, engine)
|
||||
}
|
||||
|
||||
|
@ -33,12 +26,3 @@ func NewQueryEngine(next Processor, query *parser.SelectQuery) (Processor, error
|
|||
}
|
||||
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
|
||||
// columns
|
||||
func (self *SelectQuery) HasAggregates() bool {
|
||||
|
|
Loading…
Reference in New Issue