@Test public void aggregate() { Aggregator aggregator = new TopPercentileAggregator(90, 3); Column column = EasyMock.createMock(Column.class); BitmapIndexedColumn indexedColumn = EasyMock.createMock(BitmapIndexedColumn.class); EasyMock.expect(indexedColumn.getNullIndex()).andReturn(null); EasyMock.expect(column.getBitmapIndex()).andReturn(indexedColumn); DetailColumn detailColumn = EasyMock.createMock(DetailColumn.class); for (long i = 0; i < 10; i++) { EasyMock.expect(detailColumn.getLong((int) i)).andReturn(i * 1000); } EasyMock.expect(column.getDetailColumn()).andReturn(detailColumn); RowTraversal traversal = BitMaps.newRangeBitmap(1, 10); EasyMock.replay(column, indexedColumn, detailColumn); double value = aggregator.aggregate(traversal, column).calculate(); assertEquals(9000, value, 1000); }
@Override public TopPercentileAggregatorValue aggregate(RowTraversal traversal, Column<?> column) { final DetailColumn detailColumn = column.getDetailColumn(); final TopPercentileAggregatorValue value = new TopPercentileAggregatorValue(percentile, numberOfSignificantValueDigits); traversal = getNotNullTraversal(traversal, column); traversal.traversal(new TraversalAction() { @Override public void actionPerformed(int row) { value.recordValue(detailColumn.getLong(row)); } }); return value; }
TopPercentileAggregator extends AbstractAggregator<TopPercentileAggregatorValue> implements Serializable { @Override public TopPercentileAggregatorValue aggregate(RowTraversal traversal, Column<?> column) { final DetailColumn detailColumn = column.getDetailColumn(); final TopPercentileAggregatorValue value = new TopPercentileAggregatorValue(percentile, numberOfSignificantValueDigits); traversal = getNotNullTraversal(traversal, column); traversal.traversal(new TraversalAction() { @Override public void actionPerformed(int row) { value.recordValue(detailColumn.getLong(row)); } }); return value; } }
TopPercentileAggregator extends AbstractAggregator<TopPercentileAggregatorValue> implements Serializable { @Override public TopPercentileAggregatorValue aggregate(RowTraversal traversal, Column<?> column) { final DetailColumn detailColumn = column.getDetailColumn(); final TopPercentileAggregatorValue value = new TopPercentileAggregatorValue(percentile, numberOfSignificantValueDigits); traversal = getNotNullTraversal(traversal, column); traversal.traversal(new TraversalAction() { @Override public void actionPerformed(int row) { value.recordValue(detailColumn.getLong(row)); } }); return value; } TopPercentileAggregator(double percentile, int numberOfSignificantValueDigits); }
TopPercentileAggregator extends AbstractAggregator<TopPercentileAggregatorValue> implements Serializable { @Override public TopPercentileAggregatorValue aggregate(RowTraversal traversal, Column<?> column) { final DetailColumn detailColumn = column.getDetailColumn(); final TopPercentileAggregatorValue value = new TopPercentileAggregatorValue(percentile, numberOfSignificantValueDigits); traversal = getNotNullTraversal(traversal, column); traversal.traversal(new TraversalAction() { @Override public void actionPerformed(int row) { value.recordValue(detailColumn.getLong(row)); } }); return value; } TopPercentileAggregator(double percentile, int numberOfSignificantValueDigits); @Override TopPercentileAggregatorValue aggregate(RowTraversal traversal, Column<?> column); @Override TopPercentileAggregatorValue createAggregatorValue(AggregatorValue<?> value); @Override AggregatorType getAggregatorType(); @Override void combine(TopPercentileAggregatorValue current, TopPercentileAggregatorValue other); }
TopPercentileAggregator extends AbstractAggregator<TopPercentileAggregatorValue> implements Serializable { @Override public TopPercentileAggregatorValue aggregate(RowTraversal traversal, Column<?> column) { final DetailColumn detailColumn = column.getDetailColumn(); final TopPercentileAggregatorValue value = new TopPercentileAggregatorValue(percentile, numberOfSignificantValueDigits); traversal = getNotNullTraversal(traversal, column); traversal.traversal(new TraversalAction() { @Override public void actionPerformed(int row) { value.recordValue(detailColumn.getLong(row)); } }); return value; } TopPercentileAggregator(double percentile, int numberOfSignificantValueDigits); @Override TopPercentileAggregatorValue aggregate(RowTraversal traversal, Column<?> column); @Override TopPercentileAggregatorValue createAggregatorValue(AggregatorValue<?> value); @Override AggregatorType getAggregatorType(); @Override void combine(TopPercentileAggregatorValue current, TopPercentileAggregatorValue other);  }