@Test public void addsEmUp() throws IOException, InterruptedException { Iterable<LongWritable> source=new RecyclingIterable<>( LongWritable.class ,new LongWritable(12) ,new LongWritable(4) ,new LongWritable(1000)); reducer.reduce(new Text("fl00k"),source,context); verify(context).write(new Text("fl00k"),new LongWritable(1016)); }
@Override protected void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException { long sum=0; for(LongWritable v:values) { sum += v.get(); } if(sum>threshold) { context.write(key,new LongWritable(sum)); } }
Project3DReducer extends Reducer<Text,LongWritable,Text,LongWritable> { @Override protected void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException { long sum=0; for(LongWritable v:values) { sum += v.get(); } if(sum>threshold) { context.write(key,new LongWritable(sum)); } } }
Project3DReducer extends Reducer<Text,LongWritable,Text,LongWritable> { @Override protected void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException { long sum=0; for(LongWritable v:values) { sum += v.get(); } if(sum>threshold) { context.write(key,new LongWritable(sum)); } }  }
Project3DReducer extends Reducer<Text,LongWritable,Text,LongWritable> { @Override protected void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException { long sum=0; for(LongWritable v:values) { sum += v.get(); } if(sum>threshold) { context.write(key,new LongWritable(sum)); } }   }
Project3DReducer extends Reducer<Text,LongWritable,Text,LongWritable> { @Override protected void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException { long sum=0; for(LongWritable v:values) { sum += v.get(); } if(sum>threshold) { context.write(key,new LongWritable(sum)); } }   static String THRESHOLD; }