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
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -43,17 +43,17 @@ final class EncodedHistogramData {
43
43
- if there are no buckets, the result is an empty array (byte[0])
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
-
- for each remaining bucket:
47
-
- if the index of the bucket is exactly previousBucketIndex+1, write the count for the bucket as ZigZag-VLong
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
48
48
- Otherwise there is at least one empty bucket between this one and the previous one.
49
-
We compute that number as n=currentBucketIndex-previousIndex-1 and then write -n out as
49
+
We compute the number of empty buckets as n=currentBucketIndex-previousIndex-1 and then write -n out as
50
50
ZigZag-VLong followed by the count for the bucket as ZigZag-VLong. The negation is performed to allow to
51
-
distinguish the cases when decoding.
51
+
distinguish whether a value represents a bucket count (positive number) or the number of empty buckets (negative number) when decoding.
52
52
53
53
While this encoding is designed for sparse histograms, it compresses well for dense histograms too.
54
54
For fully dense histograms it effectively results in encoding the index of the first bucket, followed by just an array of counts.
55
55
For sparse histograms it corresponds to an interleaved encoding of the bucket indices with delta compression and the bucket counts.
56
-
Even partially dense histograms profit from this encoding.
56
+
Even mostly sparse histograms that have some dense regions profit from this encoding.
Copy file name to clipboardExpand all lines: x-pack/plugin/mapper-exponential-histogram/src/main/java/org/elasticsearch/xpack/exponentialhistogram/ExponentialHistogramFieldMapper.java
0 commit comments