Scala- csv error

I have 2 file tech.txt and sal.txt with below entries;

tech.txt

first,last,technology
Amit,Jain,java
Lokesh,kumar,unix
Mithun,kale,spark

sal.txt

first,last,salary
Amit,Jain,100000
Lokesh,kumar,95000
Mithun,kale,150000

I am trying to join these 2 files based on first and last name and save the obtained result in csv format. But facing below error. Please help.

val tech = sc.textFile("/user/root/spark/technology.txt").map(x => x.split(","))
val sal = sc.textFile("/user/root/spark/salary.txt").map(x => x.split(","))

val joined = tech.map(x => ((x(0), x(1)), x(2))).join(sal.map(x => ((x(0), x(1)), x(2)))).collect()

joined.map(x => x.mkString("|")).saveAsTextFile("/user/root/empfile.csv")

Error:

error: value mkString is not a member of ((String, String), (String, String))

Thanks in advance

try this

val datamap = joined.map(x=>(""+x._1._1+","+x._1._2+","+x._2._1+","+x._2._2+""))

datamap.saveAsTextFile("/user/root/empfile.csv")

This is creating folder with extension of csv but files are not csv ones…
Does someone know how to save as CSV format