title: Spark textFile vs wholeTextFiles
body: <p>I understand the basic theory of <code>textFile</code> generating partition for each file, while <code>wholeTextFiles</code> generates an RDD of pair values, where the key is the path of each file, the value is the content of each file. </p>
  
  <p>Now, from a technical point of view, what's the difference between : </p>
  
  <pre><code>val textFile = sc.textFile("my/path/*.csv", 8)
  textFile.getNumPartitions
  </code></pre>
  
  <p>and </p>
  
  <pre><code>val textFile = sc.wholeTextFiles("my/path/*.csv",8)
  textFile.getNumPartitions
  </code></pre>
  
  <p>In both methods I'm generating 8 partitions. So why should I use <code>wholeTextFiles</code> in the first place, and what's its benefit over <code>textFile</code>? </p>