mccormickt12 commented on code in PR #5486:
URL: https://github.com/apache/hadoop/pull/5486#discussion_r1139541639


##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/util/TestSampleQuantiles.java:
##########
@@ -118,4 +118,36 @@ public void testQuantileError() throws IOException {
       }
     }
   }
+  
+  @Test
+  public void testInverseQuantiles() {

Review Comment:
   nit: can you just add a description of what the test is doing



##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/InverseQuantiles.java:
##########
@@ -0,0 +1,44 @@
+package org.apache.hadoop.metrics2.util;
+
+import org.apache.hadoop.util.Preconditions;
+import java.util.ListIterator;
+
+public class InverseQuantiles extends SampleQuantiles{
+
+  public InverseQuantiles(Quantile[] quantiles) {
+    super(quantiles);
+  }
+  
+
+  /**
+   * Get the estimated value at the inverse of the specified quantile. 
+   * Eg: return the value at (1 - 0.99)*count position for quantile 0.99.
+   * When count is 100, quantile 0.99 is desired to return the value at the 
1st position
+   *
+   * @param quantile Queried quantile, e.g. 0.50 or 0.99.
+   * @return Estimated value at the inverse position of that quantile. 
+   */
+  long query(double quantile) {

Review Comment:
   im assuming this logic looks similar to the SampleQuantile, is there any 
small refactor we could do to DRY, then maybe a couple lines below looks like 
   `int desired = getQuantile(quantile)` 
   with a default and overridden implementation?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to