Class CombineFileRecordReaderWrapper<K,V>
java.lang.Object
org.apache.hadoop.mapreduce.RecordReader<K,V>
org.apache.hadoop.mapreduce.lib.input.CombineFileRecordReaderWrapper<K,V>
- All Implemented Interfaces:
Closeable,AutoCloseable
A wrapper class for a record reader that handles a single file split. It
delegates most of the methods to the wrapped instance. A concrete subclass
needs to provide a constructor that calls this parent constructor with the
appropriate input format. The subclass constructor must satisfy the specific
constructor signature that is required by
CombineFileRecordReader.
Subclassing is needed to get a concrete record reader wrapper because of the
constructor requirement.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCombineFileRecordReaderWrapper(FileInputFormat<K, V> inputFormat, CombineFileSplit split, TaskAttemptContext context, Integer idx) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the record reader.Get the current keyGet the current value.floatThe current progress of the record reader through its data.voidinitialize(InputSplit split, TaskAttemptContext context) Called once at initialization.booleanRead the next key, value pair.
-
Constructor Details
-
CombineFileRecordReaderWrapper
protected CombineFileRecordReaderWrapper(FileInputFormat<K, V> inputFormat, CombineFileSplit split, TaskAttemptContext context, Integer idx) throws IOException, InterruptedException- Throws:
IOExceptionInterruptedException
-
-
Method Details
-
initialize
public void initialize(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException Description copied from class:RecordReaderCalled once at initialization.- Specified by:
initializein classRecordReader<K,V> - Parameters:
split- the split that defines the range of records to readcontext- the information about the task- Throws:
IOExceptionInterruptedException
-
nextKeyValue
Description copied from class:RecordReaderRead the next key, value pair.- Specified by:
nextKeyValuein classRecordReader<K,V> - Returns:
- true if a key/value pair was read
- Throws:
IOExceptionInterruptedException
-
getCurrentKey
Description copied from class:RecordReaderGet the current key- Specified by:
getCurrentKeyin classRecordReader<K,V> - Returns:
- the current key or null if there is no current key
- Throws:
IOExceptionInterruptedException
-
getCurrentValue
Description copied from class:RecordReaderGet the current value.- Specified by:
getCurrentValuein classRecordReader<K,V> - Returns:
- the object that was read
- Throws:
IOExceptionInterruptedException
-
getProgress
Description copied from class:RecordReaderThe current progress of the record reader through its data.- Specified by:
getProgressin classRecordReader<K,V> - Returns:
- a number between 0.0 and 1.0 that is the fraction of the data read
- Throws:
IOExceptionInterruptedException
-
close
Description copied from class:RecordReaderClose the record reader.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classRecordReader<K,V> - Throws:
IOException
-