Search in sources :

Example 71 with DataSegment

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));
}
Also used : DataSegment(io.druid.timeline.DataSegment) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 72 with DataSegment

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));
}
Also used : LinearShardSpec(io.druid.timeline.partition.LinearShardSpec) DataSegment(io.druid.timeline.DataSegment) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 73 with DataSegment

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));
}
Also used : DataSegment(io.druid.timeline.DataSegment) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 74 with DataSegment

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));
}
Also used : DataSegment(io.druid.timeline.DataSegment) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 75 with DataSegment

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));
}
Also used : DataSegment(io.druid.timeline.DataSegment) Interval(org.joda.time.Interval) Test(org.junit.Test)

Aggregations

DataSegment (io.druid.timeline.DataSegment)293 Test (org.junit.Test)151 Interval (org.joda.time.Interval)136 File (java.io.File)56 DateTime (org.joda.time.DateTime)52 IOException (java.io.IOException)37 DruidServer (io.druid.client.DruidServer)36 Map (java.util.Map)35 DruidDataSource (io.druid.client.DruidDataSource)19 ListeningExecutorService (com.google.common.util.concurrent.ListeningExecutorService)18 List (java.util.List)17 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)16 Rule (io.druid.server.coordinator.rules.Rule)16 ImmutableMap (com.google.common.collect.ImmutableMap)15 ForeverLoadRule (io.druid.server.coordinator.rules.ForeverLoadRule)14 IntervalDropRule (io.druid.server.coordinator.rules.IntervalDropRule)13 IntervalLoadRule (io.druid.server.coordinator.rules.IntervalLoadRule)13 CountDownLatch (java.util.concurrent.CountDownLatch)13 GET (javax.ws.rs.GET)13 Produces (javax.ws.rs.Produces)13