Search in sources :

Example 71 with TimeseriesQueryQueryToolChest

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

the class CachingClusteredClientTest method testDisableUseCache.

@Test
public void testDisableUseCache() {
    final Druids.TimeseriesQueryBuilder builder = Druids.newTimeseriesQueryBuilder().dataSource(DATA_SOURCE).intervals(SEG_SPEC).filters(DIM_FILTER).granularity(GRANULARITY).aggregators(AGGS).postAggregators(POST_AGGS).context(CONTEXT);
    QueryRunner runner = new FinalizeResultsQueryRunner(getDefaultQueryRunner(), new TimeseriesQueryQueryToolChest());
    testQueryCaching(runner, 1, true, builder.context(ImmutableMap.of("useCache", "false", "populateCache", "true")).randomQueryId().build(), Intervals.of("2011-01-01/2011-01-02"), makeTimeResults(DateTimes.of("2011-01-01"), 50, 5000));
    Assert.assertEquals(1, cache.getStats().getNumEntries());
    Assert.assertEquals(0, cache.getStats().getNumHits());
    Assert.assertEquals(0, cache.getStats().getNumMisses());
    cache.close(SegmentId.dummy("0_0").toString());
    testQueryCaching(runner, 1, false, builder.context(ImmutableMap.of("useCache", "false", "populateCache", "false")).randomQueryId().build(), Intervals.of("2011-01-01/2011-01-02"), makeTimeResults(DateTimes.of("2011-01-01"), 50, 5000));
    Assert.assertEquals(0, cache.getStats().getNumEntries());
    Assert.assertEquals(0, cache.getStats().getNumHits());
    Assert.assertEquals(0, cache.getStats().getNumMisses());
    testQueryCaching(getDefaultQueryRunner(), 1, false, builder.context(ImmutableMap.of("useCache", "true", "populateCache", "false")).randomQueryId().build(), Intervals.of("2011-01-01/2011-01-02"), makeTimeResults(DateTimes.of("2011-01-01"), 50, 5000));
    Assert.assertEquals(0, cache.getStats().getNumEntries());
    Assert.assertEquals(0, cache.getStats().getNumHits());
    Assert.assertEquals(1, cache.getStats().getNumMisses());
}
Also used : FinalizeResultsQueryRunner(org.apache.druid.query.FinalizeResultsQueryRunner) Druids(org.apache.druid.query.Druids) TimeseriesQueryQueryToolChest(org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest) FinalizeResultsQueryRunner(org.apache.druid.query.FinalizeResultsQueryRunner) QueryRunner(org.apache.druid.query.QueryRunner) Test(org.junit.Test)

Aggregations

TimeseriesQueryQueryToolChest (org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest)71 TimeseriesQuery (org.apache.druid.query.timeseries.TimeseriesQuery)62 Test (org.junit.Test)62 CountAggregatorFactory (org.apache.druid.query.aggregation.CountAggregatorFactory)41 FinalizeResultsQueryRunner (org.apache.druid.query.FinalizeResultsQueryRunner)21 TimeseriesQueryEngine (org.apache.druid.query.timeseries.TimeseriesQueryEngine)20 TimeseriesQueryRunnerFactory (org.apache.druid.query.timeseries.TimeseriesQueryRunnerFactory)20 QueryRunner (org.apache.druid.query.QueryRunner)18 LongSumAggregatorFactory (org.apache.druid.query.aggregation.LongSumAggregatorFactory)18 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)18 FieldAccessPostAggregator (org.apache.druid.query.aggregation.post.FieldAccessPostAggregator)17 TimeseriesResultValue (org.apache.druid.query.timeseries.TimeseriesResultValue)17 Result (org.apache.druid.query.Result)15 FinalizingFieldAccessPostAggregator (org.apache.druid.query.aggregation.post.FinalizingFieldAccessPostAggregator)13 IOException (java.io.IOException)11 Druids (org.apache.druid.query.Druids)10 SpatialDimFilter (org.apache.druid.query.filter.SpatialDimFilter)9 ConstantPostAggregator (org.apache.druid.query.aggregation.post.ConstantPostAggregator)8 AggregatorFactory (org.apache.druid.query.aggregation.AggregatorFactory)6 SelectorDimFilter (org.apache.druid.query.filter.SelectorDimFilter)6