use of org.apache.druid.query.aggregation.Aggregator in project druid by druid-io.
the class LongAnyAggregationTest method testLongAnyCombiningAggregator.
@Test
public void testLongAnyCombiningAggregator() {
Aggregator agg = combiningAggFactory.factorize(colSelectorFactory);
aggregate(agg);
aggregate(agg);
aggregate(agg);
aggregate(agg);
Long result = (Long) agg.get();
Assert.assertEquals(objects[0], result, 0.0001);
Assert.assertEquals(objects[0].longValue(), agg.getLong());
Assert.assertEquals(objects[0], agg.getLong(), 0.0001);
}
use of org.apache.druid.query.aggregation.Aggregator in project druid by druid-io.
the class StringAnyAggregationTest method testStringAnyAggregator.
@Test
public void testStringAnyAggregator() {
Aggregator agg = stringAnyAggFactory.factorize(colSelectorFactory);
aggregate(agg);
aggregate(agg);
aggregate(agg);
aggregate(agg);
String result = (String) agg.get();
Assert.assertEquals(strings[0], result);
}
use of org.apache.druid.query.aggregation.Aggregator in project druid by druid-io.
the class DoubleFirstAggregationTest method testDoubleFirstAggregator.
@Test
public void testDoubleFirstAggregator() {
Aggregator agg = doubleFirstAggFactory.factorize(colSelectorFactory);
aggregate(agg);
aggregate(agg);
aggregate(agg);
aggregate(agg);
Pair<Long, Double> result = (Pair<Long, Double>) agg.get();
Assert.assertEquals(times[1], result.lhs.longValue());
Assert.assertEquals(doubleValues[1], result.rhs, 0.0001);
Assert.assertEquals((long) doubleValues[1], agg.getLong());
Assert.assertEquals(doubleValues[1], agg.getDouble(), 0.0001);
}
use of org.apache.druid.query.aggregation.Aggregator in project druid by druid-io.
the class LongFirstAggregationTest method testLongFirstCombiningAggregator.
@Test
public void testLongFirstCombiningAggregator() {
Aggregator agg = combiningAggFactory.factorize(colSelectorFactory);
aggregate(agg);
aggregate(agg);
aggregate(agg);
aggregate(agg);
Pair<Long, Long> result = (Pair<Long, Long>) agg.get();
Pair<Long, Long> expected = (Pair<Long, Long>) pairs[0];
Assert.assertEquals(expected.lhs, result.lhs);
Assert.assertEquals(expected.rhs, result.rhs);
Assert.assertEquals(expected.rhs.longValue(), agg.getLong());
Assert.assertEquals(expected.rhs, agg.getFloat(), 0.0001);
}
use of org.apache.druid.query.aggregation.Aggregator in project druid by druid-io.
the class FloatAnyAggregationTest method testFloatAnyAggregator.
@Test
public void testFloatAnyAggregator() {
Aggregator agg = floatAnyAggFactory.factorize(colSelectorFactory);
aggregate(agg);
aggregate(agg);
aggregate(agg);
aggregate(agg);
Float result = (Float) agg.get();
Assert.assertEquals((Float) floats[0], result);
Assert.assertEquals((long) floats[0], agg.getLong());
Assert.assertEquals(floats[0], agg.getFloat(), 0.0001);
}
Aggregations