It seems like saveAsTextFile might do what you are looking for.

On Wednesday, April 22, 2015, Xi Shen <davidshe...@gmail.com> wrote:

> Hi,
>
> I have a RDD of some processed data. I want to write these files to HDFS,
> but not for future M/R processing. I want to write plain old style text
> file. I tried:
>
> rdd foreach {d =>
>   val file = // create the file using a HDFS FileSystem
>   val lines = d map {
>     // format data into string
>   }
>
>   IOUtils.writeLines(lines, System.separator(), file)
> }
>
> Note, I was using the IOUtils from common-io, not from Hadoop package.
>
> The results are all file are created in myHDFS, but has no data at all...
>
>
>
> [image: --]
> Xi Shen
> [image: http://]about.me/davidshen
> <http://about.me/davidshen?promo=email_sig>
>   <http://about.me/davidshen>
>


-- 
Cell : 425-233-8271

Reply via email to