Search in sources :

Example 1 with TestLongColumnSelector

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());
}
Also used : TestLongColumnSelector(io.druid.segment.TestLongColumnSelector) Test(org.junit.Test)

Example 2 with TestLongColumnSelector

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;
}
Also used : HyperLogLogCollector(io.druid.hll.HyperLogLogCollector) ArrayList(java.util.ArrayList) TestLongColumnSelector(io.druid.segment.TestLongColumnSelector) HyperUniquesAggregatorFactory(io.druid.query.aggregation.hyperloglog.HyperUniquesAggregatorFactory)

Aggregations

TestLongColumnSelector (io.druid.segment.TestLongColumnSelector)2 HyperLogLogCollector (io.druid.hll.HyperLogLogCollector)1 HyperUniquesAggregatorFactory (io.druid.query.aggregation.hyperloglog.HyperUniquesAggregatorFactory)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1