You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2023/03/22 20:16:59 UTC

[datasketches-java] branch master updated: accidentally pushed to master, reverting

This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git


The following commit(s) were added to refs/heads/master by this push:
     new f931cb45 accidentally pushed to master, reverting
f931cb45 is described below

commit f931cb45648fd38b9636db89f67262fdbb153b3b
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Wed Mar 22 13:15:09 2023 -0700

    accidentally pushed to master, reverting
---
 .../apache/datasketches/kll/KllDoublesSketch.java  |  3 +-
 .../apache/datasketches/kll/KllFloatsSketch.java   |  3 +-
 .../datasketches/quantiles/DoublesSketch.java      |  3 +-
 .../apache/datasketches/quantiles/ItemsSketch.java |  3 +-
 .../quantilescommon/QuantilesDoublesAPI.java       | 27 ++++++------
 .../quantilescommon/QuantilesFloatsAPI.java        | 27 ++++++------
 .../quantilescommon/QuantilesGenericAPI.java       | 27 ++++++------
 .../quantilescommon/QuantilesUtil.java             | 50 ++++++++--------------
 .../org/apache/datasketches/req/BaseReqSketch.java |  3 +-
 .../kll/KllDirectDoublesSketchTest.java            |  9 ++--
 .../kll/KllDirectFloatsSketchTest.java             |  9 ++--
 .../datasketches/kll/KllDoublesSketchTest.java     |  9 ++--
 .../datasketches/kll/KllFloatsSketchTest.java      |  9 ++--
 .../quantiles/HeapUpdateDoublesSketchTest.java     |  7 ++-
 .../datasketches/quantiles/ItemsSketchTest.java    |  4 +-
 .../quantilescommon/QuantilesUtilTest.java         | 32 ++++----------
 .../org/apache/datasketches/req/ReqSketchTest.java |  3 +-
 17 files changed, 95 insertions(+), 133 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/kll/KllDoublesSketch.java b/src/main/java/org/apache/datasketches/kll/KllDoublesSketch.java
index 8c469b82..da110095 100644
--- a/src/main/java/org/apache/datasketches/kll/KllDoublesSketch.java
+++ b/src/main/java/org/apache/datasketches/kll/KllDoublesSketch.java
@@ -26,7 +26,6 @@ import static org.apache.datasketches.kll.KllSketch.Error.MUST_NOT_BE_UPDATABLE_
 import static org.apache.datasketches.kll.KllSketch.Error.MUST_NOT_CALL;
 import static org.apache.datasketches.kll.KllSketch.Error.TGT_IS_READ_ONLY;
 import static org.apache.datasketches.kll.KllSketch.Error.kllSketchThrow;
-import static org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpacedRanks;
 import static org.apache.datasketches.quantilescommon.QuantilesUtil.THROWS_EMPTY;
 
 import java.util.Objects;
