@Test public void fileClosedTimeChoosesEarliestIgnoringDefault() { Status stat1 = Status.newBuilder().setBegin(10).setEnd(20).setClosed(true).setInfiniteEnd(false) .setCreatedTime(50).build(); Status stat2 = Status.newBuilder().setBegin(10).setEnd(20).setClosed(true).setInfiniteEnd(false) .setCreatedTime(100).build(); Status combined = combiner.typedReduce(key, Arrays.asList(stat1, stat2).iterator()); assertEquals(stat1, combined); Status stat3 = Status.newBuilder().setBegin(10).setEnd(20).setClosed(true).setInfiniteEnd(false) .setCreatedTime(100).build(); Status combined2 = combiner.typedReduce(key, Arrays.asList(combined, stat3).iterator()); assertEquals(combined, combined2); }
@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);  }