How to create an empty RDD with a given type?

2015-01-12 Thread Xuelin Cao
Hi, I'd like to create a transform function, that convert RDD[String] to RDD[Int] Occasionally, the input RDD could be an empty RDD. I just want to directly create an empty RDD[Int] if the input RDD is empty. And, I don't want to return None as the result. Is there an easy way to do

Re: How to create an empty RDD with a given type?

2015-01-12 Thread Justin Yip
Xuelin, There is a function called emtpyRDD under spark context which serves this purpose. Justin On Mon, Jan 12, 2015 at 9:50 PM, Xuelin Cao wrote: > > > Hi, > > I'd like to create a transform functio

Re: How to create an empty RDD with a given type?

2015-01-12 Thread Xuelin Cao
Got it, thanks! On Tue, Jan 13, 2015 at 2:00 PM, Justin Yip wrote: > Xuelin, > > There is a function called emtpyRDD under spark context > > which > serves this purpose. > > Justin > > On Mon, Jan 12, 2015

Re: How to create an empty RDD with a given type?

2015-01-13 Thread Sean Owen
PS you will probably have to cast to get the type RDD[Int]: https://issues.apache.org/jira/browse/SPARK-2331 On Tue, Jan 13, 2015 at 5:50 AM, Xuelin Cao wrote: > > > Hi, > > I'd like to create a transform function, that convert RDD[String] to > RDD[Int] > > Occasionally, the input RDD cou