Package org.apache.hadoop.mapred
Class KeyValueLineRecordReader
java.lang.Object
org.apache.hadoop.mapred.KeyValueLineRecordReader
- All Implemented Interfaces:
Closeable,AutoCloseable,RecordReader<Text,Text>
@Public
@Stable
public class KeyValueLineRecordReader
extends Object
implements RecordReader<Text,Text>
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 mapreduce.input.keyvaluelinerecordreader.key.value.separator. The default
separator is the tab character ('\t').
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close thisInputSplitto future operations.Create an object of the appropriate type to be used as a key.Create an object of the appropriate type to be used as a value.static intfindSeparator(byte[] utf, int start, int length, byte sep) longgetPos()Returns the current position in the input.floatHow much of the input has theRecordReaderconsumed i.e.booleanRead key/value pair in a line.
-
Constructor Details
-
KeyValueLineRecordReader
- Throws:
IOException
-
-
Method Details
-
getKeyClass
-
createKey
Description copied from interface:RecordReaderCreate an object of the appropriate type to be used as a key.- Specified by:
createKeyin interfaceRecordReader<Text,Text> - Returns:
- a new key object.
-
createValue
Description copied from interface:RecordReaderCreate an object of the appropriate type to be used as a value.- Specified by:
createValuein interfaceRecordReader<Text,Text> - Returns:
- a new value object.
-
findSeparator
public static int findSeparator(byte[] utf, int start, int length, byte sep) -
next
Read key/value pair in a line.- Specified by:
nextin interfaceRecordReader<Text,Text> - Parameters:
key- the key to read data intovalue- the value to read data into- Returns:
- true iff a key/value was read, false if at EOF
- Throws:
IOException
-
getProgress
Description copied from interface:RecordReaderHow much of the input has theRecordReaderconsumed i.e. has been processed by?- Specified by:
getProgressin interfaceRecordReader<Text,Text> - Returns:
- progress from
0.0to1.0. - Throws:
IOException
-
getPos
Description copied from interface:RecordReaderReturns the current position in the input.- Specified by:
getPosin interfaceRecordReader<Text,Text> - Returns:
- the current position in the input.
- Throws:
IOException
-
close
Description copied from interface:RecordReaderClose thisInputSplitto future operations.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceRecordReader<Text,Text> - Throws:
IOException
-