mapreduce for merging records