コード例 #1
0
 @Override
 public int compare(WritableComparable w1, WritableComparable w2) {
   IntPair ip1 = (IntPair) w1;
   IntPair ip2 = (IntPair) w2;
   int cmp = IntPair.compare(ip1.getFirst(), ip2.getFirst());
   if (cmp != 0) {
     return cmp;
   }
   return -IntPair.compare(ip1.getSecond(), ip2.getSecond()); // reverse
 }
コード例 #2
0
 @Override
 public int compare(WritableComparable w1, WritableComparable w2) {
   IntPair ip1 = (IntPair) w1;
   IntPair ip2 = (IntPair) w2;
   return IntPair.compare(ip1.getFirst(), ip2.getFirst());
 }
コード例 #3
0
 @Override
 public int getPartition(IntPair key, NullWritable value, int numPartitions) {
   return Math.abs(key.getFirst() * 127) % numPartitions;
 }