MapReduce is a concept that is borrowed from functional programming. The data processing is broken down into a map phase, where data preparation occurs, and a reduce phase, where the actual results are computed. The reason MapReduce has played an important role is the massive parallelism we can achieve as the data is sharded into multiple distributed servers. Without this advantage, MapReduce cannot really perform well.
Let's take up a simple example to understand how MapReduce works in functional programming:
- The input data is processed using a mapper function of our choice
- The output from the mapper function should be in a state that is consumable by the reduce function
- The output from the mapper function is fed to the reduce function to generate the necessary results
Let's understand these steps using a simple program. This program uses the following text...