Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove parentheses around records when saveAsTextFile on RDD[(String, Int)]?

I'm using saveAsTextFile(path) in order to save output as text file in later to import the result to DB. The output looks something like this:

(value1, value2)

How to remove the parentheses?

like image 952
Userrrrrrrr Avatar asked Apr 29 '15 13:04

Userrrrrrrr


1 Answers

Before making saveAsTextFile use map(x => x.mkString(",")

rdd.map(x => x.mkString(",").saveAsTextFile(path)

Output will not have bracket.

like image 181
Hutashan Chandrakar Avatar answered Sep 30 '22 18:09

Hutashan Chandrakar