diff --git a/processing/src/test/java/io/druid/query/TimewarpOperatorTest.java b/processing/src/test/java/io/druid/query/TimewarpOperatorTest.java index f1703e8099c..dc17ba61cb3 100644 --- a/processing/src/test/java/io/druid/query/TimewarpOperatorTest.java +++ b/processing/src/test/java/io/druid/query/TimewarpOperatorTest.java @@ -165,4 +165,52 @@ public class TimewarpOperatorTest ); } + + @Test + public void testEmptyFutureInterval() throws Exception + { + QueryRunner> queryRunner = testOperator.postProcess( + new QueryRunner>() + { + @Override + public Sequence> run(Query> query) + { + return Sequences.simple( + ImmutableList.of( + new Result<>( + query.getIntervals().get(0).getStart(), + new TimeseriesResultValue(ImmutableMap.of("metric", 2)) + ), + new Result<>( + query.getIntervals().get(0).getEnd(), + new TimeseriesResultValue(ImmutableMap.of("metric", 3)) + ) + ) + ); + } + }, + new DateTime("2014-08-02").getMillis() + ); + + final Query> query = + Druids.newTimeseriesQueryBuilder() + .dataSource("dummy") + .intervals("2014-08-06/2014-08-08") + .aggregators(Arrays.asList(new CountAggregatorFactory("count"))) + .build(); + + Assert.assertEquals( + Lists.newArrayList( + new Result<>( + new DateTime("2014-08-02"), + new TimeseriesResultValue(ImmutableMap.of("metric", 2)) + ), + new Result<>( + new DateTime("2014-08-02"), + new TimeseriesResultValue(ImmutableMap.of("metric", 3)) + ) + ), + Sequences.toList(queryRunner.run(query), Lists.>newArrayList()) + ); + } }