fix exception during timeboundary

Fix Exception during time boundary query where results can be
represented as integers
This commit is contained in:
nishant 2015-04-22 23:04:51 +05:30
parent f5943ed494
commit 958b34e0c2
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)
);
}
}