Skip to content

Commit

Permalink
Merge remote-tracking branch 'apache/master' into upgrade-guice-to-5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshat-Jain committed Dec 17, 2024
2 parents 3882f02 + 98b960c commit a41d3b2
Show file tree
Hide file tree
Showing 649 changed files with 1,264 additions and 1,519 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ public class FlattenJSONBenchmark
public void prepare() throws Exception
{
FlattenJSONBenchmarkUtil gen = new FlattenJSONBenchmarkUtil();
flatInputs = new ArrayList<String>();
flatInputs = new ArrayList<>();
for (int i = 0; i < NUM_EVENTS; i++) {
flatInputs.add(gen.generateFlatEvent());
}
nestedInputs = new ArrayList<String>();
nestedInputs = new ArrayList<>();
for (int i = 0; i < NUM_EVENTS; i++) {
nestedInputs.add(gen.generateNestedEvent());
}
jqInputs = new ArrayList<String>();
jqInputs = new ArrayList<>();
for (int i = 0; i < NUM_EVENTS; i++) {
jqInputs.add(gen.generateNestedEvent()); // reuse the same event as "nested"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class GenericIndexedBenchmark

public static final int ITERATIONS = 10000;

static final ObjectStrategy<byte[]> BYTE_ARRAY_STRATEGY = new ObjectStrategy<byte[]>()
static final ObjectStrategy<byte[]> BYTE_ARRAY_STRATEGY = new ObjectStrategy<>()
{
@Override
public Class<byte[]> getClazz()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public class IncrementalIndexRowTypeBenchmark
private static AggregatorFactory[] aggs;
static final int DIMENSION_COUNT = 8;

private ArrayList<InputRow> longRows = new ArrayList<InputRow>();
private ArrayList<InputRow> floatRows = new ArrayList<InputRow>();
private ArrayList<InputRow> stringRows = new ArrayList<InputRow>();
private ArrayList<InputRow> longRows = new ArrayList<>();
private ArrayList<InputRow> floatRows = new ArrayList<>();
private ArrayList<InputRow> stringRows = new ArrayList<>();


static {
Expand All @@ -95,7 +95,7 @@ public class IncrementalIndexRowTypeBenchmark
private MapBasedInputRow getLongRow(long timestamp, int dimensionCount)
{
Random rng = ThreadLocalRandom.current();
List<String> dimensionList = new ArrayList<String>(dimensionCount);
List<String> dimensionList = new ArrayList<>(dimensionCount);
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
for (int i = 0; i < dimensionCount; i++) {
String dimName = StringUtils.format("Dim_%d", i);
Expand All @@ -108,7 +108,7 @@ private MapBasedInputRow getLongRow(long timestamp, int dimensionCount)
private MapBasedInputRow getFloatRow(long timestamp, int dimensionCount)
{
Random rng = ThreadLocalRandom.current();
List<String> dimensionList = new ArrayList<String>(dimensionCount);
List<String> dimensionList = new ArrayList<>(dimensionCount);
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
for (int i = 0; i < dimensionCount; i++) {
String dimName = StringUtils.format("Dim_%d", i);
Expand All @@ -121,7 +121,7 @@ private MapBasedInputRow getFloatRow(long timestamp, int dimensionCount)
private MapBasedInputRow getStringRow(long timestamp, int dimensionCount)
{
Random rng = ThreadLocalRandom.current();
List<String> dimensionList = new ArrayList<String>(dimensionCount);
List<String> dimensionList = new ArrayList<>(dimensionCount);
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
for (int i = 0; i < dimensionCount; i++) {
String dimName = StringUtils.format("Dim_%d", i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static class BenchmarkPool
private final AtomicLong numPools = new AtomicLong(0L);
private final NonBlockingPool<Object> pool = new StupidPool<>(
"simpleObject pool",
new Supplier<Object>()
new Supplier<>()
{
@Override
public Object get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public class OnheapIncrementalIndexBenchmark

private static MapBasedInputRow getLongRow(long timestamp, int rowID, int dimensionCount)
{
List<String> dimensionList = new ArrayList<String>(dimensionCount);
List<String> dimensionList = new ArrayList<>(dimensionCount);
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
for (int i = 0; i < dimensionCount; i++) {
String dimName = StringUtils.format("Dim_%d", i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ public void setup()
public void mergeHierarchical(Blackhole blackhole)
{
Iterator<Sequence<Integer>> iterator = sequences.iterator();
List<Sequence<Integer>> partialMerged = new ArrayList<Sequence<Integer>>();
List<Sequence<Integer>> toMerge = new ArrayList<Sequence<Integer>>();
List<Sequence<Integer>> partialMerged = new ArrayList<>();
List<Sequence<Integer>> toMerge = new ArrayList<>();

while (iterator.hasNext()) {
toMerge.add(iterator.next());
if (toMerge.size() == mergeAtOnce) {
partialMerged.add(new MergeSequence<Integer>(Ordering.natural(), Sequences.simple(toMerge)));
toMerge = new ArrayList<Sequence<Integer>>();
partialMerged.add(new MergeSequence<>(Ordering.natural(), Sequences.simple(toMerge)));
toMerge = new ArrayList<>();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public DataSegment move(DataSegment segment, Map<String, Object> targetLoadSpec)
.putAll(
Maps.filterKeys(
loadSpec,
new Predicate<String>()
new Predicate<>()
{
@Override
public boolean apply(String input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public boolean delete()
public Predicate<Throwable> shouldRetryPredicate()
{
// Yay! smart retries!
return new Predicate<Throwable>()
return new Predicate<>()
{
@Override
public boolean apply(Throwable e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static boolean isServiceExceptionRecoverable(OSSException ex)
return !badStatusCode && (isIOException || isTimeout);
}

public static final Predicate<Throwable> RETRYABLE = new Predicate<Throwable>()
public static final Predicate<Throwable> RETRYABLE = new Predicate<>()
{
@Override
public boolean apply(Throwable e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public CassandraStorage(CassandraDataSegmentConfig config)
this.config = config;
indexStorage = new CassandraChunkedStorageProvider(keyspace, INDEX_TABLE_NAME);

descriptorStorage = new ColumnFamily<String, String>(DESCRIPTOR_TABLE_NAME,
descriptorStorage = new ColumnFamily<>(DESCRIPTOR_TABLE_NAME,
StringSerializer.get(), StringSerializer.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class CloudFilesUtils
{

public static final Predicate<Throwable> CLOUDFILESRETRY = new Predicate<Throwable>()
public static final Predicate<Throwable> CLOUDFILESRETRY = new Predicate<>()
{
@Override
public boolean apply(Throwable e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public String getTypeName()
@Override
public ComplexMetricExtractor<CompressedBigDecimal> getExtractor()
{
return new ComplexMetricExtractor<CompressedBigDecimal>()
return new ComplexMetricExtractor<>()
{
@Override
public Class<CompressedBigDecimal> extractedClass()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public AggregatorFactory withName(String newName)
@Override
public AggregateCombiner<DDSketch> makeAggregateCombiner()
{
return new ObjectAggregateCombiner<DDSketch>()
return new ObjectAggregateCombiner<>()
{
private DDSketch combined = DDSketches.collapsingLowestDense(relativeError, numBins);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void setup()
{
pool = new CloseableStupidPool<>(
"TopNQueryEngine-bufferPool",
new Supplier<ByteBuffer>()
new Supplier<>()
{
@Override
public ByteBuffer get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public CloseableIterator<InputRowListPlusRawValues> sample()
{

CloseableIterator<InputRow> inner = read();
return new CloseableIterator<InputRowListPlusRawValues>()
return new CloseableIterator<>()
{
@Override
public void close() throws IOException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void testSerDeserKafkaEmitterConfigNullRequestTopic() throws IOException
@Test
public void testSerDeserKafkaEmitterConfigNullMetricsTopic() throws IOException
{
Set<KafkaEmitterConfig.EventType> eventTypeSet = new HashSet<KafkaEmitterConfig.EventType>();
Set<KafkaEmitterConfig.EventType> eventTypeSet = new HashSet<>();
eventTypeSet.add(KafkaEmitterConfig.EventType.SEGMENT_METADATA);
KafkaEmitterConfig kafkaEmitterConfig = new KafkaEmitterConfig(
"hostname",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ public TaskLocation getLocation()

runner.tasks.put(task.getId(), workItem);

ListenableFuture<InputStream> future = new ListenableFuture<InputStream>()
ListenableFuture<InputStream> future = new ListenableFuture<>()
{
@Override
public void addListener(Runnable runnable, Executor executor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void updateDerivatives()
private long getAvgSizePerGranularity(String datasource)
{
return connector.retryWithHandle(
new HandleCallback<Long>() {
new HandleCallback<>() {
Set<Interval> intervals = new HashSet<>();
long totalSize = 0;
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class MaterializedViewUtils
*/
public static Set<String> getRequiredFields(Query query)
{
Set<String> dimsInFilter = null == query.getFilter() ? new HashSet<String>() : query.getFilter().getRequiredColumns();
Set<String> dimsInFilter = null == query.getFilter() ? new HashSet<>() : query.getFilter().getRequiredColumns();
Set<String> dimensions = new HashSet<>(dimsInFilter);

if (query instanceof TopNQuery) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public QueryMetrics<? super MovingAverageQuery> makeMetrics(MovingAverageQuery q
public Function<Row, Row> makePostComputeManipulatorFn(MovingAverageQuery query, MetricManipulationFn fn)
{

return new Function<Row, Row>()
return new Function<>()
{

@Override
Expand Down Expand Up @@ -122,9 +122,7 @@ public Row apply(Row result)
@Override
public TypeReference<Row> getResultTypeReference()
{
return new TypeReference<Row>()
{
};
return new TypeReference<>() {};
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,7 @@ private Class<?> getExpectedQueryType()

private TypeReference<List<MapBasedRow>> getExpectedResultType()
{
return new TypeReference<List<MapBasedRow>>()
{
};
return new TypeReference<>() {};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class BaseAveragerFactoryTest
@Before
public void setup()
{
fac = new BaseAveragerFactory<Long, Long>("test", 5, "field", 1)
fac = new BaseAveragerFactory<>("test", 5, "field", 1)
{
@Override
public Averager<Long> createAverager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ protected boolean isEndOfShard(Long seqNum)
@Override
public TypeReference<List<SequenceMetadata<String, Long>>> getSequenceMetadataTypeReference()
{
return new TypeReference<List<SequenceMetadata<String, Long>>>() {
};
return new TypeReference<>() {};
}

@Nullable
Expand All @@ -149,8 +148,8 @@ protected TreeMap<Integer, Map<String, Long>> getCheckPointsFromContext(
log.debug("Got checkpoints from task context[%s].", checkpointsString);
return toolbox.getJsonMapper().readValue(
checkpointsString,
new TypeReference<TreeMap<Integer, Map<String, Long>>>() {
});
new TypeReference<>() {}
);
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public RabbitStreamRecordSupplier(
// stateSemaphore protects isRunning and consumers
stateSemaphore = new Semaphore(1, true);
isRunning = false;
consumers = new ArrayList<Consumer>();
consumers = new ArrayList<>();

this.password = null;
this.username = null;
Expand Down Expand Up @@ -238,7 +238,7 @@ private void removeOldAssignments(Set<StreamPartition<String>> streamPartitionst
Iterator<Map.Entry<String, ConsumerBuilder>> streamBuilderIterator = streamBuilders.entrySet().iterator();
while (streamBuilderIterator.hasNext()) {
Map.Entry<String, ConsumerBuilder> entry = streamBuilderIterator.next();
StreamPartition<String> comparitor = new StreamPartition<String>(getStreamFromSubstream(entry.getKey()), entry.getKey());
StreamPartition<String> comparitor = new StreamPartition<>(getStreamFromSubstream(entry.getKey()), entry.getKey());
if (!streamPartitionstoKeep.contains(comparitor)) {
streamBuilderIterator.remove();
}
Expand All @@ -247,7 +247,7 @@ private void removeOldAssignments(Set<StreamPartition<String>> streamPartitionst
Iterator<Map.Entry<String, OffsetSpecification>> offsetIterator = offsetMap.entrySet().iterator();
while (offsetIterator.hasNext()) {
Map.Entry<String, OffsetSpecification> entry = offsetIterator.next();
StreamPartition<String> comparitor = new StreamPartition<String>(getStreamFromSubstream(entry.getKey()), entry.getKey());
StreamPartition<String> comparitor = new StreamPartition<>(getStreamFromSubstream(entry.getKey()), entry.getKey());
if (!streamPartitionstoKeep.contains(comparitor)) {
offsetIterator.remove();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@
*/
public class RabbitStreamSupervisor extends SeekableStreamSupervisor<String, Long, ByteEntity>
{
public static final TypeReference<TreeMap<Integer, Map<String, Long>>> CHECKPOINTS_TYPE_REF = new TypeReference<TreeMap<Integer, Map<String, Long>>>() {
};
public static final TypeReference<TreeMap<Integer, Map<String, Long>>> CHECKPOINTS_TYPE_REF = new TypeReference<>() {};

private static final EmittingLogger log = new EmittingLogger(RabbitStreamSupervisor.class);
private static final Long NOT_SET = -1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public void testSerializeAndDeserialize() throws IOException
histogram.add(32, 4294967295L);
histogram.add(33, 4294967296L);

ColumnValueSelector<SpectatorHistogram> selector = new ColumnValueSelector<SpectatorHistogram>()
ColumnValueSelector<SpectatorHistogram> selector = new ColumnValueSelector<>()
{
private int callCount = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public Void insertOrUpdate(
final byte[] value)
{
return getDBI().withHandle(
new HandleCallback<Void>()
new HandleCallback<>()
{
@Override
public Void withHandle(Handle handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ThriftDeserialization
private static final Logger log = LoggerFactory.getLogger(ThriftDeserialization.class);


private static final ThreadLocal<TDeserializer> DESERIALIZER_COMPACT = new ThreadLocal<TDeserializer>()
private static final ThreadLocal<TDeserializer> DESERIALIZER_COMPACT = new ThreadLocal<>()
{
@Override
protected TDeserializer initialValue()
Expand All @@ -48,7 +48,7 @@ protected TDeserializer initialValue()
}
};

private static final ThreadLocal<TDeserializer> DESERIALIZER_BINARY = new ThreadLocal<TDeserializer>()
private static final ThreadLocal<TDeserializer> DESERIALIZER_BINARY = new ThreadLocal<>()
{
@Override
protected TDeserializer initialValue()
Expand All @@ -57,7 +57,7 @@ protected TDeserializer initialValue()
}
};

private static final ThreadLocal<TDeserializer> DESERIALIZER_JSON = new ThreadLocal<TDeserializer>()
private static final ThreadLocal<TDeserializer> DESERIALIZER_JSON = new ThreadLocal<>()
{
@Override
protected TDeserializer initialValue()
Expand All @@ -66,7 +66,7 @@ protected TDeserializer initialValue()
}
};

public static final ThreadLocal<TSerializer> SERIALIZER_SIMPLE_JSON = new ThreadLocal<TSerializer>()
public static final ThreadLocal<TSerializer> SERIALIZER_SIMPLE_JSON = new ThreadLocal<>()
{
@Override
protected TSerializer initialValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected CloseableIterator<GenericRecord> intermediateRowIterator() throws IOEx
datumReader.setExpected(readerSchema);
closer.register(dataFileReader);

return new CloseableIterator<GenericRecord>()
return new CloseableIterator<>()
{
@Override
public boolean hasNext()
Expand Down
Loading

0 comments on commit a41d3b2

Please sign in to comment.