use of org.apache.druid.query.aggregation.BufferAggregator in project druid by druid-io.
the class DoubleAnyAggregationTest method testDoubleAnyCombiningBufferAggregator.
@Test
public void testDoubleAnyCombiningBufferAggregator() {
BufferAggregator agg = combiningAggFactory.factorizeBuffered(colSelectorFactory);
ByteBuffer buffer = ByteBuffer.wrap(new byte[doubleAnyAggFactory.getMaxIntermediateSizeWithNulls()]);
agg.init(buffer, 0);
aggregate(agg, buffer, 0);
aggregate(agg, buffer, 0);
aggregate(agg, buffer, 0);
aggregate(agg, buffer, 0);
Double result = (Double) agg.get(buffer, 0);
Assert.assertEquals(objects[0], result, 0.0001);
Assert.assertEquals(objects[0].longValue(), agg.getLong(buffer, 0));
Assert.assertEquals(objects[0], agg.getDouble(buffer, 0), 0.0001);
}
Aggregations