use of org.apache.druid.java.util.common.granularity.IntervalsByGranularity in project druid by apache.
the class IntervalsByGranularityTest method testTrivialIntervalExplosion.
@Test
public void testTrivialIntervalExplosion() {
Interval first = Intervals.of("2013-01-01T00Z/2013-02-01T00Z");
Interval second = Intervals.of("2012-01-01T00Z/2012-02-01T00Z");
Interval third = Intervals.of("2002-01-01T00Z/2003-01-01T00Z");
IntervalsByGranularity intervals = new IntervalsByGranularity(ImmutableList.of(first, second, third), Granularities.DAY);
// get count:
Iterator<Interval> granularityIntervals = intervals.granularityIntervalsIterator();
long count = verifyIteratorAndReturnIntervalCount(granularityIntervals);
Assert.assertEquals(62 + 365, count);
granularityIntervals = intervals.granularityIntervalsIterator();
count = getCountWithNoHasNext(granularityIntervals);
Assert.assertEquals(62 + 365, count);
}
use of org.apache.druid.java.util.common.granularity.IntervalsByGranularity in project druid by apache.
the class IntervalsByGranularityTest method testRemoveThrowsException.
@Test(expected = UnsupportedOperationException.class)
public void testRemoveThrowsException() {
final List<Interval> inputIntervals = ImmutableList.of(Intervals.of("2015-01-08T00Z/2015-01-11T00Z"));
IntervalsByGranularity intervals = new IntervalsByGranularity(inputIntervals, Granularities.MONTH);
intervals.granularityIntervalsIterator().remove();
}
Aggregations