Skip to content

Commit bc8fb20

Browse files
committed
Added unit tests
1 parent 1302c06 commit bc8fb20

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/main/java/com/yahoo/sketches/theta/Sketch.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ public double getLowerBound(final int numStdDev) {
231231

232232
/**
233233
* Returns the maximum number of storage bytes required for a CompactSketch with the given
234-
* number of actual entries.
234+
* number of actual entries. Note that this assumes the worse case of the sketch in
235+
* estimation mode, which requires storing theta and count.
235236
* @param numberOfEntries the actual number of entries stored with the CompactSketch.
236237
* @return the maximum number of storage bytes required for a CompactSketch with the given number
237238
* of entries.

src/test/java/com/yahoo/sketches/theta/ConcurrentDirectQuickSelectSketchTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,15 @@ public void checkConstructReconstructFromMemory() {
686686
}
687687
}
688688

689+
@Test
690+
public void checkNullMemory() {
691+
UpdateSketchBuilder bldr = new UpdateSketchBuilder();
692+
final UpdateSketch sk = bldr.build();
693+
for (int i = 0; i < 1000; i++) { sk.update(i); }
694+
final UpdateSketch shared = bldr.buildSharedFromSketch(sk, null);
695+
assertEquals(shared.getRetainedEntries(), 1000);
696+
assertFalse(shared.hasMemory());
697+
}
689698

690699
//checks Alex's bug where lgArrLongs > lgNomLongs +1.
691700
@Test

0 commit comments

Comments
 (0)