Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15990#discussion_r89288538
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/HyperLogLogPlusPlus.scala
 ---
    @@ -92,8 +92,11 @@ case class HyperLogLogPlusPlus(
        */
       private[this] val p = Math.ceil(2.0d * Math.log(1.106d / relativeSD) / 
Math.log(2.0d)).toInt
     
    -  require(p >= 4, "HLL++ requires at least 4 bits for addressing. " +
    -    "Use a lower error, at most 27%.")
    +  // THRESHOLDS, RAW_ESTIMATE_DATA and BIAS_DATA all have the same length 
15, and we probe these
    +  // arrays by (p - 4), so we need to guarantee 0 <= p - 4 <= 14.
    +  require(p >= 4 && p < HyperLogLogPlusPlus.THRESHOLDS.length + 4,
    +    "HLL++ requires at least 4 bits and at most 18 bits for addressing. " +
    --- End diff --
    
    Instead of hard-coding 18, this should be 
`${HyperLogLogPlusPlus.THRESHOLDS.length + 3}`. In which case it might be 
easier to make the condition above `<=` and `+ 3`. 
    
    If you're going to 2 significant figures, I think 0.22% is a better lower 
bound.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to