You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: x-pack/plugin/mapper-exponential-histogram/src/main/java/org/elasticsearch/xpack/exponentialhistogram/EncodedHistogramData.java
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -44,11 +44,13 @@ final class EncodedHistogramData {
44
44
- write the index of the first bucket as ZigZag-VLong
45
45
- write the count of the first bucket as ZigZag-VLong
46
46
- for each remaining (non-empty) bucket:
47
-
- if there was no empty bucket right before this bucket (the index of the bucket is exactly previousBucketIndex+1), write the count for the bucket as ZigZag-VLong
47
+
- if there was no empty bucket right before this bucket (the index of the bucket is exactly previousBucketIndex+1),
48
+
write the count for the bucket as ZigZag-VLong
48
49
- Otherwise there is at least one empty bucket between this one and the previous one.
49
50
We compute the number of empty buckets as n=currentBucketIndex-previousIndex-1 and then write -n out as
50
51
ZigZag-VLong followed by the count for the bucket as ZigZag-VLong. The negation is performed to allow to
51
-
distinguish whether a value represents a bucket count (positive number) or the number of empty buckets (negative number) when decoding.
52
+
distinguish whether a value represents a bucket count (positive number) or the number of empty buckets (negative number)
53
+
when decoding.
52
54
53
55
While this encoding is designed for sparse histograms, it compresses well for dense histograms too.
54
56
For fully dense histograms it effectively results in encoding the index of the first bucket, followed by just an array of counts.
0 commit comments