[MINOR] Reuse random object (#1222)
This commit is contained in:
committed by
vinoth chandar
parent
c1f8acab34
commit
fd8f1c70c0
@@ -53,6 +53,7 @@ public class TestHoodieCompactionStrategy {
|
||||
|
||||
private static final long MB = 1024 * 1024L;
|
||||
private String[] partitionPaths = {"2017/01/01", "2017/01/02", "2017/01/03"};
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
@Test
|
||||
public void testUnBounded() {
|
||||
@@ -228,7 +229,7 @@ public class TestHoodieCompactionStrategy {
|
||||
private List<HoodieCompactionOperation> createCompactionOperations(HoodieWriteConfig config,
|
||||
Map<Long, List<Long>> sizesMap) {
|
||||
Map<Long, String> keyToPartitionMap = sizesMap.keySet().stream()
|
||||
.map(e -> Pair.of(e, partitionPaths[new Random().nextInt(partitionPaths.length - 1)]))
|
||||
.map(e -> Pair.of(e, partitionPaths[RANDOM.nextInt(partitionPaths.length - 1)]))
|
||||
.collect(Collectors.toMap(Pair::getKey, Pair::getValue));
|
||||
return createCompactionOperations(config, sizesMap, keyToPartitionMap);
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ import static org.junit.Assert.fail;
|
||||
*/
|
||||
public class TestHoodieDeltaStreamer extends UtilitiesTestBase {
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
private static final String PROPS_FILENAME_TEST_SOURCE = "test-source.properties";
|
||||
private static final String PROPS_FILENAME_TEST_INVALID = "test-invalid.properties";
|
||||
private static final Logger LOG = LogManager.getLogger(TestHoodieDeltaStreamer.class);
|
||||
@@ -634,7 +635,7 @@ public class TestHoodieDeltaStreamer extends UtilitiesTestBase {
|
||||
*/
|
||||
@Override
|
||||
public Double call(Double lat1, Double lat2, Double lon1, Double lon2) {
|
||||
return new Random().nextDouble();
|
||||
return RANDOM.nextDouble();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user