@@ -216,7 +215,7 @@ public abstract class KllDoublesSketch extends KllSketch implements QuantilesDou
   @Override
   public double[] getQuantiles(final int numEvenlySpaced, final QuantileSearchCriteria searchCrit) {
     if (isEmpty()) { throw new IllegalArgumentException(THROWS_EMPTY); }
-    return getQuantiles(evenlySpacedRanks(numEvenlySpaced),
+    return getQuantiles(org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpaced(0.0, 1.0, numEvenlySpaced),
         searchCrit);
   }
 
diff --git a/src/main/java/org/apache/datasketches/kll/KllFloatsSketch.java b/src/main/java/org/apache/datasketches/kll/KllFloatsSketch.java
index 5da842ac..d012d0c5 100644
--- a/src/main/java/org/apache/datasketches/kll/KllFloatsSketch.java
+++ b/src/main/java/org/apache/datasketches/kll/KllFloatsSketch.java
@@ -26,7 +26,6 @@ import static org.apache.datasketches.kll.KllSketch.Error.MUST_NOT_BE_UPDATABLE_
 import static org.apache.datasketches.kll.KllSketch.Error.MUST_NOT_CALL;
 import static org.apache.datasketches.kll.KllSketch.Error.TGT_IS_READ_ONLY;
 import static org.apache.datasketches.kll.KllSketch.Error.kllSketchThrow;
-import static org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpacedRanks;
 import static org.apache.datasketches.quantilescommon.QuantilesUtil.THROWS_EMPTY;
 
 import java.util.Objects;
@@ -216,7 +215,7 @@ public abstract class KllFloatsSketch extends KllSketch implements QuantilesFloa
   @Override
   public float[] getQuantiles(final int numEvenlySpaced, final QuantileSearchCriteria searchCrit) {
     if (isEmpty()) { throw new IllegalArgumentException(THROWS_EMPTY); }
-    return getQuantiles(evenlySpacedRanks(numEvenlySpaced),
+    return getQuantiles(org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpaced(0.0, 1.0, numEvenlySpaced),
         searchCrit);
   }
 
diff --git a/src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java b/src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java
index 440426a7..3a982572 100644
--- a/src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java
+++ b/src/main/java/org/apache/datasketches/quantiles/DoublesSketch.java
@@ -23,7 +23,6 @@ import static java.lang.Math.max;
 import static java.lang.Math.min;
 import static org.apache.datasketches.common.Util.ceilingIntPowerOf2;
 import static org.apache.datasketches.quantiles.ClassicUtil.checkIsCompactMemory;
-import static org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpacedRanks;
 import static org.apache.datasketches.quantilescommon.QuantilesUtil.THROWS_EMPTY;
 
 import java.util.Random;
@@ -201,7 +200,7 @@ public abstract class DoublesSketch implements QuantilesDoublesAPI {
   @Override
   public double[] getQuantiles(final int numEvenlySpaced, final QuantileSearchCriteria searchCrit) {
     if (isEmpty()) { throw new IllegalArgumentException(THROWS_EMPTY); }
-    return getQuantiles(evenlySpacedRanks(numEvenlySpaced),
+    return getQuantiles(org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpaced(0.0, 1.0, numEvenlySpaced),
         searchCrit);
   }
 
diff --git a/src/main/java/org/apache/datasketches/quantiles/ItemsSketch.java b/src/main/java/org/apache/datasketches/quantiles/ItemsSketch.java
index f1d05cad..3df49447 100644
--- a/src/main/java/org/apache/datasketches/quantiles/ItemsSketch.java
+++ b/src/main/java/org/apache/datasketches/quantiles/ItemsSketch.java
@@ -31,7 +31,6 @@ import static org.apache.datasketches.quantiles.PreambleUtil.extractN;
 import static org.apache.datasketches.quantiles.PreambleUtil.extractPreLongs;
 import static org.apache.datasketches.quantiles.PreambleUtil.extractSerVer;
 import static org.apache.datasketches.quantilescommon.QuantileSearchCriteria.INCLUSIVE;
-import static org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpacedRanks;
 import static org.apache.datasketches.quantilescommon.QuantilesUtil.THROWS_EMPTY;
 
 import java.lang.reflect.Array;
@@ -545,7 +544,7 @@ public final class ItemsSketch<T> implements QuantilesAPI {
    */
   public T[] getQuantiles(final int numEvenlySpaced, final QuantileSearchCriteria searchCrit) {
     if (isEmpty()) { throw new IllegalArgumentException(THROWS_EMPTY); }
-    return getQuantiles(evenlySpacedRanks(numEvenlySpaced),
+    return getQuantiles(org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpaced(0.0, 1.0, numEvenlySpaced),
         searchCrit);
   }
 
diff --git a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesDoublesAPI.java b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesDoublesAPI.java
index 3868e413..e4083567 100644
--- a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesDoublesAPI.java
+++ b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesDoublesAPI.java
@@ -235,25 +235,24 @@ public interface QuantilesDoublesAPI extends QuantilesAPI {
   }
 
   /**
-   * This is a version of getQuantiles() where the caller only specifies the number of of desired quantile intervals 
-   * that are computed from an array of evenly spaced normalized ranks between 0 and 1.0 determined from the given
-   * <i>numEvenlySpaced</i> parameter.
+   * This is a version of getQuantiles() where the caller only specifies the number of of desired evenly spaced,
+   * normalized ranks, and returns an array of the corresponding quantiles.
    *
-   * @param numEvenlySpaced an integer that specifies the number of desired quantile intervals to be returned
-   * from the sketch. This must be a positive integer greater than 0.
-   * <ul><li>Let <i>Largest</i> be the largest quantile retained by the sketch algorithm.
-   * (This should not to be confused with {@link #getMaxItem},
-   * which is the largest quantile of the stream. They may be equal, but not necessarily.)</li>
-   * <li>A 1 will return the Largest quantile.</li>
-   * <li>A 2 will return 2 quantiles, including the Largest, dividing the quantile domain into two regions. 
-   * The first returned quantile should roughly correspond to the median quantile</li>
-   * <li>A 3 will return 3 quantiles, including the Largest, dividing the quantile domain into three regions.</li>
+   * @param numEvenlySpaced an integer that specifies the number of evenly spaced normalized ranks.
+   * This must be a positive integer greater than 0.
+   * <ul><li>Let <i>Smallest</i> and <i>Largest</i> be the smallest and largest quantiles
+   * retained by the sketch algorithm, respectively.
+   * (This should not to be confused with {@link #getMinItem} and {@link #getMaxItem},
+   * which are the smallest and largest quantiles of the stream.)</li>
+   * <li>A 1 will return the Smallest quantile.</li>
+   * <li>A 2 will return the Smallest and Largest quantiles.</li>
+   * <li>A 3 will return the Smallest, the Median, and the Largest quantiles.</li>
    * <li>Etc.</li>
    * </ul>
    *
    * @param searchCrit if INCLUSIVE, the given ranks include all quantiles &le; the quantile directly corresponding to
-   * any given rank. In this case the ranks are generated internally by this method.
-   * @return an array of quantiles that divide the quantile domain into numEvenlySpaced quantile intervals.
+   * each rank.
+   * @return an array of quantiles that are evenly spaced by their ranks.
    * @throws IllegalArgumentException if sketch is empty or if <i>numEvenlySpaced is less than 1</i>.
    * @see org.apache.datasketches.quantilescommon.QuantileSearchCriteria
    */
diff --git a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesFloatsAPI.java b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesFloatsAPI.java
index 5b73ad10..91ecfff4 100644
--- a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesFloatsAPI.java
+++ b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesFloatsAPI.java
@@ -234,25 +234,24 @@ public interface QuantilesFloatsAPI extends QuantilesAPI {
   }
 
   /**
-   * This is a version of getQuantiles() where the caller only specifies the number of of desired quantile intervals 
-   * that are computed from an array of evenly spaced normalized ranks between 0 and 1.0 determined from the given
-   * <i>numEvenlySpaced</i> parameter.
+   * This is a version of getQuantiles() where the caller only specifies the number of of desired evenly spaced,
+   * normalized ranks, and returns an array of the corresponding quantiles.
    *
-   * @param numEvenlySpaced an integer that specifies the number of desired quantile intervals to be returned
-   * from the sketch. This must be a positive integer greater than 0.
-   * <ul><li>Let <i>Largest</i> be the largest quantile retained by the sketch algorithm.
-   * (This should not to be confused with {@link #getMaxItem},
-   * which is the largest quantile of the stream. They may be equal, but not necessarily.)</li>
-   * <li>A 1 will return the Largest quantile.</li>
-   * <li>A 2 will return 2 quantiles, including the Largest, dividing the quantile domain into two regions. 
-   * The first returned quantile should roughly correspond to the median quantile</li>
-   * <li>A 3 will return 3 quantiles, including the Largest, dividing the quantile domain into three regions.</li>
+   * @param numEvenlySpaced an integer that specifies the number of evenly spaced normalized ranks.
+   * This must be a positive integer greater than 0.
+   * <ul><li>Let <i>Smallest</i> and <i>Largest</i> be the smallest and largest quantiles
+   * retained by the sketch algorithm, respectively.
+   * (This should not to be confused with {@link #getMinItem} and {@link #getMaxItem},
+   * which are the smallest and largest quantiles of the stream.)</li>
+   * <li>A 1 will return the Smallest quantile.</li>
+   * <li>A 2 will return the Smallest and Largest quantiles.</li>
+   * <li>A 3 will return the Smallest, the Median, and the Largest quantiles.</li>
    * <li>Etc.</li>
    * </ul>
    *
    * @param searchCrit if INCLUSIVE, the given ranks include all quantiles &le; the quantile directly corresponding to
-   * any given rank. In this case the ranks are generated internally by this method.
-   * @return an array of quantiles that divide the quantile domain into numEvenlySpaced quantile intervals.
+   * each rank.
+   * @return an array of quantiles that are evenly spaced by their ranks.
    * @throws IllegalArgumentException if sketch is empty or if <i>numEvenlySpaced is less than 1</i>.
    * @see org.apache.datasketches.quantilescommon.QuantileSearchCriteria
    */
diff --git a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesGenericAPI.java b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesGenericAPI.java
index a0d1177b..b6d15b60 100644
--- a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesGenericAPI.java
+++ b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesGenericAPI.java
@@ -235,25 +235,24 @@ public interface QuantilesGenericAPI<T> extends QuantilesAPI {
   }
 
   /**
-   * This is a version of getQuantiles() where the caller only specifies the number of of desired quantile intervals 
-   * that are computed from an array of evenly spaced normalized ranks between 0 and 1.0 determined from the given
-   * <i>numEvenlySpaced</i> parameter.
+   * This is a version of getQuantiles() where the caller only specifies the number of of desired evenly spaced,
+   * normalized ranks, and returns an array of the corresponding quantiles.
    *
-   * @param numEvenlySpaced an integer that specifies the number of desired quantile intervals to be returned
-   * from the sketch. This must be a positive integer greater than 0.
-   * <ul><li>Let <i>Largest</i> be the largest quantile retained by the sketch algorithm.
-   * (This should not to be confused with {@link #getMaxItem},
-   * which is the largest quantile of the stream. They may be equal, but not necessarily.)</li>
-   * <li>A 1 will return the Largest quantile.</li>
-   * <li>A 2 will return 2 quantiles, including the Largest, dividing the quantile domain into two regions. 
-   * The first returned quantile should roughly correspond to the median quantile</li>
-   * <li>A 3 will return 3 quantiles, including the Largest, dividing the quantile domain into three regions.</li>
+   * @param numEvenlySpaced an integer that specifies the number of evenly spaced normalized ranks.
+   * This must be a positive integer greater than 0.
+   * <ul><li>Let <i>Smallest</i> and <i>Largest</i> be the smallest and largest quantiles
+   * retained by the sketch algorithm, respectively.
+   * (This should not to be confused with {@link #getMinItem} and {@link #getMaxItem},
+   * which are the smallest and largest quantiles of the stream.)</li>
+   * <li>A 1 will return the Smallest quantile.</li>
+   * <li>A 2 will return the Smallest and Largest quantiles.</li>
+   * <li>A 3 will return the Smallest, the Median, and the Largest quantiles.</li>
    * <li>Etc.</li>
    * </ul>
    *
    * @param searchCrit if INCLUSIVE, the given ranks include all quantiles &le; the quantile directly corresponding to
-   * any given rank. In this case the ranks are generated internally by this method.
-   * @return an array of quantiles that divide the quantile domain into numEvenlySpaced quantile intervals.
+   * each rank.
+   * @return an array of quantiles that are evenly spaced by their ranks.
    * @throws IllegalArgumentException if sketch is empty or if <i>numEvenlySpaced is less than 1</i>.
    * @see org.apache.datasketches.quantilescommon.QuantileSearchCriteria
    */
diff --git a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesUtil.java b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesUtil.java
index a0aed292..dc469200 100644
--- a/src/main/java/org/apache/datasketches/quantilescommon/QuantilesUtil.java
+++ b/src/main/java/org/apache/datasketches/quantilescommon/QuantilesUtil.java
@@ -80,49 +80,33 @@ public final class QuantilesUtil {
   }
 
   /**
-   * Returns a double array of evenly spaced values between 0.0, exclusive, and 1.0, inclusive.
-   * If num == 1, 1.0 will be in index 0 of the returned array.
-   * @param num the total number of values excluding 0 and including 1.0. Must be 1 or greater.
-   * @return a double array of evenly spaced values between 0.0, exclusive, and 1.0, inclusive.
-   * @throws IllegalArgumentException if <i>num</i> is less than 1.
-   */
-  public static double[] evenlySpacedRanks(final int num) {
-    if (num < 1) { throw new IllegalArgumentException("num must be >= 1"); }
-    final double[] out = new double[num];
-    if (num == 1) { return new double[] { 1.0 }; }
-    out[num - 1] = 1.0;
-
-    final double delta = 1.0 / num;
-    for (int i = 0; i < num - 1; i++) { out[i] = (i + 1) * delta; }
-    return out;
-  }
-
-  /**
-   * Returns a float array of evenly spaced values between value1 and value2 inclusive.
+   * Returns a double array of evenly spaced values between value1 and value2 inclusive.
    * If value2 &gt; value1, the resulting sequence will be increasing.
    * If value2 &lt; value1, the resulting sequence will be decreasing.
+   * If num == 1, value1 will be in index 0 of the returned array.
    * @param value1 will be in index 0 of the returned array
    * @param value2 will be in the highest index of the returned array
-   * @param num the total number of values including value1 and value2. Must be 2 or greater.
-   * @return a float array of evenly spaced values between value1 and value2 inclusive.
+   * @param num the total number of values including value1 and value2. Must be 1 or greater.
+   * @return a double array of evenly spaced values between value1 and value2 inclusive.
+   * @throws IllegalArgumentException if <i>num</i> is less than 1.
    */
-  public static float[] evenlySpacedFloats(final float value1, final float value2, final int num) {
-    if (num < 2) {
-      throw new SketchesArgumentException("num must be >= 2");
+  public static double[] evenlySpaced(final double value1, final double value2, final int num) {
+    if (num < 1) {
+      throw new IllegalArgumentException("num must be >= 1");
     }
-    final float[] out = new float[num];
+    final double[] out = new double[num];
     out[0] = value1;
+    if (num == 1) { return out; }
     out[num - 1] = value2;
     if (num == 2) { return out; }
 
-    final float delta = (value2 - value1) / (num - 1);
-
+    final double delta = (value2 - value1) / (num - 1);
     for (int i = 1; i < num - 1; i++) { out[i] = i * delta + value1; }
     return out;
   }
 
   /**
-   * Returns a double array of evenly spaced values between value1, inclusive, and value2 inclusive.
+   * Returns a float array of evenly spaced values between value1 and value2 inclusive.
    * If value2 &gt; value1, the resulting sequence will be increasing.
    * If value2 &lt; value1, the resulting sequence will be decreasing.
    * @param value1 will be in index 0 of the returned array
@@ -130,21 +114,21 @@ public final class QuantilesUtil {
    * @param num the total number of values including value1 and value2. Must be 2 or greater.
    * @return a float array of evenly spaced values between value1 and value2 inclusive.
    */
-  public static double[] evenlySpacedDoubles(final double value1, final double value2, final int num) {
+  public static float[] evenlySpacedFloats(final float value1, final float value2, final int num) {
     if (num < 2) {
       throw new SketchesArgumentException("num must be >= 2");
     }
-    final double[] out = new double[num];
+    final float[] out = new float[num];
     out[0] = value1;
     out[num - 1] = value2;
     if (num == 2) { return out; }
 
-    final double delta = (value2 - value1) / (num - 1);
+    final float delta = (value2 - value1) / (num - 1);
 
     for (int i = 1; i < num - 1; i++) { out[i] = i * delta + value1; }
     return out;
   }
-  
+
   /**
    * Returns a double array of values between min and max inclusive where the log of the
    * returned values are evenly spaced.
@@ -163,7 +147,7 @@ public final class QuantilesUtil {
       throw new SketchesArgumentException("value1 and value2 must be > 0.");
     }
 
-    final double[] arr = evenlySpacedDoubles(log(value1) / Util.LOG2, log(value2) / Util.LOG2, num);
+    final double[] arr = evenlySpaced(log(value1) / Util.LOG2, log(value2) / Util.LOG2, num);
     for (int i = 0; i < arr.length; i++) { arr[i] = pow(2.0,arr[i]); }
     return arr;
   }
diff --git a/src/main/java/org/apache/datasketches/req/BaseReqSketch.java b/src/main/java/org/apache/datasketches/req/BaseReqSketch.java
index 4e4e0af2..82fd4dee 100644
--- a/src/main/java/org/apache/datasketches/req/BaseReqSketch.java
+++ b/src/main/java/org/apache/datasketches/req/BaseReqSketch.java
@@ -20,7 +20,6 @@
 package org.apache.datasketches.req;
 
 import static org.apache.datasketches.quantilescommon.QuantilesUtil.THROWS_EMPTY;
-import static org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpacedRanks;
 
 import org.apache.datasketches.quantilescommon.FloatsSortedView;
 import org.apache.datasketches.quantilescommon.QuantileSearchCriteria;
@@ -92,7 +91,7 @@ abstract class BaseReqSketch implements QuantilesFloatsAPI {
   @Override
   public float[] getQuantiles(final int numEvenlySpaced, final QuantileSearchCriteria searchCrit) {
     if (isEmpty()) { throw new IllegalArgumentException(THROWS_EMPTY); }
-    return getQuantiles(evenlySpacedRanks(numEvenlySpaced),
+    return getQuantiles(org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpaced(0.0, 1.0, numEvenlySpaced),
         searchCrit);
   }
 
diff --git a/src/test/java/org/apache/datasketches/kll/KllDirectDoublesSketchTest.java b/src/test/java/org/apache/datasketches/kll/KllDirectDoublesSketchTest.java
index 7579f916..0a10b001 100644
--- a/src/test/java/org/apache/datasketches/kll/KllDirectDoublesSketchTest.java
+++ b/src/test/java/org/apache/datasketches/kll/KllDirectDoublesSketchTest.java
@@ -429,11 +429,12 @@ public class KllDirectDoublesSketchTest {
     sketch.update(1);
     sketch.update(2);
     sketch.update(3);
-    final double[] quantiles1 = sketch.getQuantiles(new double[] {0.5, 1}, EXCLUSIVE);
-    final double[] quantiles2 = sketch.getQuantiles(2, EXCLUSIVE);
+    final double[] quantiles1 = sketch.getQuantiles(new double[] {0, 0.5, 1}, EXCLUSIVE);
+    final double[] quantiles2 = sketch.getQuantiles(3, EXCLUSIVE);
     assertEquals(quantiles1, quantiles2);
-    assertEquals(quantiles1[0], 2.0);
-    assertEquals(quantiles1[1], 3.0);
+    assertEquals(quantiles1[0], 1.0);
+    assertEquals(quantiles1[1], 2.0);
+    assertEquals(quantiles1[2], 3.0);
   }
 
   @Test
diff --git a/src/test/java/org/apache/datasketches/kll/KllDirectFloatsSketchTest.java b/src/test/java/org/apache/datasketches/kll/KllDirectFloatsSketchTest.java
index dd0fe91d..81407776 100644
--- a/src/test/java/org/apache/datasketches/kll/KllDirectFloatsSketchTest.java
+++ b/src/test/java/org/apache/datasketches/kll/KllDirectFloatsSketchTest.java
@@ -430,11 +430,12 @@ public class KllDirectFloatsSketchTest {
     sketch.update(1);
     sketch.update(2);
     sketch.update(3);
-    final float[] quantiles1 = sketch.getQuantiles(new double[] {0.5, 1}, EXCLUSIVE);
-    final float[] quantiles2 = sketch.getQuantiles(2, EXCLUSIVE);
+    final float[] quantiles1 = sketch.getQuantiles(new double[] {0, 0.5, 1}, EXCLUSIVE);
+    final float[] quantiles2 = sketch.getQuantiles(3, EXCLUSIVE);
     assertEquals(quantiles1, quantiles2);
-    assertEquals(quantiles1[0], 2f);
-    assertEquals(quantiles1[1], 3f);
+    assertEquals(quantiles1[0], 1f);
+    assertEquals(quantiles1[1], 2f);
+    assertEquals(quantiles1[2], 3f);
   }
 
   @Test
diff --git a/src/test/java/org/apache/datasketches/kll/KllDoublesSketchTest.java b/src/test/java/org/apache/datasketches/kll/KllDoublesSketchTest.java
index b9718cd4..8c7d927d 100644
--- a/src/test/java/org/apache/datasketches/kll/KllDoublesSketchTest.java
+++ b/src/test/java/org/apache/datasketches/kll/KllDoublesSketchTest.java
@@ -474,11 +474,12 @@ public class KllDoublesSketchTest {
     sketch.update(1);
     sketch.update(2);
     sketch.update(3);
-    final double[] quantiles1 = sketch.getQuantiles(new double[] {0.5, 1}, EXCLUSIVE);
-    final double[] quantiles2 = sketch.getQuantiles(2, EXCLUSIVE);
+    final double[] quantiles1 = sketch.getQuantiles(new double[] {0, 0.5, 1}, EXCLUSIVE);
+    final double[] quantiles2 = sketch.getQuantiles(3, EXCLUSIVE);
     assertEquals(quantiles1, quantiles2);
-    assertEquals(quantiles1[0], 2.0);
-    assertEquals(quantiles1[1], 3.0);
+    assertEquals(quantiles1[0], 1.0);
+    assertEquals(quantiles1[1], 2.0);
+    assertEquals(quantiles1[2], 3.0);
   }
 
   @Test
diff --git a/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java b/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java
index 2df69a2a..e79e102b 100644
--- a/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java
+++ b/src/test/java/org/apache/datasketches/kll/KllFloatsSketchTest.java
@@ -475,11 +475,12 @@ public class KllFloatsSketchTest {
     sketch.update(1);
     sketch.update(2);
     sketch.update(3);
-    final float[] quantiles1 = sketch.getQuantiles(new double[] {0.5, 1}, EXCLUSIVE);
-    final float[] quantiles2 = sketch.getQuantiles(2, EXCLUSIVE);
+    final float[] quantiles1 = sketch.getQuantiles(new double[] {0, 0.5, 1}, EXCLUSIVE);
+    final float[] quantiles2 = sketch.getQuantiles(3, EXCLUSIVE);
     assertEquals(quantiles1, quantiles2);
-    assertEquals(quantiles1[0], 2f);
-    assertEquals(quantiles1[1], 3f);
+    assertEquals(quantiles1[0], 1f);
+    assertEquals(quantiles1[1], 2f);
+    assertEquals(quantiles1[2], 3f);
   }
 
   @Test
diff --git a/src/test/java/org/apache/datasketches/quantiles/HeapUpdateDoublesSketchTest.java b/src/test/java/org/apache/datasketches/quantiles/HeapUpdateDoublesSketchTest.java
index 49a10c3b..7feaa36f 100644
--- a/src/test/java/org/apache/datasketches/quantiles/HeapUpdateDoublesSketchTest.java
+++ b/src/test/java/org/apache/datasketches/quantiles/HeapUpdateDoublesSketchTest.java
@@ -29,7 +29,6 @@ import static org.apache.datasketches.quantiles.PreambleUtil.COMPACT_FLAG_MASK;
 import static org.apache.datasketches.quantiles.PreambleUtil.EMPTY_FLAG_MASK;
 import static org.apache.datasketches.quantilescommon.QuantileSearchCriteria.EXCLUSIVE;
 import static org.apache.datasketches.quantilescommon.QuantileSearchCriteria.INCLUSIVE;
-import static org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpacedRanks;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNull;
@@ -801,12 +800,12 @@ public class HeapUpdateDoublesSketchTest {
 
   @Test
   public void checkEvenlySpaced() {
-    int n = 10;
-    double[] es = evenlySpacedRanks(n);
+    int n = 11;
+    double[] es = org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpaced(0.0, 1.0, n);
     int len = es.length;
     for (int j=0; j<len; j++) {
       double f = es[j];
-      assertEquals(f, (j+1)/10.0, ((j+1)/10.0) * 0.001);
+      assertEquals(f, j/10.0, (j/10.0) * 0.001);
       print(es[j]+", ");
     }
     println("");
diff --git a/src/test/java/org/apache/datasketches/quantiles/ItemsSketchTest.java b/src/test/java/org/apache/datasketches/quantiles/ItemsSketchTest.java
index 73e258f9..80829930 100644
--- a/src/test/java/org/apache/datasketches/quantiles/ItemsSketchTest.java
+++ b/src/test/java/org/apache/datasketches/quantiles/ItemsSketchTest.java
@@ -212,9 +212,9 @@ public class ItemsSketchTest {
 
 
 
-    quantiles = sketch.getQuantiles(2);
+    quantiles = sketch.getQuantiles(3);
 
-    assertEquals(quantiles[0], Integer.valueOf(500), 17); // median
+    assertEquals(quantiles[1], Integer.valueOf(500), 17); // median
 
 
     final double normErr = sketch.getNormalizedRankError(true);
diff --git a/src/test/java/org/apache/datasketches/quantilescommon/QuantilesUtilTest.java b/src/test/java/org/apache/datasketches/quantilescommon/QuantilesUtilTest.java
index b4f5679c..ca2187bd 100644
--- a/src/test/java/org/apache/datasketches/quantilescommon/QuantilesUtilTest.java
+++ b/src/test/java/org/apache/datasketches/quantilescommon/QuantilesUtilTest.java
@@ -28,15 +28,15 @@ import org.testng.annotations.Test;
 public class QuantilesUtilTest {
 
   @Test
-  public void checkEvenlySpacedRanks() {
-    double[] arr = QuantilesUtil.evenlySpacedRanks(2);
-    assertEquals(arr[0], 0.5);
-    assertEquals(arr[1], 1.0);
-    arr = QuantilesUtil.evenlySpacedRanks(4);
-    assertEquals(arr[0], 0.25);
+  public void checkEvenlySpaced() {
+    double[] arr = QuantilesUtil.evenlySpaced(0, 1, 3);
+    assertEquals(arr[0], 0.0);
     assertEquals(arr[1], 0.5);
-    assertEquals(arr[2], 0.75);
-    assertEquals(arr[3], 1.0);
+    assertEquals(arr[2], 1.0);
+    arr = QuantilesUtil.evenlySpaced(3, 7, 3);
+    assertEquals(arr[0], 3.0);
+    assertEquals(arr[1], 5.0);
+    assertEquals(arr[2], 7.0);
   }
 
   @Test
@@ -55,22 +55,6 @@ public class QuantilesUtilTest {
     try { QuantilesUtil.evenlySpacedFloats(0f, 1f, 1); fail(); } catch (SketchesArgumentException e) {}
   }
 
-  @Test
-  public void checkEvenlySpacedDoubles() {
-    double[] arr = QuantilesUtil.evenlySpacedDoubles(0, 1, 3);
-    assertEquals(arr[0], 0.0);
-    assertEquals(arr[1], 0.5);
-    assertEquals(arr[2], 1.0);
-    arr = QuantilesUtil.evenlySpacedDoubles(3, 7, 3);
-    assertEquals(arr[0], 3.0);
-    assertEquals(arr[1], 5.0);
-    assertEquals(arr[2], 7.0);
-    arr = QuantilesUtil.evenlySpacedDoubles(0, 1.0, 2);
-    assertEquals(arr[0], 0);
-    assertEquals(arr[1], 1.0);
-    try { QuantilesUtil.evenlySpacedDoubles(0, 1.0, 1); fail(); } catch (SketchesArgumentException e) {}
-  }
-  
   @Test
   public void checkEvenlyLogSpaced() {
     final double[] arr = QuantilesUtil.evenlyLogSpaced(1, 8, 4);
diff --git a/src/test/java/org/apache/datasketches/req/ReqSketchTest.java b/src/test/java/org/apache/datasketches/req/ReqSketchTest.java
index e72ecb0f..e1bbaf89 100644
--- a/src/test/java/org/apache/datasketches/req/ReqSketchTest.java
+++ b/src/test/java/org/apache/datasketches/req/ReqSketchTest.java
@@ -21,7 +21,6 @@ package org.apache.datasketches.req;
 
 import static org.apache.datasketches.quantilescommon.QuantileSearchCriteria.EXCLUSIVE;
 import static org.apache.datasketches.quantilescommon.QuantileSearchCriteria.INCLUSIVE;
-import static org.apache.datasketches.quantilescommon.QuantilesUtil.evenlySpacedDoubles;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.fail;
@@ -120,7 +119,7 @@ public class ReqSketchTest {
   private static void checkGetRank(final ReqSketch sk, final int min, final int max, final int iDebug) {
     if (iDebug > 0) { println("GetRank Test: INCLUSIVE"); }
     final float[] spArr = QuantilesUtil.evenlySpacedFloats(0, max, 11);
-    final double[] trueRanks = evenlySpacedDoubles(0, 1.0, 11);
+    final double[] trueRanks = QuantilesUtil.evenlySpaced(0, 1.0, 11);
     final String dfmt = "%10.2f%10.6f" + LS;
     final String sfmt = "%10s%10s" + LS;
     if (iDebug > 0) { printf(sfmt, "Value", "Rank"); }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org