Hadoop Map/Reduce
  1. Hadoop Map/Reduce
  2. MAPREDUCE-960

Unnecessary copy in mapreduce.lib.input.KeyValueLineRecordReader

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.21.0
    • Fix Version/s: 0.21.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      KeyValueLineRecordReader effects the copy from the line to the key/value by creating separate arrays:

            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);
      

      Since set triggers another copy and Text has a set taking byte[], off, len, the intermediate copy can be avoided

      1. M960-0.patch
        1 kB
        Chris Douglas

        Activity

        Tom White made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Chris Douglas made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Hadoop Flags [Reviewed]
        Fix Version/s 0.21.0 [ 12314045 ]
        Resolution Fixed [ 1 ]
        Chris Douglas made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Chris Douglas made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Chris Douglas made changes -
        Affects Version/s 0.21.0 [ 12314045 ]
        Chris Douglas made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Chris Douglas made changes -
        Field Original Value New Value
        Attachment M960-0.patch [ 12418866 ]
        Chris Douglas created issue -

          People

          • Assignee:
            Chris Douglas
            Reporter:
            Chris Douglas
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development