Merge pull request #1303 from metamx/fix-timeboundary-caching

add test for exception during timeboundary
This commit is contained in:
Xavier Léauté 2015-04-23 14:46:25 -07:00
commit 7081c830e4
1 changed files with 66 additions and 0 deletions

View File

@ -2295,4 +2295,70 @@ public class CachingClusteredClientTest
return expectations.iterator();
}
}
@Test
public void testTimeBoundaryCachingWhenTimeIsInteger() throws Exception
{
testQueryCaching(
client,
Druids.newTimeBoundaryQueryBuilder()
.dataSource(CachingClusteredClientTest.DATA_SOURCE)
.intervals(CachingClusteredClientTest.SEG_SPEC)
.context(CachingClusteredClientTest.CONTEXT)
.build(),
new Interval("1970-01-01/1970-01-02"),
makeTimeBoundaryResult(new DateTime("1970-01-01"), new DateTime("1970-01-01"), new DateTime("1970-01-02")),
new Interval("1970-01-01/2011-01-03"),
makeTimeBoundaryResult(new DateTime("1970-01-02"), new DateTime("1970-01-02"), new DateTime("1970-01-03")),
new Interval("1970-01-01/2011-01-10"),
makeTimeBoundaryResult(new DateTime("1970-01-05"), new DateTime("1970-01-05"), new DateTime("1970-01-10")),
new Interval("1970-01-01/2011-01-10"),
makeTimeBoundaryResult(new DateTime("1970-01-05T01"), new DateTime("1970-01-05T01"), new DateTime("1970-01-10"))
);
testQueryCaching(
client,
Druids.newTimeBoundaryQueryBuilder()
.dataSource(CachingClusteredClientTest.DATA_SOURCE)
.intervals(CachingClusteredClientTest.SEG_SPEC)
.context(CachingClusteredClientTest.CONTEXT)
.bound(TimeBoundaryQuery.MAX_TIME)
.build(),
new Interval("1970-01-01/2011-01-02"),
makeTimeBoundaryResult(new DateTime("1970-01-01"), null, new DateTime("1970-01-02")),
new Interval("1970-01-01/2011-01-03"),
makeTimeBoundaryResult(new DateTime("1970-01-02"), null, new DateTime("1970-01-03")),
new Interval("1970-01-01/2011-01-10"),
makeTimeBoundaryResult(new DateTime("1970-01-05"), null, new DateTime("1970-01-10")),
new Interval("1970-01-01/2011-01-10"),
makeTimeBoundaryResult(new DateTime("1970-01-05T01"), null, new DateTime("1970-01-10"))
);
testQueryCaching(
client,
Druids.newTimeBoundaryQueryBuilder()
.dataSource(CachingClusteredClientTest.DATA_SOURCE)
.intervals(CachingClusteredClientTest.SEG_SPEC)
.context(CachingClusteredClientTest.CONTEXT)
.bound(TimeBoundaryQuery.MIN_TIME)
.build(),
new Interval("1970-01-01/2011-01-02"),
makeTimeBoundaryResult(new DateTime("1970-01-01"), new DateTime("1970-01-01"), null),
new Interval("1970-01-01/2011-01-03"),
makeTimeBoundaryResult(new DateTime("1970-01-02"), new DateTime("1970-01-02"), null),
new Interval("1970-01-01/1970-01-10"),
makeTimeBoundaryResult(new DateTime("1970-01-05"), new DateTime("1970-01-05"), null),
new Interval("1970-01-01/2011-01-10"),
makeTimeBoundaryResult(new DateTime("1970-01-05T01"), new DateTime("1970-01-05T01"), null)
);
}
}