Package org.apache.hadoop.mapred
Interface RecordReader<K,V>
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Subinterfaces:
ComposableRecordReader<K,V>
- All Known Implementing Classes:
CombineFileRecordReader,CombineFileRecordReaderWrapper,InnerJoinRecordReader,JoinRecordReader,KeyValueLineRecordReader,MultiFilterRecordReader,OuterJoinRecordReader,OverrideRecordReader,SequenceFileAsTextRecordReader,SequenceFileRecordReader,WrappedRecordReader
RecordReader reads <key, value> pairs from an
InputSplit.
RecordReader, typically, converts the byte-oriented view of
the input, provided by the InputSplit, and presents a
record-oriented view for the Mapper and Reducer tasks for
processing. It thus assumes the responsibility of processing record
boundaries and presenting the tasks with keys and values.
- See Also:
-
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.longgetPos()Returns the current position in the input.floatHow much of the input has theRecordReaderconsumed i.e.booleanReads the next key/value pair from the input for processing.
-
Method Details
-
next
Reads the next key/value pair from the input for processing.- 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
-
createKey
K createKey()Create an object of the appropriate type to be used as a key.- Returns:
- a new key object.
-
createValue
V createValue()Create an object of the appropriate type to be used as a value.- Returns:
- a new value object.
-
getPos
Returns the current position in the input.- Returns:
- the current position in the input.
- Throws:
IOException
-
close
Close thisInputSplitto future operations.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getProgress
How much of the input has theRecordReaderconsumed i.e. has been processed by?- Returns:
- progress from
0.0to1.0. - Throws:
IOException
-