Merge pull request #6560 from benbjohnson/optimize-tsm1-call-iterator
Move call iterator to series levelpull/6565/head
commit
4c45f8ec32
|
@ -117,8 +117,10 @@ func (a Iterators) cast() interface{} {
|
||||||
// interval.
|
// interval.
|
||||||
func NewMergeIterator(inputs []Iterator, opt IteratorOptions) Iterator {
|
func NewMergeIterator(inputs []Iterator, opt IteratorOptions) Iterator {
|
||||||
inputs = Iterators(inputs).filterNonNil()
|
inputs = Iterators(inputs).filterNonNil()
|
||||||
if len(inputs) == 0 {
|
if n := len(inputs); n == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
} else if n == 1 {
|
||||||
|
return inputs[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aggregate functions can use a more relaxed sorting so that points
|
// Aggregate functions can use a more relaxed sorting so that points
|
||||||
|
|
|
@ -746,16 +746,24 @@ func (e *Engine) CreateIterator(opt influxql.IteratorOptions) (influxql.Iterator
|
||||||
inputs, err := e.createVarRefIterator(refOpt)
|
inputs, err := e.createVarRefIterator(refOpt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
} else if len(inputs) == 0 {
|
||||||
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
input := influxql.NewMergeIterator(inputs, opt)
|
// Wrap each series in a call iterator.
|
||||||
if input != nil {
|
for i, input := range inputs {
|
||||||
if opt.InterruptCh != nil {
|
if opt.InterruptCh != nil {
|
||||||
input = influxql.NewInterruptIterator(input, opt.InterruptCh)
|
input = influxql.NewInterruptIterator(input, opt.InterruptCh)
|
||||||
}
|
}
|
||||||
return influxql.NewCallIterator(input, opt)
|
|
||||||
|
itr, err := influxql.NewCallIterator(input, opt)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
inputs[i] = itr
|
||||||
}
|
}
|
||||||
return nil, nil
|
|
||||||
|
return influxql.NewMergeIterator(inputs, opt), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
itrs, err := e.createVarRefIterator(opt)
|
itrs, err := e.createVarRefIterator(opt)
|
||||||
|
|
Loading…
Reference in New Issue