Package org.apache.hadoop.mapred.lib
Class CombineFileRecordReader<K,V>
java.lang.Object
org.apache.hadoop.mapred.lib.CombineFileRecordReader<K,V>
- All Implemented Interfaces:
Closeable,AutoCloseable,RecordReader<K,V>
@Public
@Stable
public class CombineFileRecordReader<K,V>
extends Object
implements RecordReader<K,V>
A generic RecordReader that can hand out different recordReaders
for each chunk in a
CombineFileSplit.
A CombineFileSplit can combine data chunks from multiple files.
This class allows using different RecordReaders for processing
these data chunks from different files.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RecordReader<K,V> protected intprotected JobConfprotected longprotected Reporterprotected Constructor<RecordReader<K,V>> protected CombineFileSplit -
Constructor Summary
ConstructorsConstructorDescriptionCombineFileRecordReader(JobConf job, CombineFileSplit split, Reporter reporter, Class<RecordReader<K, V>> rrClass) A generic RecordReader that can hand out different recordReaders for each chunk in the CombineFileSplit. -
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()return the amount of data processedfloatreturn progress based on the amount of data processed so far.protected booleanGet the record reader for the next chunk in this CombineFileSplit.booleanReads the next key/value pair from the input for processing.
-
Field Details
-
split
-
jc
-
reporter
-
rrConstructor
-
idx
protected int idx -
progress
protected long progress -
curReader
-
-
Constructor Details
-
CombineFileRecordReader
public CombineFileRecordReader(JobConf job, CombineFileSplit split, Reporter reporter, Class<RecordReader<K, V>> rrClass) throws IOExceptionA generic RecordReader that can hand out different recordReaders for each chunk in the CombineFileSplit.- Throws:
IOException
-
-
Method Details
-
next
Description copied from interface:RecordReaderReads the next key/value pair from the input for processing.- Specified by:
nextin interfaceRecordReader<K,V> - 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
Description copied from interface:RecordReaderCreate an object of the appropriate type to be used as a key.- Specified by:
createKeyin interfaceRecordReader<K,V> - 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<K,V> - Returns:
- a new value object.
-
getPos
return the amount of data processed- Specified by:
getPosin interfaceRecordReader<K,V> - 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<K,V> - Throws:
IOException
-
getProgress
return progress based on the amount of data processed so far.- Specified by:
getProgressin interfaceRecordReader<K,V> - Returns:
- progress from
0.0to1.0. - Throws:
IOException
-
initNextRecordReader
Get the record reader for the next chunk in this CombineFileSplit.- Throws:
IOException
-