I am reading a CSV(file has headers header 1st,header2) and generating rdd, After few transformations I create an rdd and finally write it to a txt file. What's the best way to add the header from source file, into rdd and have it available as header into new file I.e, when I transform the rdd into textfile using saveAsTexFile("newfile") the header 1, header 2 shall be available.
Thanks,Upendra