@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<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 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)); }
@Override public GuaguaWritableAdapter<LongWritable> doCompute( WorkerContext<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> context) { long sum = context.getLastMasterResult() == null ? 0l : context.getLastMasterResult().getWritable().get(); this.list.reOpen(); for(Long longValue: this.list) { sum += longValue; } try { Thread.sleep(5 * 1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } LOG.info("worker: {} ; sum: {}", context, 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()); }
@Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter<LongWritable>(new LongWritable()); value = new GuaguaWritableAdapter<Text>(new Text());
@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()); }
@Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter<LongWritable>(new LongWritable()); value = new GuaguaWritableAdapter<Text>(new Text());
@Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter<LongWritable>(new LongWritable()); value = new GuaguaWritableAdapter<Text>(new Text());
@Override public boolean nextKeyValue() throws IOException { if(key == null) { key = new GuaguaWritableAdapter<LongWritable>(new LongWritable()); value = new GuaguaWritableAdapter<Text>(new Text());
@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()); }
@Override public GuaguaWritableAdapter<LongWritable> compute( MasterContext<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> context) { long sum = 0l; if(context.getWorkerResults() == null) { LOG.info("Master accumulates worker results with null or empty."); return null; } for(GuaguaWritableAdapter<LongWritable> longWritable: context.getWorkerResults()) { if(longWritable != null) { sum += longWritable.getWritable().get(); } } LOG.info("master:{}", sum); GuaguaWritableAdapter<LongWritable> result = new GuaguaWritableAdapter<LongWritable>(new LongWritable(sum)); if(sum > 1000000L) { result.setHalt(true); } return result; }
@Override public GuaguaWritableAdapter<LongWritable> compute( MasterContext<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> context) { long sum = 0l; if(context.getWorkerResults() == null) { LOG.info("Master accumulates worker results with null or empty."); return null; } for(GuaguaWritableAdapter<LongWritable> longWritable: context.getWorkerResults()) { if(longWritable != null) { sum += longWritable.getWritable().get(); } } LOG.info("master:{}", sum); GuaguaWritableAdapter<LongWritable> result = new GuaguaWritableAdapter<LongWritable>(new LongWritable(sum)); if(sum > 1000000L) { result.setHalt(true); } return result; }
@Override public GuaguaWritableAdapter<Tuple> getCurrentValue() { try { return new GuaguaWritableAdapter<Tuple>(this.parquetRecordReader.getCurrentValue()); } catch (IOException e) { throw new GuaguaRuntimeException(e); } catch (InterruptedException e) { throw new GuaguaRuntimeException(e); } }
GuaguaWritableAdapter<Writable> result = new GuaguaWritableAdapter<Writable>(writable); DataInputStream dataIn = null; try {