Skip to content

Commit 716dcf6

Browse files
megatron-me-ukJoshRosen
authored andcommitted
[SPARK-8541] [PYSPARK] test the absolute error in approx doctests
A minor change but one which is (presumably) visible on the public api docs webpage. Author: Scott Taylor <github@megatron.me.uk> Closes #6942 from megatron-me-uk/patch-3 and squashes the following commits: fbed000 [Scott Taylor] test the absolute error in approx doctests (cherry picked from commit f0dcbe8) Signed-off-by: Josh Rosen <joshrosen@databricks.com>
1 parent 45b4527 commit 716dcf6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/pyspark/rdd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,7 +2130,7 @@ def sumApprox(self, timeout, confidence=0.95):
21302130
21312131
>>> rdd = sc.parallelize(range(1000), 10)
21322132
>>> r = sum(xrange(1000))
2133-
>>> (rdd.sumApprox(1000) - r) / r < 0.05
2133+
>>> abs(rdd.sumApprox(1000) - r) / r < 0.05
21342134
True
21352135
"""
21362136
jrdd = self.mapPartitions(lambda it: [float(sum(it))])._to_java_object_rdd()
@@ -2147,7 +2147,7 @@ def meanApprox(self, timeout, confidence=0.95):
21472147
21482148
>>> rdd = sc.parallelize(range(1000), 10)
21492149
>>> r = sum(xrange(1000)) / 1000.0
2150-
>>> (rdd.meanApprox(1000) - r) / r < 0.05
2150+
>>> abs(rdd.meanApprox(1000) - r) / r < 0.05
21512151
True
21522152
"""
21532153
jrdd = self.map(float)._to_java_object_rdd()

0 commit comments

Comments
 (0)