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 2020/04/25 04:29:26 UTC

[incubator-datasketches-java] 03/05: Add checks for zeroing HipAccum

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

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

commit 0c57e6e86271ecc73f29b3066478fe6f3a6beb7a
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Fri Apr 24 18:31:59 2020 -0700

    Add checks for zeroing HipAccum
---
 src/test/java/org/apache/datasketches/hll/UnionCaseTest.java | 9 ++++-----
 src/test/java/org/apache/datasketches/hll/UnionTest.java     | 4 +++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java b/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java
index 33edb58..9a8dc1f 100644
--- a/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java
+++ b/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java
@@ -30,7 +30,6 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 
-import org.apache.datasketches.SketchesArgumentException;
 import org.apache.datasketches.SketchesStateException;
 import org.apache.datasketches.memory.WritableMemory;
 import org.testng.annotations.Test;
@@ -350,22 +349,22 @@ public class UnionCaseTest {
     assertFalse(u.isRebuildCurMinNumKxQFlag());
   }
 
-  @Test(expectedExceptions = SketchesArgumentException.class)
+  @Test
   public void checkRebuildCurMinNumKxQFlag1() {
     HllSketch sk = buildHeapSketch(4, HLL_8, 16);
     HllArray hllArr = (HllArray)(sk.hllSketchImpl);
     hllArr.putRebuildCurMinNumKxQFlag(true); //corrupt the flag
     Union union = buildHeapUnion(4, 0);
-    union.update(sk); //throws
+    union.update(sk);
   }
 
-  //@Test(expectedExceptions = SketchesArgumentException.class)
+  @Test
   public void checkRebuildCurMinNumKxQFlag2() {
     HllSketch sk = buildMemorySketch(4, HLL_8, 16);
     DirectHllArray hllArr = (DirectHllArray)(sk.hllSketchImpl);
     hllArr.putRebuildCurMinNumKxQFlag(true); //corrupt the flag
     WritableMemory wmem = sk.getWritableMemory();
-    Union.writableWrap(wmem); //throws
+    Union.writableWrap(wmem);
   }
 
   @Test(expectedExceptions = SketchesStateException.class)
diff --git a/src/test/java/org/apache/datasketches/hll/UnionTest.java b/src/test/java/org/apache/datasketches/hll/UnionTest.java
index dcba9d7..9ef5c84 100644
--- a/src/test/java/org/apache/datasketches/hll/UnionTest.java
+++ b/src/test/java/org/apache/datasketches/hll/UnionTest.java
@@ -474,7 +474,9 @@ public class UnionTest {
     trueCount += delta;
    }
    boolean rebuild = PreambleUtil.extractRebuildCurMinNumKxQFlag(wmem);
+   double hipAccum = PreambleUtil.extractHipAccum(wmem);
    assertTrue(rebuild);
+   assertTrue(hipAccum == 0.0);
    HllSketch result = Union.writableWrap(wmem).getResult(); //rebuilds result
    rebuild = result.hllSketchImpl.isRebuildCurMinNumKxQFlag();
    assertFalse(rebuild);
@@ -518,7 +520,7 @@ public class UnionTest {
    * @param s value to print
    */
   static void print(Object s) {
-    System.out.print(s.toString()); //disable here
+    //System.out.print(s.toString()); //disable here
   }
 
 }


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