Search in sources :

Example 1 with IntegerPartitionChunk

use of org.apache.druid.timeline.partition.IntegerPartitionChunk in project druid by druid-io.

the class VersionedIntervalTimelineSpecificDataTest method testFindChunk.

@Test
public void testFindChunk() {
    assertSingleElementChunks(makeSingle("1", 1), timeline.findChunk(Intervals.of("2011-10-01/2011-10-02"), "1", 0));
    assertSingleElementChunks(makeSingle("1", 1), timeline.findChunk(Intervals.of("2011-10-01/2011-10-01T10"), "1", 0));
    assertSingleElementChunks(makeSingle("1", 1), timeline.findChunk(Intervals.of("2011-10-01T02/2011-10-02"), "1", 0));
    assertSingleElementChunks(makeSingle("1", 1), timeline.findChunk(Intervals.of("2011-10-01T04/2011-10-01T17"), "1", 0));
    IntegerPartitionChunk<OvershadowableInteger> expected = IntegerPartitionChunk.make(10, null, 1, new OvershadowableInteger("3", 1, 21));
    IntegerPartitionChunk<OvershadowableInteger> actual = (IntegerPartitionChunk<OvershadowableInteger>) timeline.findChunk(Intervals.of("2011-10-02/2011-10-03"), "3", 1);
    Assert.assertEquals(expected, actual);
    Assert.assertEquals(expected.getObject(), actual.getObject());
    Assert.assertEquals(null, timeline.findChunk(Intervals.of("2011-10-01T04/2011-10-01T17"), "1", 1));
    Assert.assertEquals(null, timeline.findChunk(Intervals.of("2011-10-01T04/2011-10-01T17"), "2", 0));
    Assert.assertEquals(null, timeline.findChunk(Intervals.of("2011-10-01T04/2011-10-02T17"), "1", 0));
    Assert.assertEquals(null, timeline.findChunk(Intervals.of("2011-10-01T04/2011-10-02T17"), "1", 0));
}
Also used : IntegerPartitionChunk(org.apache.druid.timeline.partition.IntegerPartitionChunk) OvershadowableInteger(org.apache.druid.timeline.partition.OvershadowableInteger) Test(org.junit.Test)

Aggregations

IntegerPartitionChunk (org.apache.druid.timeline.partition.IntegerPartitionChunk)1 OvershadowableInteger (org.apache.druid.timeline.partition.OvershadowableInteger)1 Test (org.junit.Test)1