Skip to content
Permalink
Browse files
Fixes as a result of PR Review (mostly).
Plus a few other minor changes.
  • Loading branch information
leerho committed Oct 21, 2021
1 parent 42134d8 commit 8cfe98d09d15659d9ec8d6085d55c40b96280b04
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
@@ -127,7 +127,7 @@ public CompactSketch aNotB(final Sketch skA, final Sketch skB, final boolean dst
//A is not Empty
checkSeedHashes(skA.getSeedHash(), seedHash_);

if (skB.isEmpty() && skB.getRetainedEntries() == 0) {
if (skB.isEmpty()) {
return skA.compact(dstOrdered, dstMem);
}
checkSeedHashes(skB.getSeedHash(), seedHash_);
@@ -211,7 +211,8 @@ public void notB(final org.apache.datasketches.theta.Sketch skB) {
curCount_ = hashArr_.length;

summaryArr_ = daB.summaryArr;
curCount_ = hashArr_.length;


empty_ = curCount_ == 0 && thetaLong_ == Long.MAX_VALUE;
}

@@ -269,7 +270,7 @@ CompactSketch<S> aNotB(final Sketch<S> skA, final Sketch<S> skB) {
final long minThetaLong = Math.min(skA.getThetaLong(), skB.getThetaLong());

if (skA.isEmpty()) { return skA.compact(); }
if (skB.isEmpty() && skB.getRetainedEntries() == 0) { return skA.compact(); }
if (skB.isEmpty()) { return skA.compact(); }
//Both skA & skB are not empty, and skB has valid entries

//Process A
@@ -96,7 +96,7 @@ private enum Flags { IS_BIG_ENDIAN, IS_EMPTY, HAS_ENTRIES, IS_THETA_INCLUDED }
final boolean hasEntries = (flags & 1 << Flags.HAS_ENTRIES.ordinal()) > 0;
if (hasEntries) {
int classNameLength = 0;
if (version == serialVersionWithSummaryClassNameUID) {
if (version == serialVersionWithSummaryClassNameUID) { //Obsolete?
classNameLength = mem.getByte(offset++);
}
final int count = mem.getInt(offset);
@@ -562,7 +562,7 @@ public void resultDegenNewDegen() {
}

@Test
public void resultDegenResultDegen() { //AnotB NullPointerException
public void resultDegenResultDegen() {
IntegerSketch ska = getSketch(SkType.RESULT_DEGEN, MIDP, GT_MIDP_V); //entries = 0
IntegerSketch skb = getSketch(SkType.RESULT_DEGEN, LOWP, GT_LOWP_V);

@@ -30,7 +30,7 @@
* Which should be equal to AnotB(estimating{<1.0,1,F}, new{1.0,0,T} = estimating{<1.0, 1, F}. The AnotB
* threw a null pointer exception because it was not properly handling sketches with zero entries.
*/
public class MikhailsBugTuple {
public class MikhailsBugTupleTest {

@Test
public void mikhailsBug() {

0 comments on commit 8cfe98d

Please sign in to comment.