I was trying to understand a MapReduce program. While doing that, I noticed that the reduce tasks start executing almost immediately after all the maps are tasked are finished. Now, this is surprising, because the reduce tasks there work with data that is grouped by key, meaning that there is shuffle/sort step done in between. The only way this could happen is if the shuffling was being done in parallel with mapping.
Secondly, if shuffling is indeed done in parallel with mapping, what is the equivalent of that in Apache Spark? Can mapping and grouping by keys and/or sorting happen in parallel there too?