title: How Apache Spark collects and coordinate the results from executors
body: <p>Posting this question to learn how Apache Spark collects and coordinate the results from executors.</p>
  
  <p>Suppose I'm running a job with 3 executors. My DataFrame is partitioned and running across these 3 executors. 
  So now, When I execute a count() or collect() action on the DataFrame how spark will coordinate the results from these 3 executors? </p>
  
  <pre><code>val prods = spark.read.format("csv").option("header", "true").load("testFile.csv")
  
  prods.count(); // How spark collect data from three executors? Who will coordinate the result from different executors and give it to driver?
  </code></pre>