davecromberge commented on a change in pull request #324:
URL: 
https://github.com/apache/incubator-datasketches-java/pull/324#discussion_r455390315



##########
File path: src/test/java/org/apache/datasketches/theta/CompactSketchTest.java
##########
@@ -333,6 +333,55 @@ public void checkHeapCompactSketchCompact() {
     assertEquals(csk.getCurrentPreambleLongs(), 2);
   }
 
+  @Test
+  public void checkDirectCompactSketchCompact() {
+    WritableMemory wmem1, wmem2;
+    CompactSketch csk1, csk2;
+    int bytes;
+    int lgK = 6;
+
+    //empty
+    UpdateSketch sk = 
Sketches.updateSketchBuilder().setLogNominalEntries(lgK).build();
+    bytes = sk.getCompactBytes();
+    wmem1 = WritableMemory.allocate(bytes);
+    wmem2 = WritableMemory.allocate(bytes);
+    csk1 = sk.compact(true, wmem1); //place into memory
+    assertTrue(csk1 instanceof DirectCompactSketch);
+    csk2 = csk1.compact(true, wmem2);
+    assertTrue(csk2 instanceof DirectCompactSketch);
+
+    //single
+    sk.update(1);
+    bytes = sk.getCompactBytes();
+    wmem1 = WritableMemory.allocate(bytes);
+    wmem2 = WritableMemory.allocate(bytes);
+    csk1 = sk.compact(true, wmem1); //place into memory
+    assertTrue(csk1 instanceof DirectCompactSketch);
+    csk2 = csk1.compact(true, wmem2);
+    assertTrue(csk2 instanceof DirectCompactSketch);
+
+    //exact
+    sk.update(2);
+    bytes = sk.getCompactBytes();
+    wmem1 = WritableMemory.allocate(bytes);
+    wmem2 = WritableMemory.allocate(bytes);
+    csk1 = sk.compact(true, wmem1); //place into memory
+    assertTrue(csk1 instanceof DirectCompactSketch);
+    csk2 = csk1.compact(true, wmem2);
+    assertTrue(csk2 instanceof DirectCompactSketch);

Review comment:
       What is the significance of the additional value, when compared to a 
sketch containing a single value?  Considering that lgK = 6, it is clearly 
still in exact mode, is the intention here to see that the additional value 
serialises properly into memory?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to