You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by Marko Bauhardt <mb...@101tec.com> on 2006/08/17 18:00:16 UTC
IntWritable.Comparator
Hi developers,
i had wrote a mapred job with OutputKeyClass IntWritable. But the
keys are not not correct sorted in the output file. I look at the
code from the Intwritable.Comparator and i am confused.
Currently the compare-method returns:
return thisValue - thatValue;
But what is, if "thisValue" has the value Integer.MIN_VALUE+1 and the
"thatValue" has the value 2. The result of the method are return
2147483647. In that case the compare method says that "thisValue" is
greater than "thatValue".
The method should be return like that:
thisValue < thatValue ? -1 : thisValue == thatValue ? 0 : 1;
Or overlook i something?
Regards,
Marko