Search in sources :

Example 1 with BuildingDimensionRangeShardSpec

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

the class SegmentPublisherHelperTest method testAnnotateCorePartitionSetSizeForDimensionRangeShardSpec.

@Test
public void testAnnotateCorePartitionSetSizeForDimensionRangeShardSpec() {
    final Set<DataSegment> segments = ImmutableSet.of(newSegment(new BuildingDimensionRangeShardSpec(0, Arrays.asList("dim1", "dim2"), null, StringTuple.create("a", "5"), 0)), newSegment(new BuildingDimensionRangeShardSpec(1, Arrays.asList("dim1", "dim2"), null, StringTuple.create("a", "5"), 1)), newSegment(new BuildingDimensionRangeShardSpec(2, Arrays.asList("dim1", "dim2"), null, StringTuple.create("a", "5"), 2)));
    final Set<DataSegment> annotated = SegmentPublisherHelper.annotateShardSpec(segments);
    for (DataSegment segment : annotated) {
        Assert.assertSame(DimensionRangeShardSpec.class, segment.getShardSpec().getClass());
        final DimensionRangeShardSpec shardSpec = (DimensionRangeShardSpec) segment.getShardSpec();
        Assert.assertEquals(3, shardSpec.getNumCorePartitions());
    }
}
Also used : BuildingDimensionRangeShardSpec(org.apache.druid.timeline.partition.BuildingDimensionRangeShardSpec) DataSegment(org.apache.druid.timeline.DataSegment) DimensionRangeShardSpec(org.apache.druid.timeline.partition.DimensionRangeShardSpec) BuildingDimensionRangeShardSpec(org.apache.druid.timeline.partition.BuildingDimensionRangeShardSpec) Test(org.junit.Test)

Aggregations

DataSegment (org.apache.druid.timeline.DataSegment)1 BuildingDimensionRangeShardSpec (org.apache.druid.timeline.partition.BuildingDimensionRangeShardSpec)1 DimensionRangeShardSpec (org.apache.druid.timeline.partition.DimensionRangeShardSpec)1 Test (org.junit.Test)1