aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorzsxwing <zsxwing@gmail.com>2015-06-17 13:59:39 -0700
committerAndrew Or <andrew@databricks.com>2015-06-17 13:59:39 -0700
commit0fc4b96f3e3bf81724ac133a6acc97c1b77271b4 (patch)
tree7d5e783967ac602ce979fe0f15a3d3613f44a4f8 /core
parent2837e067099921dd4ab6639ac5f6e89f789d4ff4 (diff)
downloadspark-0fc4b96f3e3bf81724ac133a6acc97c1b77271b4.tar.gz
spark-0fc4b96f3e3bf81724ac133a6acc97c1b77271b4.tar.bz2
spark-0fc4b96f3e3bf81724ac133a6acc97c1b77271b4.zip
[SPARK-8373] [PYSPARK] Add emptyRDD to pyspark and fix the issue when calling sum on an empty RDD
This PR fixes the sum issue and also adds `emptyRDD` so that it's easy to create a test case. Author: zsxwing <zsxwing@gmail.com> Closes #6826 from zsxwing/python-emptyRDD and squashes the following commits: b36993f [zsxwing] Update the return type to JavaRDD[T] 71df047 [zsxwing] Add emptyRDD to pyspark and fix the issue when calling sum on an empty RDD
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala b/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
index 55a37f8c94..0103f6c6ab 100644
--- a/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
+++ b/core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala
@@ -425,6 +425,11 @@ private[spark] object PythonRDD extends Logging {
iter.foreach(write)
}
+ /** Create an RDD that has no partitions or elements. */
+ def emptyRDD[T](sc: JavaSparkContext): JavaRDD[T] = {
+ sc.emptyRDD[T]
+ }
+
/**
* Create an RDD from a path using [[org.apache.hadoop.mapred.SequenceFileInputFormat]],
* key and value class.