@Override public void load(GuaguaWritableAdapter<Text> currentKey, GuaguaWritableAdapter<Text> currentValue, WorkerContext<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> workerContext) { this.list.add(Long.parseLong(currentValue.getWritable().toString())); }
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey, GuaguaWritableAdapter<Text> currentValue, WorkerContext<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> workerContext) { this.list.add(Long.parseLong(currentValue.getWritable().toString())); }
@Override public void load(GuaguaWritableAdapter<Text> currentKey, GuaguaWritableAdapter<Text> currentValue, WorkerContext<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> workerContext) { this.list.add(Long.parseLong(currentValue.getWritable().toString())); }
@Override public void doReadFields(DataInput in) throws IOException { getWritable().readFields(in); }
@Override public String toString() { return String.format("GuaguaWritableAdapter [writable=%s, isHalt=%s]", this.getWritable(), super.isHalt()); }
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey, GuaguaWritableAdapter<Text> currentValue, WorkerContext<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> context) { this.list.append(Long.parseLong(currentValue.getWritable().toString())); }
@Override public void doReadFields(DataInput in) throws IOException { getWritable().readFields(in); }
@Override public void doWrite(DataOutput out) throws IOException { getWritable().write(out); }
@Override public void doWrite(DataOutput out) throws IOException { getWritable().write(out); }
@Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter<BytesWritable>(new BytesWritable()); } if(value == null) { value = new GuaguaWritableAdapter<BytesWritable>(new BytesWritable()); } return this.sequenceReader.next(key.getWritable(), value.getWritable()); }
@Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter<Text>(new Text()); } if(value == null) { value = new GuaguaWritableAdapter<Text>(new Text()); } return this.sequenceReader.next(key.getWritable(), value.getWritable()); }
@Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter<Text>(new Text()); } if(value == null) { value = new GuaguaWritableAdapter<Text>(new Text()); } return this.sequenceReader.next(key.getWritable(), value.getWritable()); }
@Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter<BytesWritable>(new BytesWritable()); } if(value == null) { value = new GuaguaWritableAdapter<BytesWritable>(new BytesWritable()); } return this.sequenceReader.next(key.getWritable(), value.getWritable()); }
@Override public GuaguaWritableAdapter<LongWritable> doCompute( WorkerContext<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> workerContext) { long sum = workerContext.getLastMasterResult() == null ? 0l : workerContext.getLastMasterResult().getWritable() .get(); for(long longValue: this.list) { sum += longValue; } LOG.info("worker: {} ; sum: {}", workerContext, sum); return new GuaguaWritableAdapter<LongWritable>(new LongWritable(sum)); }
@Override public GuaguaWritableAdapter<LongWritable> doCompute( WorkerContext<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> workerContext) { long sum = workerContext.getLastMasterResult() == null ? 0l : workerContext.getLastMasterResult().getWritable() .get(); for(long longValue: this.list) { sum += longValue; } LOG.info("worker: {} ; sum: {}", workerContext, sum); return new GuaguaWritableAdapter<LongWritable>(new LongWritable(sum)); }
@Override public GuaguaWritableAdapter<LongWritable> doCompute( WorkerContext<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> workerContext) { long sum = workerContext.getLastMasterResult() == null ? 0l : workerContext.getLastMasterResult().getWritable() .get(); for(long longValue: this.list) { sum += longValue; } LOG.info("worker: {} ; sum: {}", workerContext, sum); return new GuaguaWritableAdapter<LongWritable>(new LongWritable(sum)); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter(((Writable) ReflectionUtils.newInstance(this.keyClass))); } if(value == null) { value = new GuaguaWritableAdapter(((Writable) ReflectionUtils.newInstance(this.valueClass))); } return this.sequenceReader.next(key.getWritable(), value.getWritable()); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter(((Writable) ReflectionUtils.newInstance(this.keyClass))); } if(value == null) { value = new GuaguaWritableAdapter(((Writable) ReflectionUtils.newInstance(this.valueClass))); } return this.sequenceReader.next(key.getWritable(), value.getWritable()); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter(((Writable) ReflectionUtils.newInstance(this.keyClass))); } if(value == null) { value = new GuaguaWritableAdapter(((Writable) ReflectionUtils.newInstance(this.valueClass))); } return this.sequenceReader.next(key.getWritable(), value.getWritable()); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter(((Writable) ReflectionUtils.newInstance(this.keyClass))); } if(value == null) { value = new GuaguaWritableAdapter(((Writable) ReflectionUtils.newInstance(this.valueClass))); } return this.sequenceReader.next(key.getWritable(), value.getWritable()); }