private Value combineStatsKey(STATS_TYPE statsType, Key key, Iterator<Value> iter) { // If this is a STATS link count edge, merge all the values into a single one. if (STATS_TYPE.LINKS == statsType) { return (StatsLinksEdgeCombiner.combineStatsLinksEdgeValues(key, iter)); } EdgeValueBuilder builder = EdgeValue.newBuilder(); List<Long> combinedList = new ArrayList<>(); while (iter.hasNext()) { Value value = iter.next(); try { EdgeData.EdgeValue protoEdgeValue = EdgeData.EdgeValue.parseFrom(value.get()); useEarliestLoadDate(key, builder, protoEdgeValue); combineSourceAndSink(builder, protoEdgeValue); useEarliestUuid(builder, protoEdgeValue); combineBadActivityDate(builder, protoEdgeValue); combineHistogram(statsType, builder, combinedList, protoEdgeValue); // already decoded the value } catch (InvalidProtocolBufferException e) { // value wasn't previously a protobuf, so we don't get the source or sink // combine the stats hours/duration with the raw value combineHistogramFromLegacyValue(statsType, builder, combinedList, value); } } return builder.build().encode(); }
Value value = iter.next(); try { EdgeData.EdgeValue protoEdgeValue = EdgeData.EdgeValue.parseFrom(value.get());
public static EdgeValue decode(Value value) throws InvalidProtocolBufferException { EdgeData.EdgeValue proto = EdgeData.EdgeValue.parseFrom(value.get());
public static List<Long> decodeDurationHistogram(Value value) { try { return decodeDurationHistogram(EdgeData.EdgeValue.parseFrom(value.get()).getDurationList()); } catch (InvalidProtocolBufferException e) { // Probably an old edge value return decodeDurationHistogram(getVarLongList(value.get())); } }
public static List<Long> decodeActivityHistogram(Value value) { try { return decodeActivityHistogram(EdgeData.EdgeValue.parseFrom(value.get()).getHoursList()); } catch (InvalidProtocolBufferException e) { // Probably an old edge value return decodeActivityHistogram(getVarLongList(value.get())); } }