diff options
author | Erik van Oosten <evanoosten@ebay.com> | 2015-04-14 12:39:56 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2015-04-14 12:39:56 +0100 |
commit | 51b306b930cfe03ad21af72a3a6ef31e6e626235 (patch) | |
tree | 14dd70aab48b870a648f3992f66180c8df706a28 /core/src/test | |
parent | 628a72f70ed06b8d7aee81cfb16070eb2c87b9cd (diff) | |
download | spark-51b306b930cfe03ad21af72a3a6ef31e6e626235.tar.gz spark-51b306b930cfe03ad21af72a3a6ef31e6e626235.tar.bz2 spark-51b306b930cfe03ad21af72a3a6ef31e6e626235.zip |
SPARK-6878 [CORE] Fix for sum on empty RDD fails with exception
Author: Erik van Oosten <evanoosten@ebay.com>
Closes #5489 from erikvanoosten/master and squashes the following commits:
1c91954 [Erik van Oosten] Rewrote double range matcher to an exact equality assert (SPARK-6878)
f1708c9 [Erik van Oosten] Fix for sum on empty RDD fails with exception (SPARK-6878)
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/scala/org/apache/spark/rdd/DoubleRDDSuite.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/src/test/scala/org/apache/spark/rdd/DoubleRDDSuite.scala b/core/src/test/scala/org/apache/spark/rdd/DoubleRDDSuite.scala index 97079382c7..01039b9449 100644 --- a/core/src/test/scala/org/apache/spark/rdd/DoubleRDDSuite.scala +++ b/core/src/test/scala/org/apache/spark/rdd/DoubleRDDSuite.scala @@ -22,6 +22,12 @@ import org.scalatest.FunSuite import org.apache.spark._ class DoubleRDDSuite extends FunSuite with SharedSparkContext { + test("sum") { + assert(sc.parallelize(Seq.empty[Double]).sum() === 0.0) + assert(sc.parallelize(Seq(1.0)).sum() === 1.0) + assert(sc.parallelize(Seq(1.0, 2.0)).sum() === 3.0) + } + // Verify tests on the histogram functionality. We test with both evenly // and non-evenly spaced buckets as the bucket lookup function changes. test("WorksOnEmpty") { |