title: Write Header only CSV record from Spark Scala DataFrame
body: <p>My requirement is to write only Header CSV record using Spark Scala DataFrame. Can any one help me on this.</p>
  
  <pre><code>val OHead1 = "/xxxxx/xxxx/xxxx/xxx/OHead1/" 
  val sc = sparkFile.sparkContext
  val outDF = csvDF.select("col_01", "col_02", "col_03").schema
  sc.parallelize(Seq(outDF.fieldNames.mkString("\t"))).coalesce(1).saveAsTextFile(s"$OHead1")
  
  The above one is working and able to create header in the CSV with tab delimiter. Since I am using spark session I am creating sparkContext in the second line. outDF is my dataframe created before these statements.
  Two things are outstanding, can you one of you help me.
  
  1. The above working code is not overriding the files, so every time I need to delete the files manually. I could not find override option, can you help me.
  2. Since I am doing a select statement and schema, will it be consider as action and start another lineage for this statement. If it is true then this would degrade the performance.
  </code></pre>