kolakao
kolakao

Reputation: 71

Can merge-sort algorithm be implemented in MapReduce?

Is it possible to implement merge-sort algorithm using MapReduce? I am sceptic about this, because mappers or reducers cannot communicate with each other, but someone told me it is one of the crucial use cases for MapReduce(??). I was searching for any implementation or even clue on how to do it, but i couldn't find anything. I myself have no single clue on how to do it... Any ideas?

@Edit Yes. I know that MapReduce has sorting feature out of the box. Is it possible to turn it off for example?

Upvotes: 0

Views: 4930

Answers (2)

Jijo
Jijo

Reputation: 610

Merge sort is the default feature of mapreduce no need to implement it and you cannot change the sorting method of mapreduce because the data comes from different nodes to a single point so the best algorithm that can be used here is the mergesort .What else you can do is specify your own comparator class to sort your keys in ascending or descending order.

job.setSortComparatorClass(YourClass.class);

Upvotes: 3

DDW
DDW

Reputation: 2015

Merge sort is what MapReduce does when the map and reduce function are unit functions. Look up Terasort benchmark to see more details.

Upvotes: 3

Related Questions