@Test public void testCombination() { List<Status> status = new ArrayList<>(); long time = System.currentTimeMillis(); status.add(StatusUtil.fileCreated(time)); status.add(StatusUtil.openWithUnknownLength()); status.add(StatusUtil.fileClosed()); Status combined = combiner.typedReduce(new Key("row"), status.iterator()); assertEquals(time, combined.getCreatedTime()); assertTrue(combined.getInfiniteEnd()); assertTrue(combined.getClosed()); }
@Override public Status typedReduce(Key key, Iterator<Status> iter) { Builder combined = null; while (iter.hasNext()) { Status status = iter.next(); if (combined == null) { if (iter.hasNext()) { combined = Status.newBuilder(); } else { if (log.isTraceEnabled()) { log.trace("Returned single value: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(status)); } return status; } } combine(combined, status); } if (log.isTraceEnabled()) { log.trace("Combined: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(combined.build())); } return combined.build(); }
StatusCombiner extends TypedValueCombiner<Status> { @Override public Status typedReduce(Key key, Iterator<Status> iter) { Builder combined = null; while (iter.hasNext()) { Status status = iter.next(); if (combined == null) { if (iter.hasNext()) { combined = Status.newBuilder(); } else { if (log.isTraceEnabled()) { log.trace("Returned single value: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(status)); } return status; } } combine(combined, status); } if (log.isTraceEnabled()) { log.trace("Combined: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(combined.build())); } return combined.build(); } }
StatusCombiner extends TypedValueCombiner<Status> { @Override public Status typedReduce(Key key, Iterator<Status> iter) { Builder combined = null; while (iter.hasNext()) { Status status = iter.next(); if (combined == null) { if (iter.hasNext()) { combined = Status.newBuilder(); } else { if (log.isTraceEnabled()) { log.trace("Returned single value: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(status)); } return status; } } combine(combined, status); } if (log.isTraceEnabled()) { log.trace("Combined: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(combined.build())); } return combined.build(); }  }
StatusCombiner extends TypedValueCombiner<Status> { @Override public Status typedReduce(Key key, Iterator<Status> iter) { Builder combined = null; while (iter.hasNext()) { Status status = iter.next(); if (combined == null) { if (iter.hasNext()) { combined = Status.newBuilder(); } else { if (log.isTraceEnabled()) { log.trace("Returned single value: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(status)); } return status; } } combine(combined, status); } if (log.isTraceEnabled()) { log.trace("Combined: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(combined.build())); } return combined.build(); }  @Override IteratorOptions describeOptions(); @Override boolean validateOptions(Map<String,String> options); @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
      IteratorEnvironment env); @Override Status typedReduce(Key key, Iterator<Status> iter); void combine(Builder combined, Status status); }
StatusCombiner extends TypedValueCombiner<Status> { @Override public Status typedReduce(Key key, Iterator<Status> iter) { Builder combined = null; while (iter.hasNext()) { Status status = iter.next(); if (combined == null) { if (iter.hasNext()) { combined = Status.newBuilder(); } else { if (log.isTraceEnabled()) { log.trace("Returned single value: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(status)); } return status; } } combine(combined, status); } if (log.isTraceEnabled()) { log.trace("Combined: {} {}", key.toStringNoTruncate(), ProtobufUtil.toString(combined.build())); } return combined.build(); }  @Override IteratorOptions describeOptions(); @Override boolean validateOptions(Map<String,String> options); @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
      IteratorEnvironment env); @Override Status typedReduce(Key key, Iterator<Status> iter); void combine(Builder combined, Status status);  }