use of org.apache.druid.server.QueryPrioritizationStrategy 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.server.QueryPrioritizationStrategy 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.server.QueryPrioritizationStrategy 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());
}
use of org.apache.druid.server.QueryPrioritizationStrategy in project druid by druid-io.
the class ThresholdBasedQueryPrioritizationStrategyTest method testPrioritizationDurationThresholdInsideDuration.
@Test
public void testPrioritizationDurationThresholdInsideDuration() {
QueryPrioritizationStrategy strategy = new ThresholdBasedQueryPrioritizationStrategy(null, "P7D", null, 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()).isPresent());
}
use of org.apache.druid.server.QueryPrioritizationStrategy in project druid by druid-io.
the class ThresholdBasedQueryPrioritizationStrategyTest method testPrioritizationDurationThresholdOutsideDuration.
@Test
public void testPrioritizationDurationThresholdOutsideDuration() {
QueryPrioritizationStrategy strategy = new ThresholdBasedQueryPrioritizationStrategy(null, "P7D", null, 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()).get());
}
Aggregations