Search in sources :

Example 1 with StringCardinalityAggregatorColumnSelectorStrategy

use of io.druid.query.aggregation.cardinality.types.StringCardinalityAggregatorColumnSelectorStrategy in project druid by druid-io.

the class CardinalityAggregatorBenchmark method setUp.

protected void setUp() {
    Iterable<String[]> values = FluentIterable.from(ContiguousSet.create(Range.closedOpen(0, 500), DiscreteDomain.integers())).transform(new Function<Integer, String[]>() {

        @Override
        public String[] apply(Integer input) {
            if (multivaluedSized == 1) {
                return new String[] { input.toString() };
            } else {
                String[] res = new String[multivaluedSized];
                String value = input.toString();
                for (int i = 0; i < multivaluedSized; ++i) {
                    res[i] = value + i;
                }
                return res;
            }
        }
    }).cycle().limit(MAX);
    final DimensionSpec dimSpec1 = new DefaultDimensionSpec("dim1", "dim1");
    final CardinalityAggregatorTest.TestDimensionSelector dim1 = new CardinalityAggregatorTest.TestDimensionSelector(values, null);
    final ColumnSelectorPlus<CardinalityAggregatorColumnSelectorStrategy> dimInfo1 = new ColumnSelectorPlus(dimSpec1.getDimension(), dimSpec1.getOutputName(), new StringCardinalityAggregatorColumnSelectorStrategy(), dim1);
    selectorList = Lists.newArrayList((DimensionSelector) dim1);
    dimInfos = new ColumnSelectorPlus[] { dimInfo1 };
    agg = new CardinalityBufferAggregator(dimInfos, byRow);
    CardinalityAggregatorFactory factory = new CardinalityAggregatorFactory("billy", Lists.<DimensionSpec>newArrayList(new DefaultDimensionSpec("dim1", "dim1")), byRow);
    int maxSize = factory.getMaxIntermediateSize();
    buf = ByteBuffer.allocate(maxSize + 64);
    pos = 10;
    buf.limit(pos + maxSize);
    agg.init(buf, pos);
}
Also used : DimensionSpec(io.druid.query.dimension.DimensionSpec) DefaultDimensionSpec(io.druid.query.dimension.DefaultDimensionSpec) ColumnSelectorPlus(io.druid.query.ColumnSelectorPlus) DimensionSelector(io.druid.segment.DimensionSelector) StringCardinalityAggregatorColumnSelectorStrategy(io.druid.query.aggregation.cardinality.types.StringCardinalityAggregatorColumnSelectorStrategy) CardinalityAggregatorColumnSelectorStrategy(io.druid.query.aggregation.cardinality.types.CardinalityAggregatorColumnSelectorStrategy) DefaultDimensionSpec(io.druid.query.dimension.DefaultDimensionSpec) StringCardinalityAggregatorColumnSelectorStrategy(io.druid.query.aggregation.cardinality.types.StringCardinalityAggregatorColumnSelectorStrategy)

Aggregations

ColumnSelectorPlus (io.druid.query.ColumnSelectorPlus)1 CardinalityAggregatorColumnSelectorStrategy (io.druid.query.aggregation.cardinality.types.CardinalityAggregatorColumnSelectorStrategy)1 StringCardinalityAggregatorColumnSelectorStrategy (io.druid.query.aggregation.cardinality.types.StringCardinalityAggregatorColumnSelectorStrategy)1 DefaultDimensionSpec (io.druid.query.dimension.DefaultDimensionSpec)1 DimensionSpec (io.druid.query.dimension.DimensionSpec)1 DimensionSelector (io.druid.segment.DimensionSelector)1