Class InverseMapper<K,V>

java.lang.Object
org.apache.hadoop.mapred.MapReduceBase
org.apache.hadoop.mapred.lib.InverseMapper<K,V>
All Implemented Interfaces:
Closeable, AutoCloseable, Closeable, JobConfigurable, Mapper<K,V,V,K>

@Public @Stable public class InverseMapper<K,V> extends MapReduceBase implements Mapper<K,V,V,K>
A Mapper that swaps keys and values.
  • Constructor Details

    • InverseMapper

      public InverseMapper()
  • Method Details

    • map

      public void map(K key, V value, OutputCollector<V,K> output, Reporter reporter) throws IOException
      The inverse function. Input keys and values are swapped.
      Specified by:
      map in interface Mapper<K,V,V,K>
      Parameters:
      key - the input key.
      value - the input value.
      output - collects mapped keys and values.
      reporter - facility to report progress.
      Throws:
      IOException