mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
e954330e54
commit
0c6ce34295
1 changed files with 58 additions and 0 deletions
|
@ -524,6 +524,8 @@ func (br *blockResult) getBucketedTimestampValues(bf *byStatsField) []string {
|
|||
bucketSizeInt = 1
|
||||
}
|
||||
bucketOffsetInt := int64(bf.bucketOffset)
|
||||
|
||||
timestampPrev := int64(0)
|
||||
for i := range timestamps {
|
||||
if i > 0 && timestamps[i-1] == timestamps[i] {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
|
@ -541,6 +543,12 @@ func (br *blockResult) getBucketedTimestampValues(bf *byStatsField) []string {
|
|||
}
|
||||
timestamp += bucketOffsetInt
|
||||
|
||||
if i > 0 && timestampPrev == timestamp {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
continue
|
||||
}
|
||||
timestampPrev = timestamp
|
||||
|
||||
bufLen := len(buf)
|
||||
buf = marshalTimestampRFC3339Nano(buf, timestamp)
|
||||
s = bytesutil.ToUnsafeString(buf[bufLen:])
|
||||
|
@ -620,6 +628,7 @@ func (br *blockResult) getBucketedUint8Values(encodedValues []string, bf *byStat
|
|||
}
|
||||
bucketOffsetInt := uint64(int64(bf.bucketOffset))
|
||||
|
||||
nPrev := uint64(0)
|
||||
for i, v := range encodedValues {
|
||||
if i > 0 && encodedValues[i-1] == encodedValues[i] {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
|
@ -631,6 +640,12 @@ func (br *blockResult) getBucketedUint8Values(encodedValues []string, bf *byStat
|
|||
n -= n % bucketSizeInt
|
||||
n += bucketOffsetInt
|
||||
|
||||
if i > 0 && nPrev == n {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
continue
|
||||
}
|
||||
nPrev = n
|
||||
|
||||
bufLen := len(buf)
|
||||
buf = marshalUint64(buf, n)
|
||||
s = bytesutil.ToUnsafeString(buf[bufLen:])
|
||||
|
@ -672,6 +687,7 @@ func (br *blockResult) getBucketedUint16Values(encodedValues []string, bf *bySta
|
|||
}
|
||||
bucketOffsetInt := uint64(int64(bf.bucketOffset))
|
||||
|
||||
nPrev := uint64(0)
|
||||
for i, v := range encodedValues {
|
||||
if i > 0 && encodedValues[i-1] == encodedValues[i] {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
|
@ -684,6 +700,12 @@ func (br *blockResult) getBucketedUint16Values(encodedValues []string, bf *bySta
|
|||
n -= n % bucketSizeInt
|
||||
n += bucketOffsetInt
|
||||
|
||||
if i > 0 && nPrev == n {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
continue
|
||||
}
|
||||
nPrev = n
|
||||
|
||||
bufLen := len(buf)
|
||||
buf = marshalUint64(buf, n)
|
||||
s = bytesutil.ToUnsafeString(buf[bufLen:])
|
||||
|
@ -725,6 +747,7 @@ func (br *blockResult) getBucketedUint32Values(encodedValues []string, bf *bySta
|
|||
}
|
||||
bucketOffsetInt := uint64(int64(bf.bucketOffset))
|
||||
|
||||
nPrev := uint64(0)
|
||||
for i, v := range encodedValues {
|
||||
if i > 0 && encodedValues[i-1] == encodedValues[i] {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
|
@ -737,6 +760,12 @@ func (br *blockResult) getBucketedUint32Values(encodedValues []string, bf *bySta
|
|||
n -= n % bucketSizeInt
|
||||
n += bucketOffsetInt
|
||||
|
||||
if i > 0 && nPrev == n {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
continue
|
||||
}
|
||||
nPrev = n
|
||||
|
||||
bufLen := len(buf)
|
||||
buf = marshalUint64(buf, n)
|
||||
s = bytesutil.ToUnsafeString(buf[bufLen:])
|
||||
|
@ -778,6 +807,7 @@ func (br *blockResult) getBucketedUint64Values(encodedValues []string, bf *bySta
|
|||
}
|
||||
bucketOffsetInt := uint64(int64(bf.bucketOffset))
|
||||
|
||||
nPrev := uint64(0)
|
||||
for i, v := range encodedValues {
|
||||
if i > 0 && encodedValues[i-1] == encodedValues[i] {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
|
@ -790,6 +820,12 @@ func (br *blockResult) getBucketedUint64Values(encodedValues []string, bf *bySta
|
|||
n -= n % bucketSizeInt
|
||||
n += bucketOffsetInt
|
||||
|
||||
if i > 0 && nPrev == n {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
continue
|
||||
}
|
||||
nPrev = n
|
||||
|
||||
bufLen := len(buf)
|
||||
buf = marshalUint64(buf, n)
|
||||
s = bytesutil.ToUnsafeString(buf[bufLen:])
|
||||
|
@ -835,6 +871,8 @@ func (br *blockResult) getBucketedFloat64Values(encodedValues []string, bf *bySt
|
|||
_, e := decimal.FromFloat(bucketSize)
|
||||
p10 := math.Pow10(int(-e))
|
||||
bucketSizeP10 := int64(bucketSize * p10)
|
||||
|
||||
fPrev := float64(0)
|
||||
for i, v := range encodedValues {
|
||||
if i > 0 && encodedValues[i-1] == encodedValues[i] {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
|
@ -854,6 +892,12 @@ func (br *blockResult) getBucketedFloat64Values(encodedValues []string, bf *bySt
|
|||
|
||||
f += bf.bucketOffset
|
||||
|
||||
if fPrev == f {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
continue
|
||||
}
|
||||
fPrev = f
|
||||
|
||||
bufLen := len(buf)
|
||||
buf = marshalFloat64(buf, f)
|
||||
s = bytesutil.ToUnsafeString(buf[bufLen:])
|
||||
|
@ -893,6 +937,7 @@ func (br *blockResult) getBucketedIPv4Values(encodedValues []string, bf *byStats
|
|||
}
|
||||
bucketOffsetInt := uint32(int32(bf.bucketOffset))
|
||||
|
||||
nPrev := uint32(0)
|
||||
for i, v := range encodedValues {
|
||||
if i > 0 && encodedValues[i-1] == encodedValues[i] {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
|
@ -905,6 +950,12 @@ func (br *blockResult) getBucketedIPv4Values(encodedValues []string, bf *byStats
|
|||
n -= n % bucketSizeInt
|
||||
n += bucketOffsetInt
|
||||
|
||||
if i > 0 && nPrev == n {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
continue
|
||||
}
|
||||
nPrev = n
|
||||
|
||||
bufLen := len(buf)
|
||||
buf = marshalIPv4(buf, n)
|
||||
s = bytesutil.ToUnsafeString(buf[bufLen:])
|
||||
|
@ -947,6 +998,7 @@ func (br *blockResult) getBucketedTimestampISO8601Values(encodedValues []string,
|
|||
}
|
||||
bucketOffsetInt := int64(bf.bucketOffset)
|
||||
|
||||
timestampPrev := int64(0)
|
||||
bb := bbPool.Get()
|
||||
for i, v := range encodedValues {
|
||||
if i > 0 && encodedValues[i-1] == encodedValues[i] {
|
||||
|
@ -967,6 +1019,12 @@ func (br *blockResult) getBucketedTimestampISO8601Values(encodedValues []string,
|
|||
timestamp -= timestamp % bucketSizeInt
|
||||
timestamp += bucketOffsetInt
|
||||
|
||||
if timestampPrev == timestamp {
|
||||
valuesBuf = append(valuesBuf, s)
|
||||
continue
|
||||
}
|
||||
timestampPrev = timestamp
|
||||
|
||||
bufLen := len(buf)
|
||||
buf = marshalTimestampISO8601(buf, int64(timestamp))
|
||||
s = bytesutil.ToUnsafeString(buf[bufLen:])
|
||||
|
|
Loading…
Reference in a new issue