michaelschiff opened a new issue #265: PairwiseSetOperations.aNotB throws 
ArrayOutOfBoundsException
URL: https://github.com/apache/incubator-datasketches-java/issues/265
 
 
   Reproduced with:
   ```
           UpdateSketch one = new 
UpdateSketchBuilder().setNominalEntries(4096).build();
           UpdateSketch two = new 
UpdateSketchBuilder().setNominalEntries(4096).build();
           UpdateSketch three = new 
UpdateSketchBuilder().setNominalEntries(4096).build();
           for (int i = 0; i < 1_000_000; i++) {
               one.update(i);
               two.update(1_000_000 + i);
               three.update(2_000_000 + i);
           }
           
PairwiseSetOperations.aNotB(PairwiseSetOperations.intersect(one.compact(), 
two.compact()), three.compact());
   ```
   
   The bug itself doesn't seem to be in the implementation of aNotB, but rather 
that `CompactSketch.isEmpty()` (which aNotB checks) is deceiving, and may 
return false despite the internal array being length 0.  When aNotB checks to 
see if the sketch is empty, it sees it is not, and then proceeds to attempt the 
set difference which fails to the zero length array.  If you attempt the same 
thing, but replace `one.compact()` with a newly constructed empty sketch, aNotB 
works as expected.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

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

Reply via email to