-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-8373][PySpark]Add emptyRDD to pyspark and fix the issue when calling sum on an empty RDD #6826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-8373][PySpark]Add emptyRDD to pyspark and fix the issue when calling sum on an empty RDD #6826
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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] = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this API used anywhere? If the answer is "no", we should remove it.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is just bringing it to parity with the scala SparkContext API, which we currently also only use in tests. This is probably fine.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This class is
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see |
||
| sc.emptyRDD[T] | ||
| } | ||
|
|
||
| /** | ||
| * Create an RDD from a path using [[org.apache.hadoop.mapred.SequenceFileInputFormat]], | ||
| * key and value class. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emptyRDD[T]should produce an RDD ofT, not byte arrays right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T in the return type is not used. Actually, it can be an arbitrary type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will update it to T