use of org.apache.druid.java.util.common.granularity.IntervalsByGranularity in project druid by druid-io.
the class IntervalsByGranularityTest method testEmptyInput.
@Test
public void testEmptyInput() {
final List<Interval> inputIntervals = Collections.emptyList();
IntervalsByGranularity intervals = new IntervalsByGranularity(inputIntervals, Granularities.MONTH);
Assert.assertFalse(intervals.granularityIntervalsIterator().hasNext());
}
use of org.apache.druid.java.util.common.granularity.IntervalsByGranularity in project druid by druid-io.
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();
}
use of org.apache.druid.java.util.common.granularity.IntervalsByGranularity in project druid by apache.
the class IntervalsByGranularityTest method testCondenseForManyIntervals.
@Test
public void testCondenseForManyIntervals() {
// This method attempts to test that there are no issues when condensed is called
// with an iterator pointing to millions of intervals (since the version of condensed
// used here takes an interval iterator and does not materialize intervals)
Interval first = Intervals.of("2012-01-01T00Z/P1Y");
IntervalsByGranularity intervals = new IntervalsByGranularity(ImmutableList.of(first), Granularities.SECOND);
Assert.assertEquals(ImmutableList.of(Intervals.of("2012-01-01T00Z/2013-01-01T00Z")), ImmutableList.copyOf(JodaUtils.condensedIntervalsIterator(intervals.granularityIntervalsIterator())));
}
use of org.apache.druid.java.util.common.granularity.IntervalsByGranularity in project druid by apache.
the class IntervalsByGranularityTest method testSimpleEliminateRepeated.
@Test
public void testSimpleEliminateRepeated() {
final List<Interval> inputIntervals = ImmutableList.of(Intervals.of("2012-01-08T00Z/2012-01-11T00Z"), Intervals.of("2012-01-07T00Z/2012-01-08T00Z"), Intervals.of("2012-01-03T00Z/2012-01-04T00Z"), Intervals.of("2012-01-01T00Z/2012-01-03T00Z"));
IntervalsByGranularity intervals = new IntervalsByGranularity(inputIntervals, Granularities.MONTH);
Assert.assertEquals(ImmutableList.of(Intervals.of("2012-01-01T00Z/2012-02-01T00Z")), ImmutableList.copyOf(intervals.granularityIntervalsIterator()));
}
use of org.apache.druid.java.util.common.granularity.IntervalsByGranularity in project druid by apache.
the class IntervalsByGranularityTest method testOverlappingShouldThrow.
@Test
public void testOverlappingShouldThrow() {
List<Interval> inputIntervals = ImmutableList.of(Intervals.of("2013-01-01T00Z/2013-01-11T00Z"), Intervals.of("2013-01-05T00Z/2013-01-08T00Z"), Intervals.of("2013-01-07T00Z/2013-01-15T00Z"));
IntervalsByGranularity intervals = new IntervalsByGranularity(inputIntervals, Granularities.DAY);
Iterator<Interval> granularityIntervals = intervals.granularityIntervalsIterator();
long count = verifyIteratorAndReturnIntervalCount(granularityIntervals);
Assert.assertEquals(14, count);
}
Aggregations