Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update hama-mapreduce/src/org/apache/hama/computemodel/mapreduce/Redu…

…cerKeyDesignator.java
  • Loading branch information...
commit f6fd10e2a6d084e8732fcb27c47a72e4dca32319 1 parent 36adf94
@ssmenon authored
View
14 hama-mapreduce/src/org/apache/hama/computemodel/mapreduce/ReducerKeyDesignator.java
@@ -26,12 +26,24 @@ public static ReducerKeyDesignator getReduceDesignator(
//
// }
+ //Assuming non contiguous and minimize communcation
return new ReducerKeyDesignator(){
@Override
protected void designateKeysToReducers(int[] keyDistribution,
long[][] globalKeyDistribution, Configuration conf) {
-
+ for(int peerNumber = 0;
+ peerNumber < globalKeyDistribution.length; ++peerNumber){
+ long max = 0L;
+ int maxPartition = -1;
+ for(int i = 0; i < globalKeyDistribution[0].length; ++i){
+ if(max < globalKeyDistribution[peerNumber][i]){
+ maxPartition = i;
+ max = globalKeyDistribution[peerNumber][i];
+ }
+ }
+ keyDistribution[peerNumber] = maxPartition;
+ }
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.