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 "Chris Douglas (JIRA)" <ji...@apache.org> on 2009/09/08 02:57:57 UTC

[jira] Updated: (MAPREDUCE-960) Unnecessary copy in mapreduce.lib.input.KeyValueLineRecordReader

     [ https://issues.apache.org/jira/browse/MAPREDUCE-960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Douglas updated MAPREDUCE-960:
------------------------------------

    Attachment: M960-0.patch

Removed intermediate buffer and {{KeyValueLineRecordReader::getKeyClass}} accidentally copied from mapred in MAPREDUCE-655

> Unnecessary copy in mapreduce.lib.input.KeyValueLineRecordReader
> ----------------------------------------------------------------
>
>                 Key: MAPREDUCE-960
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-960
>             Project: Hadoop Map/Reduce
>          Issue Type: Improvement
>            Reporter: Chris Douglas
>            Assignee: Chris Douglas
>         Attachments: M960-0.patch
>
>
> KeyValueLineRecordReader effects the copy from the line to the key/value by creating separate arrays:
> {noformat}
>       int keyLen = pos;
>       byte[] keyBytes = new byte[keyLen];
>       System.arraycopy(line, 0, keyBytes, 0, keyLen);
>       int valLen = lineLen - keyLen - 1;
>       byte[] valBytes = new byte[valLen];
>       System.arraycopy(line, pos + 1, valBytes, 0, valLen);
>       key.set(keyBytes);
>       value.set(valBytes);
> {noformat}
> Since set triggers another copy and Text has a set taking {{byte[], off, len}}, the intermediate copy can be avoided

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.