Example #1
0
 @Override
 protected void cleanup(Context context) throws IOException, InterruptedException {
   val.setSeed(r.nextLong());
   while (factory.next(null, val)) {
     context.write(NullWritable.get(), val);
     val.setSeed(r.nextLong());
   }
 }
Example #2
0
 @Override
 public void map(NullWritable ignored, GridmixRecord rec, Context context)
     throws IOException, InterruptedException {
   acc += ratio;
   while (acc >= 1.0 && !reduces.isEmpty()) {
     key.setSeed(r.nextLong());
     val.setSeed(r.nextLong());
     final int idx = r.nextInt(reduces.size());
     final RecordFactory f = reduces.get(idx);
     if (!f.next(key, val)) {
       reduces.remove(idx);
       continue;
     }
     context.write(key, val);
     acc -= 1.0;
   }
 }
Example #3
0
 @Override
 public boolean nextKeyValue() throws IOException {
   val.setSeed(r.nextLong());
   return factory.next(null, val);
 }