Skip to content

Commit

Permalink
[SPARK-8541] [PYSPARK] test the absolute error in approx doctests
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
megatron-me-uk authored and nemccarthy committed Jun 25, 2015
1 parent d839952 commit 7f46b8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/pyspark/rdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ def sumApprox(self, timeout, confidence=0.95):
>>> rdd = sc.parallelize(range(1000), 10)
>>> r = sum(range(1000))
>>> (rdd.sumApprox(1000) - r) / r < 0.05
>>> abs(rdd.sumApprox(1000) - r) / r < 0.05
True
"""
jrdd = self.mapPartitions(lambda it: [float(sum(it))])._to_java_object_rdd()
Expand All @@ -2215,7 +2215,7 @@ def meanApprox(self, timeout, confidence=0.95):
>>> rdd = sc.parallelize(range(1000), 10)
>>> r = sum(range(1000)) / 1000.0
>>> (rdd.meanApprox(1000) - r) / r < 0.05
>>> abs(rdd.meanApprox(1000) - r) / r < 0.05
True
"""
jrdd = self.map(float)._to_java_object_rdd()
Expand Down

0 comments on commit 7f46b8f

Please sign in to comment.