use of org.apache.druid.query.aggregation.cardinality.vector.SingleValueStringCardinalityVectorProcessor in project druid by druid-io.
the class CardinalityVectorAggregatorTest method testAggregateSingleValueString.
@Test
public void testAggregateSingleValueString() {
final int[] ids = { 1, 2, 2, 3, 3, 3, 0 };
final String[] dict = { null, "abc", "def", "foo" };
final CardinalityVectorAggregator aggregator = new CardinalityVectorAggregator(Collections.singletonList(new SingleValueStringCardinalityVectorProcessor(new SingleValueDimensionVectorSelector() {
@Override
public int[] getRowVector() {
return ids;
}
@Override
public int getValueCardinality() {
return dict.length;
}
@Nullable
@Override
public String lookupName(int id) {
return dict[id];
}
@Override
public boolean nameLookupPossibleInAdvance() {
return true;
}
@Nullable
@Override
public IdLookup idLookup() {
return null;
}
@Override
public int getMaxVectorSize() {
return ids.length;
}
@Override
public int getCurrentVectorSize() {
return ids.length;
}
})));
testAggregate(aggregator, ids.length, NullHandling.replaceWithDefault() ? 4 : 3);
}
Aggregations