use of org.apache.druid.segment.IdLookup in project druid by druid-io.
the class CardinalityVectorAggregatorTest method testAggregateMultiValueString.
@Test
public void testAggregateMultiValueString() {
final IndexedInts[] ids = { new ArrayBasedIndexedInts(new int[] { 1, 2 }), new ArrayBasedIndexedInts(new int[] { 2, 3 }), new ArrayBasedIndexedInts(new int[] { 3, 3 }), new ArrayBasedIndexedInts(new int[] { 0 }) };
final String[] dict = { null, "abc", "def", "foo" };
final CardinalityVectorAggregator aggregator = new CardinalityVectorAggregator(Collections.singletonList(new MultiValueStringCardinalityVectorProcessor(new MultiValueDimensionVectorSelector() {
@Override
public IndexedInts[] 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