Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/15990#discussion_r89296748
--- 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 --
This LGTM. The only question I have is: Should we allow a user to use a
value higher then `p=18` and just apply a max when we go above it?
---
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]