You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Gavin Yue <yu...@gmail.com> on 2016/08/25 17:15:01 UTC

How to output RDD to one file with specific name?

I am trying to output RDD to disk by

rdd.coleasce(1).saveAsTextFile("/foo")

It outputs to foo folder with a file with name: Part-00000.

Is there a way I could directly save the file as /foo/somename ?

Thanks.

RE: How to output RDD to one file with specific name?

Posted by Stefan Panayotov <sp...@msn.com>.
You can do something like:

 

dbutils.fs.cp("/foo/part-00000","/foo/my-data.csv")

 

Stefan Panayotov, PhD

 <ma...@outlook.com> spanayotov@outlook.com

 <ma...@comcast.net> spanayotov@comcast.net

Cell: 610-517-5586

Home: 610-355-0919

 

From: Gavin Yue [mailto:yue.yuanyuan@gmail.com] 
Sent: Thursday, August 25, 2016 1:15 PM
To: user <us...@spark.apache.org>
Subject: How to output RDD to one file with specific name?

 

I am trying to output RDD to disk by

 

rdd.coleasce(1).saveAsTextFile("/foo")

 

It outputs to foo folder with a file with name: Part-00000. 

 

Is there a way I could directly save the file as /foo/somename ?

 

Thanks.