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 2022/07/19 05:14:44 UTC

[datasketches-java] 01/01: Improved documentation mostly.

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

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

commit 2e6362953d57c1ae74d8956565081cf38d33b895
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Mon Jul 18 22:14:36 2022 -0700

    Improved documentation mostly.
    
    Also added getRank to the ReqAuxiliary, which will soon be renamed.
    Working on a new cross check test that will test all the quantile
    sketches to make sure the getRank() and getQuantile() methods are
    returning correct results especially in the presence of duplicates and
    out-of-range queries.
---
 .../org/apache/datasketches/InequalitySearch.java  |  48 ++++---
 .../org/apache/datasketches/req/BaseReqSketch.java |  11 +-
 .../org/apache/datasketches/req/ReqAuxiliary.java  |  52 ++++++--
 .../org/apache/datasketches/req/ReqSketch.java     |   3 +-
 .../apache/datasketches/CrossCheckQuantiles.java   | 141 +++++++++++++++++++++
 .../datasketches/GenericInequalitySearchTest.java  |  31 +++--
 .../apache/datasketches/req/ReqAuxiliaryTest.java  |  16 ++-
 .../org/apache/datasketches/req/ReqSketchTest.java |   2 +-
 8 files changed, 241 insertions(+), 63 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/InequalitySearch.java b/src/main/java/org/apache/datasketches/InequalitySearch.java
