@Test public void aggregate() { RowTraversal traversal = mock(RowTraversal.class); Column column = mock(Column.class); ImmutableBitMap bitMap = mock(ImmutableBitMap.class); Aggregator aggregator = mock(Aggregator.class); DetailFilter detailFilter = mock(DetailFilter.class); AggregatorValue aggregatorValue = mock(AggregatorValue.class); when(aggregator.aggregate(traversal, column)).thenReturn(aggregatorValue); Assert.assertEquals(aggregatorValue, new MetricFilterAggregator(aggregator, detailFilter).aggregate(traversal, column)); ImmutableBitMap mapIndex = mock(ImmutableBitMap.class); when(traversal.toBitMap()).thenReturn(mapIndex); ImmutableBitMap map = mock(ImmutableBitMap.class); when(bitMap.getAnd(mapIndex)).thenReturn(map); when(aggregator.aggregate(traversal, column)).thenReturn(aggregatorValue); Assert.assertEquals(aggregatorValue, new MetricFilterAggregator(aggregator, detailFilter).aggregate(traversal, column)); }
@Override public AggregatorValue aggregate(RowTraversal traversal, Map<ColumnKey, Column<?>> columns) { traversal = bitMap == null ? traversal : bitMap.getAnd(traversal.toBitMap()); return aggregator.aggregate(traversal, columns); }
MetricFilterAggregator implements Serializable, Aggregator<AggregatorValue<?>> { @Override public AggregatorValue aggregate(RowTraversal traversal, Map<ColumnKey, Column<?>> columns) { traversal = bitMap == null ? traversal : bitMap.getAnd(traversal.toBitMap()); return aggregator.aggregate(traversal, columns); } }
MetricFilterAggregator implements Serializable, Aggregator<AggregatorValue<?>> { @Override public AggregatorValue aggregate(RowTraversal traversal, Map<ColumnKey, Column<?>> columns) { traversal = bitMap == null ? traversal : bitMap.getAnd(traversal.toBitMap()); return aggregator.aggregate(traversal, columns); } MetricFilterAggregator(Aggregator aggregator, DetailFilter filter); }
MetricFilterAggregator implements Serializable, Aggregator<AggregatorValue<?>> { @Override public AggregatorValue aggregate(RowTraversal traversal, Map<ColumnKey, Column<?>> columns) { traversal = bitMap == null ? traversal : bitMap.getAnd(traversal.toBitMap()); return aggregator.aggregate(traversal, columns); } MetricFilterAggregator(Aggregator aggregator, DetailFilter filter); @Override AggregatorValue aggregate(RowTraversal traversal, Map<ColumnKey, Column<?>> columns); @Override AggregatorValue aggregate(RowTraversal traversal, Column<?> column); @Override AggregatorValue createAggregatorValue(AggregatorValue<?> value); @Override AggregatorType getAggregatorType(); @Override void combine(AggregatorValue<?> current, AggregatorValue<?> other); }
MetricFilterAggregator implements Serializable, Aggregator<AggregatorValue<?>> { @Override public AggregatorValue aggregate(RowTraversal traversal, Map<ColumnKey, Column<?>> columns) { traversal = bitMap == null ? traversal : bitMap.getAnd(traversal.toBitMap()); return aggregator.aggregate(traversal, columns); } MetricFilterAggregator(Aggregator aggregator, DetailFilter filter); @Override AggregatorValue aggregate(RowTraversal traversal, Map<ColumnKey, Column<?>> columns); @Override AggregatorValue aggregate(RowTraversal traversal, Column<?> column); @Override AggregatorValue createAggregatorValue(AggregatorValue<?> value); @Override AggregatorType getAggregatorType(); @Override void combine(AggregatorValue<?> current, AggregatorValue<?> other);  }