Search in sources :

Example 1 with UpperExtractionFn

use of io.druid.query.extraction.UpperExtractionFn in project druid by druid-io.

the class SearchBenchmark method basicC.

private static SearchQueryBuilder basicC(final BenchmarkSchemaInfo basicSchema) {
    final QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec(Arrays.asList(basicSchema.getDataInterval()));
    final List<String> dimUniformFilterVals = Lists.newArrayList();
    final int resultNum = (int) (100000 * 0.1);
    final int step = 100000 / resultNum;
    for (int i = 1; i < 100001 && dimUniformFilterVals.size() < resultNum; i += step) {
        dimUniformFilterVals.add(String.valueOf(i));
    }
    final String dimName = "dimUniform";
    final List<DimFilter> dimFilters = Lists.newArrayList();
    dimFilters.add(new InDimFilter(dimName, dimUniformFilterVals, IdentityExtractionFn.getInstance()));
    dimFilters.add(new SelectorDimFilter(dimName, "3", StrlenExtractionFn.instance()));
    dimFilters.add(new BoundDimFilter(dimName, "100", "10000", true, true, true, new DimExtractionFn() {

        @Override
        public byte[] getCacheKey() {
            return new byte[] { 0xF };
        }

        @Override
        public String apply(String value) {
            return String.valueOf(Long.parseLong(value) + 1);
        }

        @Override
        public boolean preservesOrdering() {
            return false;
        }

        @Override
        public ExtractionType getExtractionType() {
            return ExtractionType.ONE_TO_ONE;
        }
    }, null));
    dimFilters.add(new InDimFilter(dimName, dimUniformFilterVals, new LowerExtractionFn(null)));
    dimFilters.add(new InDimFilter(dimName, dimUniformFilterVals, new UpperExtractionFn(null)));
    dimFilters.add(new InDimFilter(dimName, dimUniformFilterVals, new SubstringDimExtractionFn(1, 3)));
    return Druids.newSearchQueryBuilder().dataSource("blah").granularity(Granularities.ALL).intervals(intervalSpec).query("").dimensions(Lists.newArrayList("dimUniform")).filters(new AndDimFilter(dimFilters));
}
Also used : BoundDimFilter(io.druid.query.filter.BoundDimFilter) AndDimFilter(io.druid.query.filter.AndDimFilter) MultipleIntervalSegmentSpec(io.druid.query.spec.MultipleIntervalSegmentSpec) SubstringDimExtractionFn(io.druid.query.extraction.SubstringDimExtractionFn) LowerExtractionFn(io.druid.query.extraction.LowerExtractionFn) SelectorDimFilter(io.druid.query.filter.SelectorDimFilter) InDimFilter(io.druid.query.filter.InDimFilter) QuerySegmentSpec(io.druid.query.spec.QuerySegmentSpec) BoundDimFilter(io.druid.query.filter.BoundDimFilter) InDimFilter(io.druid.query.filter.InDimFilter) SelectorDimFilter(io.druid.query.filter.SelectorDimFilter) DimFilter(io.druid.query.filter.DimFilter) AndDimFilter(io.druid.query.filter.AndDimFilter) DimExtractionFn(io.druid.query.extraction.DimExtractionFn) SubstringDimExtractionFn(io.druid.query.extraction.SubstringDimExtractionFn) UpperExtractionFn(io.druid.query.extraction.UpperExtractionFn)

Aggregations

DimExtractionFn (io.druid.query.extraction.DimExtractionFn)1 LowerExtractionFn (io.druid.query.extraction.LowerExtractionFn)1 SubstringDimExtractionFn (io.druid.query.extraction.SubstringDimExtractionFn)1 UpperExtractionFn (io.druid.query.extraction.UpperExtractionFn)1 AndDimFilter (io.druid.query.filter.AndDimFilter)1 BoundDimFilter (io.druid.query.filter.BoundDimFilter)1 DimFilter (io.druid.query.filter.DimFilter)1 InDimFilter (io.druid.query.filter.InDimFilter)1 SelectorDimFilter (io.druid.query.filter.SelectorDimFilter)1 MultipleIntervalSegmentSpec (io.druid.query.spec.MultipleIntervalSegmentSpec)1 QuerySegmentSpec (io.druid.query.spec.QuerySegmentSpec)1