title: Spark CollectAsMap
body: <p>I would like to know how collectAsMap works in Spark. More specifically I would like to know where the aggregation of the data of all partitions will take place? The aggregation either takes place in master or in workers. In the first case each worker send its data on master and when the master collects the data from each one worker, then master will aggregate the results. In the second case the workers are responsible to aggregate the results(after they exchange the data among them) and after that the results will be sent to the master.</p>
  
  <p>It is critical for me to find a way so as the master to be able collect the data from each partition separately, without workers exchange data.</p>