title: Spark: adding column name to csv file fails
body: <p>I have "a.txt" which is in csv format and is separated by tabs:</p>
  
  <pre><code>16777216    16777471        -33.4940    143.2104
  16777472    16778239    Fuzhou  26.0614 119.3061
  </code></pre>
  
  <p>Then I run:</p>
  
  <pre><code>sc.textFile("path/to/a.txt").map(line =&gt; line.split("\t")).toDF("startIP", "endIP", "City", "Longitude", "Latitude")
  </code></pre>
  
  <p>THen I got:</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: requirement failed: The number of
    columns doesn't match. Old column names (1): value New column names
    (5): startIP, endIP, City, Longitude, Latitude   at
    scala.Predef$.require(Predef.scala:224)   at
    org.apache.spark.sql.Dataset.toDF(Dataset.scala:376)   at
    org.apache.spark.sql.DatasetHolder.toDF(DatasetHolder.scala:40)   ...
    47 elided</p>
  </blockquote>
  
  <p>If I just run:</p>
  
  <pre><code>res.map(line =&gt; line.split("\t")).take(2)
  </code></pre>
  
  <p>I got:</p>
  
  <pre><code>rdd: Array[Array[String]] = Array(Array(16777216, 16777471, "", -33.4940, 143.2104), Array(16777472, 16778239, Fuzhou, 26.0614, 119.3061))
  </code></pre>
  
  <p>What is wrong here?</p>