use of org.apache.druid.query.timeseries.TimeseriesQuery in project druid by druid-io.
the class HiLoQueryLaningStrategyTest method testLaningNoPriority.
@Test
public void testLaningNoPriority() {
TimeseriesQuery query = queryBuilder.build();
Assert.assertFalse(strategy.computeLane(QueryPlus.wrap(query), ImmutableSet.of()).isPresent());
}
use of org.apache.druid.query.timeseries.TimeseriesQuery in project druid by druid-io.
the class NoQueryLaningStrategyTest method testPreservesManualLaneFromContext.
@Test
public void testPreservesManualLaneFromContext() {
final String someLane = "some-lane";
TimeseriesQuery query = queryBuilder.context(ImmutableMap.of(QueryContexts.PRIORITY_KEY, 100, QueryContexts.LANE_KEY, someLane)).build();
Assert.assertEquals(someLane, strategy.computeLane(QueryPlus.wrap(query), ImmutableSet.of()).get());
}
use of org.apache.druid.query.timeseries.TimeseriesQuery in project druid by druid-io.
the class ThresholdBasedQueryPrioritizationStrategyTest method testPrioritizationSegmentCountWithinThreshold.
@Test
public void testPrioritizationSegmentCountWithinThreshold() {
QueryPrioritizationStrategy strategy = new ThresholdBasedQueryPrioritizationStrategy(null, null, 2, adjustment);
DateTime startDate = DateTimes.nowUtc().minusDays(1);
DateTime endDate = DateTimes.nowUtc();
TimeseriesQuery query = queryBuilder.intervals(ImmutableList.of(new Interval(startDate, endDate))).granularity(Granularities.MINUTE).context(ImmutableMap.of()).build();
Assert.assertFalse(strategy.computePriority(QueryPlus.wrap(query), ImmutableSet.of(EasyMock.createMock(SegmentServerSelector.class))).isPresent());
}
use of org.apache.druid.query.timeseries.TimeseriesQuery in project druid by druid-io.
the class ThresholdBasedQueryPrioritizationStrategyTest method testPrioritizationSegmentCountOverThreshold.
@Test
public void testPrioritizationSegmentCountOverThreshold() {
QueryPrioritizationStrategy strategy = new ThresholdBasedQueryPrioritizationStrategy(null, null, 2, adjustment);
DateTime startDate = DateTimes.nowUtc().minusDays(20);
DateTime endDate = DateTimes.nowUtc();
TimeseriesQuery query = queryBuilder.intervals(ImmutableList.of(new Interval(startDate, endDate))).granularity(Granularities.HOUR).context(ImmutableMap.of()).build();
Assert.assertEquals(-adjustment, (int) strategy.computePriority(QueryPlus.wrap(query), ImmutableSet.of(EasyMock.createMock(SegmentServerSelector.class), EasyMock.createMock(SegmentServerSelector.class), EasyMock.createMock(SegmentServerSelector.class))).get());
}
use of org.apache.druid.query.timeseries.TimeseriesQuery in project druid by druid-io.
the class ThresholdBasedQueryPrioritizationStrategyTest method testPrioritizationPeriodThresholdOutsidePeriod.
@Test
public void testPrioritizationPeriodThresholdOutsidePeriod() {
QueryPrioritizationStrategy strategy = new ThresholdBasedQueryPrioritizationStrategy("P90D", null, null, adjustment);
DateTime startDate = DateTimes.nowUtc().minusDays(100);
DateTime endDate = DateTimes.nowUtc().minusDays(80);
TimeseriesQuery query = queryBuilder.intervals(ImmutableList.of(new Interval(startDate, endDate))).granularity(Granularities.HOUR).context(ImmutableMap.of()).build();
Assert.assertEquals(-adjustment, (int) strategy.computePriority(QueryPlus.wrap(query), ImmutableSet.of()).get());
}
Aggregations