org.apache.hadoop.mapred
Class KeyValueLineRecordReader

java.lang.Object
  extended by org.apache.hadoop.mapred.LineRecordReader
      extended by org.apache.hadoop.mapred.KeyValueLineRecordReader
All Implemented Interfaces:
RecordReader
Direct Known Subclasses:
StreamLineRecordReader

public class KeyValueLineRecordReader
extends LineRecordReader

This class treats a line in the input as a key/value pair separated by a separator character. The separator can be specified in config file under the attribute name key.value.separator.in.input.line. The default separator is the tab character ('\t').


Constructor Summary
KeyValueLineRecordReader(Configuration job, FileSplit split)
           
 
Method Summary
 Text createKey()
          Create an object of the appropriate type to be used as a key.
static int findSeparator(byte[] utf, int start, int length, byte sep)
           
 Class getKeyClass()
           
 boolean next(Writable key, Writable value)
          Read key/value pair in a line.
 
Methods inherited from class org.apache.hadoop.mapred.LineRecordReader
close, createValue, getPos, getProgress, readLine, readLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyValueLineRecordReader

public KeyValueLineRecordReader(Configuration job,
                                FileSplit split)
                         throws IOException
Throws:
IOException
Method Detail

getKeyClass

public Class getKeyClass()

createKey

public Text createKey()
Description copied from interface: RecordReader
Create an object of the appropriate type to be used as a key.

Specified by:
createKey in interface RecordReader
Overrides:
createKey in class LineRecordReader
Returns:
a new key object

findSeparator

public static int findSeparator(byte[] utf,
                                int start,
                                int length,
                                byte sep)

next

public boolean next(Writable key,
                    Writable value)
             throws IOException
Read key/value pair in a line.

Specified by:
next in interface RecordReader
Overrides:
next in class LineRecordReader
Parameters:
key - the key to read data into
value - the value to read data into
Returns:
true iff a key/value was read, false if at EOF
Throws:
IOException
See Also:
Writable.readFields(DataInput)


Copyright © 2006 The Apache Software Foundation