use of io.druid.timeline.DataSegment in project druid by druid-io.
the class DruidCoordinatorSegmentMergerTest method testNoMerges.
@Test
public void testNoMerges() {
final List<DataSegment> segments = ImmutableList.of(DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-01/P1D")).version("2").size(80).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-02/P1D")).version("2").size(80).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-03/P1D")).version("2").size(80).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-04/P1D")).version("2").size(80).build());
Assert.assertEquals(ImmutableList.of(), merge(segments));
}
use of io.druid.timeline.DataSegment in project druid by druid-io.
the class DruidCoordinatorSegmentMergerTest method testMergeMixedShardSpecs.
@Test
public void testMergeMixedShardSpecs() {
final List<DataSegment> segments = ImmutableList.of(DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-01/P1D")).version("1").build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-02/P1D")).version("1").build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-03/P1D")).version("1").shardSpec(new LinearShardSpec(1500)).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-04/P1D")).version("1").build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-05/P1D")).version("1").build());
Assert.assertEquals(ImmutableList.of(ImmutableList.of(segments.get(0), segments.get(1)), ImmutableList.of(segments.get(3), segments.get(4))), merge(segments));
}
use of io.druid.timeline.DataSegment in project druid by druid-io.
the class DruidCoordinatorSegmentMergerTest method testOverlappingMerge2.
@Test
public void testOverlappingMerge2() {
final List<DataSegment> segments = ImmutableList.of(DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-01/P1D")).version("2").size(15).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-02/P4D")).version("2").size(80).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-03/P1D")).version("3").size(25).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-04/P1D")).version("4").size(25).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-05/P1D")).version("3").size(25).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-06/P1D")).version("2").size(80).build());
Assert.assertEquals(ImmutableList.of(ImmutableList.of(segments.get(2), segments.get(3), segments.get(4))), merge(segments));
}
use of io.druid.timeline.DataSegment in project druid by druid-io.
the class DruidCoordinatorSegmentMergerTest method testOverlappingMerge5.
@Test
public void testOverlappingMerge5() {
final List<DataSegment> segments = ImmutableList.of(DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-01/P1D")).version("2").size(1).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-02/P4D")).version("2").size(80).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-03/P1D")).version("3").size(25).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-04/P1D")).version("1").size(25).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-05/P1D")).version("3").size(25).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-06/P1D")).version("2").size(80).build());
Assert.assertEquals(ImmutableList.of(), merge(segments));
}
use of io.druid.timeline.DataSegment in project druid by druid-io.
the class DruidCoordinatorSegmentMergerTest method testOverlappingMerge4.
@Test
public void testOverlappingMerge4() {
final List<DataSegment> segments = ImmutableList.of(DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-01/P1D")).version("2").size(80).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-02/P4D")).version("2").size(80).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-03/P1D")).version("3").size(1).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-04/P1D")).version("4").size(1).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-05/P1D")).version("3").size(1).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-06/P1D")).version("2").size(80).build());
Assert.assertEquals(ImmutableList.of(ImmutableList.of(segments.get(1), segments.get(2), segments.get(3), segments.get(4))), merge(segments));
}
Aggregations