I have a Spark program (in Scala) and a SparkContext
. I am writing some files with RDD
's saveAsTextFile
. On my local machine I can use a local file path and it works with the local file system. On my cluster it works with HDFS.
I also want to write other arbitrary files as the result of processing. I'm writing them as regular files on my local machine, but want them to go into HDFS on the cluster.
SparkContext
seems to have a few file-related methods but they all seem to be inputs not outputs.
How do I do this?