FAQ
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

Search Discussions

  • Marko Bauhardt at Aug 17, 2006 at 5:12 pm
    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
  • Doug Cutting at Aug 17, 2006 at 5:15 pm
    That looks like a bug. Can you please submit an issue in Jira? Thanks.

    Doug

    Marko Bauhardt wrote:
    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
  • Marko Bauhardt at Aug 17, 2006 at 6:09 pm

    Am 17.08.2006 um 19:15 schrieb Doug Cutting:

    That looks like a bug. Can you please submit an issue in Jira?
    Thanks.
    To late, this bug was already submitted.
    https://issues.apache.org/jira/browse/HADOOP-176

    Marko
  • Doug Cutting at Aug 17, 2006 at 8:46 pm
    Okay. I just fixed it. Thanks for bringing it to my attention!

    Doug

    Marko Bauhardt wrote:
    Am 17.08.2006 um 19:15 schrieb Doug Cutting:
    That looks like a bug. Can you please submit an issue in Jira? Thanks.
    To late, this bug was already submitted.
    https://issues.apache.org/jira/browse/HADOOP-176

    Marko

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-dev @
categorieshadoop
postedAug 17, '06 at 4:02p
activeAug 17, '06 at 8:46p
posts5
users3
websitehadoop.apache.org...
irc#hadoop

People

Translate

site design / logo © 2022 Grokbase