@Test public void testAggregate() { double compression = 100; int datasize = 10000; PercentileAggregator aggregator = new PercentileAggregator(compression); Random random = new Random(); List<Double> dataset = Lists.newArrayListWithCapacity(datasize); for (int i = 0; i < datasize; i++) { double d = random.nextDouble(); dataset.add(d); PercentileCounter c = new PercentileCounter(compression, 0.5); c.add(d); aggregator.aggregate(c); } Collections.sort(dataset); double actualResult = aggregator.getState().getResultEstimate(); double expectResult = MathUtil.findMedianInSortedList(dataset); assertEquals(expectResult, actualResult, 0.001); }
@Override public void aggregate(PercentileCounter value) { if (sum == null) sum = new PercentileCounter(value); else sum.merge(value); }
PercentileAggregator extends MeasureAggregator<PercentileCounter> { @Override public void aggregate(PercentileCounter value) { if (sum == null) sum = new PercentileCounter(value); else sum.merge(value); } }
PercentileAggregator extends MeasureAggregator<PercentileCounter> { @Override public void aggregate(PercentileCounter value) { if (sum == null) sum = new PercentileCounter(value); else sum.merge(value); } PercentileAggregator(double compression); }
PercentileAggregator extends MeasureAggregator<PercentileCounter> { @Override public void aggregate(PercentileCounter value) { if (sum == null) sum = new PercentileCounter(value); else sum.merge(value); } PercentileAggregator(double compression); @Override void reset(); @Override void aggregate(PercentileCounter value); @Override PercentileCounter aggregate(PercentileCounter value1, PercentileCounter value2); @Override PercentileCounter getState(); @Override int getMemBytesEstimate(); }
PercentileAggregator extends MeasureAggregator<PercentileCounter> { @Override public void aggregate(PercentileCounter value) { if (sum == null) sum = new PercentileCounter(value); else sum.merge(value); } PercentileAggregator(double compression); @Override void reset(); @Override void aggregate(PercentileCounter value); @Override PercentileCounter aggregate(PercentileCounter value1, PercentileCounter value2); @Override PercentileCounter getState(); @Override int getMemBytesEstimate();  }