mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
3bc01a1ad6
commit
1e7090cc8e
2 changed files with 14 additions and 7 deletions
|
@ -147,13 +147,20 @@ func (vd *valuesDecoder) decodeInplace(values []string, vt valueType, dictValues
|
|||
case valueTypeString:
|
||||
// nothing to do - values are already decoded.
|
||||
case valueTypeDict:
|
||||
sb := getStringBucket()
|
||||
for _, v := range dictValues {
|
||||
dstLen := len(dstBuf)
|
||||
dstBuf = append(dstBuf, v...)
|
||||
sb.a = append(sb.a, bytesutil.ToUnsafeString(dstBuf[dstLen:]))
|
||||
}
|
||||
for i, v := range values {
|
||||
id := int(v[0])
|
||||
if id >= len(dictValues) {
|
||||
return fmt.Errorf("unexpected dictionary id: %d; it must be smaller than %d", id, len(dictValues))
|
||||
}
|
||||
values[i] = dictValues[id]
|
||||
values[i] = sb.a[id]
|
||||
}
|
||||
putStringBucket(sb)
|
||||
case valueTypeUint8:
|
||||
for i, v := range values {
|
||||
if len(v) != 1 {
|
||||
|
|
|
@ -77,6 +77,12 @@ func TestValuesEncoder(t *testing.T) {
|
|||
}
|
||||
f(values, valueTypeUint64, 1<<32, uint64(len(values))<<32)
|
||||
|
||||
// float64 values
|
||||
for i := range values {
|
||||
values[i] = fmt.Sprintf("%g", math.Sqrt(float64(i+1)))
|
||||
}
|
||||
f(values, valueTypeFloat64, 4607182418800017408, 4613937818241073152)
|
||||
|
||||
// ipv4 values
|
||||
for i := range values {
|
||||
values[i] = fmt.Sprintf("1.2.3.%d", i)
|
||||
|
@ -88,12 +94,6 @@ func TestValuesEncoder(t *testing.T) {
|
|||
values[i] = fmt.Sprintf("2011-04-19T03:44:01.%03dZ", i)
|
||||
}
|
||||
f(values, valueTypeTimestampISO8601, 1303184641000000000, 1303184641008000000)
|
||||
|
||||
// float64 values
|
||||
for i := range values {
|
||||
values[i] = fmt.Sprintf("%g", math.Sqrt(float64(i+1)))
|
||||
}
|
||||
f(values, valueTypeFloat64, 4607182418800017408, 4613937818241073152)
|
||||
}
|
||||
|
||||
func TestTryParseIPv4_Success(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue