Move things around

pull/893/head
John Shahid 2014-08-28 17:35:05 -04:00
parent 0a0b14ba23
commit 2c55e04188
3 changed files with 18 additions and 17 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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 {