use of io.druid.segment.TestLongColumnSelector in project druid by druid-io.
the class ExpressionObjectSelectorTest method testSupplierFromLongSelector.
@Test
public void testSupplierFromLongSelector() {
final Supplier<Number> supplier = ExpressionObjectSelector.supplierFromLongSelector(new TestLongColumnSelector() {
@Override
public long get() {
return 1L;
}
});
Assert.assertEquals(1L, supplier.get());
}
use of io.druid.segment.TestLongColumnSelector in project druid by druid-io.
the class MetricManipulatorFnsTest method constructorFeeder.
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> constructorFeeder() {
final ArrayList<Object[]> constructorArrays = new ArrayList<>();
final long longVal = 13789;
LongMinAggregator longMinAggregator = new LongMinAggregator(new TestLongColumnSelector() {
@Override
public long get() {
return longVal;
}
});
LongMinAggregatorFactory longMinAggregatorFactory = new LongMinAggregatorFactory(NAME, FIELD);
constructorArrays.add(new Object[] { longMinAggregatorFactory, longMinAggregator, longMinAggregator, longMinAggregator, longVal, longVal });
HyperUniquesAggregatorFactory hyperUniquesAggregatorFactory = new HyperUniquesAggregatorFactory(NAME, FIELD);
HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector();
collector.add((short) 1, (byte) 5);
constructorArrays.add(new Object[] { hyperUniquesAggregatorFactory, collector, collector, collector.estimateCardinality(), collector.toByteArray(), collector });
LongSumAggregatorFactory longSumAggregatorFactory = new LongSumAggregatorFactory(NAME, FIELD);
LongSumAggregator longSumAggregator = new LongSumAggregator(new TestLongColumnSelector() {
@Override
public long get() {
return longVal;
}
});
constructorArrays.add(new Object[] { longSumAggregatorFactory, longSumAggregator, longSumAggregator, longSumAggregator, longVal, longVal });
for (Object[] argList : constructorArrays) {
Assert.assertEquals(String.format("Arglist %s is too short. Expected 6 found %d", Arrays.toString(argList), argList.length), 6, argList.length);
}
return constructorArrays;
}
Aggregations