Merge pull request #13752 from influxdata/fix/read-filter

fix(readservice): normalize special tag keys after reducing request p…
pull/13758/head
Lorenzo Affetti 2019-05-02 20:13:32 +02:00 committed by GitHub
commit 26d327ef9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -129,16 +129,8 @@ func (c *indexSeriesCursor) Next() *reads.SeriesRow {
//TODO(edd): check this.
c.row.SeriesTags = copyTags(c.row.SeriesTags, sr.Tags)
c.row.Tags = copyTags(c.row.Tags, sr.Tags)
// Normalise the special tag keys to the emitted format.
mv := c.row.Tags.Get(models.MeasurementTagKeyBytes)
c.row.Tags.Delete(models.MeasurementTagKeyBytes)
c.row.Tags.Set(measurementKeyBytes, mv)
fv := c.row.Tags.Get(models.FieldKeyTagKeyBytes)
c.row.Field = string(fv)
c.row.Tags.Delete(models.FieldKeyTagKeyBytes)
c.row.Tags.Set(fieldKeyBytes, fv)
if c.cond != nil && c.hasValueExpr {
// TODO(sgc): lazily evaluate valueCond
@ -149,6 +141,13 @@ func (c *indexSeriesCursor) Next() *reads.SeriesRow {
}
}
// Normalise the special tag keys to the emitted format.
mv := c.row.Tags.Get(models.MeasurementTagKeyBytes)
c.row.Tags.Delete(models.MeasurementTagKeyBytes)
c.row.Tags.Set(measurementKeyBytes, mv)
c.row.Tags.Delete(models.FieldKeyTagKeyBytes)
c.row.Tags.Set(fieldKeyBytes, fv)
return &c.row
}