Search in sources :

Example 76 with DataSegment

use of io.druid.timeline.DataSegment in project druid by druid-io.

the class DruidCoordinatorSegmentMergerTest method testOverlappingMerge8.

@Test
public void testOverlappingMerge8() {
    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(120).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("1").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(4), segments.get(5))), merge(segments));
}
Also used : DataSegment(io.druid.timeline.DataSegment) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 77 with DataSegment

use of io.druid.timeline.DataSegment in project druid by druid-io.

the class DruidCoordinatorSegmentMergerTest method testMergeAtStart.

@Test
public void testMergeAtStart() {
    final List<DataSegment> segments = ImmutableList.of(DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-01/P1D")).version("2").size(20).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(20).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-04/P1D")).version("2").size(90).build());
    Assert.assertEquals(ImmutableList.of(ImmutableList.of(segments.get(0), segments.get(1))), merge(segments));
}
Also used : DataSegment(io.druid.timeline.DataSegment) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 78 with DataSegment

use of io.druid.timeline.DataSegment in project druid by druid-io.

the class DruidCoordinatorSegmentMergerTest method testMergeAtEnd.

@Test
public void testMergeAtEnd() {
    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(20).build());
    Assert.assertEquals(ImmutableList.of(ImmutableList.of(segments.get(2), segments.get(3))), merge(segments));
}
Also used : DataSegment(io.druid.timeline.DataSegment) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 79 with DataSegment

use of io.druid.timeline.DataSegment in project druid by druid-io.

the class DruidCoordinatorSegmentMergerTest method testOverlappingMerge6.

@Test
public void testOverlappingMerge6() {
    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("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 80 with DataSegment

use of io.druid.timeline.DataSegment in project druid by druid-io.

the class DruidCoordinatorSegmentMergerTest method testMergeLinearShardSpecs.

@Test
public void testMergeLinearShardSpecs() {
    final List<DataSegment> segments = ImmutableList.of(DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-01/P1D")).version("1").shardSpec(new LinearShardSpec(1)).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-02/P1D")).version("1").shardSpec(new LinearShardSpec(7)).build(), DataSegment.builder().dataSource("foo").interval(new Interval("2012-01-03/P1D")).version("1").shardSpec(new LinearShardSpec(1500)).build());
    Assert.assertEquals(ImmutableList.of(), merge(segments));
}
Also used : LinearShardSpec(io.druid.timeline.partition.LinearShardSpec) 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