I am trying to develop a set of simple mapreduce application where I process some complex data from file using map-only and map-reduce application. I am seeing some failure in my serialization code when I try to run map-reduce application. It is happening when the system tries to write intermediate data after map step. Due to this, one of the mapper is failing. But the same mapper is successful when there is no reducer.
Given an array of values,
values = [1,2,3,5,8,13,21,34,55]
we can create a new array of modified values by iterating over that one.
newValues = values.map(x => x ** 2) console.log(newValues) // -<- [ 1, 4, 9, 25, 64, 169, 441, 1156, 3025 ]
Given an array of values we can use reduce to add all the values (or multiply, etc).
summation = newValues.reduce((a, b) => a + b) console.log(summation) // <- 4894