Fix index bug in float encoder
parent
09da18c08e
commit
91d0a8c3d2
|
@ -68,7 +68,7 @@ func FloatArrayEncodeAll(src []float64, b []byte) ([]byte, error) {
|
|||
|
||||
// First the current bit of the current byte is set to indicate we're
|
||||
// writing a delta value to the stream.
|
||||
if n>>3 >= uint64(len(b)) { // Grow b — no room in current byte.
|
||||
for n>>3 >= uint64(len(b)) { // Keep growing b until we can fit all bits in.
|
||||
b = append(b, byte(0))
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,13 @@ import (
|
|||
"github.com/influxdata/influxdb/tsdb/engine/tsm1"
|
||||
)
|
||||
|
||||
var fullBlockFloat64Ones []float64
|
||||
|
||||
func init() {
|
||||
for i := 0; i < 1000; i++ {
|
||||
fullBlockFloat64Ones = append(fullBlockFloat64Ones, 1.0)
|
||||
}
|
||||
}
|
||||
func TestFloatArrayEncodeAll(t *testing.T) {
|
||||
examples := [][]float64{
|
||||
{12, 12, 24, 13, 24, 24, 24, 24}, // From example paper.
|
||||
|
@ -28,6 +35,7 @@ func TestFloatArrayEncodeAll(t *testing.T) {
|
|||
3.5635180996210295e+307}, // Failed during early development
|
||||
{6.00065e+06, 6.000656e+06, 6.000657e+06, 6.000659e+06, 6.000661e+06}, // Similar values.
|
||||
twoHoursData,
|
||||
fullBlockFloat64Ones,
|
||||
{},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue