title: how to access Mapper Counter value in a Reducer?
body: <p>I want to acces the myCounter.my value in reducer :</p>
  
  <pre><code>public static class Map extends Mapper&lt;LongWritable, Text, ImmutableBytesWritable, ImmutableBytesWritable&gt;
  {
      public static enum myCounter{my};
  
      @Override
      public void map(LongWritable key, Text value, Context context) 
      {
          context.getCounter(myCounter.my).increment(1);
          context.write( new ImmutableBytesWritable ( ),new ImmutableBytesWritable() );
      }
  }
  
  
  public static class Reduce extends Reducer&lt;ImmutableBytesWritable, ImmutableBytesWritable, Text, Text&gt;
  {
      @Override
      public void reduce(ImmutableBytesWritable key,Iterable&lt;ImmutableBytesWritable&gt; result,Context context)
      {
  
      }
  }
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/5450290/accessing-a-mappers-counter-from-a-reducer?rq=1">Accessing a mapper's counter from a reducer(for old API is given )</a>
  how to make it work for new API ? </p>
  
  <p><strong>Or</strong> </p>
  
  <p>I want to know the total number of mapper output ? Is there any better way ? (i am not able to access counter in Reducer:</p>
  
  <p><code>Group Name-&gt;org.apache.hadoop.mapred.Task$Counter  Counter Name-&gt;MAP_OUTPUT_RECORDS</code>)</p>
  
  <p>Thanks </p>