Search in sources :

Example 1 with BySegmentSkippingQueryRunner

use of org.apache.druid.query.BySegmentSkippingQueryRunner in project druid by druid-io.

the class SegmentMetadataQueryQueryToolChest method mergeResults.

@Override
public QueryRunner<SegmentAnalysis> mergeResults(final QueryRunner<SegmentAnalysis> runner) {
    return new BySegmentSkippingQueryRunner<SegmentAnalysis>(runner) {

        @Override
        public Sequence<SegmentAnalysis> doRun(QueryRunner<SegmentAnalysis> baseRunner, QueryPlus<SegmentAnalysis> queryPlus, ResponseContext context) {
            SegmentMetadataQuery updatedQuery = ((SegmentMetadataQuery) queryPlus.getQuery()).withFinalizedAnalysisTypes(config);
            QueryPlus<SegmentAnalysis> updatedQueryPlus = queryPlus.withQuery(updatedQuery);
            return new MappedSequence<>(CombiningSequence.create(baseRunner.run(updatedQueryPlus, context), makeOrdering(updatedQuery), createMergeFn(updatedQuery)), MERGE_TRANSFORM_FN::apply);
        }

        private Ordering<SegmentAnalysis> makeOrdering(SegmentMetadataQuery query) {
            return (Ordering<SegmentAnalysis>) SegmentMetadataQueryQueryToolChest.this.createResultComparator(query);
        }

        private BinaryOperator<SegmentAnalysis> createMergeFn(final SegmentMetadataQuery inQ) {
            return SegmentMetadataQueryQueryToolChest.this.createMergeFn(inQ);
        }
    };
}
Also used : MappedSequence(org.apache.druid.java.util.common.guava.MappedSequence) SegmentMetadataQuery(org.apache.druid.query.metadata.metadata.SegmentMetadataQuery) ResponseContext(org.apache.druid.query.context.ResponseContext) Ordering(com.google.common.collect.Ordering) SegmentAnalysis(org.apache.druid.query.metadata.metadata.SegmentAnalysis) BySegmentSkippingQueryRunner(org.apache.druid.query.BySegmentSkippingQueryRunner) QueryRunner(org.apache.druid.query.QueryRunner) BySegmentSkippingQueryRunner(org.apache.druid.query.BySegmentSkippingQueryRunner) QueryPlus(org.apache.druid.query.QueryPlus)

Aggregations

Ordering (com.google.common.collect.Ordering)1 MappedSequence (org.apache.druid.java.util.common.guava.MappedSequence)1 BySegmentSkippingQueryRunner (org.apache.druid.query.BySegmentSkippingQueryRunner)1 QueryPlus (org.apache.druid.query.QueryPlus)1 QueryRunner (org.apache.druid.query.QueryRunner)1 ResponseContext (org.apache.druid.query.context.ResponseContext)1 SegmentAnalysis (org.apache.druid.query.metadata.metadata.SegmentAnalysis)1 SegmentMetadataQuery (org.apache.druid.query.metadata.metadata.SegmentMetadataQuery)1