org.apache.hadoop.mapreduce
Class RecordReader<KEYIN,VALUEIN>

java.lang.Object
  extended by org.apache.hadoop.mapreduce.RecordReader<KEYIN,VALUEIN>
Type Parameters:
KEYIN -
VALUEIN -
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
CombineFileRecordReader, CombineFileRecordReaderWrapper, ComposableRecordReader, DBRecordReader, KeyValueLineRecordReader, SequenceFileAsTextRecordReader, SequenceFileRecordReader

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class RecordReader<KEYIN,VALUEIN>
extends Object
implements Closeable

The record reader breaks the data into key/value pairs for input to the Mapper.


Constructor Summary
RecordReader()
           
 
Method Summary
abstract  void close()
          Close the record reader.
abstract  KEYIN getCurrentKey()
          Get the current key
abstract  VALUEIN getCurrentValue()
          Get the current value.
abstract  float getProgress()
          The current progress of the record reader through its data.
abstract  void initialize(InputSplit split, TaskAttemptContext context)
          Called once at initialization.
abstract  boolean nextKeyValue()
          Read the next key, value pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordReader

public RecordReader()
Method Detail

initialize

public abstract void initialize(InputSplit split,
                                TaskAttemptContext context)
                         throws IOException,
                                InterruptedException
Called once at initialization.

Parameters:
split - the split that defines the range of records to read
context - the information about the task
Throws:
IOException
InterruptedException

nextKeyValue

public abstract boolean nextKeyValue()
                              throws IOException,
                                     InterruptedException
Read the next key, value pair.

Returns:
true if a key/value pair was read
Throws:
IOException
InterruptedException

getCurrentKey

public abstract KEYIN getCurrentKey()
                             throws IOException,
                                    InterruptedException
Get the current key

Returns:
the current key or null if there is no current key
Throws:
IOException
InterruptedException

getCurrentValue

public abstract VALUEIN getCurrentValue()
                                 throws IOException,
                                        InterruptedException
Get the current value.

Returns:
the object that was read
Throws:
IOException
InterruptedException

getProgress

public abstract float getProgress()
                           throws IOException,
                                  InterruptedException
The current progress of the record reader through its data.

Returns:
a number between 0.0 and 1.0 that is the fraction of the data read
Throws:
IOException
InterruptedException

close

public abstract void close()
                    throws IOException
Close the record reader.

Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2014 Apache Software Foundation. All Rights Reserved.