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/02/03 23:05:14 UTC

[incubator-datasketches-java] branch CheckCurMin created (now 179a4b7)

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

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


      at 179a4b7  Merge branch 'up_javadocs' into CheckCurMin

This branch includes the following new commits:

     new 65e53e5  update javadoc overview.html
     new 6b4bdef  fix checkstyle to be compatible with eclipse version of Checkstyle.
     new 0a1de03  update javadoc in Conversions.curMinAndNum() to make more clear.
     new 179a4b7  Merge branch 'up_javadocs' into CheckCurMin

The 4 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


[incubator-datasketches-java] 04/04: Merge branch 'up_javadocs' into CheckCurMin

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

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

commit 179a4b71f1ba3f9212e7f4af00a259fda971f14a
Merge: 0a1de03 6b4bdef
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Mon Feb 3 15:04:07 2020 -0800

    Merge branch 'up_javadocs' into CheckCurMin

 src/main/javadoc/overview.html | 6 +++---
 tools/SketchesCheckstyle.xml   | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)


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


[incubator-datasketches-java] 01/04: update javadoc overview.html

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

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

commit 65e53e58a12b30e74c6185feb0b98823a7d4b5dd
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Thu Jan 23 23:08:49 2020 -0800

    update javadoc overview.html
---
 src/main/javadoc/overview.html | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/javadoc/overview.html b/src/main/javadoc/overview.html
index 6bed16a..a52cbdc 100644
--- a/src/main/javadoc/overview.html
+++ b/src/main/javadoc/overview.html
@@ -68,13 +68,13 @@ under the License.
 <li><b><a href="https://datasketches.apache.org/api/java/snapshot/apidocs/org/apache/datasketches/tuple/package-summary.html">Tuple - The Base Tuple Family</a></b>
 </li>
 
-<li><b><a href="https://datasketches.apache.org/api/java/snapshot/apidocs/org/apache/datasketches/tuple/adouble/package-summary.html">Tuple - Example Implementation with a single double</a></b>
+<li><b><a href="https://datasketches.apache.org/api/java/snapshot/apidocs/org/apache/datasketches/tuple/adouble/package-summary.html">Tuple/adouble - Example Implementation with a single double</a></b>
 </li>
 
-<li><b><a href="https://datasketches.apache.org/api/java/snapshot/apidocs/org/apache/datasketches/tuple/aninteger/package-summary.html">Tuple - Example Implementation with a single integer</a></b>
+<li><b><a href="https://datasketches.apache.org/api/java/snapshot/apidocs/org/apache/datasketches/tuple/aninteger/package-summary.html">Tuple/aninteger - Example Implementation with a single integer</a></b>
 </li>
 
-<li><b><a href="https://datasketches.apache.org/api/java/snapshot/apidocs/org/apache/datasketches/tuple/strings/package-summary.html">Tuple - Example Implementation with an array of Strings</a></b>
+<li><b><a href="https://datasketches.apache.org/api/java/snapshot/apidocs/org/apache/datasketches/tuple/strings/package-summary.html">Tuple/strings - Example Implementation with an array of Strings</a></b>
 </li>
 
 </ul>


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


[incubator-datasketches-java] 03/04: update javadoc in Conversions.curMinAndNum() to make more clear.

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

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

commit 0a1de039c77b1f8204c38a8327fee94f944bc553
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Mon Feb 3 15:02:31 2020 -0800

    update javadoc in Conversions.curMinAndNum() to make more clear.
    
    Added IsomorphicTest.checkCurMinConversions() to improve confidence that
    curMin is computed after a type conversion from 8 or 6 to 4.
    
    Added additional check for isRebuildCurMinNumKxQFlag() in
    union.getResult() and union toString(...).
---
 .../org/apache/datasketches/hll/Conversions.java   |  9 +++++--
 .../java/org/apache/datasketches/hll/Union.java    |  8 +++----
 .../apache/datasketches/hll/IsomorphicTest.java    | 28 +++++++++++++++++++++-
 3 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/hll/Conversions.java b/src/main/java/org/apache/datasketches/hll/Conversions.java
index f92628c..0f06ffe 100644
--- a/src/main/java/org/apache/datasketches/hll/Conversions.java
+++ b/src/main/java/org/apache/datasketches/hll/Conversions.java
@@ -69,8 +69,13 @@ class Conversions {
   }
 
   /**
-   * If the given absHllArr is type HLL_4, this returns the correct curMin and numAtCurMin.
-   * For HLL_6 and HLL_8, curMin is always 0, and numAtCurMin is the number of zero slots.
+   * This returns curMin and numAtCurMin as a pair and will be correct independent of the TgtHllType
+   * of the input AbstractHllArray.
+   *
+   * <p>In general, it is always true that for HLL_6 and HLL_8, curMin is always 0, and numAtCurMin
+   * is the number of zero slots. For these two types there is no need to track curMin nor to track
+   * numAtCurMin once all the slots are filled.
+   *
    * @param absHllArr an instance of AbstractHllArray
    * @return pair values representing numAtCurMin and curMin
    */
