[ http://issues.apache.org/jira/browse/HADOOP-176?page=all ]

Doug Cutting resolved HADOOP-176.
---------------------------------

    Fix Version/s: 0.6.0
       Resolution: Fixed

I just committed this.  Thanks, Dick.

> comparators of integral writable types are not transitive for inequalities
> --------------------------------------------------------------------------
>
>                 Key: HADOOP-176
>                 URL: http://issues.apache.org/jira/browse/HADOOP-176
>             Project: Hadoop
>          Issue Type: Bug
>          Components: io
>         Environment: red hat
>            Reporter: Dick King
>             Fix For: 0.6.0
>
>
> Consider the following code from IntWritable.java :
>     public int compare(byte[] b1, int s1, int l1,
>                        byte[] b2, int s2, int l2) {
>       int thisValue = readInt(b1, s1);
>       int thatValue = readInt(b2, s2);
>       return thisValue - thatValue;
>     }
> If a Java Runtime subtracts 20 from -(2^31 - 10) it gets a huge positive 
> number, not the negative value that the comparator should return.
> LongWritable does this right, of course.
> That last line should be
>        return (thisValue<thatValue ? -1 : (thisValue==thatValue ? 0 : 1));
> -dk

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to