apache / datasketches-java

A software library of stochastic streaming algorithms, a.k.a. sketches.
https://datasketches.apache.org
Apache License 2.0
874 stars 207 forks source link

Bug in datasketches-java 6.0.0 #568

Open leerho opened 1 month ago

leerho commented 1 month ago

The function in /theta/Sketch::getCompactSketchMaxBytes(lgNomEntries) is computed incorrectly due to a misplaced right-parentheses. Ironically the test method that tests this function made the same mistake!

This function is also referenced by /theta/Sketches/ with the same name.

The Javadocs in both places are also incorrect.

AlexanderSaydakov commented 1 month ago

I would suggest to test not by asserting a particular number, but by measuring the actual peak size. https://github.com/apache/datasketches-cpp/blob/76edd74f5db286b672c170a8ded4ce39b3a8800f/theta/test/theta_sketch_test.cpp#L561

leerho commented 1 month ago

good idea.