Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/5974#discussion_r29844326
--- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
@@ -1177,8 +1177,9 @@ abstract class RDD[T: ClassTag](
* It must be greater than 0.000017.
*/
def countApproxDistinct(relativeSD: Double = 0.05): Long = withScope {
+ require(relativeSD > 0.000017, s"accuracy ($relativeSD) must be
greater than 0.000017")
val p = math.ceil(2.0 * math.log(1.054 / relativeSD) /
math.log(2)).toInt
- countApproxDistinct(p, 0)
+ countApproxDistinct(if (p < 4) 4 else p, 0)
--- End diff --
Seems OK, in that it enforces the contract in the docs, and then avoids an
error in a case that does not seem to be an error. @rxin do you have any
thoughts on this one?
---
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]