You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-issues@hadoop.apache.org by "Hadoop QA (JIRA)" <ji...@apache.org> on 2011/07/06 15:19:17 UTC

[jira] [Commented] (MAPREDUCE-2538) InputSampler.writePartitionFile() may write duplicate keys

    [ https://issues.apache.org/jira/browse/MAPREDUCE-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13060562#comment-13060562 ] 

Hadoop QA commented on MAPREDUCE-2538:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12485400/MAPREDUCE-2538.patch
  against trunk revision 1143252.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    -1 core tests.  The patch failed these core unit tests:
                  org.apache.hadoop.cli.TestMRCLI
                  org.apache.hadoop.fs.TestFileSystem
                  org.apache.hadoop.mapred.TestDebugScript

    -1 contrib tests.  The patch failed contrib unit tests.

    +1 system test framework.  The patch passed system test framework compile.

Test results: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/436//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/436//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/436//console

This message is automatically generated.

> InputSampler.writePartitionFile() may write duplicate keys
> ----------------------------------------------------------
>
>                 Key: MAPREDUCE-2538
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-2538
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>    Affects Versions: 0.20.2
>         Environment: EMR.
>            Reporter: Michael White
>            Priority: Minor
>             Fix For: 0.23.0
>
>         Attachments: MAPREDUCE-2538.patch
>
>
> InputSampler.writePartitionFile() outputs the same key multiple times if the input samples have enough of a given key to span multiple partitions.  There is logic in the code that appears to try to avoid this, but seems incorrect:
> for(int i = 1; i < numPartitions; ++i) {
>   int k = Math.round(stepSize * i);
>   while (last >= k && comparator.compare(samples[last], samples[k]) == 0) {
>     ++k;
>   }
>   writer.append(samples[k], nullValue);
>   last = k;
> }
> The while loop condition "last >= k" is always false.  The sample comparison after the && never occurs.
> It's not entirely clear what the correct fix is.  The current behavior is arguably correct mathematically, though the while loop could be elided for clarity.  If bug MAPREDUCE-1987 were fixed, it would be less of a problem (for me at least), since that is where the non-uniqueness causes me problems.
> Alternatively, changing the while to:
> "if( last >= 0) {
>    while (comparator.compare(samples[last], samples[k]) >= 0)) {"
> or, optimized for skipping over many duplicates (but arguably less clear):
> "if (last >= 0) {
>    while (last >= k || comparator.compare(samples[last], samples[k]) >= 0)) {"
> would probably achieve what the original author intended.
> Perhaps the behavior could be selected by a parameter, e.g. "boolean unique".

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira