/** * @param groupbyFields * @param aggregateFuntionTypes * @param aggregatedFields */ public FlatAggregator(List<String> groupbyFields, List<AggregateFunctionType> aggregateFuntionTypes, List<String> aggregatedFields){ super(groupbyFields, aggregateFuntionTypes, aggregatedFields); bucket = new GroupbyBucket(this.aggregateFunctionTypes); }
/** * Support new aggregate result * * @return */ @Override public List<GroupbyKeyValue> getGroupbyKeyValues(){ if(this.ignoredEntityCounter > 0) LOG.warn("Ignored "+this.ignoredEntityCounter+" entities for reason: timestamp > "+this.endTime+" or < "+this.startTime); return bucket.getGroupbyKeyValue(); }
public Map<List<String>, List<Double>> result(){ return bucket.result(); }
public void accumulate(TaggedLogAPIEntity entity) throws Exception{ List<String> groupbyFieldValues = createGroup(entity); List<Double> preAggregatedValues = createPreAggregatedValues(entity); bucket.addDatapoint(groupbyFieldValues, preAggregatedValues); }
public void accumulate(TaggedLogAPIEntity entity) throws Exception{ List<String> groupbyFieldValues = createGroup(entity); // TODO: make sure timestamp be in range of this.startTime to this.endTime in outer side // guard the time range to avoid to accumulate entities whose timestamp is bigger than endTime if(entity.getTimestamp() >= this.endTime || entity.getTimestamp() < this.startTime){ if(LOG.isDebugEnabled()) LOG.debug("Ignore in-coming entity whose timestamp > endTime or < startTime, timestamp: " + entity.getTimestamp() + ", startTime:" + startTime + ", endTime:" + endTime); this.ignoredEntityCounter ++; return; } // time series bucket index long located =(entity.getTimestamp() - startTime)/intervalms; groupbyFieldValues.add(String.valueOf(located)); List<Double> preAggregatedValues = createPreAggregatedValues(entity); bucket.addDatapoint(groupbyFieldValues, preAggregatedValues); }
public Map<List<String>, List<Double>> result(){ if(this.ignoredEntityCounter > 0) LOG.warn("Ignored "+this.ignoredEntityCounter+" entities for reason: timestamp > "+this.endTime+" or < "+this.startTime); return bucket.result(); }
public Map<List<String>, List<double[]>> getMetric(){ Map<List<String>, List<Double>> result = bucket.result();