How to use the Map and reduce both functions in map reduce script.

In the map reduce script we can’t use directly both functions for using both functions we need to write the values from map to reduce using this Methode we can use both functions

// Add additional code
...
function map(context)
{
    for (var i = 0; context.value && i < context.value.length; i++)
        if (context.value[i] !=== ' ' && !PUNCTUATION_REGEXP.test(context.value[i]))
           {
                context.write({
                    key: context.value[i],
                    value: 1
                });
           }
}


...
// Add additional code

Leave a comment

Your email address will not be published. Required fields are marked *