private MeasureAggregator[] newAggregators() { return info.codeSystem.newMetricsAggregators(metrics, metricsAggrFuncs); }
@Override public E next() { if (!hasNext()) { throw new NoSuchElementException(); } // WATCH OUT! record returned by "input" scanner could be changed later, // so we must make a shallow copy of it. first.shallowCopyFrom(input.next()); // shortcut to avoid extra deserialize/serialize cost if (!shouldMergeNext(first)) { return finalizeResult(first); } // merge records with the same key MeasureAggregator[] aggrs = codeSystem.newMetricsAggregators(metrics, metricFuncs); aggregate(aggrs, first); aggregate(aggrs, input.next()); // no need to copy record because it's not referred to later while (shouldMergeNext(first)) { aggregate(aggrs, input.next()); } Object[] aggStates = new Object[aggrs.length]; for (int i = 0; i < aggStates.length; i++) { aggStates[i] = aggrs[i].getState(); } return finalizeResult(first, aggStates); }
private MeasureAggregator[] newAggregators() { return info.codeSystem.newMetricsAggregators(metrics, metricsAggrFuncs); }
@Override public E next() { if (!hasNext()) { throw new NoSuchElementException(); } // WATCH OUT! record returned by "input" scanner could be changed later, // so we must make a shallow copy of it. first.shallowCopyFrom(input.next()); // shortcut to avoid extra deserialize/serialize cost if (!shouldMergeNext(first)) { return finalizeResult(first); } // merge records with the same key MeasureAggregator[] aggrs = codeSystem.newMetricsAggregators(metrics, metricFuncs); aggregate(aggrs, first); aggregate(aggrs, input.next()); // no need to copy record because it's not referred to later while (shouldMergeNext(first)) { aggregate(aggrs, input.next()); } Object[] aggStates = new Object[aggrs.length]; for (int i = 0; i < aggStates.length; i++) { aggStates[i] = aggrs[i].getState(); } return finalizeResult(first, aggStates); }