You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean Owen (JIRA)" <ji...@apache.org> on 2014/09/27 21:38:34 UTC

[jira] [Commented] (SPARK-2331) SparkContext.emptyRDD has wrong return type

    [ https://issues.apache.org/jira/browse/SPARK-2331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14150746#comment-14150746 ] 

Sean Owen commented on SPARK-2331:
----------------------------------

Yes your analysis is right-er, I think. I imagine this won't be changed as it introduces an API change, but yes I think the return type should have been {{RDD[T]}} As a workaround you can do...

{code}
val empty: RDD[String] = sc.emptyRDD
val rdds = Seq("a","b","c").foldLeft(empty){ (rdd,path) => rdd.union(sc.textFile(path)) }
{code}

Anyone else? WontFix, at least for 1.x?

> SparkContext.emptyRDD has wrong return type
> -------------------------------------------
>
>                 Key: SPARK-2331
>                 URL: https://issues.apache.org/jira/browse/SPARK-2331
>             Project: Spark
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Ian Hummel
>
> The return type for SparkContext.emptyRDD is EmptyRDD[T].
> It should be RDD[T].  That means you have to add extra type annotations on code like the below (which creates a union of RDDs over some subset of paths in a folder)
> val rdds = Seq("a", "b", "c").foldLeft[RDD[String]](sc.emptyRDD[String]) { (rdd, path) ⇒
>           rdd.union(sc.textFile(path))
>         }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org