title: Does coalesce(numPartitions) in spark undergo shuffling or not?
body: <p>I have a simple question in spark transformation function.</p>
  
  <p>coalesce(numPartitions) -   Decrease the number of partitions in the RDD to numPartitions. Useful for running operations more efficiently after filtering down a large dataset.  </p>
  
  <pre><code>val dataRDD = sc.textFile("/user/cloudera/inputfiles/records.txt")
  val filterRDD = dataRDD.filter(record =&gt; record.split(0) == "USA")
  val resizeRDD = filterRDD.coalesce(50)
  val result    = resizeRDD.collect
  </code></pre>
  
  <p>My question is </p>
  
  <ol>
  <li><p>Is it true that coalesce(numPartitions)  will remove the empty partitions  from filterRDD?</p></li>
  <li><p>Does coalesce(numPartitions)  undergo shuffling or not?</p></li>
  </ol>