commit
9e0e62323a
|
@ -729,7 +729,8 @@ func (i *Index) SeriesPointIterator(opt influxql.IteratorOptions) (influxql.Iter
|
||||||
sort.Sort(mms)
|
sort.Sort(mms)
|
||||||
|
|
||||||
return &seriesPointIterator{
|
return &seriesPointIterator{
|
||||||
mms: mms,
|
database: i.database,
|
||||||
|
mms: mms,
|
||||||
point: influxql.FloatPoint{
|
point: influxql.FloatPoint{
|
||||||
Aux: make([]interface{}, len(opt.Aux)),
|
Aux: make([]interface{}, len(opt.Aux)),
|
||||||
},
|
},
|
||||||
|
@ -911,9 +912,10 @@ func NewShardIndex(id uint64, database, path string, opt tsdb.EngineOptions) tsd
|
||||||
|
|
||||||
// seriesPointIterator emits series as influxql points.
|
// seriesPointIterator emits series as influxql points.
|
||||||
type seriesPointIterator struct {
|
type seriesPointIterator struct {
|
||||||
mms Measurements
|
database string
|
||||||
keys struct {
|
mms Measurements
|
||||||
buf []string
|
keys struct {
|
||||||
|
buf []*Series
|
||||||
i int
|
i int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,14 +943,18 @@ func (itr *seriesPointIterator) Next() (*influxql.FloatPoint, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the next key.
|
// Read the next key.
|
||||||
key := itr.keys.buf[itr.keys.i]
|
series := itr.keys.buf[itr.keys.i]
|
||||||
itr.keys.i++
|
itr.keys.i++
|
||||||
|
|
||||||
|
if !itr.opt.Authorizer.AuthorizeSeriesRead(itr.database, series.measurement.name, series.tags) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Write auxiliary fields.
|
// Write auxiliary fields.
|
||||||
for i, f := range itr.opt.Aux {
|
for i, f := range itr.opt.Aux {
|
||||||
switch f.Val {
|
switch f.Val {
|
||||||
case "key":
|
case "key":
|
||||||
itr.point.Aux[i] = key
|
itr.point.Aux[i] = series.Key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &itr.point, nil
|
return &itr.point, nil
|
||||||
|
@ -975,8 +981,12 @@ func (itr *seriesPointIterator) nextKeys() error {
|
||||||
} else if len(ids) == 0 {
|
} else if len(ids) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
itr.keys.buf = mm.AppendSeriesKeysByID(itr.keys.buf, ids)
|
itr.keys.buf = mm.SeriesByIDSlice(ids)
|
||||||
sort.Strings(itr.keys.buf)
|
|
||||||
|
// Sort series by key
|
||||||
|
sort.Slice(itr.keys.buf, func(i, j int) bool {
|
||||||
|
return itr.keys.buf[i].Key < itr.keys.buf[j].Key
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue