我想访问 reducer 中的 myCounter.my 值:
public static class Map extends Mapper<LongWritable, Text, ImmutableBytesWritable, ImmutableBytesWritable>
{
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<ImmutableBytesWritable, ImmutableBytesWritable, Text, Text>
{
@Override
public void reduce(ImmutableBytesWritable key,Iterable<ImmutableBytesWritable> result,Context context)
{
}
}
从 reducer 访问映射器的计数器(旧 API 已给出) 如何使其适用于新 API?
或者
我想知道映射器输出的总数?有没有更好的办法?(我无法访问 Reducer 中的计数器:
Group Name->org.apache.hadoop.mapred.Task$Counter Counter Name->MAP_OUTPUT_RECORDS
)
谢谢