AlexanderSaydakov commented on code in PR #559:
URL: https://github.com/apache/datasketches-java/pull/559#discussion_r1597298333


##########
src/main/java/org/apache/datasketches/theta/Sketch.java:
##########
@@ -297,13 +297,27 @@ public double getLowerBound(final int numStdDev) {
    * @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.
+   * @deprecated as a public method. Use {@link #getCompactSketchMaxBytes(int) 
instead}
    */
+  @Deprecated
   public static int getMaxCompactSketchBytes(final int numberOfEntries) {
     if (numberOfEntries == 0) { return 8; }
     if (numberOfEntries == 1) { return 16; }
     return (numberOfEntries << 3) + 24;
   }
 
+  /**
+   * Returns the maximum number of storage bytes required for a CompactSketch 
given the configured
+   * number of nominal entries (power of 2).
+   * @param nomEntries <a 
href="{@docRoot}/resources/dictionary.html#nomEntries">Nominal Entries</a>
+   * @return the maximum number of storage bytes required for a CompactSketch 
with the given
+   * nomEntries.
+   */
+  public static int getCompactSketchMaxBytes(final int nomEntries) {

Review Comment:
   I would suggest reusing the existing logic like this:
   HeapQuickSelectSketch.setHashTableThreshold(lgK, lgK + 1) + 
Family.QUICKSELECT.getMaxPreLongs()) * Long.BYTES
   
   By the way, I noticed that the setHashTableThreshold() method is duplicated 
in DirectQuickSelectSketch (not introduced by this PR)



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

To unsubscribe, e-mail: [email protected]

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