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 Details

  • Constructor Details

  • Method Details

    • next

      public boolean next(K key, V value) throws IOException
      Description copied from interface: RecordReader
      Reads the next key/value pair from the input for processing.
      Specified by:
      next in interface RecordReader<K,V>
      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

      public K createKey()
      Description copied from interface: RecordReader
      Create an object of the appropriate type to be used as a key.
      Specified by:
      createKey in interface RecordReader<K,V>
      Returns:
      a new key object.
    • createValue

      public V createValue()
      Description copied from interface: RecordReader
      Create an object of the appropriate type to be used as a value.
      Specified by:
      createValue in interface RecordReader<K,V>
      Returns:
      a new value object.
    • getPos

      public long getPos() throws IOException
      return the amount of data processed
      Specified by:
      getPos in interface RecordReader<K,V>
      Returns:
      the current position in the input.
      Throws:
      IOException
    • close

      public void close() throws IOException
      Description copied from interface: RecordReader
      Close this InputSplit to future operations.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface RecordReader<K,V>
      Throws:
      IOException
    • getProgress

      public float getProgress() throws IOException
      return progress based on the amount of data processed so far.
      Specified by:
      getProgress in interface RecordReader<K,V>
      Returns:
      progress from 0.0 to 1.0.
      Throws:
      IOException
    • initNextRecordReader

      protected boolean initNextRecordReader() throws IOException
      Get the record reader for the next chunk in this CombineFileSplit.
      Throws:
      IOException