Search in sources :

Example 6 with QueryToolChest

use of io.druid.query.QueryToolChest in project druid by druid-io.

the class SegmentMetadataQueryTest method testSegmentMetadataQueryWithHasMultipleValuesMerge.

@Test
public void testSegmentMetadataQueryWithHasMultipleValuesMerge() {
    SegmentAnalysis mergedSegmentAnalysis = new SegmentAnalysis(differentIds ? "merged" : "testSegment", null, ImmutableMap.of("placement", new ColumnAnalysis(ValueType.STRING.toString(), false, 0, 1, null, null, null), "placementish", new ColumnAnalysis(ValueType.STRING.toString(), true, 0, 9, null, null, null)), 0, expectedSegmentAnalysis1.getNumRows() + expectedSegmentAnalysis2.getNumRows(), null, null, null, null);
    QueryToolChest toolChest = FACTORY.getToolchest();
    ExecutorService exec = Executors.newCachedThreadPool();
    QueryRunner myRunner = new FinalizeResultsQueryRunner<>(toolChest.mergeResults(FACTORY.mergeRunners(MoreExecutors.sameThreadExecutor(), Lists.<QueryRunner<SegmentAnalysis>>newArrayList(toolChest.preMergeQueryDecoration(runner1), toolChest.preMergeQueryDecoration(runner2)))), toolChest);
    TestHelper.assertExpectedObjects(ImmutableList.of(mergedSegmentAnalysis), myRunner.run(Druids.newSegmentMetadataQueryBuilder().dataSource("testing").intervals("2013/2014").toInclude(new ListColumnIncluderator(Arrays.asList("placement", "placementish"))).analysisTypes(SegmentMetadataQuery.AnalysisType.CARDINALITY).merge(true).build(), Maps.newHashMap()), "failed SegmentMetadata merging query");
    exec.shutdownNow();
}
Also used : FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) ListColumnIncluderator(io.druid.query.metadata.metadata.ListColumnIncluderator) ColumnAnalysis(io.druid.query.metadata.metadata.ColumnAnalysis) ExecutorService(java.util.concurrent.ExecutorService) SegmentAnalysis(io.druid.query.metadata.metadata.SegmentAnalysis) QueryToolChest(io.druid.query.QueryToolChest) FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) QueryRunner(io.druid.query.QueryRunner) Test(org.junit.Test)

Example 7 with QueryToolChest

use of io.druid.query.QueryToolChest in project druid by druid-io.

the class TopNTypeInterfaceBenchmark method runQuery.

private static <T> List<T> runQuery(QueryRunnerFactory factory, QueryRunner runner, Query<T> query) {
    QueryToolChest toolChest = factory.getToolchest();
    QueryRunner<T> theRunner = new FinalizeResultsQueryRunner<>(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner)), toolChest);
    Sequence<T> queryResult = theRunner.run(query, Maps.<String, Object>newHashMap());
    return Sequences.toList(queryResult, Lists.<T>newArrayList());
}
Also used : FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) TopNQueryQueryToolChest(io.druid.query.topn.TopNQueryQueryToolChest) QueryToolChest(io.druid.query.QueryToolChest)

Example 8 with QueryToolChest

use of io.druid.query.QueryToolChest in project druid by druid-io.

the class TimeseriesBenchmark method runQuery.

private static <T> List<T> runQuery(QueryRunnerFactory factory, QueryRunner runner, Query<T> query) {
    QueryToolChest toolChest = factory.getToolchest();
    QueryRunner<T> theRunner = new FinalizeResultsQueryRunner<>(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner)), toolChest);
    Sequence<T> queryResult = theRunner.run(query, Maps.<String, Object>newHashMap());
    return Sequences.toList(queryResult, Lists.<T>newArrayList());
}
Also used : FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) TimeseriesQueryQueryToolChest(io.druid.query.timeseries.TimeseriesQueryQueryToolChest) QueryToolChest(io.druid.query.QueryToolChest)

Example 9 with QueryToolChest

use of io.druid.query.QueryToolChest in project druid by druid-io.

the class GroupByBenchmark method runQuery.

private static <T> List<T> runQuery(QueryRunnerFactory factory, QueryRunner runner, Query<T> query) {
    QueryToolChest toolChest = factory.getToolchest();
    QueryRunner<T> theRunner = new FinalizeResultsQueryRunner<>(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner)), toolChest);
    Sequence<T> queryResult = theRunner.run(query, Maps.<String, Object>newHashMap());
    return Sequences.toList(queryResult, Lists.<T>newArrayList());
}
Also used : FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) GroupByQueryQueryToolChest(io.druid.query.groupby.GroupByQueryQueryToolChest) QueryToolChest(io.druid.query.QueryToolChest)

Example 10 with QueryToolChest

use of io.druid.query.QueryToolChest in project druid by druid-io.

the class SearchBenchmark method runQuery.

private static <T> List<T> runQuery(QueryRunnerFactory factory, QueryRunner runner, Query<T> query) {
    QueryToolChest toolChest = factory.getToolchest();
    QueryRunner<T> theRunner = new FinalizeResultsQueryRunner<>(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner)), toolChest);
    Sequence<T> queryResult = theRunner.run(query, Maps.<String, Object>newHashMap());
    return Sequences.toList(queryResult, Lists.<T>newArrayList());
}
Also used : FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) SearchQueryQueryToolChest(io.druid.query.search.SearchQueryQueryToolChest) QueryToolChest(io.druid.query.QueryToolChest)

Aggregations

QueryToolChest (io.druid.query.QueryToolChest)32 FinalizeResultsQueryRunner (io.druid.query.FinalizeResultsQueryRunner)27 QueryRunner (io.druid.query.QueryRunner)20 Test (org.junit.Test)15 Result (io.druid.query.Result)13 ExecutorService (java.util.concurrent.ExecutorService)13 SegmentAnalysis (io.druid.query.metadata.metadata.SegmentAnalysis)9 ColumnAnalysis (io.druid.query.metadata.metadata.ColumnAnalysis)8 ListColumnIncluderator (io.druid.query.metadata.metadata.ListColumnIncluderator)8 DateTime (org.joda.time.DateTime)7 LongSumAggregatorFactory (io.druid.query.aggregation.LongSumAggregatorFactory)6 TimeseriesQueryQueryToolChest (io.druid.query.timeseries.TimeseriesQueryQueryToolChest)6 BySegmentResultValue (io.druid.query.BySegmentResultValue)5 BySegmentResultValueClass (io.druid.query.BySegmentResultValueClass)5 Query (io.druid.query.Query)5 TopNQueryQueryToolChest (io.druid.query.topn.TopNQueryQueryToolChest)5 PeriodGranularity (io.druid.java.util.common.granularity.PeriodGranularity)4 SelectorDimFilter (io.druid.query.filter.SelectorDimFilter)4 QueryableIndexSegment (io.druid.segment.QueryableIndexSegment)4 Interval (org.joda.time.Interval)4