title: Implementing WritableComparable for Hadoop
body: <p>I have implemented <strong>WritableComparable</strong> for my map job and have passed three values to it.</p>
  
  <pre><code>public class KeyCustom implementsw WritableComparable&lt;KeyCustom&gt;
  {
     private Text placeOfBirth;
     private Text country;
     private LongWritable age;
     //Implemented constructors and set methods, write, readFields, hashCode and equals
     @Override
     public int compareTo(KeyCustom arg0)
     {
        return placeOfBirth.compareTo(arg0.placeOfBirth);
     }
  }
  </code></pre>
  
  <p>But then when I log these three fields in my reducer I can clearly see that all the <strong>people with the same country are being grouped together</strong>. It would be great if someone could help me out so that all my <strong>reducers get the people with the same place of birth</strong>. I dont' know how to do this or if my compareTo function is wrong. </p>
  
  <p>Thanks for all the help. </p>