diff --git a/src/main/java/org/apache/datasketches/hll/Union.java b/src/main/java/org/apache/datasketches/hll/Union.java
index cc00d41..e9cf76f 100644
--- a/src/main/java/org/apache/datasketches/hll/Union.java
+++ b/src/main/java/org/apache/datasketches/hll/Union.java
@@ -200,10 +200,7 @@ public class Union extends BaseHllSketch {
    * @return the result of this union operator as an HLL_4 sketch.
    */
   public HllSketch getResult() {
-    if (gadget.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
-      rebuildCurMinNumKxQ((AbstractHllArray)(gadget.hllSketchImpl));
-    }
-    return gadget.copyAs(HllSketch.DEFAULT_HLL_TYPE);
+    return getResult(HllSketch.DEFAULT_HLL_TYPE);
   }
 
   /**
@@ -309,6 +306,9 @@ public class Union extends BaseHllSketch {
   @Override
   public String toString(final boolean summary, final boolean hllDetail,
       final boolean auxDetail, final boolean all) {
+    if (gadget.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
+      rebuildCurMinNumKxQ((AbstractHllArray)(gadget.hllSketchImpl));
+    }
     return gadget.toString(summary, hllDetail, auxDetail, all);
   }
 
diff --git a/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java b/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java
index d896b7d..7b2c680 100644
--- a/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java
+++ b/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java
@@ -25,6 +25,7 @@ import static org.apache.datasketches.hll.CurMode.SET;
 import static org.apache.datasketches.hll.TgtHllType.HLL_4;
 import static org.apache.datasketches.hll.TgtHllType.HLL_6;
 import static org.apache.datasketches.hll.TgtHllType.HLL_8;
+import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
 
 import org.apache.datasketches.memory.WritableMemory;
@@ -328,6 +329,31 @@ public class IsomorphicTest {
     return ((lgK < 8) && (curMode == HLL)) ? (1 << lgK) : 1 << (lgK - 3);
   }
 
+  @Test
+  public void checkCurMinConversion() {
+    TgtHllType hll8 = HLL_8;
+    TgtHllType hll4 = HLL_4;
+    for (int lgK = 4; lgK <= 21; lgK++) {
+      HllSketch sk8 = new HllSketch(lgK, hll8);
+      //The Coupon Collector Problem predicts that all slots will be filled by k Log(k).
+      int n = (1 << lgK) * lgK;
+      for (int i = 0; i < n; i++) { sk8.update(i); }
+      double est8 = sk8.getEstimate();
+      AbstractHllArray aharr8 = (AbstractHllArray)sk8.hllSketchImpl;
+      int curMin8 = aharr8.getCurMin();
+      int numAtCurMin8 = aharr8.getNumAtCurMin();
+      HllSketch sk4 = sk8.copyAs(hll4);
+      AbstractHllArray aharr4 = (AbstractHllArray)sk4.hllSketchImpl;
+      int curMin4 = ((AbstractHllArray)sk4.hllSketchImpl).getCurMin();
+      int numAtCurMin4 =aharr4.getNumAtCurMin();
+      double est4 = sk4.getEstimate();
+      assertEquals(est4, est8, 0.0);
+      assertEquals(curMin4, 1);
+      //println("Est 8 = " + est8 + ", CurMin = " + curMin8 + ", #CurMin + " + numAtCurMin8);
+      //println("Est 4 = " + est4 + ", CurMin = " + curMin4 + ", #CurMin + " + numAtCurMin4);
+    }
+  }
+
   private static double bytesToDouble(byte[] arr, int offset) {
     long v = 0;
     for (int i = offset; i < (offset + 8); i++) {
@@ -352,7 +378,7 @@ public class IsomorphicTest {
    * @param o value to print
    */
   static void print(Object o) {
-    //System.out.print(o.toString()); //disable here
+    System.out.print(o.toString()); //disable here
   }
 
   /**


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


[incubator-datasketches-java] 02/04: fix checkstyle to be compatible with eclipse version of Checkstyle.

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

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

commit 6b4bdefeb36dcfe6ee672405974e47b6d2ea9b8b
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Sat Jan 25 22:40:56 2020 -0800

    fix checkstyle to be compatible with eclipse version of Checkstyle.
---
 tools/SketchesCheckstyle.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/SketchesCheckstyle.xml b/tools/SketchesCheckstyle.xml
index a6520de..03a69c3 100644
--- a/tools/SketchesCheckstyle.xml
+++ b/tools/SketchesCheckstyle.xml
@@ -207,7 +207,7 @@ under the License.
       <!-- <property name="allowMissingThrowsTags" value="true"/> now not allowed ?!? -->
       <property name="allowMissingReturnTag" value="false"/>
       <property name="allowedAnnotations" value="Override, Test"/>
-      <property name="allowThrowsTagsForSubclasses" value="true"/>
+      <!-- <property name="allowThrowsTagsForSubclasses" value="true"/> now not allowed ?!? -->
     </module>
     
     <module name="JavadocParagraph"/>


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