I have a question regarding the Hadoop API documentation for .19.  The
question is in regard to:
http://hadoop.apache.org/core/docs/current/api/org/apache/hadoop/io/Writ
ableComparable.html.  The document shows the following for the compareTo
method:

 

       public int compareTo(MyWritableComparable w) {

         int thisValue = this.value;

         int thatValue = ((IntWritable)o).value;

         return (thisValue < thatValue ? -1 : (thisValue==thatValue ? 0
: 1));

       }

 

 

   Taking the full class example doesn't compile.  What I _think_ would
be right would be:

 

       public int compareTo(Object o) {

         int thisValue = this.value;

         int thatValue = ((MyWritableComparable)o).value;

         return (thisValue < thatValue ? -1 : (thisValue==thatValue ? 0
: 1));

       }

 

  But even at that it's unclear why the compareTo function is comparing
value ( which isn't a member of the class in the example ) and not the
counter and timestamp variables in the class.

 

   Am I understanding this right?  Is there something amiss with the
documentation?

 

   Thanks

 

   Andy

 

 

Reply via email to