diff --git a/src/main/java/com/yahoo/sketches/theta/Sketch.java b/src/main/java/com/yahoo/sketches/theta/Sketch.java index 436a75bc1..d4d03afd4 100644 --- a/src/main/java/com/yahoo/sketches/theta/Sketch.java +++ b/src/main/java/com/yahoo/sketches/theta/Sketch.java @@ -231,7 +231,8 @@ public double getLowerBound(final int numStdDev) { /** * Returns the maximum number of storage bytes required for a CompactSketch with the given - * number of actual entries. + * number of actual entries. Note that this assumes the worse case of the sketch in + * estimation mode, which requires storing theta and count. * @param numberOfEntries the actual number of entries stored with the CompactSketch. * @return the maximum number of storage bytes required for a CompactSketch with the given number * of entries. diff --git a/src/test/java/com/yahoo/sketches/theta/ConcurrentDirectQuickSelectSketchTest.java b/src/test/java/com/yahoo/sketches/theta/ConcurrentDirectQuickSelectSketchTest.java index 0e0be1ca6..3d2d2cfe1 100644 --- a/src/test/java/com/yahoo/sketches/theta/ConcurrentDirectQuickSelectSketchTest.java +++ b/src/test/java/com/yahoo/sketches/theta/ConcurrentDirectQuickSelectSketchTest.java @@ -686,6 +686,15 @@ public void checkConstructReconstructFromMemory() { } } + @Test + public void checkNullMemory() { + UpdateSketchBuilder bldr = new UpdateSketchBuilder(); + final UpdateSketch sk = bldr.build(); + for (int i = 0; i < 1000; i++) { sk.update(i); } + final UpdateSketch shared = bldr.buildSharedFromSketch(sk, null); + assertEquals(shared.getRetainedEntries(), 1000); + assertFalse(shared.hasMemory()); + } //checks Alex's bug where lgArrLongs > lgNomLongs +1. @Test