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

@Public @Stable public interface RecordReader<K,V> extends Closeable
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 Type
    Method
    Description
    void
    Close this InputSplit to 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.
    long
    Returns the current position in the input.
    float
    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 Details

    • 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.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      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