use of org.joda.time.Interval in project druid by druid-io.
the class QueryGranularityTest method testIterableMonth.
@Test
public void testIterableMonth() throws Exception {
final DateTimeZone tz = DateTimeZone.forID("America/Los_Angeles");
final DateTime baseTime = new DateTime("2012-11-03T10:00:00", tz);
assertSameInterval(Lists.newArrayList(new DateTime("2012-11-01T00:00:00.000-07:00"), new DateTime("2012-12-01T00:00:00.000-08:00"), new DateTime("2013-01-01T00:00:00.000-08:00"), new DateTime("2013-02-01T00:00:00.000-08:00")), new PeriodGranularity(new Period("P1M"), null, tz).getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Months.months(3)).getMillis())));
}
use of org.joda.time.Interval in project druid by druid-io.
the class QueryGranularityTest method testIterableWeek.
@Test
public void testIterableWeek() throws Exception {
final DateTimeZone tz = DateTimeZone.forID("America/Los_Angeles");
final DateTime baseTime = new DateTime("2012-11-03T10:00:00", tz);
assertSameInterval(Lists.newArrayList(new DateTime("2012-10-29T00:00:00.000-07:00"), new DateTime("2012-11-05T00:00:00.000-08:00"), new DateTime("2012-11-12T00:00:00.000-08:00"), new DateTime("2012-11-19T00:00:00.000-08:00")), new PeriodGranularity(new Period("P1W"), null, tz).getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Weeks.weeks(3)).getMillis())));
assertSameInterval(Lists.newArrayList(new DateTime("2012-11-03T10:00:00.000-07:00"), new DateTime("2012-11-10T10:00:00.000-08:00"), new DateTime("2012-11-17T10:00:00.000-08:00")), new PeriodGranularity(new Period("P1W"), baseTime, tz).getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Weeks.weeks(3)).getMillis())));
}
use of org.joda.time.Interval in project druid by druid-io.
the class QueryGranularityTest method testIterableAllComplex.
@Test
public void testIterableAllComplex() throws Exception {
final DateTime baseTime = new DateTime("2011-01-01T09:38:02.992Z");
assertSameInterval(Lists.newArrayList(baseTime), Granularities.ALL.getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Days.days(3)).getMillis())));
}
use of org.joda.time.Interval in project druid by druid-io.
the class QueryGranularityTest method testIterableDayComplex.
@Test
public void testIterableDayComplex() throws Exception {
final DateTime baseTime = new DateTime("2011-01-01T09:38:02.992Z");
assertSameInterval(Lists.newArrayList(new DateTime("2011-01-01T00:00:00.000Z"), new DateTime("2011-01-02T00:00:00.000Z"), new DateTime("2011-01-03T00:00:00.000Z"), new DateTime("2011-01-04T00:00:00.000Z")), Granularities.DAY.getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Days.days(3)).getMillis())));
}
use of org.joda.time.Interval in project druid by druid-io.
the class QueryGranularityTest method testIterableMinuteComplex.
@Test
public void testIterableMinuteComplex() throws Exception {
final DateTime baseTime = new DateTime("2011-01-01T09:38:02.992Z");
assertSameInterval(Lists.newArrayList(new DateTime("2011-01-01T09:38:00.000Z"), new DateTime("2011-01-01T09:39:00.000Z"), new DateTime("2011-01-01T09:40:00.000Z"), new DateTime("2011-01-01T09:41:00.000Z")), Granularities.MINUTE.getIterable(new Interval(baseTime.getMillis(), baseTime.plus(Minutes.THREE).getMillis())));
}
Aggregations