Skip to content

Commit

Permalink
Replace the deprecated usage of NoneShardSpec (apache#3166)
Browse files Browse the repository at this point in the history
  • Loading branch information
HyukjinKwon authored and gianm committed Jun 25, 2016
1 parent 4cc39b2 commit 45f553f
Show file tree
Hide file tree
Showing 65 changed files with 91 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void shouldNotHaveColonsInHdfsStorageDir() throws Exception {
loadSpec,
Arrays.asList("dim1", "dim2"),
Arrays.asList("met1", "met2"),
new NoneShardSpec(),
NoneShardSpec.instance(),
null,
1
);
Expand Down
4 changes: 2 additions & 2 deletions api/src/test/java/io/druid/timeline/DataSegmentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void testV1Serialization() throws Exception
loadSpec,
Arrays.asList("dim1", "dim2"),
Arrays.asList("met1", "met2"),
new NoneShardSpec(),
NoneShardSpec.instance(),
TEST_VERSION,
1
);
Expand Down Expand Up @@ -152,7 +152,7 @@ public void testIdentifier()
.dataSource("foo")
.interval(new Interval("2012-01-01/2012-01-02"))
.version(new DateTime("2012-01-01T11:22:33.444Z").toString())
.shardSpec(new NoneShardSpec())
.shardSpec(NoneShardSpec.instance())
.build();

