Search in sources :

Example 1 with BaseDoubleVectorValueSelector

use of org.apache.druid.segment.vector.BaseDoubleVectorValueSelector in project druid by druid-io.

the class CardinalityVectorAggregatorTest method testAggregateDouble.

@Test
public void testAggregateDouble() {
    final double[] values = { 1, 2, 2, 3, 3, 3, 0 };
    final boolean[] nulls = NullHandling.replaceWithDefault() ? null : new boolean[] { false, false, false, false, false, false, true };
    final CardinalityVectorAggregator aggregator = new CardinalityVectorAggregator(Collections.singletonList(new DoubleCardinalityVectorProcessor(new BaseDoubleVectorValueSelector(new NoFilterVectorOffset(values.length, 0, values.length)) {

        @Override
        public double[] getDoubleVector() {
            return values;
        }

        @Nullable
        @Override
        public boolean[] getNullVector() {
            return nulls;
        }
    })));
    testAggregate(aggregator, values.length, NullHandling.replaceWithDefault() ? 4 : 3);
}
Also used : DoubleCardinalityVectorProcessor(org.apache.druid.query.aggregation.cardinality.vector.DoubleCardinalityVectorProcessor) BaseDoubleVectorValueSelector(org.apache.druid.segment.vector.BaseDoubleVectorValueSelector) NoFilterVectorOffset(org.apache.druid.segment.vector.NoFilterVectorOffset) Nullable(javax.annotation.Nullable) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Aggregations

Nullable (javax.annotation.Nullable)1 DoubleCardinalityVectorProcessor (org.apache.druid.query.aggregation.cardinality.vector.DoubleCardinalityVectorProcessor)1 BaseDoubleVectorValueSelector (org.apache.druid.segment.vector.BaseDoubleVectorValueSelector)1 NoFilterVectorOffset (org.apache.druid.segment.vector.NoFilterVectorOffset)1 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)1 Test (org.junit.Test)1