how to access Mapper Counter value in a Reducer?

后端 未结 3 1862
臣服心动
臣服心动 2021-02-15 12:16

I want to acces the myCounter.my value in reducer :

public static class Map extends Mapper

        
3条回答
  •  自闭症患者
    2021-02-15 12:41

    You to make it work for new API by accessing the counters via job object.

    Configuration conf = context.getConfiguration();
    Cluster cluster = new Cluster(conf);
    Job currentJob = cluster.getJob(context.getJobID());
    long val=currentJob.getCounters().findCounter(myCounter.my).getValue();
    

提交回复
热议问题