Search in sources :

Example 11 with VectorAggregator

use of org.apache.druid.query.aggregation.VectorAggregator in project druid by druid-io.

the class VarianceAggregatorFactoryUnitTest method factorizeVectorShouldReturnFloatVectorAggregator.

@Test
public void factorizeVectorShouldReturnFloatVectorAggregator() {
    VectorAggregator agg = target.factorizeVector(selectorFactory);
    Assert.assertNotNull(agg);
    Assert.assertEquals(VarianceFloatVectorAggregator.class, agg.getClass());
}
Also used : VectorAggregator(org.apache.druid.query.aggregation.VectorAggregator) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Example 12 with VectorAggregator

use of org.apache.druid.query.aggregation.VectorAggregator in project druid by druid-io.

the class VarianceAggregatorFactoryUnitTest method factorizeVectorForLongShouldReturnFloatVectorAggregator.

@Test
public void factorizeVectorForLongShouldReturnFloatVectorAggregator() {
    target = new VarianceAggregatorFactory(NAME, FIELD_NAME, null, LONG);
    VectorAggregator agg = target.factorizeVector(selectorFactory);
    Assert.assertNotNull(agg);
    Assert.assertEquals(VarianceLongVectorAggregator.class, agg.getClass());
}
Also used : VectorAggregator(org.apache.druid.query.aggregation.VectorAggregator) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Example 13 with VectorAggregator

use of org.apache.druid.query.aggregation.VectorAggregator in project druid by druid-io.

the class VarianceAggregatorFactoryUnitTest method factorizeVectorForVarianceShouldReturnObjectVectorAggregator.

@Test
public void factorizeVectorForVarianceShouldReturnObjectVectorAggregator() {
    target = new VarianceAggregatorFactory(NAME, FIELD_NAME, null, VARIANCE);
    VectorAggregator agg = target.factorizeVector(selectorFactory);
    Assert.assertNotNull(agg);
    Assert.assertEquals(VarianceObjectVectorAggregator.class, agg.getClass());
}
Also used : VectorAggregator(org.apache.druid.query.aggregation.VectorAggregator) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Example 14 with VectorAggregator

use of org.apache.druid.query.aggregation.VectorAggregator in project druid by druid-io.

the class LongAnyAggregatorFactoryTest method factorizeVectorWithNumericColumnShouldReturnLongVectorAggregator.

@Test
public void factorizeVectorWithNumericColumnShouldReturnLongVectorAggregator() {
    Mockito.doReturn(capabilities).when(selectorFactory).getColumnCapabilities(FIELD_NAME);
    Mockito.doReturn(true).when(capabilities).isNumeric();
    VectorAggregator aggregator = target.factorizeVector(selectorFactory);
    Assert.assertNotNull(aggregator);
    Assert.assertEquals(LongAnyVectorAggregator.class, aggregator.getClass());
}
Also used : VectorAggregator(org.apache.druid.query.aggregation.VectorAggregator) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Example 15 with VectorAggregator

use of org.apache.druid.query.aggregation.VectorAggregator in project druid by druid-io.

the class LongAnyAggregatorFactoryTest method factorizeVectorForStringTypeShouldReturnLongVectorAggregatorWithNilSelector.

@Test
public void factorizeVectorForStringTypeShouldReturnLongVectorAggregatorWithNilSelector() {
    Mockito.doReturn(capabilities).when(selectorFactory).getColumnCapabilities(FIELD_NAME);
    Mockito.doReturn(false).when(capabilities).isNumeric();
    VectorAggregator aggregator = target.factorizeVector(selectorFactory);
    Assert.assertNotNull(aggregator);
    Assert.assertEquals(NullHandling.defaultLongValue(), aggregator.get(BUFFER, POSITION));
}
Also used : VectorAggregator(org.apache.druid.query.aggregation.VectorAggregator) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Aggregations

VectorAggregator (org.apache.druid.query.aggregation.VectorAggregator)21 Test (org.junit.Test)20 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)14 ByteBuffer (java.nio.ByteBuffer)7 ISE (org.apache.druid.java.util.common.ISE)1 CountAggregatorFactory (org.apache.druid.query.aggregation.CountAggregatorFactory)1 FilteredAggregatorFactory (org.apache.druid.query.aggregation.FilteredAggregatorFactory)1 VectorCursor (org.apache.druid.segment.vector.VectorCursor)1