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 2019/12/24 07:11:41 UTC
[incubator-datasketches-java] 06/10: Added Isomorphism tests,
and a few others.
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch NewHllIterator
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-java.git
commit 93e4ca2bccc305cf230da0eaa9bbfb11e05af4fd
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Fri Dec 20 21:25:21 2019 -0800
Added Isomorphism tests, and a few others.
---
.../apache/datasketches/hll/ToByteArrayImpl.java | 2 +
.../java/org/apache/datasketches/hll/Union.java | 33 ++-
.../apache/datasketches/hll/CouponListTest.java | 9 +-
.../org/apache/datasketches/hll/HllArrayTest.java | 10 +-
.../apache/datasketches/hll/IsomorphicTest.java | 224 +++++++++++++++++++++
.../org/apache/datasketches/hll/UnionCaseTest.java | 51 ++++-
6 files changed, 311 insertions(+), 18 deletions(-)
diff --git a/src/main/java/org/apache/datasketches/hll/ToByteArrayImpl.java b/src/main/java/org/apache/datasketches/hll/ToByteArrayImpl.java
index 2705fe7..2179ff7 100644
--- a/src/main/java/org/apache/datasketches/hll/ToByteArrayImpl.java
+++ b/src/main/java/org/apache/datasketches/hll/ToByteArrayImpl.java
@@ -40,6 +40,7 @@ import static org.apache.datasketches.hll.PreambleUtil.insertListCount;
import static org.apache.datasketches.hll.PreambleUtil.insertNumAtCurMin;
import static org.apache.datasketches.hll.PreambleUtil.insertOooFlag;
import static org.apache.datasketches.hll.PreambleUtil.insertPreInts;
+import static org.apache.datasketches.hll.PreambleUtil.insertRebuildCurMinNumKxQFlag;
import static org.apache.datasketches.hll.PreambleUtil.insertSerVer;
import static org.apache.datasketches.hll.PreambleUtil.insertTgtHllType;
@@ -100,6 +101,7 @@ class ToByteArrayImpl {
insertKxQ0(tgtWmem, srcImpl.getKxQ0());
insertKxQ1(tgtWmem, srcImpl.getKxQ1());
insertNumAtCurMin(tgtWmem, srcImpl.getNumAtCurMin());
+ insertRebuildCurMinNumKxQFlag(tgtWmem, srcImpl.isRebuildCurMinNumKxQFlag());
}
private static final void insertAux(final AbstractHllArray srcImpl, final WritableMemory tgtWmem,
diff --git a/src/main/java/org/apache/datasketches/hll/Union.java b/src/main/java/org/apache/datasketches/hll/Union.java
index 17878e9..ae20156 100644
--- a/src/main/java/org/apache/datasketches/hll/Union.java
+++ b/src/main/java/org/apache/datasketches/hll/Union.java
@@ -96,8 +96,9 @@ public class Union extends BaseHllSketch {
if (tgtHllType != TgtHllType.HLL_8) {
throw new SketchesArgumentException("Union can only wrap writable HLL_8 sketches.");
}
+ //This should never happen
if (sketch.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
- curMinAndNumAndKxQ((AbstractHllArray)(sketch.hllSketchImpl));
+ rebuildCurMinNumKxQ((AbstractHllArray)(sketch.hllSketchImpl));
}
gadget = sketch;
}
@@ -142,7 +143,7 @@ public class Union extends BaseHllSketch {
@Override
public double getCompositeEstimate() {
if (gadget.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
- curMinAndNumAndKxQ((AbstractHllArray)(gadget.hllSketchImpl));
+ rebuildCurMinNumKxQ((AbstractHllArray)(gadget.hllSketchImpl));
}
return gadget.hllSketchImpl.getCompositeEstimate();
}
@@ -160,7 +161,7 @@ public class Union extends BaseHllSketch {
@Override
public double getEstimate() {
if (gadget.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
- curMinAndNumAndKxQ((AbstractHllArray)(gadget.hllSketchImpl));
+ rebuildCurMinNumKxQ((AbstractHllArray)(gadget.hllSketchImpl));
}
return gadget.getEstimate();
}
@@ -189,7 +190,7 @@ public class Union extends BaseHllSketch {
@Override
public double getLowerBound(final int numStdDev) {
if (gadget.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
- curMinAndNumAndKxQ((AbstractHllArray)(gadget.hllSketchImpl));
+ rebuildCurMinNumKxQ((AbstractHllArray)(gadget.hllSketchImpl));
}
return gadget.getLowerBound(numStdDev);
}
@@ -200,7 +201,7 @@ public class Union extends BaseHllSketch {
*/
public HllSketch getResult() {
if (gadget.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
- curMinAndNumAndKxQ((AbstractHllArray)(gadget.hllSketchImpl));
+ rebuildCurMinNumKxQ((AbstractHllArray)(gadget.hllSketchImpl));
}
return gadget.copyAs(HllSketch.DEFAULT_HLL_TYPE);
}
@@ -212,7 +213,7 @@ public class Union extends BaseHllSketch {
*/
public HllSketch getResult(final TgtHllType tgtHllType) {
if (gadget.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
- curMinAndNumAndKxQ((AbstractHllArray)(gadget.hllSketchImpl));
+ rebuildCurMinNumKxQ((AbstractHllArray)(gadget.hllSketchImpl));
}
return gadget.copyAs(tgtHllType);
}
@@ -230,7 +231,7 @@ public class Union extends BaseHllSketch {
@Override
public double getUpperBound(final int numStdDev) {
if (gadget.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
- curMinAndNumAndKxQ((AbstractHllArray)(gadget.hllSketchImpl));
+ rebuildCurMinNumKxQ((AbstractHllArray)(gadget.hllSketchImpl));
}
return gadget.getUpperBound(numStdDev);
}
@@ -291,11 +292,17 @@ public class Union extends BaseHllSketch {
*/
@Override
public byte[] toCompactByteArray() {
+ if (gadget.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
+ rebuildCurMinNumKxQ((AbstractHllArray)(gadget.hllSketchImpl));
+ }
return gadget.toCompactByteArray();
}
@Override
public byte[] toUpdatableByteArray() {
+ if (gadget.hllSketchImpl.isRebuildCurMinNumKxQFlag()) {
+ rebuildCurMinNumKxQ((AbstractHllArray)(gadget.hllSketchImpl));
+ }
return gadget.toUpdatableByteArray();
}
@@ -351,19 +358,24 @@ public class Union extends BaseHllSketch {
final int lgMaxK) {
assert gadget.getTgtHllType() == HLL_8;
if ((source == null) || source.isEmpty()) { return gadget.hllSketchImpl; }
+ final int srcLgK = source.getLgConfigK();
+ final int gadgetLgK = gadget.getLgConfigK();
+ //Source is either LIST or SET mode
if (source.getCurMode() == CurMode.LIST ) {
source.mergeTo(gadget);
gadget.putOutOfOrderFlag(gadget.isOutOfOrderFlag() | source.isOutOfOrderFlag());
return gadget.hllSketchImpl;
}
if (source.getCurMode() == CurMode.SET ) {
+ if (gadget.isEmpty() && (!source.isMemory()) && (!gadget.isMemory()) && (srcLgK == gadgetLgK)) {
+ gadget.hllSketchImpl = source.copyAs(HLL_8).hllSketchImpl;
+ return gadget.hllSketchImpl;
+ }
source.mergeTo(gadget);
gadget.putOutOfOrderFlag(true);
return gadget.hllSketchImpl;
}
//Hereafter, the srcImpl is in HLL mode.
- final int srcLgK = source.getLgConfigK();
- final int gadgetLgK = gadget.getLgConfigK();
final int bit0 = gadget.isMemory() ? 1 : 0;
final int bits1_2 = (gadget.isEmpty() ? 3 : gadget.getCurMode().ordinal()) << 1;
final int bit3 = (srcLgK < gadgetLgK) ? 8 : 0;
@@ -572,7 +584,8 @@ public class Union extends BaseHllSketch {
return new HllSketch(tgtHllArr);
}
- static final void curMinAndNumAndKxQ(final AbstractHllArray absHllArr) {
+ //
+ private static final void rebuildCurMinNumKxQ(final AbstractHllArray absHllArr) {
int curMin = 64;
int numAtCurMin = 0;
double kxq0 = 1 << absHllArr.getLgConfigK();
diff --git a/src/test/java/org/apache/datasketches/hll/CouponListTest.java b/src/test/java/org/apache/datasketches/hll/CouponListTest.java
index fc9eda1..3f81f88 100644
--- a/src/test/java/org/apache/datasketches/hll/CouponListTest.java
+++ b/src/test/java/org/apache/datasketches/hll/CouponListTest.java
@@ -24,9 +24,8 @@ import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-
import org.apache.datasketches.memory.WritableMemory;
+import org.testng.annotations.Test;
/**
* @author Lee Rhodes
@@ -77,6 +76,9 @@ public class CouponListTest {
}
assertEquals(sk.getCurMode(), CurMode.LIST);
assertEquals(sk.getCompositeEstimate(), 7.0, 7 * .01);
+ assertEquals(sk.getHipEstimate(), 7.0, 7 * .01);
+ sk.hllSketchImpl.putEmptyFlag(false); //dummy
+ sk.hllSketchImpl.putRebuildCurMinNumKxQFlag(false); //dummy
if (direct) {
assertNotNull(sk.hllSketchImpl.getWritableMemory());
} else {
@@ -87,6 +89,7 @@ public class CouponListTest {
sk.update(8);
assertEquals(sk.getCurMode(), CurMode.SET);
assertEquals(sk.getCompositeEstimate(), 8.0, 8 * .01);
+ assertEquals(sk.getHipEstimate(), 8.0, 8 * .01);
if (direct) {
assertNotNull(sk.hllSketchImpl.getWritableMemory());
} else {
@@ -107,6 +110,8 @@ public class CouponListTest {
double re = sk.getRelErr(true, true, 4, 1);
assertTrue(re < 0.0);
+
+
}
@Test
diff --git a/src/test/java/org/apache/datasketches/hll/HllArrayTest.java b/src/test/java/org/apache/datasketches/hll/HllArrayTest.java
index d9180a8..f198b4a 100644
--- a/src/test/java/org/apache/datasketches/hll/HllArrayTest.java
+++ b/src/test/java/org/apache/datasketches/hll/HllArrayTest.java
@@ -99,7 +99,9 @@ public class HllArrayTest {
if (sk1.hllSketchImpl instanceof HllArray) {
assertFalse(sk1.hllSketchImpl.isMemory());
assertFalse(sk1.isSameResource(wmem));
- } else {
+ int v = ((AbstractHllArray)sk1.hllSketchImpl).getSlot(0);
+ ((AbstractHllArray)sk1.hllSketchImpl).putSlot(0, v);
+ } else { //DirectHllArray
assertTrue(sk1.hllSketchImpl.isMemory());
assertTrue(sk1.isSameResource(wmem));
}
@@ -107,6 +109,12 @@ public class HllArrayTest {
//sk1.update(u);
double est1 = sk1.getEstimate();
assertEquals(est1, u, u * .03);
+ assertEquals(sk1.getHipEstimate(), est1, 0.0);
+
+ //misc calls
+ sk1.hllSketchImpl.putEmptyFlag(false);
+ sk1.hllSketchImpl.putRebuildCurMinNumKxQFlag(true);
+ sk1.hllSketchImpl.putRebuildCurMinNumKxQFlag(false);
byte[] byteArray = sk1.toCompactByteArray();
HllSketch sk2 = HllSketch.heapify(byteArray);
diff --git a/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java b/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java
new file mode 100644
index 0000000..a82ea71
--- /dev/null
+++ b/src/test/java/org/apache/datasketches/hll/IsomorphicTest.java
@@ -0,0 +1,224 @@
+/*
+ * 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.hll;
+
+import static org.apache.datasketches.hll.CurMode.LIST;
+import static org.apache.datasketches.hll.CurMode.SET;
+
+import org.apache.datasketches.memory.WritableMemory;
+import org.testng.annotations.Test;
+
+/**
+ * @author Lee Rhodes
+ */
+@SuppressWarnings({"javadoc", "unused"})
+public class IsomorphicTest {
+ long v = 0;
+ final int maxLgK = 12;
+ HllSketch source;
+ Union union;
+
+ @Test
+ public void isomorphsUnionUpdatableHeap() {
+ for (int lgK = 4; lgK <= 21; lgK++) {
+ for (int cm = 0; cm <= 2; cm++) {
+ if ((lgK < 8) && (cm == 1)) { continue; } //lgk < 8 list transistions directly to HLL
+ CurMode curMode = CurMode.fromOrdinal(cm);
+ for (int t = 0; t <= 2; t++) {
+ TgtHllType tgtHllType = TgtHllType.fromOrdinal(t);
+ HllSketch sk1 = buildHeapSketch(lgK, tgtHllType, curMode);
+ byte[] sk1bytes = sk1.toUpdatableByteArray();
+ Union union = buildHeapUnion(lgK, null);
+ union.update(sk1);
+ HllSketch sk2 = union.getResult(tgtHllType);
+ byte[] sk2bytes = sk2.toUpdatableByteArray();
+ String comb = "LgK=" + lgK + ", CurMode=" + curMode.toString() + ", Type:" + tgtHllType;
+ checkArrays(sk1bytes, sk2bytes, comb);
+ }
+ }
+ }
+ }
+
+ @Test
+ public void isomorphsUnionCompactHeap() {
+ for (int lgK = 4; lgK <= 21; lgK++) {
+ for (int cm = 0; cm <= 2; cm++) {
+ if ((lgK < 8) && (cm == 1)) { continue; } //lgk < 8 list transistions directly to HLL
+ CurMode curMode = CurMode.fromOrdinal(cm);
+ for (int t = 0; t <= 2; t++) {
+ TgtHllType tgtHllType = TgtHllType.fromOrdinal(t);
+ HllSketch sk1 = buildHeapSketch(lgK, tgtHllType, curMode);
+ byte[] sk1bytes = sk1.toCompactByteArray();
+ Union union = buildHeapUnion(lgK, null);
+ union.update(sk1);
+ HllSketch sk2 = union.getResult(tgtHllType);
+ byte[] sk2bytes = sk2.toCompactByteArray();
+ String comb = "LgK=" + lgK + ", CurMode=" + curMode.toString() + ", Type:" + tgtHllType;
+ checkArrays(sk1bytes, sk2bytes, comb);
+ }
+ }
+ }
+ }
+
+
+ @Test
+ public void isomorphsCopyAsUpdatableHeap() {
+ for (int lgK = 4; lgK <= 21; lgK++) {
+ for (int cm = 0; cm <= 2; cm++) {
+ if ((lgK < 8) && (cm == 1)) { continue; } //lgk < 8 list transistions directly to HLL
+ CurMode curMode = CurMode.fromOrdinal(cm);
+ for (int t1 = 0; t1 <= 2; t1++) {
+ TgtHllType tgtHllType1 = TgtHllType.fromOrdinal(t1);
+ HllSketch sk1 = buildHeapSketch(lgK, tgtHllType1, curMode);
+ byte[] sk1bytes = sk1.toUpdatableByteArray();
+
+ for (int t2 = 0; t2 <= 2; t2++) {
+ if (t2 == t1) { continue; }
+ TgtHllType tgtHllType2 = TgtHllType.fromOrdinal(t2);
+ HllSketch sk2 = sk1.copyAs(tgtHllType2);
+ HllSketch sk3 = sk2.copyAs(tgtHllType1);
+ byte[] sk3bytes = sk3.toUpdatableByteArray();
+ String comb = "LgK= " + lgK + ", CurMode= " + curMode.toString()
+ + ", Type1: " + tgtHllType1 + ", Type2: " + tgtHllType2;
+ checkArrays(sk1bytes, sk3bytes, comb);
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void isomorphsCopyAsCompactHeap() {
+ for (int lgK = 4; lgK <= 21; lgK++) {
+ for (int cm = 0; cm <= 2; cm++) {
+ if ((lgK < 8) && (cm == 1)) { continue; } //lgk < 8 list transistions directly to HLL
+ CurMode curMode = CurMode.fromOrdinal(cm);
+ for (int t1 = 0; t1 <= 2; t1++) {
+ TgtHllType tgtHllType1 = TgtHllType.fromOrdinal(t1);
+ HllSketch sk1 = buildHeapSketch(lgK, tgtHllType1, curMode);
+ byte[] sk1bytes = sk1.toCompactByteArray();
+
+ for (int t2 = 0; t2 <= 2; t2++) {
+ if (t2 == t1) { continue; }
+ TgtHllType tgtHllType2 = TgtHllType.fromOrdinal(t2);
+ HllSketch sk2 = sk1.copyAs(tgtHllType2);
+ HllSketch sk3 = sk2.copyAs(tgtHllType1);
+ byte[] sk3bytes = sk3.toCompactByteArray();
+ String comb = "LgK= " + lgK + ", CurMode= " + curMode.toString()
+ + ", Type1: " + tgtHllType1 + ", Type2: " + tgtHllType2;
+ checkArrays(sk1bytes, sk3bytes, comb);
+ }
+ }
+ }
+ }
+ }
+
+
+ private static void checkArrays(byte[] sk1, byte[] sk2, String comb) {
+ int len = sk1.length;
+ if (len != sk2.length) {
+ println("Sketch images not the same length: " + comb);
+ return;
+ }
+
+ boolean first = true;
+ for (int i = 0; i < len; i++) {
+ if (sk1[i] == sk2[i]) { continue; }
+ if (first) {
+ print(comb + ": ");
+ first = false;
+ }
+ print(i + " ");
+ }
+ if (!first) { println(""); }
+ }
+
+
+ //BUILDERS
+ private Union buildHeapUnion(int lgMaxK, CurMode curMode) {
+ Union u = new Union(lgMaxK);
+ int n = (curMode == null) ? 0 : getN(lgMaxK, curMode);
+ for (int i = 0; i < n; i++) { u.update(i + v); }
+ v += n;
+ return u;
+ }
+
+ private Union buildMemoryUnion(int lgMaxK, CurMode curMode) {
+ final int bytes = HllSketch.getMaxUpdatableSerializationBytes(lgMaxK, TgtHllType.HLL_8);
+ WritableMemory wmem = WritableMemory.allocate(bytes);
+ Union u = new Union(lgMaxK, wmem);
+ int n = (curMode == null) ? 0 : getN(lgMaxK, curMode);
+ for (int i = 0; i < n; i++) { u.update(i + v); }
+ v += n;
+ return u;
+ }
+
+ private HllSketch buildHeapSketch(int lgK, TgtHllType tgtHllType, CurMode curMode) {
+ HllSketch sk = new HllSketch(lgK, tgtHllType);
+ int n = (curMode == null) ? 0 : getN(lgK, curMode);
+ for (int i = 0; i < n; i++) { sk.update(i + v); }
+ v += n;
+ return sk;
+ }
+
+ private HllSketch buildMemorySketch(int lgK, TgtHllType tgtHllType, CurMode curMode) {
+ final int bytes = HllSketch.getMaxUpdatableSerializationBytes(lgK,tgtHllType);
+ WritableMemory wmem = WritableMemory.allocate(bytes);
+ HllSketch sk = new HllSketch(lgK, tgtHllType, wmem);
+ int n = (curMode == null) ? 0 : getN(lgK, curMode);
+ for (int i = 0; i < n; i++) { sk.update(i + v); }
+ v += n;
+ return sk;
+ }
+
+ //lgK >= 8
+ private static int getN(int lgK, CurMode curMode) {
+ if (curMode == LIST) { return 4; }
+ if (curMode == SET) { return 1 << (lgK - 4); }
+ return 1 << (lgK - 3); //HLL
+ }
+
+ @Test
+ public void printlnTest() {
+ println("PRINTING: "+this.getClass().getName());
+ }
+
+ /**
+ * @param o value to print
+ */
+ static void println(Object o) {
+ print(o.toString() + "\n");
+ }
+
+ /**
+ * @param o value to print
+ */
+ static void print(Object o) {
+ //System.out.print(o.toString()); //disable here
+ }
+
+ /**
+ * @param fmt format
+ * @param args arguments
+ */
+ static void printf(String fmt, Object...args) {
+ //System.out.printf(fmt, args); //disable here
+ }
+}
diff --git a/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java b/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java
index 3272295..2459850 100644
--- a/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java
+++ b/src/test/java/org/apache/datasketches/hll/UnionCaseTest.java
@@ -119,7 +119,6 @@ public class UnionCaseTest {
assertTrue(err < rse);
}
-
private HllSketch getSource(int caseNum, TgtHllType tgtHllType, boolean memory) {
int srcLgK = getSrcLgK(caseNum, maxLgK);
int srcU = getSrcCount(caseNum, maxLgK);
@@ -197,7 +196,7 @@ public class UnionCaseTest {
}
@Test
- public void checkSrcListSet() { //src: SET, gadget: LIST, cases 0, 1
+ public void checkSrcListSet() { //src: SET, gadget: LIST
int n1 = 5;
int n2 = 2;
int n3 = 16;
@@ -219,7 +218,7 @@ public class UnionCaseTest {
}
@Test
- public void checkSrcSetList() { //src: LIST, gadget: SET, cases 0, 4
+ public void checkSrcSetList() { //src: LIST, gadget: SET
int n1 = 6;
int n2 = 10;
int n3 = 6;
@@ -241,7 +240,7 @@ public class UnionCaseTest {
}
@Test
- public void checkSrcSetSet() { //src: SET, gadget: SET, cases 0, 5
+ public void checkSrcSetSet() { //src: SET, gadget: SET
int n1 = 6;
int n2 = 10;
int n3 = 16;
@@ -263,7 +262,7 @@ public class UnionCaseTest {
}
@Test
- public void checkSrcEmptyList() { //src: LIST, gadget: empty, case 12
+ public void checkSrcEmptyList() { //src: LIST, gadget: empty
int n1 = 0;
int n2 = 0;
int n3 = 7;
@@ -306,6 +305,48 @@ public class UnionCaseTest {
assertEquals(u.getEstimate(), sum, err);
}
+ @SuppressWarnings("unused")
+ @Test
+ public void checkSpecialMergeCase4() {
+ Union u = buildHeapUnion(12, 1 << 9);
+ HllSketch sk = buildHeapSketch(12, HLL_8, 1 << 9);
+
+ u.update(sk);
+ assertTrue(u.isRebuildCurMinNumKxQFlag());
+ u.getCompositeEstimate();
+ assertFalse(u.isRebuildCurMinNumKxQFlag());
+
+ u.update(sk);
+ assertTrue(u.isRebuildCurMinNumKxQFlag());
+ u.getLowerBound(2);
+ assertFalse(u.isRebuildCurMinNumKxQFlag());
+
+ u.update(sk);
+ assertTrue(u.isRebuildCurMinNumKxQFlag());
+ u.getUpperBound(2);
+ assertFalse(u.isRebuildCurMinNumKxQFlag());
+
+ u.update(sk);
+ assertTrue(u.isRebuildCurMinNumKxQFlag());
+ u.getResult();
+ assertFalse(u.isRebuildCurMinNumKxQFlag());
+
+ u.update(sk);
+ assertTrue(u.isRebuildCurMinNumKxQFlag());
+ byte[] ba = u.toCompactByteArray();
+ assertFalse(u.isRebuildCurMinNumKxQFlag());
+
+ u.update(sk);
+ assertTrue(u.isRebuildCurMinNumKxQFlag());
+ ba = u.toUpdatableByteArray();
+ assertFalse(u.isRebuildCurMinNumKxQFlag());
+
+ u.putRebuildCurMinNumKxQFlag(true);
+ assertTrue(u.isRebuildCurMinNumKxQFlag());
+ u.putRebuildCurMinNumKxQFlag(false);
+ assertFalse(u.isRebuildCurMinNumKxQFlag());
+ }
+
private static double errorFactor(int lgK, boolean oooFlag, double numStdDev) {
double f;
if (oooFlag) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org