fix: summation should be in native type for mean,count iterator (#21334)
parent
32aa970eba
commit
4cf19f8254
|
@ -47,6 +47,7 @@ v1.9.0 [unreleased]
|
|||
- [#21139](https://github.com/influxdata/influxdb/pull/21139): fix(tsdb): exclude stop time from array cursors
|
||||
- [#21036](https://github.com/influxdata/influxdb/pull/21306): fix(models): grow tag index buffer if needed
|
||||
- [#21275](https://github.com/influxdata/influxdb/pull/21275): fix: Anti-Entropy loops endlessly with empty shard
|
||||
- [#21334](https://github.com/influxdata/influxdb/pull/21334): fix: summation should be in native type for new meancount iterator
|
||||
|
||||
v1.8.5 [unreleased]
|
||||
-------------------
|
||||
|
|
|
@ -2135,7 +2135,7 @@ func (c *integerWindowMeanCountArrayCursor) Next() *cursors.MeanCountArray {
|
|||
}
|
||||
|
||||
rowIdx := 0
|
||||
var sum float64
|
||||
var sum int64
|
||||
var count int64
|
||||
|
||||
var windowEnd int64
|
||||
|
@ -2156,7 +2156,7 @@ WINDOWS:
|
|||
// do not generate a point for empty windows
|
||||
if windowHasPoints {
|
||||
c.res.Timestamps[pos] = windowEnd
|
||||
c.res.Values0[pos] = sum / float64(count)
|
||||
c.res.Values0[pos] = float64(sum) / float64(count)
|
||||
c.res.Values1[pos] = count
|
||||
pos++
|
||||
if pos >= MaxPointsPerBlock {
|
||||
|
@ -2177,7 +2177,7 @@ WINDOWS:
|
|||
|
||||
continue WINDOWS
|
||||
} else {
|
||||
sum += float64(a.Values[rowIdx])
|
||||
sum += a.Values[rowIdx]
|
||||
count++
|
||||
windowHasPoints = true
|
||||
}
|
||||
|
@ -2194,7 +2194,7 @@ WINDOWS:
|
|||
// do not generate a point for empty windows
|
||||
if windowHasPoints {
|
||||
c.res.Timestamps[pos] = windowEnd
|
||||
c.res.Values0[pos] = sum / float64(count)
|
||||
c.res.Values0[pos] = float64(sum) / float64(count)
|
||||
c.res.Values1[pos] = count
|
||||
pos++
|
||||
}
|
||||
|
@ -3138,7 +3138,7 @@ func (c *unsignedWindowMeanCountArrayCursor) Next() *cursors.MeanCountArray {
|
|||
}
|
||||
|
||||
rowIdx := 0
|
||||
var sum float64
|
||||
var sum uint64
|
||||
var count int64
|
||||
|
||||
var windowEnd int64
|
||||
|
@ -3159,7 +3159,7 @@ WINDOWS:
|
|||
// do not generate a point for empty windows
|
||||
if windowHasPoints {
|
||||
c.res.Timestamps[pos] = windowEnd
|
||||
c.res.Values0[pos] = sum / float64(count)
|
||||
c.res.Values0[pos] = float64(sum) / float64(count)
|
||||
c.res.Values1[pos] = count
|
||||
pos++
|
||||
if pos >= MaxPointsPerBlock {
|
||||
|
@ -3180,7 +3180,7 @@ WINDOWS:
|
|||
|
||||
continue WINDOWS
|
||||
} else {
|
||||
sum += float64(a.Values[rowIdx])
|
||||
sum += a.Values[rowIdx]
|
||||
count++
|
||||
windowHasPoints = true
|
||||
}
|
||||
|
@ -3197,7 +3197,7 @@ WINDOWS:
|
|||
// do not generate a point for empty windows
|
||||
if windowHasPoints {
|
||||
c.res.Timestamps[pos] = windowEnd
|
||||
c.res.Values0[pos] = sum / float64(count)
|
||||
c.res.Values0[pos] = float64(sum) / float64(count)
|
||||
c.res.Values1[pos] = count
|
||||
pos++
|
||||
}
|
||||
|
|
|
@ -102,9 +102,9 @@
|
|||
{
|
||||
"Name":"MeanCount",
|
||||
"OutputTypeName":"MeanCount",
|
||||
"AccDecls":"var sum float64; var count int64",
|
||||
"Accumulate":"sum += float64(a.Values[rowIdx]); count++",
|
||||
"AccEmit":"c.res.Timestamps[pos] = windowEnd; c.res.Values0[pos] = sum / float64(count); c.res.Values1[pos] = count",
|
||||
"AccDecls":"var sum int64; var count int64",
|
||||
"Accumulate":"sum += a.Values[rowIdx]; count++",
|
||||
"AccEmit":"c.res.Timestamps[pos] = windowEnd; c.res.Values0[pos] = float64(sum) / float64(count); c.res.Values1[pos] = count",
|
||||
"AccReset":"sum = 0; count = 0"
|
||||
}
|
||||
]
|
||||
|
@ -157,9 +157,9 @@
|
|||
{
|
||||
"Name":"MeanCount",
|
||||
"OutputTypeName":"MeanCount",
|
||||
"AccDecls":"var sum float64; var count int64",
|
||||
"Accumulate":"sum += float64(a.Values[rowIdx]); count++",
|
||||
"AccEmit":"c.res.Timestamps[pos] = windowEnd; c.res.Values0[pos] = sum / float64(count); c.res.Values1[pos] = count",
|
||||
"AccDecls":"var sum uint64; var count int64",
|
||||
"Accumulate":"sum += a.Values[rowIdx]; count++",
|
||||
"AccEmit":"c.res.Timestamps[pos] = windowEnd; c.res.Values0[pos] = float64(sum) / float64(count); c.res.Values1[pos] = count",
|
||||
"AccReset":"sum = 0; count = 0"
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue