MapReduce framework assumes very simplistic organization of data. All data must be organized into files of key-value pairs. In such organization, each data item consists of a sequence of two data items. The first data item is called "key" and the second data item is called "value". A "key" component place a role of a name of a property and a "value" component plays a role of a value of a property. Speaking in the terms of relational data model "key" is an "attribute" in a header of a relational table and a "value" is a value of an attribute in a row of a relational table.
For example, a "key" "City" can be associated with a value "Sydney". It means that a name of a city is Sydney.
For example, a key "Date" can be associated with two dates: data of birth and optionally date of death. It means that a value may have its internal structure.
A "key" must be unique within a collection of data it is included in.
Semistructured data like for example a sequence of words organized into lines must be converted to key-value format before processing. For example, words extracted from the lines can be associated with a counter equal to the total number of occurrencies of a word in a text.
For example a text:
text to
pass to
reader
can be converted into the following sequence of key-value pairs:
text:1, to:2, pass:1, reader:1
A sample transformation procedure can be organized as the following sequence of steps:
(1) extract the words from text and assign each word with a number 1:
text:1, to:1, pass:1, to:1, reader:1
(2) sort the pairs by words
pass:1,reader:1,text:1,to:1,to:1
(3) perform summation of ones for key-value pairs that have the same key:
pass;1,reader:1,text:1to;2
A procedure explained above as a very simple example of application of MapReduce framework.