Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/897#discussion_r13360624
--- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
@@ -921,15 +920,44 @@ abstract class RDD[T: ClassTag](
* :: Experimental ::
* Return approximate number of distinct elements in the RDD.
*
- * The accuracy of approximation can be controlled through the relative
standard deviation
- * (relativeSD) parameter, which also controls the amount of memory
used. Lower values result in
- * more accurate counts but increase the memory footprint and vise
versa. The default value of
- * relativeSD is 0.05.
+ * The algorithm used is based on streamlib's implementation of
"HyperLogLog in Practice:
+ * Algorithmic Engineering of a State of The Art Cardinality Estimation
Algorithm", available
+ * <a href="http://research.google.com/pubs/pub40671.html">here</a>.
+ *
+ * @param p The precision value for the normal set.
+ * <code>p</code> must be a value between 4 and <code>sp</code>.
--- End diff --
The relative standard error is approximately `1.054 / sqrt(2^p)`. Setting a
nonzero `sp > p` would trigger sparse representation of registers, which may
reduce the memory consumption and increase accuracy WHEN the cardinality is
small.
---
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.
---