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/12/09 00:53:09 UTC

(datasketches-java) branch weighted_kll_doubles created (now fbe8076f)

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

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


      at fbe8076f updating the KllMiscDoublesTest::viewHeapCompactions()

This branch includes the following new commits:

     new fbe8076f updating the KllMiscDoublesTest::viewHeapCompactions()

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


(datasketches-java) 01/01: updating the KllMiscDoublesTest::viewHeapCompactions()

Posted by le...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit fbe8076f1a59abe652df0c3e554421dc7e2fd000
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Fri Dec 8 16:52:55 2023 -0800

    updating the KllMiscDoublesTest::viewHeapCompactions()
---
 .../java/org/apache/datasketches/kll/KllHelper.java   | 17 +++++++++--------
 .../apache/datasketches/kll/KllMiscDoublesTest.java   | 19 +++++++++++++------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/kll/KllHelper.java b/src/main/java/org/apache/datasketches/kll/KllHelper.java
index 6956ccb6..4127c9f1 100644
--- a/src/main/java/org/apache/datasketches/kll/KllHelper.java
+++ b/src/main/java/org/apache/datasketches/kll/KllHelper.java
@@ -817,20 +817,21 @@ final class KllHelper {
     return result;
   }
 
+  private final static boolean enablePrinting = true;
+
   /**
-   * @param fmt format
-   * @param args arguments
+   * @param format the format
+   * @param args the args
    */
-  private static void printf(final String fmt, final Object ... args) {
-    //System.out.printf(fmt, args); //Disable
+  private static final void printf(final String format, final Object ... args) {
+    if (enablePrinting) { System.out.printf(format, args); }
   }
 
   /**
-   * Println Object o
-   * @param o object to print
+   * @param o the Object to println
    */
-  private static void println(final Object o) {
-    //System.out.println(o.toString()); //Disable
+  private static final void println(final Object o) {
+    if (enablePrinting) { System.out.println(o.toString()); }
   }
 
 }
diff --git a/src/test/java/org/apache/datasketches/kll/KllMiscDoublesTest.java b/src/test/java/org/apache/datasketches/kll/KllMiscDoublesTest.java
index fe208088..b6b9801c 100644
--- a/src/test/java/org/apache/datasketches/kll/KllMiscDoublesTest.java
+++ b/src/test/java/org/apache/datasketches/kll/KllMiscDoublesTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.datasketches.kll;
 
+import static org.apache.datasketches.kll.KllHelper.getGrowthSchemeForGivenN;
 import static org.apache.datasketches.kll.KllSketch.SketchType.DOUBLES_SKETCH;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
@@ -27,6 +28,7 @@ import static org.testng.Assert.fail;
 
 import org.apache.datasketches.common.SketchesArgumentException;
 import org.apache.datasketches.kll.KllDirectDoublesSketch.KllDirectCompactDoublesSketch;
+import org.apache.datasketches.kll.KllSketch.SketchType;
 import org.apache.datasketches.memory.DefaultMemoryRequestServer;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.MemoryRequestServer;
@@ -164,23 +166,28 @@ public class KllMiscDoublesTest {
     assertEquals(sk2.getNumRetained(), 56);
   }
 
-  @Test //set static enablePrinting = true for visual checking
+  @Test //set static enablePrinting = true for visual checking //HERE
   public void viewHeapCompactions() {
     int k = 20;
-    int n = 108;
+    int n = 21;
     int compaction = 0;
     KllDoublesSketch sk = KllDoublesSketch.newHeapInstance(k);
     for (int i = 1; i <= n; i++) {
-      sk.update(i);
+      sk.update(1);//i
       if (sk.levelsArr[0] == 0) {
         println(LS + "#<<< BEFORE COMPACTION # " + (++compaction) + " >>>");
         println(sk.toString(true, true));
-        sk.update(++i);
+        if (i == n) { break; }
+        sk.update(1); ++i; //++i
         println(LS + "#<<< AFTER COMPACTION  # " + (compaction) + " >>>");
         println(sk.toString(true, true));
-        assertEquals(sk.getDoubleItemsArray()[sk.levelsArr[0]], i);
+        //assertEquals(sk.getDoubleItemsArray()[sk.levelsArr[0]], i);
       }
     }
+    println(LS + "#<<< END STATE # >>>");
+    println(sk.toString(true, true));
+    println("");
+    getGrowthSchemeForGivenN(k,8,n,SketchType.DOUBLES_SKETCH, true);
   }
 
   @Test //set static enablePrinting = true for visual checking
@@ -592,7 +599,7 @@ public class KllMiscDoublesTest {
     printf("%s\n", s);
   }
 
-  private final static boolean enablePrinting = false;
+  private final static boolean enablePrinting = true;
 
   /**
    * @param format the format


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