Skip to content

Commit 7f46b8f

Browse files
megatron-me-uknemccarthy
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 apache#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 d839952 commit 7f46b8f

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
@@ -2198,7 +2198,7 @@ def sumApprox(self, timeout, confidence=0.95):
21982198
21992199
>>> rdd = sc.parallelize(range(1000), 10)
22002200
>>> r = sum(range(1000))
2201-
>>> (rdd.sumApprox(1000) - r) / r < 0.05
2201+
>>> abs(rdd.sumApprox(1000) - r) / r < 0.05
22022202
True
22032203
"""
22042204
jrdd = self.mapPartitions(lambda it: [float(sum(it))])._to_java_object_rdd()
@@ -2215,7 +2215,7 @@ def meanApprox(self, timeout, confidence=0.95):
22152215
22162216
>>> rdd = sc.parallelize(range(1000), 10)
22172217
>>> r = sum(range(1000)) / 1000.0
2218-
>>> (rdd.meanApprox(1000) - r) / r < 0.05
2218+
>>> abs(rdd.meanApprox(1000) - r) / r < 0.05
22192219
True
22202220
"""
22212221
jrdd = self.map(float)._to_java_object_rdd()

0 commit comments

Comments
 (0)