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(); }
return builder.build().encode();
builder.setBadActivityDate(proto.getBadActivity()); return builder.build();
return builder.build().encode();
public Value getStatsActivityValue(boolean forwardEdge, EdgeKey.DATE_TYPE date_type) { EdgeValueBuilder builder = datawave.edge.util.EdgeValue.newBuilder(); int hour = -1; if (date_type == EdgeKey.DATE_TYPE.ACTIVITY_ONLY || date_type == EdgeKey.DATE_TYPE.ACTIVITY_AND_EVENT) { hour = getHour(activityDate); } else { hour = getHour(eventDate); } if (date_type == EdgeKey.DATE_TYPE.EVENT_ONLY) { if (validActivityDate) { builder.setBadActivityDate(false); } else { builder.setBadActivityDate(true); } } List<Long> hours = EdgeValueHelper.getLongListForHour(hour, this.isDeleting()); builder.setHours(hours); if (forwardEdge == true) { builder.setSourceValue(source.getValue(ValueType.EVENT)); } else { builder.setSourceValue(sink.getValue(ValueType.EVENT)); } builder.setLoadDate(loadDate); builder.setUuid(uuid); return builder.build().encode(); }
public Value getDurationAsValue(boolean forwardEdge) { EdgeValueBuilder builder = datawave.edge.util.EdgeValue.newBuilder(); List<Long> duration = EdgeValueHelper.getLongListForDuration(this.getDuration(), this.isDeleting()); builder.setDuration(duration); if (forwardEdge == true) { builder.setSourceValue(source.getValue(ValueType.EVENT)); } else { builder.setSourceValue(sink.getValue(ValueType.EVENT)); } builder.setLoadDate(loadDate); builder.setUuid(uuid); return builder.build().encode(); }