org.apache.hadoop.mapred
Interface RecordReader<K,V>

All Known Subinterfaces:
ComposableRecordReader<K,V>
All Known Implementing Classes:
CombineFileRecordReader, CombineFileRecordReaderWrapper, InnerJoinRecordReader, JoinRecordReader, KeyValueLineRecordReader, MultiFilterRecordReader, OuterJoinRecordReader, OverrideRecordReader, SequenceFileAsTextRecordReader, SequenceFileRecordReader, WrappedRecordReader

@InterfaceAudience.Public
@InterfaceStability.Stable
public interface RecordReader<K,V>

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 & Reducer tasks for processing. It thus assumes the responsibility of processing record boundaries and presenting the tasks with keys and values.

See Also:
InputSplit, InputFormat

Method Summary
 void close()
          Close this InputSplit to future operations.
 K createKey()
          Create an object of the appropriate type to be used as a key.
 V createValue()
          Create an object of the appropriate type to be used as a value.
 long getPos()
          Returns the current position in the input.
 float getProgress()
          How much of the input has the RecordReader consumed i.e.
 boolean next(K key, V value)
          Reads the next key/value pair from the input for processing.
 

Method Detail

next

boolean next(K key,
             V value)
             throws IOException
Reads the next key/value pair from the input for processing.

Parameters:
key - the key to read data into
value - 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

long getPos()
            throws IOException
Returns the current position in the input.

Returns:
the current position in the input.
Throws:
IOException

close

void close()
           throws IOException
Close this InputSplit to future operations.

Throws:
IOException

getProgress

float getProgress()
                  throws IOException
How much of the input has the RecordReader consumed i.e. has been processed by?

Returns:
progress from 0.0 to 1.0.
Throws:
IOException


Copyright © 2014 Apache Software Foundation. All Rights Reserved.