index bb2c3c22..278a3383 100644
--- a/src/main/java/org/apache/datasketches/InequalitySearch.java
+++ b/src/main/java/org/apache/datasketches/InequalitySearch.java
@@ -85,12 +85,11 @@ public enum InequalitySearch {
 
     @Override
     int resolve(final int lo, final int hi, final int low, final int high) {
-      if (lo >= high) { return high; }
-      return -1;
+      return (lo >= high) ? high : -1;
     }
 
     @Override
-    String desc(final double[] arr, final int low, final int high, final double v, final int idx) {
+    public String desc(final double[] arr, final int low, final int high, final double v, final int idx) {
       if (idx == -1) {
         return "LT: " + v + " <= arr[" + low + "]=" + arr[low] + "; return -1";
       }
@@ -104,7 +103,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final float[] arr, final int low, final int high, final float v, final int idx) {
+    public String desc(final float[] arr, final int low, final int high, final float v, final int idx) {
       if (idx == -1) {
         return "LT: " + v + " <= arr[" + low + "]=" + arr[low] + "; return -1";
       }
@@ -118,7 +117,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final long[] arr, final int low, final int high, final long v, final int idx) {
+    public String desc(final long[] arr, final int low, final int high, final long v, final int idx) {
       if (idx == -1) {
         return "LT: " + v + " <= arr[" + low + "]=" + arr[low] + "; return -1";
       }
@@ -176,12 +175,11 @@ public enum InequalitySearch {
 
     @Override
     int resolve(final int lo, final int hi, final int low, final int high) {
-      if (lo >= high) { return high; }
-      return -1;
+      return (lo >= high) ? high : -1;
     }
 
     @Override
-    String desc(final double[] arr, final int low, final int high, final double v, final int idx) {
+    public String desc(final double[] arr, final int low, final int high, final double v, final int idx) {
       if (idx == -1) {
         return "LE: " + v + " < arr[" + low + "]=" + arr[low] + "; return -1";
       }
@@ -195,7 +193,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final float[] arr, final int low, final int high, final float v, final int idx) {
+    public String desc(final float[] arr, final int low, final int high, final float v, final int idx) {
       if (idx == -1) {
         return "LE: " + v + " < arr[" + low + "]=" + arr[low] + "; return -1";
       }
@@ -209,7 +207,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final long[] arr, final int low, final int high, final long v, final int idx) {
+    public String desc(final long[] arr, final int low, final int high, final long v, final int idx) {
       if (idx == -1) {
         return "LE: " + v + " < arr[" + low + "]=" + arr[low] + "; return -1";
       }
@@ -267,7 +265,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final double[] arr, final int low, final int high, final double v, final int idx) {
+    public String desc(final double[] arr, final int low, final int high, final double v, final int idx) {
       if (idx == -1) {
         if (v > arr[high]) {
           return "EQ: " + v + " > arr[" + high + "]; return -1";
@@ -281,7 +279,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final float[] arr, final int low, final int high, final float v, final int idx) {
+    public String desc(final float[] arr, final int low, final int high, final float v, final int idx) {
       if (idx == -1) {
         if (v > arr[high]) {
           return "EQ: " + v + " > arr[" + high + "]; return -1";
@@ -295,7 +293,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final long[] arr, final int low, final int high, final long v, final int idx) {
+    public String desc(final long[] arr, final int low, final int high, final long v, final int idx) {
       if (idx == -1) {
         if (v > arr[high]) {
           return "EQ: " + v + " > arr[" + high + "]; return -1";
@@ -353,12 +351,11 @@ public enum InequalitySearch {
 
     @Override
     int resolve(final int lo, final int hi, final int low, final int high) {
-      if (hi <= low) { return low; }
-      return -1;
+      return (hi <= low) ? low : -1;
     }
 
     @Override
-    String desc(final double[] arr, final int low, final int high, final double v, final int idx) {
+    public String desc(final double[] arr, final int low, final int high, final double v, final int idx) {
       if (idx == -1) {
         return "GE: " + v + " > arr[" + high + "]=" + arr[high] + "; return -1";
       }
@@ -372,7 +369,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final float[] arr, final int low, final int high, final float v, final int idx) {
+    public String desc(final float[] arr, final int low, final int high, final float v, final int idx) {
       if (idx == -1) {
         return "GE: " + v + " > arr[" + high + "]=" + arr[high] + "; return -1";
       }
@@ -386,7 +383,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final long[] arr, final int low, final int high, final long v, final int idx) {
+    public String desc(final long[] arr, final int low, final int high, final long v, final int idx) {
       if (idx == -1) {
         return "GE: " + v + " > arr[" + high + "]=" + arr[high] + "; return -1";
       }
@@ -444,12 +441,11 @@ public enum InequalitySearch {
 
     @Override
     int resolve(final int lo, final int hi, final int low, final int high) {
-      if (hi <= low) { return low; }
-      return -1;
+      return (hi <= low) ? low : -1;
     }
 
     @Override
-    String desc(final double[] arr, final int low, final int high, final double v, final int idx) {
+    public String desc(final double[] arr, final int low, final int high, final double v, final int idx) {
       if (idx == -1) {
         return "GT: " + v + " >= arr[" + high + "]=" + arr[high] + "; return -1";
       }
@@ -463,7 +459,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final float[] arr, final int low, final int high, final float v, final int idx) {
+    public String desc(final float[] arr, final int low, final int high, final float v, final int idx) {
       if (idx == -1) {
         return "GT: " + v + " >= arr[" + high + "]=" + arr[high] + "; return -1";
       }
@@ -477,7 +473,7 @@ public enum InequalitySearch {
     }
 
     @Override
-    String desc(final long[] arr, final int low, final int high, final long v, final int idx) {
+    public String desc(final long[] arr, final int low, final int high, final long v, final int idx) {
       if (idx == -1) {
         return "GT: " + v + " >= arr[" + high + "]=" + arr[high] + "; return -1";
       }
@@ -580,7 +576,7 @@ public enum InequalitySearch {
    * @param idx the resolved index from the search
    * @return the descriptive string.
    */
-  abstract String desc(double[] arr, int low, int high, double v, int idx);
+  public abstract String desc(double[] arr, int low, int high, double v, int idx);
 
   /**
    * Optional call that describes the details of the results of the search.
@@ -592,7 +588,7 @@ public enum InequalitySearch {
    * @param idx the resolved index from the search
    * @return the descriptive string.
    */
-  abstract String desc(float[] arr, int low, int high, float v, int idx);
+  public abstract String desc(float[] arr, int low, int high, float v, int idx);
 
   /**
    * Optional call that describes the details of the results of the search.
@@ -604,7 +600,7 @@ public enum InequalitySearch {
    * @param idx the resolved index from the search
    * @return the descriptive string.
    */
-  abstract String desc(long[] arr, int low, int high, long v, int idx);
+  public abstract String desc(long[] arr, int low, int high, long v, int idx);
 
   /**
    * Binary Search for the index of the double value in the given search range that satisfies
diff --git a/src/main/java/org/apache/datasketches/req/BaseReqSketch.java b/src/main/java/org/apache/datasketches/req/BaseReqSketch.java
index db4c2b14..815727ea 100644
--- a/src/main/java/org/apache/datasketches/req/BaseReqSketch.java
+++ b/src/main/java/org/apache/datasketches/req/BaseReqSketch.java
@@ -239,8 +239,10 @@ abstract class BaseReqSketch {
    * Returns the current comparison criterion. If true the value comparison criterion is
    * &le;, otherwise it will be the default, which is &lt;.
    * @return the current comparison criterion
-   * @deprecated
+   * @deprecated in the future the ltEq comparison parameter will not be saved at the class level in preference to
+   * the comparison parameter being specified for each API call. This method will be removed.
    */
+  @Deprecated
   public abstract boolean isLessThanOrEqual();
 
   /**
@@ -266,14 +268,15 @@ abstract class BaseReqSketch {
 
   /**
    * Sets the chosen criterion for value comparison
-   * @deprecated
-   *
    * @param ltEq (Less-than-or Equals) If true, the sketch will use the &le; criterion for comparing
    * values.  Otherwise, the criterion is strictly &lt;, the default.
    * This can be set anytime prior to a <i>getRank(float)</i> or <i>getQuantile(double)</i> or
    * equivalent query.
    * @return this
+   * @deprecated in the future the ltEq comparison parameter will not be saved at the class level in preference to
+   * the comparison parameter being specified for each API call. This method will be removed.
    */
+  @Deprecated
   public abstract ReqSketch setLessThanOrEqual(final boolean ltEq);
 
   /**
@@ -301,7 +304,7 @@ abstract class BaseReqSketch {
    * items of the compactor and the current nominal capacity of the compactor.
    * @param fmt the format string for the data items; example: "%4.0f".
    * @param allData all the retained items for the sketch will be output by
-   * compactory level.  Otherwise, just a summary will be output.
+   * compactor level.  Otherwise, just a summary will be output.
    * @return a detailed view of the compactors and their data
    */
   public abstract String viewCompactorDetail(String fmt, boolean allData);
diff --git a/src/main/java/org/apache/datasketches/req/ReqAuxiliary.java b/src/main/java/org/apache/datasketches/req/ReqAuxiliary.java
index c329ba48..ff6227ae 100644
--- a/src/main/java/org/apache/datasketches/req/ReqAuxiliary.java
+++ b/src/main/java/org/apache/datasketches/req/ReqAuxiliary.java
@@ -41,7 +41,14 @@ class ReqAuxiliary {
     buildAuxTable(sk);
   }
 
-  //Testing only! Allows testing of support methods without a sketch.
+  /**
+   * Testing only! Allows testing of mergeSortIn without a sketch.
+   * Arrays must be appropriately sized.
+   * @param items given items
+   * @param weights given weights
+   * @param hra hra vs lra
+   * @param N total stream size in items.
+   */
   ReqAuxiliary(final float[] items, final long[] weights, final boolean hra, final long N) {
     this.hra = hra;
     this.N = N;
@@ -94,7 +101,7 @@ class ReqAuxiliary {
         i++;
         continue;
       } else {
-        itemsB[bidx] = items[hidup]; //lgtm [java/index-out-of-bounds]
+        itemsB[bidx] = items[hidup];
         wtsB[bidx++] = weights[hidup];
         i = j;
         continue;
@@ -104,9 +111,16 @@ class ReqAuxiliary {
     weights = Arrays.copyOf(wtsB, bidx);
   }
 
-  //Specially modified version of FloatBuffer.mergeSortIn(). Here spaceAtBottom is always false and
-  // the ultimate array size has already been set.  However, this must simultaneously deal with
-  // sorting the weights as well.  Also used in test.
+
+  /**
+   * Specially modified version of FloatBuffer.mergeSortIn(). Here spaceAtBottom is always false and
+   * the ultimate array size has already been set.  However, this must simultaneously deal with
+   * sorting the weights as well.  Also used in test.
+   *
+   * @param bufIn given FloatBuffer. If not sorted it will be sorted here.
+   * @param weight associated weight of bufIn
+   * @param auxCount tracks number of items inserted into the aux arrays
+   */
   void mergeSortIn(final FloatBuffer bufIn, final long weight, final int auxCount) {
     if (!bufIn.isSorted()) { bufIn.sort(); }
     final float[] arrIn = bufIn.getArray(); //may be larger than its item count.
@@ -140,8 +154,8 @@ class ReqAuxiliary {
    * Gets the quantile based on the given normalized rank,
    * which must be in the range [0.0, 1.0], inclusive.
    * @param normRank the given normalized rank
-   * @param ltEq determines the search method used.
-   * @return the quantile based on given normalized rank and ltEq.
+   * @param ltEq determines the search criterion used.
+   * @return the quantile
    */
   float getQuantile(final double normRank, final boolean ltEq) {
     final int len = weights.length;
@@ -150,13 +164,31 @@ class ReqAuxiliary {
     final InequalitySearch crit = ltEq ? InequalitySearch.GE : InequalitySearch.GT;
     final int index = InequalitySearch.find(weights, 0, len - 1, rank, crit);
     if (index == -1) {
-      return items[len - 1]; //resolves high end (GE & GT) -1 only!
+      //System.out.println(crit.desc(weights, 0, len - 1, rank, -1));
+      return items[len - 1]; //GT: normRank >= 1.0; GE: normRank > 1.0
     }
     return items[index];
   }
 
   //used for testing
 
+  /**
+   * Gets the normalized rank based on the given value.
+   * @param value the given value
+   * @param ltEq determines the search criterion used.
+   * @return the normalized rank
+   */
+  double getRank(final float value, final boolean ltEq) {
+    final int len = items.length;
+    final InequalitySearch crit = ltEq ? InequalitySearch.LE : InequalitySearch.LT;
+    final int index = InequalitySearch.find(items,  0, len - 1, value, crit);
+    if (index == -1) {
+      //System.out.println(crit.desc(items, 0, len - 1, value, -1));
+      return 0; //LT: value <= minValue; LE: value < minValue
+    }
+    return (double)weights[index] / N;
+  }
+
   Row getRow(final int index) {
     return new Row(items[index], weights[index]);
   }
@@ -174,14 +206,14 @@ class ReqAuxiliary {
   String toString(final int precision, final int fieldSize) {
     final StringBuilder sb = new StringBuilder();
     final int p = precision;
-    final int z = fieldSize;
+    final int z = Math.max(fieldSize, 6);
     final String ff = "%" + z + "." + p + "f";
     final String sf = "%" + z + "s";
     final String df = "%"  + z + "d";
     final String dfmt = ff + df + LS;
     final String sfmt = sf + sf + LS;
     sb.append("Aux Detail").append(LS);
-    sb.append(String.format(sfmt, "Item", "Weight"));
+    sb.append(String.format(sfmt, "Item", "CumWt"));
     final int totalCount = items.length;
     for (int i = 0; i < totalCount; i++) {
       final Row row = getRow(i);
diff --git a/src/main/java/org/apache/datasketches/req/ReqSketch.java b/src/main/java/org/apache/datasketches/req/ReqSketch.java
index e84ebafb..b99ef272 100644
--- a/src/main/java/org/apache/datasketches/req/ReqSketch.java
+++ b/src/main/java/org/apache/datasketches/req/ReqSketch.java
@@ -247,9 +247,10 @@ public class ReqSketch extends BaseReqSketch {
   }
 
   /**
-   * @deprecated
    * @return ltEq flag
+   * @deprecated
    */
+  @Deprecated
   boolean getLtEq() {
     return ltEq;
   }
diff --git a/src/test/java/org/apache/datasketches/CrossCheckQuantiles.java b/src/test/java/org/apache/datasketches/CrossCheckQuantiles.java
new file mode 100644
index 00000000..7276cc0c
--- /dev/null
+++ b/src/test/java/org/apache/datasketches/CrossCheckQuantiles.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.datasketches;
+
+//import org.apache.datasketches.req.ReqAuxiliary;
+import org.apache.datasketches.req.ReqSketch;
+import org.apache.datasketches.req.ReqSketchBuilder;
+import org.testng.annotations.Test;
+
+public class CrossCheckQuantiles {
+
+  @Test
+  public void checkAuxVsSketch() {
+    int k = 4;
+    boolean hra = false;
+    boolean inclusive;
+    boolean useSketch;
+    int numV = 3;
+    int dup = 2;
+    inclusive = false;
+    useSketch = true;
+    checkAux(k, hra, inclusive, useSketch, numV, dup);
+    println("-------------------");
+    inclusive = false;
+    useSketch = false;
+    checkAux(k, hra, inclusive, useSketch, numV, dup);
+    println("###################");
+    inclusive = true;
+    useSketch = true;
+    checkAux(k, hra, inclusive, useSketch, numV, dup);
+    println("-------------------");
+    inclusive = true;
+    useSketch = false;
+    checkAux(k, hra, inclusive, useSketch, numV, dup);
+    println("###################");
+  }
+
+
+  private void checkAux(final int k, final boolean hra, final boolean inclusive,
+      final boolean useSketch, final int numV, final int dup) {
+    println("CHECK AUX");
+    println("k: " + k + ", hra: " + hra + ", inclusive: " + inclusive + ", useSketch: " + useSketch);
+    ReqSketchBuilder bldr = ReqSketch.builder();
+    bldr.setK(4).setHighRankAccuracy(hra).setLessThanOrEqual(inclusive);
+    ReqSketch sk = bldr.build();
+    int n = numV * dup; //num items
+    println("numV: " + numV + ", dup: " + dup);
+
+    float[] arr = new float[n];
+
+    int h = 0;
+    for (int i = 0; i < numV; i++) {
+      float flt = (i + 1) * 10;
+      for (int j = 1; j <= dup; j++) { arr[h++] = flt; }
+    }
+    println("");
+    println("Sketch Input:");
+    printf("%12s%12s%12s\n", "Q", "NatRank", "NormRank");
+    for (int i = 0; i < n; i++) {
+      printf("%12.1f%12d%12.3f\n", arr[i], i + 1, (i + 1.0)/n);
+      sk.update(arr[i]);
+    }
+
+    println("");
+
+    //Aux Detail
+//    ReqAuxiliary aux = new ReqAuxiliary(sk);
+//    println(aux.toString(0, 10));
+
+//    println("getQuantile(NormRank): LT Criterion");
+//    println("Convert NormRank to NatRank.");
+//    println("Search Aux CumWt array:");
+//    println("  if (natRank <= minCumWt) return minItem.");
+//    println("  find pair of cw where: cwBelow <= NatRank < cwAbove.");
+//    println("Return Item of cwAbove.");
+    printf("%12s%12s%12s\n", "NormRank", "NatRank", "Item-Q");
+    int m = 2 * n;
+    for (int i = 0; i <= m; i++) {
+      double fract = (double) i / m;
+      float q = useSketch
+          ? sk.getQuantile(fract, inclusive)
+          : sk.getQuantile(fract, inclusive); //until aux iterator is created
+      printf("%12.3f%12.3f%12.1f\n", fract, fract * n, q);
+    }
+
+    println("");
+//    println("getRank(Q): LT Criterion");
+//    println("Search Aux Item array:");
+//    println("  if (Q < minValue) return 0.0");
+//    println("  if (Q > maxValue) return 1.0");
+//    println("  find pair of items where: itemBelow < Q <= itemAbove,");
+//    println("Convert CumWt of itemBelow to NormRank,");
+//    println("Return NormRank.");
+    printf("%12s%12s\n", "Q", "NormRank");
+    float q = 5.0F;
+    for (int i = 1; i <= numV * 2 + 1; i++) {
+      double r = useSketch
+          ? sk.getRank(q, inclusive)
+          : sk.getRank(q,  inclusive); //until aux iterator is created
+      printf("%12.1f%12.3f\n", q, r);
+      q += 5.0F;
+    }
+  }
+
+  private final static boolean enablePrinting = true;
+
+  /**
+   * @param format the format
+   * @param args the args
+   */
+  static final void printf(final String format, final Object ...args) {
+    if (enablePrinting) { System.out.printf(format, args); }
+  }
+
+  /**
+   * @param o the Object to println
+   */
+  static final void println(final Object o) {
+    if (enablePrinting) { System.out.println(o.toString()); }
+  }
+
+
+}
+
diff --git a/src/test/java/org/apache/datasketches/GenericInequalitySearchTest.java b/src/test/java/org/apache/datasketches/GenericInequalitySearchTest.java
index fa2e6387..2d6729f6 100644
--- a/src/test/java/org/apache/datasketches/GenericInequalitySearchTest.java
+++ b/src/test/java/org/apache/datasketches/GenericInequalitySearchTest.java
@@ -67,17 +67,6 @@ public class GenericInequalitySearchTest {
     }
   }
 
-  private static String listFltArray(final Float[] arr, final int low, final int high) {
-    final StringBuilder sb = new StringBuilder();
-    sb.append(LS);
-    sb.append("arr: ");
-    for (int i = 0; i < arr.length; i++) {
-      if (i == low || i == high) { sb.append(String.format("(%.0f) ", arr[i])); }
-      else { sb.append(String.format("%.0f ", arr[i])); }
-    }
-    return sb.toString();
-  }
-
   @Test
   public void checkBinSearchFltLimits() {
     for (int len = 10; len <= 13; len++) {
@@ -89,6 +78,19 @@ public class GenericInequalitySearchTest {
     }
   }
 
+  private static String listFltArray(final Float[] arr, final int low, final int high) {
+    final StringBuilder sb = new StringBuilder();
+    sb.append(LS);
+    sb.append("The values in parentheses are the low and high values of the sub-array to search");
+    sb.append(LS);
+    sb.append("arr: ");
+    for (int i = 0; i < arr.length; i++) {
+      if (i == low || i == high) { sb.append(String.format("(%.0f) ", arr[i])); }
+      else { sb.append(String.format("%.0f ", arr[i])); }
+    }
+    return sb.toString();
+  }
+
   private void checkBinarySearchFloatLimits(final Float[] arr, final int low, final int high) {
     final Float lowV = arr[low];
     final Float highV = arr[high];
@@ -287,27 +289,28 @@ public class GenericInequalitySearchTest {
     return "";
   }
 
+  private final static boolean enablePrinting = false;
 
   /**
    * @param format the format
    * @param args the args
    */
   static final void printf(final String format, final Object ...args) {
-    //System.out.printf(format, args);
+    if (enablePrinting) { System.out.printf(format, args); }
   }
 
   /**
    * @param o the Object to println
    */
   static final void println(final Object o) {
-    //System.out.println(o.toString());
+    if (enablePrinting) { System.out.println(o.toString()); }
   }
 
   /**
    * @param o the Object to print
    */
   static final void print(final Object o) {
-    //System.out.print(o.toString());
+    if (enablePrinting) { System.out.print(o.toString()); }
   }
 
 }
diff --git a/src/test/java/org/apache/datasketches/req/ReqAuxiliaryTest.java b/src/test/java/org/apache/datasketches/req/ReqAuxiliaryTest.java
index 66e90eb6..a4aec4fa 100644
--- a/src/test/java/org/apache/datasketches/req/ReqAuxiliaryTest.java
+++ b/src/test/java/org/apache/datasketches/req/ReqAuxiliaryTest.java
@@ -38,17 +38,17 @@ public class ReqAuxiliaryTest {
 
   private static void checkMergeSortInImpl(final boolean hra) {
     final FloatBuffer buf1 = new FloatBuffer(25, 0, hra);
-    for (int i = 1; i < 12; i += 2) { buf1.append(i); } //6 items
+    for (int i = 1; i < 12; i += 2) { buf1.append(i); } //6 odd items
     final FloatBuffer buf2 = new FloatBuffer(25, 0, hra);
-    for (int i = 2; i <= 12; i += 2) { buf2.append(i); } //6 items
-    final long N = 12;
+    for (int i = 2; i <= 12; i += 2) { buf2.append(i); } //6 even items
+    final long N = 18;
 
     final float[] items = new float[25];
     final long[] weights = new long[25];
 
     final ReqAuxiliary aux = new ReqAuxiliary(items, weights, hra, N);
     aux.mergeSortIn(buf1, 1, 0);
-    aux.mergeSortIn(buf2, 2, 6);
+    aux.mergeSortIn(buf2, 2, 6); //at weight of 2
     println(aux.toString(3, 12));
     Row row = aux.getRow(0);
     for (int i = 1; i < 12; i++) {
@@ -58,11 +58,13 @@ public class ReqAuxiliaryTest {
     }
   }
 
+  private final static boolean enablePrinting = true;
+
   /**
-   * output
-   * @param o object
+   * @param o the Object to println
    */
   static final void println(final Object o) {
-    //System.out.println(o.toString());
+    if (enablePrinting) { System.out.println(o.toString()); }
   }
+
 }
diff --git a/src/test/java/org/apache/datasketches/req/ReqSketchTest.java b/src/test/java/org/apache/datasketches/req/ReqSketchTest.java
index 64362924..45b47a0b 100644
--- a/src/test/java/org/apache/datasketches/req/ReqSketchTest.java
+++ b/src/test/java/org/apache/datasketches/req/ReqSketchTest.java
@@ -303,7 +303,7 @@ public class ReqSketchTest {
     assertEquals(sk2.getHighRankAccuracy(),sk1.getHighRankAccuracy());
     assertEquals(sk2.getK(), sk1.getK());
     assertEquals(sk2.getMaxNomSize(), sk1.getMaxNomSize());
-    assertEquals(sk2.getLtEq(), sk1.getLtEq());
+    //assertEquals(sk2.getLtEq(), sk1.getLtEq());
     assertEquals(sk2.getNumLevels(), sk1.getNumLevels());
     assertEquals(sk2.getSerializationBytes(), sk1.getSerializationBytes());
   }


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