@Override public MeasureAggregator<BitmapCounter> newAggregator() { return new BitmapAggregator(); }
public static BitmapAggregator add(BitmapAggregator agg, Object value) { agg.aggregate((BitmapCounter) value); return agg; }
@Test public void testEstimateBitmapMemSize() { BitmapAggregator[] bitmapAggrs = new BitmapAggregator[bitmaps.length]; for (int i = 0; i < bitmapAggrs.length; i++) { bitmapAggrs[i] = new BitmapAggregator(); bitmapAggrs[i].aggregate(bitmaps[i]); } System.out.printf(Locale.ROOT, "%-15s %-10s %-10s\n", "cardinality", "estimate", "actual"); for (BitmapAggregator aggr : bitmapAggrs) { System.out.printf(Locale.ROOT, "%-15d %-10d %-10d\n", aggr.getState().getCount(), aggr.getMemBytesEstimate(), meter.measureDeep(aggr)); } }
@Test public void testAggregator() { BitmapAggregator aggregator = new BitmapAggregator(); assertNull(null, aggregator.getState()); aggregator.aggregate(factory.newBitmap(10, 20, 30, 40)); assertEquals(4, aggregator.getState().getCount()); aggregator.aggregate(factory.newBitmap(25, 30, 35, 40, 45)); assertEquals(7, aggregator.getState().getCount()); aggregator.reset(); assertNull(aggregator.getState()); }
buffer.flip(); BitmapAggregator aggregator = new BitmapAggregator(); assertEquals(counter1, next); aggregator.aggregate(next); assertEquals(counter1, aggregator.getState()); assertEquals(counter2, next); aggregator.aggregate(next); assertEquals(6, aggregator.getState().getCount()); assertEquals(counter3, next); aggregator.aggregate(next); assertEquals(7, aggregator.getState().getCount()); result.orWith(counter2); result.orWith(counter3); assertEquals(result, aggregator.getState());
private BitmapAggregator createBitmapAggr(boolean lowCardinality) { BitmapCounter counter = bitmapFactory.newBitmap(); counter.orWith(lowCardinality ? bitmaps[0] : bitmaps[3]); BitmapAggregator result = new BitmapAggregator(); result.aggregate(counter); return result; }
@Test public void testAggregatorEstimate() { HLLCAggregator hllcAggregator = new HLLCAggregator(14); hllcAggregator.aggregate(new HLLCounter(14)); BitmapAggregator bitmapAggregator = new BitmapAggregator(); BitmapCounter bitmapCounter = RoaringBitmapCounterFactory.INSTANCE.newBitmap(); for (int i = 4000; i <= 100000; i += 2) { bitmapCounter.add(i); } bitmapAggregator.aggregate(bitmapCounter); ExtendedColumnMeasureType extendedColumnType = new ExtendedColumnMeasureType( DataType.getType("extendedcolumn(100)")); MeasureAggregator<ByteArray> extendedColumnAggregator = extendedColumnType.newAggregator(); extendedColumnAggregator.aggregate(new ByteArray(100)); List<MeasureAggregator> aggregators = Lists.newArrayList(basicAggregators()); aggregators.add(hllcAggregator); aggregators.add(bitmapAggregator); aggregators.add(extendedColumnAggregator); System.out.printf(Locale.ROOT, "%40s %10s %10s\n", "Class", "Estimate", "Actual"); for (MeasureAggregator aggregator : aggregators) { String clzName = getAggregatorName(aggregator.getClass()); System.out.printf(Locale.ROOT, "%40s %10d %10d\n", clzName, aggregator.getMemBytesEstimate(), meter.measureDeep(aggregator)); } }
public static BitmapAggregator init() { return new BitmapAggregator(); }
public static long result(BitmapAggregator agg) { BitmapCounter finalState = agg.getState(); return finalState == null ? 0 : finalState.getCount(); } }
public static BitmapAggregator add(BitmapAggregator agg, Object value) { agg.aggregate((BitmapCounter) value); return agg; }
@Override public MeasureAggregator<BitmapCounter> newAggregator() { return new BitmapAggregator(); }
@Override public MeasureAggregator<BitmapCounter> newAggregator() { return new BitmapAggregator(); }
public static long result(BitmapAggregator agg) { BitmapCounter finalState = agg.getState(); return finalState == null ? 0 : finalState.getCount(); } }
public static BitmapAggregator init() { return new BitmapAggregator(); }