Assert.assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class NoneShardSpecTest
@Test
public void testEqualsAndHashCode()
{
final ShardSpec one = new NoneShardSpec();
final ShardSpec two = new NoneShardSpec();
final ShardSpec one = NoneShardSpec.instance();
final ShardSpec two = NoneShardSpec.instance();
Assert.assertEquals(one, two);
Assert.assertEquals(one.hashCode(), two.hashCode());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,4 @@ public void queryMultiQueryableIndex(Blackhole blackhole) throws Exception
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class AzureDataSegmentKillerTest extends EasyMockSupport
ImmutableMap.<String, Object>of("containerName", containerName, "blobPath", blobPath),
null,
null,
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
1
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class AzureDataSegmentPullerTest extends EasyMockSupport
ImmutableMap.<String, Object>of("containerName", containerName, "blobPath", blobPath),
null,
null,
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
1
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class AzureDataSegmentPusherTest extends EasyMockSupport
ImmutableMap.<String, Object>of("containerName", containerName, "blobPath", blobPath),
null,
null,
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
1
);
Expand Down Expand Up @@ -99,7 +99,7 @@ public void testPush() throws Exception
Maps.<String, Object>newHashMap(),
Lists.<String>newArrayList(),
Lists.<String>newArrayList(),
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
size
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void testPush() throws Exception
Maps.<String, Object>newHashMap(),
Lists.<String>newArrayList(),
Lists.<String>newArrayList(),
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
size
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private DataSegment getSegmentWithPath(String path)
),
ImmutableList.of("product"),
ImmutableList.of("visited_sum", "unique_hosts"),
new NoneShardSpec(),
NoneShardSpec.instance(),
9,
12334
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void testPush() throws Exception
Maps.<String, Object>newHashMap(),
Lists.<String>newArrayList(),
Lists.<String>newArrayList(),
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
size
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class S3DataSegmentMoverTest
),
ImmutableList.of("dim1", "dim1"),
ImmutableList.of("metric1", "metric2"),
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
1
);
Expand Down Expand Up @@ -128,7 +128,7 @@ public void testIgnoresGoneButAlreadyMoved() throws Exception
),
ImmutableList.of("dim1", "dim1"),
ImmutableList.of("metric1", "metric2"),
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
1
), ImmutableMap.<String, Object>of("bucket", "DOES NOT EXIST", "baseKey", "baseKey"));
Expand All @@ -151,7 +151,7 @@ public void testFailsToMoveMissing() throws Exception
),
ImmutableList.of("dim1", "dim1"),
ImmutableList.of("metric1", "metric2"),
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
1
), ImmutableMap.<String, Object>of("bucket", "DOES NOT EXIST", "baseKey", "baseKey2"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void testPush() throws Exception
Maps.<String, Object>newHashMap(),
Lists.<String>newArrayList(),
Lists.<String>newArrayList(),
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
size
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public boolean run()

List<HadoopyShardSpec> actualSpecs = Lists.newArrayListWithExpectedSize(numberOfShards);
if (numberOfShards == 1) {
actualSpecs.add(new HadoopyShardSpec(new NoneShardSpec(), shardCount++));
actualSpecs.add(new HadoopyShardSpec(NoneShardSpec.instance(), shardCount++));
} else {
for (int i = 0; i < numberOfShards; ++i) {
actualSpecs.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ protected void innerReduce(
final ShardSpec shardSpec;

if (currentDimPartitions.partitions.isEmpty()) {
shardSpec = new NoneShardSpec();
shardSpec = NoneShardSpec.instance();
} else {
if (currentDimPartition.rows < config.getTargetPartitionSize() * SHARD_COMBINE_THRESHOLD) {
// Combine with previous shard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public boolean run()
shardSpecs.put(bucket, specs);
log.info("DateTime[%s], spec[%s]", bucket, specs);
} else {
final HadoopyShardSpec spec = new HadoopyShardSpec(new NoneShardSpec(), shardCount++);
final HadoopyShardSpec spec = new HadoopyShardSpec(NoneShardSpec.instance(), shardCount++);
shardSpecs.put(bucket, Lists.newArrayList(spec));
log.info("DateTime[%s], spec[%s]", bucket, spec);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public HadoopIngestionSpecUpdateDatasourcePathSpecSegmentsTest()
),
ImmutableList.of("host"),
ImmutableList.of("visited_sum", "unique_hosts"),
new NoneShardSpec(),
NoneShardSpec.instance(),
9,
2
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void setUp() throws Exception
),
ImmutableList.of("host"),
ImmutableList.of("visited_sum", "unique_hosts"),
new NoneShardSpec(),
NoneShardSpec.instance(),
9,
2
)
Expand All @@ -89,7 +89,7 @@ public void setUp() throws Exception
),
ImmutableList.of("host"),
ImmutableList.of("visited_sum", "unique_hosts"),
new NoneShardSpec(),
NoneShardSpec.instance(),
9,
11
)
Expand All @@ -105,7 +105,7 @@ public void setUp() throws Exception
),
ImmutableList.of("host"),
ImmutableList.of("visited_sum", "unique_hosts"),
new NoneShardSpec(),
NoneShardSpec.instance(),
9,
4
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testSerde() throws Exception
),
ImmutableList.of("host"),
ImmutableList.of("visited_sum", "unique_hosts"),
new NoneShardSpec(),
NoneShardSpec.instance(),
9,
12334
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class WindowedDataSegmentTest
),
ImmutableList.of("host"),
ImmutableList.of("visited_sum", "unique_hosts"),
new NoneShardSpec(),
NoneShardSpec.instance(),
9,
2
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public DatasourcePathSpecTest()
),
ImmutableList.of("product"),
ImmutableList.of("visited_sum", "unique_hosts"),
new NoneShardSpec(),
NoneShardSpec.instance(),
9,
12334
)
Expand All @@ -112,7 +112,7 @@ public DatasourcePathSpecTest()
),
ImmutableList.of("product"),
ImmutableList.of("visited_sum", "unique_hosts"),
new NoneShardSpec(),
NoneShardSpec.instance(),
9,
12335
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public TaskStatus run(TaskToolbox toolbox) throws Exception
shardSpecs.add(new HashBasedNumberedShardSpec(i, numShards, null, jsonMapper));
}
} else {
shardSpecs = ImmutableList.<ShardSpec>of(new NoneShardSpec());
shardSpecs = ImmutableList.<ShardSpec>of(NoneShardSpec.instance());
}
}
for (final ShardSpec shardSpec : shardSpecs) {
Expand Down Expand Up @@ -301,7 +301,7 @@ private List<ShardSpec> determinePartitions(
final List<ShardSpec> shardSpecs = Lists.newArrayList();

if (numberOfShards == 1) {
shardSpecs.add(new NoneShardSpec());
shardSpecs.add(NoneShardSpec.instance());
} else {
for (int i = 0; i < numberOfShards; ++i) {
shardSpecs.add(new HashBasedNumberedShardSpec(i, numberOfShards, null, jsonMapper));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private static DataSegment computeMergedSegment(
.interval(mergedInterval)
.version(version)
.binaryVersion(IndexIO.CURRENT_VERSION_ID)
.shardSpec(new NoneShardSpec())
.shardSpec(NoneShardSpec.instance())
.dimensions(Lists.newArrayList(mergedDimensions))
.metrics(Lists.newArrayList(mergedMetrics))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void testSerializationSimple() throws Exception
ImmutableMap.<String, Object>of(),
ImmutableList.<String>of(),
ImmutableList.<String>of(),
new NoneShardSpec(),
NoneShardSpec.instance(),
9,
102937
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class HadoopConverterTaskSerDeTest
private static final Map<String, Object> LOAD_SPEC = ImmutableMap.<String, Object>of("someKey", "someVal");
private static final List<String> DIMENSIONS = ImmutableList.of("dim1", "dim2");
private static final List<String> METRICS = ImmutableList.of("metric1", "metric2");
private static final ShardSpec SHARD_SPEC = new NoneShardSpec();
private static final ShardSpec SHARD_SPEC = NoneShardSpec.instance();
private static final int BINARY_VERSION = 34718;
private static final long SEGMENT_SIZE = 7483901348790L;
private static final IndexSpec INDEX_SPEC = new IndexSpec(new ConciseBitmapSerdeFactory(), "lz4", "lzf");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public Plumber findPlumber(
null,
null,
1,
new NoneShardSpec(),
NoneShardSpec.instance(),
indexSpec,
null,
0,
Expand Down Expand Up @@ -487,7 +487,7 @@ public void testSegmentConvetSerdeReflection() throws IOException
ImmutableMap.<String, Object>of(),
ImmutableList.of("dim1", "dim2"),
ImmutableList.of("metric1", "metric2"),
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
12345L
),
Expand All @@ -511,7 +511,7 @@ public void testSegmentConvertSerde() throws IOException
ImmutableMap.<String, Object>of(),
ImmutableList.of("dim1", "dim2"),
ImmutableList.of("metric1", "metric2"),
new NoneShardSpec(),
NoneShardSpec.instance(),
0,
12345L
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ public DataSegment apply(String input)
.version("2011-04-6T16:52:46.119-05:00")
.dimensions(ImmutableList.<String>of())
.metrics(ImmutableList.<String>of())
.shardSpec(new NoneShardSpec())
.shardSpec(NoneShardSpec.instance())
.binaryVersion(9)
.size(0)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ public void read(ByteBuffer buffer, ColumnBuilder builder, ColumnConfig columnCo
}
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private static String makeIdentifier(Interval interval, String version)
interval.getStart(),
interval.getEnd(),
version,
new NoneShardSpec()
NoneShardSpec.instance()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ protected WritableSupplier<IndexedMultivalue<IndexedInts>> fromByteBuffer(ByteBu
buffer, ByteOrder.nativeOrder()
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ private static QueryableIndex makeAppendedMMappedIndex(
Ordering.natural().nullsFirst()
);

ShardSpec noneShardSpec = new NoneShardSpec();
ShardSpec noneShardSpec = NoneShardSpec.instance();

for (int i = 0; i < intervals.size(); i++) {
timeline.add(intervals.get(i), i, noneShardSpec.createChunk(filesToMap.get(i)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ public void testWriteEmpty() throws Exception
vals = new int[0];
checkSerializedSizeAndData(2);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,4 @@ public void testEmpty() throws Exception
vals = new ArrayList<>();
checkSerializedSizeAndData(1, 2);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@ public void testEmpty() throws Exception
vals = new int[0];
checkSerializedSizeAndData(2);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ public void testWriteEmpty() throws Exception
vals = new int[0];
checkSerializedSizeAndData();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ public void run()

Assert.assertEquals(0, checkFailedCount.get());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class RealtimeTuningConfig implements TuningConfig, AppenderatorConfig
private static final VersioningPolicy defaultVersioningPolicy = new IntervalStartVersioningPolicy();
private static final RejectionPolicyFactory defaultRejectionPolicyFactory = new ServerTimeRejectionPolicyFactory();
private static final int defaultMaxPendingPersists = 0;
private static final ShardSpec defaultShardSpec = new NoneShardSpec();
private static final ShardSpec defaultShardSpec = NoneShardSpec.instance();
private static final IndexSpec defaultIndexSpec = new IndexSpec();
private static final Boolean defaultBuildV9Directly = Boolean.FALSE;
private static final Boolean defaultReportParseExceptions = Boolean.FALSE;
Expand Down
Loading

0 comments on commit 45f553f

Please sign in to comment.