Writing file into HDFS as tab delimited file from spark

Hi,

I am joining two tables (customers and orders) in spark using dataframe api.

After the join I use .map( x => x.mkString("\t")).saveAsTextFile(“PATH”) to write into HDFS.

Although this works the function doesn’t apply the tab delimiter to every row.

The tab delimiter doesn’t get applied to whatever is after the city “CAGUAS” (row 1,4,5,8,9,10)

Any help would be greatly appreciated because I have looked everywhere and tried everything.