JayajP commented on code in PR #28995:
URL: https://github.com/apache/beam/pull/28995#discussion_r1360848687


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/util/HistogramData.java:
##########
@@ -227,6 +276,133 @@ public interface BucketType extends Serializable {
     double getAccumulatedBucketSize(int endIndex);
   }
 
+  @AutoValue
+  public abstract static class ExponentialBuckets implements BucketType {
+
+    public abstract double getBase();
+
+    public abstract int getScale();
+
+    /**
+     * Set to 2**scale which is equivalent to 1/log_2(base). Precomputed to 
use in {@code
+     * getBucketIndexPositiveScale}
+     */
+    public abstract double getInvLog2GrowthFactor();
+
+    @Override
+    public abstract int getNumBuckets();
+
+    /* Precomputed since this value is used everytime a datapoint is recorded. 
*/
+    @Override
+    public abstract double getRangeTo();
+
+    public static ExponentialBuckets of(int scale, int numBuckets) {
+      if (scale < -3) {

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to