Merge pull request #1345 from zhulongcheng/reduce-tag-copy

reduce parsing and copying of tags
pull/10616/head
Edd Robinson 2018-11-15 13:15:01 +00:00 committed by GitHub
commit dbc4610747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -45,19 +45,19 @@ func ExplodePoints(org, bucket platform.ID, points []models.Point) ([]models.Poi
ob := EncodeName(org, bucket)
name := string(ob[:])
var tags models.Tags
tags := make(models.Tags, 2)
for _, pt := range points {
t := pt.Time()
tags = tags[:2]
tags[1] = models.NewTag(MeasurementTagKeyBytes, pt.Name())
pt.ForEachTag(func(k, v []byte) bool {
tags = append(tags, models.NewTag(k, v))
return true
})
t := pt.Time()
itr := pt.FieldIterator()
for itr.Next() {
tags = tags[:0]
tags = append(tags, models.NewTag(FieldKeyTagKeyBytes, itr.FieldKey()))
tags = append(tags, models.NewTag(MeasurementTagKeyBytes, pt.Name()))
pt.ForEachTag(func(k, v []byte) bool {
tags = append(tags, models.NewTag(k, v))
return true
})
tags[0] = models.NewTag(FieldKeyTagKeyBytes, itr.FieldKey())
var err error
field := make(models.Fields, 1)