diff --git a/benchmarks/src/main/java/org/apache/druid/benchmark/MergeSequenceBenchmark.java b/benchmarks/src/main/java/org/apache/druid/benchmark/MergeSequenceBenchmark.java index cc203fb5de4..bb15b896ddb 100644 --- a/benchmarks/src/main/java/org/apache/druid/benchmark/MergeSequenceBenchmark.java +++ b/benchmarks/src/main/java/org/apache/druid/benchmark/MergeSequenceBenchmark.java @@ -22,7 +22,6 @@ package org.apache.druid.benchmark; import com.google.common.collect.Lists; import com.google.common.collect.Ordering; import com.google.common.primitives.Ints; -import org.apache.druid.java.util.common.guava.Accumulator; import org.apache.druid.java.util.common.guava.MergeSequence; import org.apache.druid.java.util.common.guava.Sequence; import org.apache.druid.java.util.common.guava.Sequences; @@ -94,25 +93,14 @@ public class MergeSequenceBenchmark } if (!toMerge.isEmpty()) { - partialMerged.add(new MergeSequence(Ordering.natural(), Sequences.simple(toMerge))); + partialMerged.add(new MergeSequence<>(Ordering.natural(), Sequences.simple(toMerge))); } - MergeSequence mergeSequence = new MergeSequence( - Ordering.natural(), + MergeSequence mergeSequence = new MergeSequence<>( + Ordering.natural(), Sequences.simple(partialMerged) ); - Integer accumulate = mergeSequence.accumulate( - 0, new Accumulator() - { - @Override - public Integer accumulate(Integer accumulated, Integer in) - { - return accumulated + in; - } - } - ); + Integer accumulate = mergeSequence.accumulate(0, Integer::sum); blackhole.consume(accumulate); - - } @Benchmark @@ -120,20 +108,8 @@ public class MergeSequenceBenchmark @OutputTimeUnit(TimeUnit.MILLISECONDS) public void mergeFlat(final Blackhole blackhole) { - MergeSequence mergeSequence = new MergeSequence(Ordering.natural(), Sequences.simple(sequences)); - Integer accumulate = mergeSequence.accumulate( - 0, new Accumulator() - { - @Override - public Integer accumulate(Integer accumulated, Integer in) - { - return accumulated + in; - } - } - ); + MergeSequence mergeSequence = new MergeSequence<>(Ordering.natural(), Sequences.simple(sequences)); + Integer accumulate = mergeSequence.accumulate(0, Integer::sum); blackhole.consume(accumulate); - } - - } diff --git a/benchmarks/src/main/java/org/apache/druid/benchmark/query/QueryBenchmarkUtil.java b/benchmarks/src/main/java/org/apache/druid/benchmark/query/QueryBenchmarkUtil.java index fdde8bfedc0..d482504d101 100644 --- a/benchmarks/src/main/java/org/apache/druid/benchmark/query/QueryBenchmarkUtil.java +++ b/benchmarks/src/main/java/org/apache/druid/benchmark/query/QueryBenchmarkUtil.java @@ -42,11 +42,8 @@ public class QueryBenchmarkUtil Segment adapter ) { - return new FinalizeResultsQueryRunner( - new BySegmentQueryRunner( - segmentId, adapter.getDataInterval().getStart(), - factory.createRunner(adapter) - ), + return new FinalizeResultsQueryRunner<>( + new BySegmentQueryRunner<>(segmentId, adapter.getDataInterval().getStart(), factory.createRunner(adapter)), (QueryToolChest>) factory.getToolchest() ); } diff --git a/codestyle/checkstyle-suppressions.xml b/codestyle/checkstyle-suppressions.xml index 601a9ad7762..c1d9d3deca6 100644 --- a/codestyle/checkstyle-suppressions.xml +++ b/codestyle/checkstyle-suppressions.xml @@ -50,7 +50,8 @@ - + + diff --git a/codestyle/checkstyle.xml b/codestyle/checkstyle.xml index 8065c308189..1acafcd65ea 100644 --- a/codestyle/checkstyle.xml +++ b/codestyle/checkstyle.xml @@ -205,5 +205,63 @@ + + + + + + diff --git a/core/src/main/java/org/apache/druid/common/config/ConfigManager.java b/core/src/main/java/org/apache/druid/common/config/ConfigManager.java index f21742609b4..15108641af9 100644 --- a/core/src/main/java/org/apache/druid/common/config/ConfigManager.java +++ b/core/src/main/java/org/apache/druid/common/config/ConfigManager.java @@ -80,7 +80,10 @@ public class ConfigManager poller = new PollingCallable(); ScheduledExecutors.scheduleWithFixedDelay( - exec, new Duration(0), config.get().getPollDuration().toStandardDuration(), poller + exec, + new Duration(0), + config.get().getPollDuration().toStandardDuration(), + poller ); started = true; diff --git a/core/src/main/java/org/apache/druid/common/guava/CombiningSequence.java b/core/src/main/java/org/apache/druid/common/guava/CombiningSequence.java index 915a94934d7..33dd06421dc 100644 --- a/core/src/main/java/org/apache/druid/common/guava/CombiningSequence.java +++ b/core/src/main/java/org/apache/druid/common/guava/CombiningSequence.java @@ -72,9 +72,8 @@ public class CombiningSequence implements Sequence @Override public Yielder toYielder(OutType initValue, final YieldingAccumulator accumulator) { - final CombiningYieldingAccumulator combiningAccumulator = new CombiningYieldingAccumulator<>( - ordering, mergeFn, accumulator - ); + final CombiningYieldingAccumulator combiningAccumulator = + new CombiningYieldingAccumulator<>(ordering, mergeFn, accumulator); combiningAccumulator.setRetVal(initValue); Yielder baseYielder = baseSequence.toYielder(null, combiningAccumulator); diff --git a/core/src/main/java/org/apache/druid/data/input/impl/DimensionsSpec.java b/core/src/main/java/org/apache/druid/data/input/impl/DimensionsSpec.java index 3073976e0fd..b3373a40248 100644 --- a/core/src/main/java/org/apache/druid/data/input/impl/DimensionsSpec.java +++ b/core/src/main/java/org/apache/druid/data/input/impl/DimensionsSpec.java @@ -122,9 +122,7 @@ public class DimensionsSpec @JsonIgnore public List getSpatialDimensions() { - Iterable filteredList = Iterables.filter( - dimensions, NewSpatialDimensionSchema.class - ); + Iterable filteredList = Iterables.filter(dimensions, NewSpatialDimensionSchema.class); Iterable transformedList = Iterables.transform( filteredList, diff --git a/core/src/main/java/org/apache/druid/guice/DruidSecondaryModule.java b/core/src/main/java/org/apache/druid/guice/DruidSecondaryModule.java index 5968fa5f91a..cded7dda87c 100644 --- a/core/src/main/java/org/apache/druid/guice/DruidSecondaryModule.java +++ b/core/src/main/java/org/apache/druid/guice/DruidSecondaryModule.java @@ -91,12 +91,8 @@ public class DruidSecondaryModule implements Module mapper.setInjectableValues(new GuiceInjectableValues(injector)); mapper.setAnnotationIntrospectors( - new AnnotationIntrospectorPair( - guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector() - ), - new AnnotationIntrospectorPair( - guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector() - ) + new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), + new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()) ); } } diff --git a/core/src/main/java/org/apache/druid/guice/PolyBind.java b/core/src/main/java/org/apache/druid/guice/PolyBind.java index f5c1a9d32f7..e7e53b6c984 100644 --- a/core/src/main/java/org/apache/druid/guice/PolyBind.java +++ b/core/src/main/java/org/apache/druid/guice/PolyBind.java @@ -34,6 +34,7 @@ import org.apache.druid.guice.annotations.PublicApi; import org.apache.druid.java.util.common.StringUtils; import javax.annotation.Nullable; +import java.lang.annotation.Annotation; import java.lang.reflect.ParameterizedType; import java.util.Map; import java.util.Properties; @@ -122,13 +123,10 @@ public class PolyBind final TypeLiteral interfaceType = interfaceKey.getTypeLiteral(); if (interfaceKey.getAnnotation() != null) { - return MapBinder.newMapBinder( - binder, TypeLiteral.get(String.class), interfaceType, interfaceKey.getAnnotation() - ); + return MapBinder.newMapBinder(binder, TypeLiteral.get(String.class), interfaceType, interfaceKey.getAnnotation()); } else if (interfaceKey.getAnnotationType() != null) { - return MapBinder.newMapBinder( - binder, TypeLiteral.get(String.class), interfaceType, interfaceKey.getAnnotationType() - ); + Class annotationType = interfaceKey.getAnnotationType(); + return MapBinder.newMapBinder(binder, TypeLiteral.get(String.class), interfaceType, annotationType); } else { return MapBinder.newMapBinder(binder, TypeLiteral.get(String.class), interfaceType); } @@ -178,7 +176,7 @@ public class PolyBind if (key.getAnnotation() != null) { implsMap = (Map>) injector.getInstance(Key.get(mapType, key.getAnnotation())); } else if (key.getAnnotationType() != null) { - implsMap = (Map>) injector.getInstance(Key.get(mapType, key.getAnnotation())); + implsMap = (Map>) injector.getInstance(Key.get(mapType, key.getAnnotationType())); } else { implsMap = (Map>) injector.getInstance(Key.get(mapType)); } diff --git a/core/src/main/java/org/apache/druid/java/util/common/concurrent/Execs.java b/core/src/main/java/org/apache/druid/java/util/common/concurrent/Execs.java index e69e661108e..58cffb33c16 100644 --- a/core/src/main/java/org/apache/druid/java/util/common/concurrent/Execs.java +++ b/core/src/main/java/org/apache/druid/java/util/common/concurrent/Execs.java @@ -131,7 +131,12 @@ public class Execs queue = new SynchronousQueue<>(); } return new ThreadPoolExecutor( - 1, 1, 0L, TimeUnit.MILLISECONDS, queue, makeThreadFactory(nameFormat, priority), + 1, + 1, + 0L, + TimeUnit.MILLISECONDS, + queue, + makeThreadFactory(nameFormat, priority), new RejectedExecutionHandler() { @Override diff --git a/core/src/main/java/org/apache/druid/java/util/common/concurrent/ScheduledExecutors.java b/core/src/main/java/org/apache/druid/java/util/common/concurrent/ScheduledExecutors.java index 5368faa699d..a25d73e4c13 100644 --- a/core/src/main/java/org/apache/druid/java/util/common/concurrent/ScheduledExecutors.java +++ b/core/src/main/java/org/apache/druid/java/util/common/concurrent/ScheduledExecutors.java @@ -19,7 +19,6 @@ package org.apache.druid.java.util.common.concurrent; -import com.google.common.util.concurrent.ThreadFactoryBuilder; import org.apache.druid.java.util.common.lifecycle.Lifecycle; import org.apache.druid.java.util.common.logger.Logger; import org.joda.time.Duration; @@ -180,8 +179,6 @@ public class ScheduledExecutors public static ScheduledExecutorService fixed(int corePoolSize, String nameFormat) { - return Executors.newScheduledThreadPool( - corePoolSize, new ThreadFactoryBuilder().setDaemon(true).setNameFormat(nameFormat).build() - ); + return Executors.newScheduledThreadPool(corePoolSize, Execs.makeThreadFactory(nameFormat)); } } diff --git a/core/src/main/java/org/apache/druid/java/util/common/granularity/PeriodGranularity.java b/core/src/main/java/org/apache/druid/java/util/common/granularity/PeriodGranularity.java index 58741ef08b8..e8f88da949f 100644 --- a/core/src/main/java/org/apache/druid/java/util/common/granularity/PeriodGranularity.java +++ b/core/src/main/java/org/apache/druid/java/util/common/granularity/PeriodGranularity.java @@ -22,7 +22,6 @@ package org.apache.druid.java.util.common.granularity; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializable; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; @@ -428,9 +427,8 @@ public class PeriodGranularity extends Granularity implements JsonSerializable } @Override - public void serialize( - JsonGenerator jsonGenerator, SerializerProvider serializerProvider - ) throws IOException, JsonProcessingException + public void serialize(JsonGenerator jsonGenerator, SerializerProvider serializerProvider) + throws IOException { // Retain the same behavior as before #3850. // i.e. when Granularity class was an enum. @@ -448,8 +446,10 @@ public class PeriodGranularity extends Granularity implements JsonSerializable @Override public void serializeWithType( - JsonGenerator jsonGenerator, SerializerProvider serializerProvider, TypeSerializer typeSerializer - ) throws IOException, JsonProcessingException + JsonGenerator jsonGenerator, + SerializerProvider serializerProvider, + TypeSerializer typeSerializer + ) throws IOException { serialize(jsonGenerator, serializerProvider); } diff --git a/core/src/main/java/org/apache/druid/java/util/common/guava/FilteredSequence.java b/core/src/main/java/org/apache/druid/java/util/common/guava/FilteredSequence.java index 3b004c03861..d3851ae1a69 100644 --- a/core/src/main/java/org/apache/druid/java/util/common/guava/FilteredSequence.java +++ b/core/src/main/java/org/apache/druid/java/util/common/guava/FilteredSequence.java @@ -48,9 +48,8 @@ public class FilteredSequence implements Sequence @Override public Yielder toYielder(OutType initValue, YieldingAccumulator accumulator) { - final FilteringYieldingAccumulator filteringAccumulator = new FilteringYieldingAccumulator<>( - pred, accumulator - ); + final FilteringYieldingAccumulator filteringAccumulator = + new FilteringYieldingAccumulator<>(pred, accumulator); return wrapYielder(baseSequence.toYielder(initValue, filteringAccumulator), filteringAccumulator); } diff --git a/core/src/main/java/org/apache/druid/java/util/common/parsers/JSONToLowerParser.java b/core/src/main/java/org/apache/druid/java/util/common/parsers/JSONToLowerParser.java index a3d8f677617..5febd0c8ca2 100644 --- a/core/src/main/java/org/apache/druid/java/util/common/parsers/JSONToLowerParser.java +++ b/core/src/main/java/org/apache/druid/java/util/common/parsers/JSONToLowerParser.java @@ -82,9 +82,7 @@ public class JSONToLowerParser implements Parser private ArrayList fieldNames; - public JSONToLowerParser( - ObjectMapper objectMapper, Iterable fieldNames, Iterable exclude - ) + public JSONToLowerParser(ObjectMapper objectMapper, Iterable fieldNames, Iterable exclude) { this.objectMapper = objectMapper; if (fieldNames != null) { diff --git a/core/src/main/java/org/apache/druid/java/util/http/client/response/FullResponseHandler.java b/core/src/main/java/org/apache/druid/java/util/http/client/response/FullResponseHandler.java index 34a9c3ebd1f..982378807ee 100644 --- a/core/src/main/java/org/apache/druid/java/util/http/client/response/FullResponseHandler.java +++ b/core/src/main/java/org/apache/druid/java/util/http/client/response/FullResponseHandler.java @@ -71,9 +71,7 @@ public class FullResponseHandler implements HttpResponseHandler clientResponse, Throwable e - ) + public void exceptionCaught(ClientResponse clientResponse, Throwable e) { // Its safe to Ignore as the ClientResponse returned in handleChunk were unfinished } diff --git a/core/src/main/java/org/apache/druid/java/util/http/client/response/StatusResponseHandler.java b/core/src/main/java/org/apache/druid/java/util/http/client/response/StatusResponseHandler.java index 1da8095c9df..594acd22e05 100644 --- a/core/src/main/java/org/apache/druid/java/util/http/client/response/StatusResponseHandler.java +++ b/core/src/main/java/org/apache/druid/java/util/http/client/response/StatusResponseHandler.java @@ -70,9 +70,7 @@ public class StatusResponseHandler implements HttpResponseHandler clientResponse, Throwable e - ) + public void exceptionCaught(ClientResponse clientResponse, Throwable e) { // Its safe to Ignore as the ClientResponse returned in handleChunk were unfinished } diff --git a/core/src/main/java/org/apache/druid/java/util/metrics/SysMonitor.java b/core/src/main/java/org/apache/druid/java/util/metrics/SysMonitor.java index 3651be1779f..27bc9d2cbf5 100644 --- a/core/src/main/java/org/apache/druid/java/util/metrics/SysMonitor.java +++ b/core/src/main/java/org/apache/druid/java/util/metrics/SysMonitor.java @@ -313,7 +313,8 @@ public class SysMonitor extends FeedDefiningMonitor } if (du != null) { final Map stats = diff.to( - name, ImmutableMap.builder() + name, + ImmutableMap.builder() .put("sys/disk/read/size", du.getReadBytes()) .put("sys/disk/read/count", du.getReads()) .put("sys/disk/write/size", du.getWriteBytes()) @@ -379,7 +380,8 @@ public class SysMonitor extends FeedDefiningMonitor } if (netstat != null) { final Map stats = diff.to( - name, ImmutableMap.builder() + name, + ImmutableMap.builder() .put("sys/net/read/size", netstat.getRxBytes()) .put("sys/net/read/packets", netstat.getRxPackets()) .put("sys/net/read/errors", netstat.getRxErrors()) @@ -434,7 +436,8 @@ public class SysMonitor extends FeedDefiningMonitor final Cpu cpu = cpus[i]; final String name = Integer.toString(i); final Map stats = diff.to( - name, ImmutableMap.builder() + name, + ImmutableMap.builder() .put("user", cpu.getUser()) // user = Δuser / Δtotal .put("sys", cpu.getSys()) // sys = Δsys / Δtotal .put("nice", cpu.getNice()) // nice = Δnice / Δtotal diff --git a/core/src/main/java/org/apache/druid/segment/loading/DataSegmentFinder.java b/core/src/main/java/org/apache/druid/segment/loading/DataSegmentFinder.java index ce4ce3a3b5f..ccc13109963 100644 --- a/core/src/main/java/org/apache/druid/segment/loading/DataSegmentFinder.java +++ b/core/src/main/java/org/apache/druid/segment/loading/DataSegmentFinder.java @@ -61,7 +61,9 @@ public interface DataSegmentFinder * @param segmentModifiedAt segment modified timestamp */ static void putInMapRetainingNewest( - Map> timestampedSegments, DataSegment dataSegment, long segmentModifiedAt + Map> timestampedSegments, + DataSegment dataSegment, + long segmentModifiedAt ) { timestampedSegments.merge( diff --git a/core/src/test/java/org/apache/druid/TestObjectMapper.java b/core/src/test/java/org/apache/druid/TestObjectMapper.java index 719ca97565d..a552c4bdab8 100644 --- a/core/src/test/java/org/apache/druid/TestObjectMapper.java +++ b/core/src/test/java/org/apache/druid/TestObjectMapper.java @@ -20,7 +20,6 @@ package org.apache.druid; import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.MapperFeature; @@ -55,12 +54,12 @@ public class TestObjectMapper extends ObjectMapper { addSerializer(Interval.class, ToStringSerializer.instance); addDeserializer( - Interval.class, new StdDeserializer(Interval.class) + Interval.class, + new StdDeserializer(Interval.class) { @Override - public Interval deserialize( - JsonParser jsonParser, DeserializationContext deserializationContext - ) throws IOException, JsonProcessingException + public Interval deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException { return Intervals.of(jsonParser.getText()); } diff --git a/core/src/test/java/org/apache/druid/common/utils/UUIDUtilsTest.java b/core/src/test/java/org/apache/druid/common/utils/UUIDUtilsTest.java index 78c61bd9d56..2a6c366c5ed 100644 --- a/core/src/test/java/org/apache/druid/common/utils/UUIDUtilsTest.java +++ b/core/src/test/java/org/apache/druid/common/utils/UUIDUtilsTest.java @@ -57,7 +57,8 @@ public class UUIDUtilsTest args.add(new String[]{possibleArg}); } return Collections2.transform( - args, new Function() + args, + new Function() { @Override public Object[] apply(String[] input) diff --git a/core/src/test/java/org/apache/druid/guice/JsonConfiguratorTest.java b/core/src/test/java/org/apache/druid/guice/JsonConfiguratorTest.java index d6094aa1b4a..5c95fd202fd 100644 --- a/core/src/test/java/org/apache/druid/guice/JsonConfiguratorTest.java +++ b/core/src/test/java/org/apache/druid/guice/JsonConfiguratorTest.java @@ -65,7 +65,10 @@ public class JsonConfiguratorTest @Override public Set> validateValue( - Class beanType, String propertyName, Object value, Class... groups + Class beanType, + String propertyName, + Object value, + Class... groups ) { return ImmutableSet.of(); diff --git a/core/src/test/java/org/apache/druid/java/util/common/guava/UnsupportedSequence.java b/core/src/test/java/org/apache/druid/java/util/common/guava/UnsupportedSequence.java index 18cc457284c..c551c564b67 100644 --- a/core/src/test/java/org/apache/druid/java/util/common/guava/UnsupportedSequence.java +++ b/core/src/test/java/org/apache/druid/java/util/common/guava/UnsupportedSequence.java @@ -24,17 +24,13 @@ package org.apache.druid.java.util.common.guava; public class UnsupportedSequence implements Sequence { @Override - public OutType accumulate( - OutType initValue, Accumulator accumulator - ) + public OutType accumulate(OutType initValue, Accumulator accumulator) { throw new UnsupportedOperationException(); } @Override - public Yielder toYielder( - OutType initValue, YieldingAccumulator accumulator - ) + public Yielder toYielder(OutType initValue, YieldingAccumulator accumulator) { throw new UnsupportedOperationException(); } diff --git a/core/src/test/java/org/apache/druid/java/util/http/client/FriendlyServersTest.java b/core/src/test/java/org/apache/druid/java/util/http/client/FriendlyServersTest.java index 12b3e5f2ddb..2a47033c52c 100644 --- a/core/src/test/java/org/apache/druid/java/util/http/client/FriendlyServersTest.java +++ b/core/src/test/java/org/apache/druid/java/util/http/client/FriendlyServersTest.java @@ -246,7 +246,8 @@ public class FriendlyServersTest final ListenableFuture response2 = skepticalClient .go( new Request( - HttpMethod.GET, new URL(StringUtils.format("https://localhost:%d/", sslConnector.getLocalPort())) + HttpMethod.GET, + new URL(StringUtils.format("https://localhost:%d/", sslConnector.getLocalPort())) ), new StatusResponseHandler(StandardCharsets.UTF_8) ); diff --git a/core/src/test/java/org/apache/druid/math/expr/EvalTest.java b/core/src/test/java/org/apache/druid/math/expr/EvalTest.java index a63b9caeed6..70e1a955fc8 100644 --- a/core/src/test/java/org/apache/druid/math/expr/EvalTest.java +++ b/core/src/test/java/org/apache/druid/math/expr/EvalTest.java @@ -122,12 +122,8 @@ public class EvalTest Assert.assertFalse(evalLong("!9223372036854775807", bindings) > 0); Assert.assertEquals(3037000499L, evalLong("cast(sqrt(9223372036854775807), 'long')", bindings)); - Assert.assertEquals( - 1L, evalLong("if(x == 9223372036854775807, 1, 0)", bindings) - ); - Assert.assertEquals( - 0L, evalLong("if(x - 1 == 9223372036854775807, 1, 0)", bindings) - ); + Assert.assertEquals(1L, evalLong("if(x == 9223372036854775807, 1, 0)", bindings)); + Assert.assertEquals(0L, evalLong("if(x - 1 == 9223372036854775807, 1, 0)", bindings)); Assert.assertEquals(1271030400000L, evalLong("timestamp('2010-04-12')", bindings)); Assert.assertEquals(1270998000000L, evalLong("timestamp('2010-04-12T+09:00')", bindings)); diff --git a/core/src/test/java/org/apache/druid/segment/loading/NoopDataSegmentMover.java b/core/src/test/java/org/apache/druid/segment/loading/NoopDataSegmentMover.java index 60f0bbbf9ff..dec621a03c1 100644 --- a/core/src/test/java/org/apache/druid/segment/loading/NoopDataSegmentMover.java +++ b/core/src/test/java/org/apache/druid/segment/loading/NoopDataSegmentMover.java @@ -29,9 +29,7 @@ import java.util.Map; public class NoopDataSegmentMover implements DataSegmentMover { @Override - public DataSegment move( - DataSegment segment, Map targetLoadSpec - ) + public DataSegment move(DataSegment segment, Map targetLoadSpec) { return segment; } diff --git a/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/firehose/cloudfiles/StaticCloudFilesFirehoseFactory.java b/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/firehose/cloudfiles/StaticCloudFilesFirehoseFactory.java index c2b591a0857..b0a6cf7303b 100644 --- a/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/firehose/cloudfiles/StaticCloudFilesFirehoseFactory.java +++ b/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/firehose/cloudfiles/StaticCloudFilesFirehoseFactory.java @@ -97,8 +97,7 @@ public class StaticCloudFilesFirehoseFactory extends PrefetchableTextFilesFireho log.info("Retrieving file from region[%s], container[%s] and path [%s]", region, container, path ); - CloudFilesObjectApiProxy objectApi = new CloudFilesObjectApiProxy( - cloudFilesApi, region, container); + CloudFilesObjectApiProxy objectApi = new CloudFilesObjectApiProxy(cloudFilesApi, region, container); return new CloudFilesByteSource(objectApi, path); } diff --git a/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesDataSegmentPuller.java b/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesDataSegmentPuller.java index 47ceac57ab0..807b308a5b3 100644 --- a/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesDataSegmentPuller.java +++ b/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesDataSegmentPuller.java @@ -64,8 +64,10 @@ public class CloudFilesDataSegmentPuller } catch (IOException ioe) { log.warn( - ioe, "Failed to remove output directory [%s] for segment pulled from [%s]", - outDir.getAbsolutePath(), path + ioe, + "Failed to remove output directory [%s] for segment pulled from [%s]", + outDir.getAbsolutePath(), + path ); } throw new SegmentLoadingException(e, e.getMessage()); diff --git a/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesDataSegmentPusher.java b/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesDataSegmentPusher.java index 11d5352fa4a..cbe3236c77c 100644 --- a/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesDataSegmentPusher.java +++ b/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesDataSegmentPusher.java @@ -92,7 +92,9 @@ public class CloudFilesDataSegmentPusher implements DataSegmentPusher return CloudFilesUtils.retryCloudFilesOperation( () -> { CloudFilesObject segmentData = new CloudFilesObject( - segmentPath, outFile, objectApi.getRegion(), + segmentPath, + outFile, + objectApi.getRegion(), objectApi.getContainer() ); @@ -103,8 +105,10 @@ public class CloudFilesDataSegmentPusher implements DataSegmentPusher // runtime, and because Guava deletes methods over time, that causes incompatibilities. Files.write(descFile.toPath(), jsonMapper.writeValueAsBytes(inSegment)); CloudFilesObject descriptorData = new CloudFilesObject( - segmentPath, descFile, - objectApi.getRegion(), objectApi.getContainer() + segmentPath, + descFile, + objectApi.getRegion(), + objectApi.getContainer() ); log.info("Pushing %s.", descriptorData.getPath()); objectApi.put(descriptorData); diff --git a/extensions-contrib/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleDataSegmentPuller.java b/extensions-contrib/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleDataSegmentPuller.java index 67936c01330..9e24a29cc40 100644 --- a/extensions-contrib/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleDataSegmentPuller.java +++ b/extensions-contrib/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleDataSegmentPuller.java @@ -68,8 +68,10 @@ public class GoogleDataSegmentPuller implements URIDataPuller } catch (IOException ioe) { LOG.warn( - ioe, "Failed to remove output directory [%s] for segment pulled from [%s]", - outDir.getAbsolutePath(), path + ioe, + "Failed to remove output directory [%s] for segment pulled from [%s]", + outDir.getAbsolutePath(), + path ); } throw new SegmentLoadingException(e, e.getMessage()); diff --git a/extensions-contrib/kafka-eight-simpleConsumer/src/main/java/org/apache/druid/firehose/kafka/KafkaEightSimpleConsumerFirehoseFactory.java b/extensions-contrib/kafka-eight-simpleConsumer/src/main/java/org/apache/druid/firehose/kafka/KafkaEightSimpleConsumerFirehoseFactory.java index b56b99f68a7..afd135f81da 100644 --- a/extensions-contrib/kafka-eight-simpleConsumer/src/main/java/org/apache/druid/firehose/kafka/KafkaEightSimpleConsumerFirehoseFactory.java +++ b/extensions-contrib/kafka-eight-simpleConsumer/src/main/java/org/apache/druid/firehose/kafka/KafkaEightSimpleConsumerFirehoseFactory.java @@ -153,12 +153,14 @@ public class KafkaEightSimpleConsumerFirehoseFactory implements final Map lastOffsets = loadOffsetFromPreviousMetaData(lastCommit); for (Integer partition : partitionIdList) { - final KafkaSimpleConsumer kafkaSimpleConsumer = new KafkaSimpleConsumer( - feed, partition, clientId, brokerList, earliest - ); + final KafkaSimpleConsumer kafkaSimpleConsumer = + new KafkaSimpleConsumer(feed, partition, clientId, brokerList, earliest); Long startOffset = lastOffsets.get(partition); PartitionConsumerWorker worker = new PartitionConsumerWorker( - feed, kafkaSimpleConsumer, partition, startOffset == null ? -1 : startOffset + feed, + kafkaSimpleConsumer, + partition, + startOffset == null ? -1 : startOffset ); consumerWorkers.add(worker); } diff --git a/extensions-contrib/kafka-eight-simpleConsumer/src/main/java/org/apache/druid/firehose/kafka/KafkaSimpleConsumer.java b/extensions-contrib/kafka-eight-simpleConsumer/src/main/java/org/apache/druid/firehose/kafka/KafkaSimpleConsumer.java index 54b2af2ce57..ec204f9df4d 100644 --- a/extensions-contrib/kafka-eight-simpleConsumer/src/main/java/org/apache/druid/firehose/kafka/KafkaSimpleConsumer.java +++ b/extensions-contrib/kafka-eight-simpleConsumer/src/main/java/org/apache/druid/firehose/kafka/KafkaSimpleConsumer.java @@ -196,9 +196,7 @@ public class KafkaSimpleConsumer earliest ? kafka.api.OffsetRequest.EarliestTime() : kafka.api.OffsetRequest.LatestTime(), 1 ) ); - OffsetRequest request = new OffsetRequest( - requestInfo, kafka.api.OffsetRequest.CurrentVersion(), clientId - ); + OffsetRequest request = new OffsetRequest(requestInfo, kafka.api.OffsetRequest.CurrentVersion(), clientId); OffsetResponse response = null; try { response = consumer.getOffsetsBefore(request); @@ -323,7 +321,11 @@ public class KafkaSimpleConsumer catch (Exception e) { ensureNotInterrupted(e); log.warn( - e, "error communicating with Kafka Broker [%s] to find leader for [%s] - [%s]", broker, topic, partitionId + e, + "error communicating with Kafka Broker [%s] to find leader for [%s] - [%s]", + broker, + topic, + partitionId ); } finally { diff --git a/extensions-contrib/materialized-view-selection/src/test/java/org/apache/druid/query/materializedview/DatasourceOptimizerTest.java b/extensions-contrib/materialized-view-selection/src/test/java/org/apache/druid/query/materializedview/DatasourceOptimizerTest.java index 50e571e6df6..73b82cd8e60 100644 --- a/extensions-contrib/materialized-view-selection/src/test/java/org/apache/druid/query/materializedview/DatasourceOptimizerTest.java +++ b/extensions-contrib/materialized-view-selection/src/test/java/org/apache/druid/query/materializedview/DatasourceOptimizerTest.java @@ -261,18 +261,14 @@ public class DatasourceOptimizerTest extends CuratorTestBase private void setupViews() throws Exception { - baseView = new BatchServerInventoryView( - zkPathsConfig, - curator, - jsonMapper, - Predicates.alwaysTrue() - ) + baseView = new BatchServerInventoryView(zkPathsConfig, curator, jsonMapper, Predicates.alwaysTrue()) { @Override public void registerSegmentCallback(Executor exec, final SegmentCallback callback) { super.registerSegmentCallback( - exec, new SegmentCallback() + exec, + new SegmentCallback() { @Override public CallbackAction segmentAdded(DruidServerMetadata server, DataSegment segment) diff --git a/extensions-contrib/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcIndexGeneratorJobTest.java b/extensions-contrib/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcIndexGeneratorJobTest.java index ed59a13b8a6..3c70531e64c 100644 --- a/extensions-contrib/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcIndexGeneratorJobTest.java +++ b/extensions-contrib/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcIndexGeneratorJobTest.java @@ -203,9 +203,7 @@ public class OrcIndexGeneratorJobTest Map.class ), aggs, - new UniformGranularitySpec( - Granularities.DAY, Granularities.NONE, ImmutableList.of(this.interval) - ), + new UniformGranularitySpec(Granularities.DAY, Granularities.NONE, ImmutableList.of(this.interval)), null, mapper ), diff --git a/extensions-contrib/parquet-extensions/src/main/java/org/apache/parquet/avro/DruidParquetReadSupport.java b/extensions-contrib/parquet-extensions/src/main/java/org/apache/parquet/avro/DruidParquetReadSupport.java index be98ffe361a..0ee31437874 100755 --- a/extensions-contrib/parquet-extensions/src/main/java/org/apache/parquet/avro/DruidParquetReadSupport.java +++ b/extensions-contrib/parquet-extensions/src/main/java/org/apache/parquet/avro/DruidParquetReadSupport.java @@ -95,8 +95,10 @@ public class DruidParquetReadSupport extends AvroReadSupport @Override public RecordMaterializer prepareForRead( - Configuration configuration, Map keyValueMetaData, - MessageType fileSchema, ReadContext readContext + Configuration configuration, + Map keyValueMetaData, + MessageType fileSchema, + ReadContext readContext ) { MessageType parquetSchema = readContext.getRequestedSchema(); diff --git a/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/AvroValueInputFormat.java b/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/AvroValueInputFormat.java index 457eb2e365a..e74c7f2e660 100644 --- a/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/AvroValueInputFormat.java +++ b/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/AvroValueInputFormat.java @@ -45,9 +45,8 @@ public class AvroValueInputFormat extends FileInputFormat createRecordReader( - InputSplit split, TaskAttemptContext context - ) throws IOException + public RecordReader createRecordReader(InputSplit split, TaskAttemptContext context) + throws IOException { Schema readerSchema = AvroJob.getInputValueSchema(context.getConfiguration()); diff --git a/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/InlineSchemaAvroBytesDecoder.java b/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/InlineSchemaAvroBytesDecoder.java index 01bf930f985..a5f1d42e96d 100644 --- a/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/InlineSchemaAvroBytesDecoder.java +++ b/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/InlineSchemaAvroBytesDecoder.java @@ -90,7 +90,9 @@ public class InlineSchemaAvroBytesDecoder implements AvroBytesDecoder catch (EOFException eof) { // waiting for avro v1.9.0 (#AVRO-813) throw new ParseException( - eof, "Avro's unnecessary EOFException, detail: [%s]", "https://issues.apache.org/jira/browse/AVRO-813" + eof, + "Avro's unnecessary EOFException, detail: [%s]", + "https://issues.apache.org/jira/browse/AVRO-813" ); } catch (Exception e) { diff --git a/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/InlineSchemasAvroBytesDecoder.java b/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/InlineSchemasAvroBytesDecoder.java index 65fc04539b8..9eee1359c42 100644 --- a/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/InlineSchemasAvroBytesDecoder.java +++ b/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/InlineSchemasAvroBytesDecoder.java @@ -122,7 +122,9 @@ public class InlineSchemasAvroBytesDecoder implements AvroBytesDecoder catch (EOFException eof) { // waiting for avro v1.9.0 (#AVRO-813) throw new ParseException( - eof, "Avro's unnecessary EOFException, detail: [%s]", "https://issues.apache.org/jira/browse/AVRO-813" + eof, + "Avro's unnecessary EOFException, detail: [%s]", + "https://issues.apache.org/jira/browse/AVRO-813" ); } catch (Exception e) { diff --git a/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/SchemaRepoBasedAvroBytesDecoder.java b/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/SchemaRepoBasedAvroBytesDecoder.java index bc6ea7decb5..7f461a0ab31 100644 --- a/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/SchemaRepoBasedAvroBytesDecoder.java +++ b/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/SchemaRepoBasedAvroBytesDecoder.java @@ -84,7 +84,9 @@ public class SchemaRepoBasedAvroBytesDecoder implements AvroBytesDe catch (EOFException eof) { // waiting for avro v1.9.0 (#AVRO-813) throw new ParseException( - eof, "Avro's unnecessary EOFException, detail: [%s]", "https://issues.apache.org/jira/browse/AVRO-813" + eof, + "Avro's unnecessary EOFException, detail: [%s]", + "https://issues.apache.org/jira/browse/AVRO-813" ); } catch (IOException e) { diff --git a/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/AvroStreamInputRowParserTest.java b/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/AvroStreamInputRowParserTest.java index a713101c3ba..e20091dc074 100644 --- a/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/AvroStreamInputRowParserTest.java +++ b/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/AvroStreamInputRowParserTest.java @@ -281,7 +281,8 @@ public class AvroStreamInputRowParserTest // towards Map avro field as druid dimension, need to convert its toString() back to HashMap to check equality assertEquals(1, inputRow.getDimension("someIntValueMap").size()); assertEquals( - SOME_INT_VALUE_MAP_VALUE, new HashMap( + SOME_INT_VALUE_MAP_VALUE, + new HashMap( Maps.transformValues( Splitter.on(",") .withKeyValueSeparator("=") @@ -299,7 +300,8 @@ public class AvroStreamInputRowParserTest ) ); assertEquals( - SOME_STRING_VALUE_MAP_VALUE, new HashMap( + SOME_STRING_VALUE_MAP_VALUE, + new HashMap( Splitter.on(",") .withKeyValueSeparator("=") .split(inputRow.getDimension("someIntValueMap").get(0).replaceAll("[\\{\\} ]", "")) diff --git a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchModule.java b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchModule.java index 3bd04b43e03..a2083e108f6 100644 --- a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchModule.java +++ b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchModule.java @@ -68,9 +68,7 @@ public class SketchModule implements DruidModule new NamedType(SketchSetPostAggregator.class, THETA_SKETCH_SET_OP_POST_AGG), new NamedType(SketchConstantPostAggregator.class, THETA_SKETCH_CONSTANT_POST_AGG) ) - .addSerializer( - SketchHolder.class, new SketchHolderJsonSerializer() - ) + .addSerializer(SketchHolder.class, new SketchHolderJsonSerializer()) ); } } diff --git a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/CommonCacheNotifier.java b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/CommonCacheNotifier.java index fcfc2be4e50..f1e61ebfba7 100644 --- a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/CommonCacheNotifier.java +++ b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/CommonCacheNotifier.java @@ -231,9 +231,7 @@ public class CommonCacheNotifier } @Override - public void exceptionCaught( - ClientResponse clientResponse, Throwable e - ) + public void exceptionCaught(ClientResponse clientResponse, Throwable e) { // Its safe to Ignore as the ClientResponse returned in handleChunk were unfinished log.error(e, "exceptionCaught in CommonCacheNotifier ResponseHandler."); diff --git a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BasicHTTPAuthenticator.java b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BasicHTTPAuthenticator.java index 71d927dc773..98d4ecf9ef6 100644 --- a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BasicHTTPAuthenticator.java +++ b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BasicHTTPAuthenticator.java @@ -152,9 +152,8 @@ public class BasicHTTPAuthenticator implements Authenticator @Override - public void doFilter( - ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain - ) throws IOException, ServletException + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) + throws IOException, ServletException { HttpServletResponse httpResp = (HttpServletResponse) servletResponse; diff --git a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BytesFullResponseHandler.java b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BytesFullResponseHandler.java index bb8196a0f89..7d80a7fe882 100644 --- a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BytesFullResponseHandler.java +++ b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/BytesFullResponseHandler.java @@ -68,9 +68,7 @@ public class BytesFullResponseHandler implements HttpResponseHandler clientResponse, Throwable e - ) + public void exceptionCaught(ClientResponse clientResponse, Throwable e) { // Its safe to Ignore as the ClientResponse returned in handleChunk were unfinished } diff --git a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/BasicRoleBasedAuthorizer.java b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/BasicRoleBasedAuthorizer.java index d84a7489aa2..8e88ca9efe8 100644 --- a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/BasicRoleBasedAuthorizer.java +++ b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/BasicRoleBasedAuthorizer.java @@ -67,9 +67,7 @@ public class BasicRoleBasedAuthorizer implements Authorizer } @Override - public Access authorize( - AuthenticationResult authenticationResult, Resource resource, Action action - ) + public Access authorize(AuthenticationResult authenticationResult, Resource resource, Action action) { if (authenticationResult == null) { throw new IAE("WTF? authenticationResult should never be null."); diff --git a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/db/updater/CoordinatorBasicAuthorizerMetadataStorageUpdater.java b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/db/updater/CoordinatorBasicAuthorizerMetadataStorageUpdater.java index 10b1ec99946..5c80ec7d9ba 100644 --- a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/db/updater/CoordinatorBasicAuthorizerMetadataStorageUpdater.java +++ b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/db/updater/CoordinatorBasicAuthorizerMetadataStorageUpdater.java @@ -356,9 +356,7 @@ public class CoordinatorBasicAuthorizerMetadataStorageUpdater implements BasicAu } @Override - public void setPermissions( - String prefix, String roleName, List permissions - ) + public void setPermissions(String prefix, String roleName, List permissions) { Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS)); setPermissionsInternal(prefix, roleName, permissions); diff --git a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/endpoint/CoordinatorBasicAuthorizerResourceHandler.java b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/endpoint/CoordinatorBasicAuthorizerResourceHandler.java index 7aa53d8c276..d3e6e6c221e 100644 --- a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/endpoint/CoordinatorBasicAuthorizerResourceHandler.java +++ b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/endpoint/CoordinatorBasicAuthorizerResourceHandler.java @@ -241,9 +241,7 @@ public class CoordinatorBasicAuthorizerResourceHandler implements BasicAuthorize } @Override - public Response setRolePermissions( - String authorizerName, String roleName, List permissions - ) + public Response setRolePermissions(String authorizerName, String roleName, List permissions) { final BasicRoleBasedAuthorizer authorizer = authorizerMap.get(authorizerName); if (authorizer == null) { diff --git a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/endpoint/DefaultBasicAuthorizerResourceHandler.java b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/endpoint/DefaultBasicAuthorizerResourceHandler.java index ff0cac63c21..9280e3a8ed6 100644 --- a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/endpoint/DefaultBasicAuthorizerResourceHandler.java +++ b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/endpoint/DefaultBasicAuthorizerResourceHandler.java @@ -126,9 +126,7 @@ public class DefaultBasicAuthorizerResourceHandler implements BasicAuthorizerRes } @Override - public Response setRolePermissions( - String authorizerName, String roleName, List permissions - ) + public Response setRolePermissions(String authorizerName, String roleName, List permissions) { return NOT_FOUND_RESPONSE; } diff --git a/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/guice/BloomFilterSerializersModule.java b/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/guice/BloomFilterSerializersModule.java index 011e091d3dd..0072ff38d27 100644 --- a/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/guice/BloomFilterSerializersModule.java +++ b/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/guice/BloomFilterSerializersModule.java @@ -40,9 +40,7 @@ public class BloomFilterSerializersModule extends SimpleModule public BloomFilterSerializersModule() { - registerSubtypes( - new NamedType(BloomDimFilter.class, BLOOM_FILTER_TYPE_NAME) - ); + registerSubtypes(new NamedType(BloomDimFilter.class, BLOOM_FILTER_TYPE_NAME)); addSerializer(BloomKFilter.class, new BloomKFilterSerializer()); addDeserializer(BloomKFilter.class, new BloomKFilterDeserializer()); addDeserializer(BloomKFilterHolder.class, new BloomKFilterHolderDeserializer()); @@ -50,16 +48,14 @@ public class BloomFilterSerializersModule extends SimpleModule private static class BloomKFilterSerializer extends StdSerializer { - BloomKFilterSerializer() { super(BloomKFilter.class); } @Override - public void serialize( - BloomKFilter bloomKFilter, JsonGenerator jsonGenerator, SerializerProvider serializerProvider - ) throws IOException + public void serialize(BloomKFilter bloomKFilter, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) + throws IOException { jsonGenerator.writeBinary(bloomKFilterToBytes(bloomKFilter)); } @@ -67,16 +63,14 @@ public class BloomFilterSerializersModule extends SimpleModule private static class BloomKFilterDeserializer extends StdDeserializer { - BloomKFilterDeserializer() { super(BloomKFilter.class); } @Override - public BloomKFilter deserialize( - JsonParser jsonParser, DeserializationContext deserializationContext - ) throws IOException + public BloomKFilter deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException { return bloomKFilterFromBytes(jsonParser.getBinaryValue()); } @@ -90,9 +84,8 @@ public class BloomFilterSerializersModule extends SimpleModule } @Override - public BloomKFilterHolder deserialize( - JsonParser jsonParser, DeserializationContext deserializationContext - ) throws IOException + public BloomKFilterHolder deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException { return BloomKFilterHolder.fromBytes(jsonParser.getBinaryValue()); } diff --git a/extensions-core/druid-kerberos/src/main/java/org/apache/druid/security/kerberos/DruidKerberosAuthenticationHandler.java b/extensions-core/druid-kerberos/src/main/java/org/apache/druid/security/kerberos/DruidKerberosAuthenticationHandler.java index cbc52e33fa5..b6f91b5369d 100644 --- a/extensions-core/druid-kerberos/src/main/java/org/apache/druid/security/kerberos/DruidKerberosAuthenticationHandler.java +++ b/extensions-core/druid-kerberos/src/main/java/org/apache/druid/security/kerberos/DruidKerberosAuthenticationHandler.java @@ -91,8 +91,7 @@ public class DruidKerberosAuthenticationHandler extends KerberosAuthenticationHa // specifically configured final String[] spnegoPrincipals; if ("*".equals(principal)) { - spnegoPrincipals = KerberosUtil.getPrincipalNames( - keytab, Pattern.compile("HTTP/.*")); + spnegoPrincipals = KerberosUtil.getPrincipalNames(keytab, Pattern.compile("HTTP/.*")); if (spnegoPrincipals.length == 0) { throw new ServletException("Principals do not exist in the keytab"); } diff --git a/extensions-core/druid-kerberos/src/main/java/org/apache/druid/security/kerberos/KerberosAuthenticator.java b/extensions-core/druid-kerberos/src/main/java/org/apache/druid/security/kerberos/KerberosAuthenticator.java index e8966f1d7df..394e82625ef 100644 --- a/extensions-core/druid-kerberos/src/main/java/org/apache/druid/security/kerberos/KerberosAuthenticator.java +++ b/extensions-core/druid-kerberos/src/main/java/org/apache/druid/security/kerberos/KerberosAuthenticator.java @@ -229,9 +229,8 @@ public class KerberosAuthenticator implements Authenticator } @Override - public void doFilter( - ServletRequest request, ServletResponse response, FilterChain filterChain - ) throws IOException, ServletException + public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) + throws IOException, ServletException { HttpServletRequest httpReq = (HttpServletRequest) request; @@ -474,7 +473,9 @@ public class KerberosAuthenticator implements Authenticator @Override public void decorateProxyRequest( - HttpServletRequest clientRequest, HttpServletResponse proxyResponse, Request proxyRequest + HttpServletRequest clientRequest, + HttpServletResponse proxyResponse, + Request proxyRequest ) { Object cookieToken = clientRequest.getAttribute(SIGNED_TOKEN_ATTRIBUTE); @@ -674,8 +675,11 @@ public class KerberosAuthenticator implements Authenticator * long, boolean, boolean) */ private static void tokenToAuthCookie( - HttpServletResponse resp, String token, - String domain, String path, long expires, + HttpServletResponse resp, + String token, + String domain, + String path, + long expires, boolean isCookiePersistent, boolean isSecure ) diff --git a/extensions-core/hdfs-storage/src/test/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPusherTest.java b/extensions-core/hdfs-storage/src/test/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPusherTest.java index 8b0684d173e..ee99a4b4900 100644 --- a/extensions-core/hdfs-storage/src/test/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPusherTest.java +++ b/extensions-core/hdfs-storage/src/test/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPusherTest.java @@ -378,7 +378,8 @@ public class HdfsDataSegmentPusherTest addSerializer(Interval.class, ToStringSerializer.instance); addSerializer(NumberedShardSpec.class, ToStringSerializer.instance); addDeserializer( - Interval.class, new StdDeserializer(Interval.class) + Interval.class, + new StdDeserializer(Interval.class) { @Override public Interval deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) diff --git a/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java b/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java index 0cf84ea01ac..d09f5774358 100644 --- a/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java +++ b/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java @@ -575,8 +575,15 @@ public class ApproximateHistogram } int mergedBinCount = combineBins( - this.binCount, this.positions, this.bins, h.binCount, h.positions, h.bins, - mergedPositions, mergedBins, deltas + this.binCount, + this.positions, + this.bins, + h.binCount, + h.positions, + h.bins, + mergedPositions, + mergedBins, + deltas ); if (mergedBinCount == 0) { return this; @@ -631,14 +638,26 @@ public class ApproximateHistogram if (this.binCount + h.binCount <= this.size) { // no need to merge bins mergedBinCount = combineBins( - this.binCount, this.positions, this.bins, - h.binCount, h.positions, h.bins, - mergedPositions, mergedBins, null + this.binCount, + this.positions, + this.bins, + h.binCount, + h.positions, + h.bins, + mergedPositions, + mergedBins, + null ); } else { mergedBinCount = ruleCombineBins( - this.binCount, this.positions, this.bins, h.binCount, h.positions, h.bins, - mergedPositions, mergedBins + this.binCount, + this.positions, + this.bins, + h.binCount, + h.positions, + h.bins, + mergedPositions, + mergedBins ); } for (int i = 0; i < mergedBinCount; ++i) { @@ -653,9 +672,14 @@ public class ApproximateHistogram } protected int ruleCombineBins( - int leftBinCount, float[] leftPositions, long[] leftBins, - int rightBinCount, float[] rightPositions, long[] rightBins, - float[] mergedPositions, long[] mergedBins + int leftBinCount, + float[] leftPositions, + long[] leftBins, + int rightBinCount, + float[] rightPositions, + long[] rightBins, + float[] mergedPositions, + long[] mergedBins ) { final float cutoff; @@ -855,7 +879,8 @@ public class ApproximateHistogram * @return the last valid index into the mergedPositions and mergedBins arrays */ private static void mergeBins( - int mergedBinCount, float[] mergedPositions, + int mergedBinCount, + float[] mergedPositions, long[] mergedBins, float[] deltas, int numMerge, @@ -1049,9 +1074,15 @@ public class ApproximateHistogram * @return the number of combined bins */ private static int combineBins( - int leftBinCount, float[] leftPositions, long[] leftBins, - int rightBinCount, float[] rightPositions, long[] rightBins, - float[] mergedPositions, long[] mergedBins, float[] deltas + int leftBinCount, + float[] leftPositions, + long[] leftBins, + int rightBinCount, + float[] rightPositions, + long[] rightBins, + float[] mergedPositions, + long[] mergedBins, + float[] deltas ) { int i = 0; diff --git a/extensions-core/kafka-extraction-namespace/src/main/java/org/apache/druid/query/lookup/KafkaLookupExtractorFactory.java b/extensions-core/kafka-extraction-namespace/src/main/java/org/apache/druid/query/lookup/KafkaLookupExtractorFactory.java index 530e6e7d2f8..ced2d16c13f 100644 --- a/extensions-core/kafka-extraction-namespace/src/main/java/org/apache/druid/query/lookup/KafkaLookupExtractorFactory.java +++ b/extensions-core/kafka-extraction-namespace/src/main/java/org/apache/druid/query/lookup/KafkaLookupExtractorFactory.java @@ -242,7 +242,8 @@ public class KafkaLookupExtractorFactory implements LookupExtractorFactory } ); Futures.addCallback( - future, new FutureCallback() + future, + new FutureCallback() { @Override public void onSuccess(Object result) diff --git a/extensions-core/kafka-extraction-namespace/src/test/java/org/apache/druid/query/lookup/KafkaLookupExtractorFactoryTest.java b/extensions-core/kafka-extraction-namespace/src/test/java/org/apache/druid/query/lookup/KafkaLookupExtractorFactoryTest.java index 23077290944..cbeb028145f 100644 --- a/extensions-core/kafka-extraction-namespace/src/test/java/org/apache/druid/query/lookup/KafkaLookupExtractorFactoryTest.java +++ b/extensions-core/kafka-extraction-namespace/src/test/java/org/apache/druid/query/lookup/KafkaLookupExtractorFactoryTest.java @@ -95,7 +95,10 @@ public class KafkaLookupExtractorFactoryTest { @Override public Object findInjectableValue( - Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance + Object valueId, + DeserializationContext ctxt, + BeanProperty forProperty, + Object beanInstance ) { if ("org.apache.druid.server.lookup.namespace.cache.NamespaceExtractionCacheManager".equals(valueId)) { diff --git a/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/KafkaIndexTaskClient.java b/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/KafkaIndexTaskClient.java index 3bc52eb954a..803a6bea07f 100644 --- a/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/KafkaIndexTaskClient.java +++ b/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/KafkaIndexTaskClient.java @@ -67,7 +67,11 @@ public class KafkaIndexTaskClient extends IndexTaskClient try { final FullResponseHolder response = submitRequestWithEmptyContent( - id, HttpMethod.POST, "stop", publish ? "publish=true" : null, true + id, + HttpMethod.POST, + "stop", + publish ? "publish=true" : null, + true ); return isSuccess(response); } diff --git a/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisor.java b/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisor.java index 57d6feb27c9..da33d3db94a 100644 --- a/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisor.java +++ b/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisor.java @@ -2195,9 +2195,9 @@ public class KafkaSupervisor implements Supervisor Map currentOffsets = entry.getValue().currentOffsets; Long remainingSeconds = null; if (startTime != null) { - remainingSeconds = Math.max( - 0, ioConfig.getTaskDuration().getMillis() - (System.currentTimeMillis() - startTime.getMillis()) - ) / 1000; + long elapsedMillis = System.currentTimeMillis() - startTime.getMillis(); + long remainingMillis = Math.max(0, ioConfig.getTaskDuration().getMillis() - elapsedMillis); + remainingSeconds = TimeUnit.MILLISECONDS.toSeconds(remainingMillis); } taskReports.add( diff --git a/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIndexTaskTest.java b/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIndexTaskTest.java index 6dd210ae4c5..81aad11f69a 100644 --- a/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIndexTaskTest.java +++ b/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIndexTaskTest.java @@ -2102,9 +2102,7 @@ public class KafkaIndexTaskTest ) { @Override - public QueryRunner decorate( - QueryRunner delegate, QueryToolChest> toolChest - ) + public QueryRunner decorate(QueryRunner delegate, QueryToolChest> toolChest) { return delegate; } @@ -2204,7 +2202,9 @@ public class KafkaIndexTaskTest { @Override public boolean registerSegmentHandoffCallback( - SegmentDescriptor descriptor, Executor exec, Runnable handOffRunnable + SegmentDescriptor descriptor, + Executor exec, + Runnable handOffRunnable ) { if (doHandoff) { diff --git a/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorIOConfigTest.java b/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorIOConfigTest.java index a7dc2041b8a..e64015adba5 100644 --- a/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorIOConfigTest.java +++ b/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorIOConfigTest.java @@ -134,9 +134,7 @@ public class KafkaSupervisorIOConfigTest + " \"ssl.key.password\":\"mykeypassword\"}\n" + "}"; - KafkaSupervisorIOConfig config = mapper.readValue( - jsonStr, KafkaSupervisorIOConfig.class - ); + KafkaSupervisorIOConfig config = mapper.readValue(jsonStr, KafkaSupervisorIOConfig.class); Properties props = new Properties(); KafkaIndexTask.addConsumerPropertiesFromConfig(props, mapper, config.getConsumerProperties()); diff --git a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactoryTest.java b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactoryTest.java index 7f121b7a365..0ca7b22815b 100644 --- a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactoryTest.java +++ b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactoryTest.java @@ -91,7 +91,10 @@ public class NamespaceLookupExtractorFactoryTest { @Override public Object findInjectableValue( - Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance + Object valueId, + DeserializationContext ctxt, + BeanProperty forProperty, + Object beanInstance ) { if (CacheScheduler.class.getName().equals(valueId)) { @@ -524,7 +527,9 @@ public class NamespaceLookupExtractorFactoryTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test-inject", null, false, null, null, true, false) ); } } diff --git a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/namespace/UriExtractionNamespaceTest.java b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/namespace/UriExtractionNamespaceTest.java index 26e7e5c1f73..c834c24a444 100644 --- a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/namespace/UriExtractionNamespaceTest.java +++ b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/namespace/UriExtractionNamespaceTest.java @@ -68,10 +68,12 @@ public class UriExtractionNamespaceTest final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector(); mapper.setAnnotationIntrospectors( new AnnotationIntrospectorPair( - guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector() + guiceIntrospector, + mapper.getSerializationConfig().getAnnotationIntrospector() ), new AnnotationIntrospectorPair( - guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector() + guiceIntrospector, + mapper.getDeserializationConfig().getAnnotationIntrospector() ) ); return mapper; diff --git a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OffHeapNamespaceExtractionCacheManagerTest.java b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OffHeapNamespaceExtractionCacheManagerTest.java index 699f688542d..0063c1308e6 100644 --- a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OffHeapNamespaceExtractionCacheManagerTest.java +++ b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OffHeapNamespaceExtractionCacheManagerTest.java @@ -49,7 +49,9 @@ public class OffHeapNamespaceExtractionCacheManagerTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test-inject", null, false, null, null, true, false) ); } } diff --git a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OnHeapNamespaceExtractionCacheManagerTest.java b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OnHeapNamespaceExtractionCacheManagerTest.java index 9f8330c3aab..1210620ace2 100644 --- a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OnHeapNamespaceExtractionCacheManagerTest.java +++ b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OnHeapNamespaceExtractionCacheManagerTest.java @@ -49,7 +49,9 @@ public class OnHeapNamespaceExtractionCacheManagerTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test-inject", null, false, null, null, true, false) ); } } diff --git a/extensions-core/lookups-cached-single/src/main/java/org/apache/druid/server/lookup/cache/loading/LookupCacheStats.java b/extensions-core/lookups-cached-single/src/main/java/org/apache/druid/server/lookup/cache/loading/LookupCacheStats.java index 27ec53d91d9..12713237d9f 100644 --- a/extensions-core/lookups-cached-single/src/main/java/org/apache/druid/server/lookup/cache/loading/LookupCacheStats.java +++ b/extensions-core/lookups-cached-single/src/main/java/org/apache/druid/server/lookup/cache/loading/LookupCacheStats.java @@ -39,10 +39,7 @@ public class LookupCacheStats /** * Constructs a new {@code CacheStats} instance. */ - public LookupCacheStats( - long hitCount, long missCount, - long evictionCount - ) + public LookupCacheStats(long hitCount, long missCount, long evictionCount) { Preconditions.checkArgument(hitCount >= 0); Preconditions.checkArgument(missCount >= 0); diff --git a/extensions-core/lookups-cached-single/src/main/java/org/apache/druid/server/lookup/cache/polling/OffHeapPollingCache.java b/extensions-core/lookups-cached-single/src/main/java/org/apache/druid/server/lookup/cache/polling/OffHeapPollingCache.java index d2c6174c1df..b042e1ea1df 100644 --- a/extensions-core/lookups-cached-single/src/main/java/org/apache/druid/server/lookup/cache/polling/OffHeapPollingCache.java +++ b/extensions-core/lookups-cached-single/src/main/java/org/apache/druid/server/lookup/cache/polling/OffHeapPollingCache.java @@ -62,7 +62,8 @@ public class OffHeapPollingCache implements PollingCache final Set setOfValues = setOfValuesBuilder.build(); reverseCache.putAll(Maps.asMap( - setOfValues, new Function>() + setOfValues, + new Function>() { @Override public List apply(final V input) @@ -80,7 +81,8 @@ public class OffHeapPollingCache implements PollingCache } }).keySet()); } - })); + } + )); started.getAndSet(true); } } diff --git a/extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3DataSegmentMover.java b/extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3DataSegmentMover.java index ebf8792c321..1ad77a6cff0 100644 --- a/extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3DataSegmentMover.java +++ b/extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3DataSegmentMover.java @@ -93,7 +93,8 @@ public class S3DataSegmentMover implements DataSegmentMover ImmutableMap.builder() .putAll( Maps.filterKeys( - loadSpec, new Predicate() + loadSpec, + new Predicate() { @Override public boolean apply(String input) diff --git a/extensions-core/s3-extensions/src/test/java/org/apache/druid/storage/s3/S3DataSegmentArchiverTest.java b/extensions-core/s3-extensions/src/test/java/org/apache/druid/storage/s3/S3DataSegmentArchiverTest.java index 8e21f254f94..42e0135fc7c 100644 --- a/extensions-core/s3-extensions/src/test/java/org/apache/druid/storage/s3/S3DataSegmentArchiverTest.java +++ b/extensions-core/s3-extensions/src/test/java/org/apache/druid/storage/s3/S3DataSegmentArchiverTest.java @@ -40,16 +40,22 @@ import java.util.Map; public class S3DataSegmentArchiverTest { private static final ObjectMapper MAPPER = new DefaultObjectMapper() - .setInjectableValues(new InjectableValues() - { - @Override - public Object findInjectableValue( - Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance - ) - { - return PULLER; - } - }).registerModule(new SimpleModule("s3-archive-test-module").registerSubtypes(S3LoadSpec.class)); + .setInjectableValues( + new InjectableValues() + { + @Override + public Object findInjectableValue( + Object valueId, + DeserializationContext ctxt, + BeanProperty forProperty, + Object beanInstance + ) + { + return PULLER; + } + } + ) + .registerModule(new SimpleModule("s3-archive-test-module").registerSubtypes(S3LoadSpec.class)); private static final S3DataSegmentArchiverConfig ARCHIVER_CONFIG = new S3DataSegmentArchiverConfig() { @Override diff --git a/extensions-core/stats/src/test/java/org/apache/druid/query/aggregation/teststats/PvaluefromZscorePostAggregatorTest.java b/extensions-core/stats/src/test/java/org/apache/druid/query/aggregation/teststats/PvaluefromZscorePostAggregatorTest.java index 7841625764d..1e46f2bcf06 100644 --- a/extensions-core/stats/src/test/java/org/apache/druid/query/aggregation/teststats/PvaluefromZscorePostAggregatorTest.java +++ b/extensions-core/stats/src/test/java/org/apache/druid/query/aggregation/teststats/PvaluefromZscorePostAggregatorTest.java @@ -50,8 +50,10 @@ public class PvaluefromZscorePostAggregatorTest public void testSerde() throws Exception { DefaultObjectMapper mapper = new DefaultObjectMapper(); - PvaluefromZscorePostAggregator postAggregator1 = mapper.readValue(mapper.writeValueAsString( - pvaluefromZscorePostAggregator), PvaluefromZscorePostAggregator.class); + PvaluefromZscorePostAggregator postAggregator1 = mapper.readValue( + mapper.writeValueAsString(pvaluefromZscorePostAggregator), + PvaluefromZscorePostAggregator.class + ); Assert.assertEquals(pvaluefromZscorePostAggregator, postAggregator1); } diff --git a/hll/src/test/java/org/apache/druid/hll/HyperLogLogCollectorTest.java b/hll/src/test/java/org/apache/druid/hll/HyperLogLogCollectorTest.java index 4affa385d54..64c19158f46 100644 --- a/hll/src/test/java/org/apache/druid/hll/HyperLogLogCollectorTest.java +++ b/hll/src/test/java/org/apache/druid/hll/HyperLogLogCollectorTest.java @@ -19,7 +19,6 @@ package org.apache.druid.hll; -import com.google.common.base.Function; import com.google.common.collect.Collections2; import com.google.common.collect.Lists; import com.google.common.hash.HashFunction; @@ -31,7 +30,6 @@ import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; -import javax.annotation.Nullable; import java.nio.ByteBuffer; import java.security.MessageDigest; import java.util.Arrays; @@ -763,19 +761,8 @@ public class HyperLogLogCollectorTest ); List collectors = Lists.transform( - objects, new Function() - { - @Nullable - @Override - public HyperLogLogCollector apply( - @Nullable String s - ) - { - return HyperLogLogCollector.makeCollector( - ByteBuffer.wrap(Base64.decodeBase64(s)) - ); - } - } + objects, + s -> HyperLogLogCollector.makeCollector(ByteBuffer.wrap(Base64.decodeBase64(s))) ); Collection> permutations = Collections2.permutations(collectors); diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/DetermineHashedPartitionsJob.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/DetermineHashedPartitionsJob.java index 0716e162fee..12d4c487c1f 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/DetermineHashedPartitionsJob.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/DetermineHashedPartitionsJob.java @@ -167,7 +167,7 @@ public class DetermineHashedPartitionsJob implements Jobby if (Utils.exists(groupByJob, fileSystem, partitionInfoPath)) { final Long numRows = config.JSON_MAPPER.readValue( Utils.openInputStream(groupByJob, partitionInfoPath), - new TypeReference() {} + Long.class ); log.info("Found approximately [%,d] rows in data.", numRows); @@ -381,19 +381,12 @@ public class DetermineHashedPartitionsJob implements Jobby intervals.add(interval); final Path outPath = config.makeSegmentPartitionInfoPath(interval); - final OutputStream out = Utils.makePathAndOutputStream( - context, outPath, config.isOverwriteFiles() - ); + final OutputStream out = Utils.makePathAndOutputStream(context, outPath, config.isOverwriteFiles()); try { - HadoopDruidIndexerConfig.JSON_MAPPER.writerWithType( - new TypeReference() - { - } - ).writeValue( - out, - aggregate.estimateCardinalityRound() - ); + HadoopDruidIndexerConfig.JSON_MAPPER + .writerWithType(Long.class) + .writeValue(out, aggregate.estimateCardinalityRound()); } finally { Closeables.close(out, false); @@ -407,9 +400,7 @@ public class DetermineHashedPartitionsJob implements Jobby super.run(context); if (determineIntervals) { final Path outPath = config.makeIntervalInfoPath(); - final OutputStream out = Utils.makePathAndOutputStream( - context, outPath, config.isOverwriteFiles() - ); + final OutputStream out = Utils.makePathAndOutputStream(context, outPath, config.isOverwriteFiles()); try { HadoopDruidIndexerConfig.JSON_MAPPER.writerWithType( diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java index 27486129110..e0b355ad174 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java @@ -360,9 +360,7 @@ public class DeterminePartitionsJob implements Jobby } @Override - protected void map( - BytesWritable key, NullWritable value, Context context - ) throws IOException, InterruptedException + protected void map(BytesWritable key, NullWritable value, Context context) throws IOException, InterruptedException { final List timeAndDims = HadoopDruidIndexerConfig.JSON_MAPPER.readValue(key.getBytes(), List.class); @@ -529,9 +527,8 @@ public class DeterminePartitionsJob implements Jobby } @Override - protected void reduce( - BytesWritable key, Iterable values, Context context - ) throws IOException, InterruptedException + protected void reduce(BytesWritable key, Iterable values, Context context) + throws IOException, InterruptedException { SortableBytes keyBytes = SortableBytes.fromBytesWritable(key); @@ -540,7 +537,9 @@ public class DeterminePartitionsJob implements Jobby } protected abstract void innerReduce( - Context context, SortableBytes keyBytes, Iterable combinedIterable + Context context, + SortableBytes keyBytes, + Iterable combinedIterable ) throws IOException, InterruptedException; private Iterable combineRows(Iterable input) @@ -586,9 +585,8 @@ public class DeterminePartitionsJob implements Jobby public static class DeterminePartitionsDimSelectionCombiner extends DeterminePartitionsDimSelectionBaseReducer { @Override - protected void innerReduce( - Context context, SortableBytes keyBytes, Iterable combinedIterable - ) throws IOException, InterruptedException + protected void innerReduce(Context context, SortableBytes keyBytes, Iterable combinedIterable) + throws IOException, InterruptedException { for (DimValueCount dvc : combinedIterable) { write(context, keyBytes.getGroupKey(), dvc); @@ -602,9 +600,8 @@ public class DeterminePartitionsJob implements Jobby private static final int HIGH_CARDINALITY_THRESHOLD = 3000000; @Override - protected void innerReduce( - Context context, SortableBytes keyBytes, Iterable combinedIterable - ) throws IOException + protected void innerReduce(Context context, SortableBytes keyBytes, Iterable combinedIterable) + throws IOException { final ByteBuffer groupKey = ByteBuffer.wrap(keyBytes.getGroupKey()); groupKey.position(4); // Skip partition @@ -807,14 +804,8 @@ public class DeterminePartitionsJob implements Jobby : minDistancePartitions; final List chosenShardSpecs = Lists.transform( - chosenPartitions.partitions, new Function() - { - @Override - public ShardSpec apply(DimPartition dimPartition) - { - return dimPartition.shardSpec; - } - } + chosenPartitions.partitions, + dimPartition -> dimPartition.shardSpec ); log.info("Chosen partitions:"); @@ -950,13 +941,8 @@ public class DeterminePartitionsJob implements Jobby ) throws IOException, InterruptedException { - context.write( - new SortableBytes( - groupKey, TAB_JOINER.join(dimValueCount.dim, dimValueCount.value).getBytes( - HadoopDruidIndexerConfig.JAVA_NATIVE_CHARSET - ) - ).toBytesWritable(), - dimValueCount.toText() - ); + byte[] sortKey = TAB_JOINER.join(dimValueCount.dim, dimValueCount.value) + .getBytes(HadoopDruidIndexerConfig.JAVA_NATIVE_CHARSET); + context.write(new SortableBytes(groupKey, sortKey).toBytesWritable(), dimValueCount.toText()); } } diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java index 2cf53584878..8cf808fe8e9 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java @@ -109,7 +109,9 @@ public class HadoopDruidIndexerConfig public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("hadoop-indexer", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("hadoop-indexer", null, false, null, null, true, false) ); JsonConfigProvider.bind(binder, "druid.hadoop.security.kerberos", HadoopKerberosConfig.class); } @@ -162,9 +164,7 @@ public class HadoopDruidIndexerConfig { try { return fromMap( - HadoopDruidIndexerConfig.JSON_MAPPER.readValue( - file, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT - ) + HadoopDruidIndexerConfig.JSON_MAPPER.readValue(file, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT) ); } catch (IOException e) { @@ -178,9 +178,7 @@ public class HadoopDruidIndexerConfig // This is a map to try and prevent dependency screwbally-ness try { return fromMap( - HadoopDruidIndexerConfig.JSON_MAPPER.readValue( - str, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT - ) + HadoopDruidIndexerConfig.JSON_MAPPER.readValue(str, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT) ); } catch (IOException e) { @@ -197,9 +195,7 @@ public class HadoopDruidIndexerConfig Reader reader = new InputStreamReader(fs.open(pt), StandardCharsets.UTF_8); return fromMap( - HadoopDruidIndexerConfig.JSON_MAPPER.readValue( - reader, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT - ) + HadoopDruidIndexerConfig.JSON_MAPPER.readValue(reader, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT) ); } catch (Exception e) { diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/IndexGeneratorJob.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/IndexGeneratorJob.java index 1f63c897969..9aec2d74a3d 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/IndexGeneratorJob.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/IndexGeneratorJob.java @@ -420,11 +420,9 @@ public class IndexGeneratorJob implements Jobby } @Override - protected void reduce( - final BytesWritable key, Iterable values, final Context context - ) throws IOException, InterruptedException + protected void reduce(final BytesWritable key, Iterable values, final Context context) + throws IOException, InterruptedException { - Iterator iter = values.iterator(); BytesWritable first = iter.next(); @@ -587,9 +585,8 @@ public class IndexGeneratorJob implements Jobby final ProgressIndicator progressIndicator ) throws IOException { - return HadoopDruidIndexerConfig.INDEX_MERGER_V9.persist( - index, interval, file, config.getIndexSpec(), progressIndicator, null - ); + return HadoopDruidIndexerConfig.INDEX_MERGER_V9 + .persist(index, interval, file, config.getIndexSpec(), progressIndicator, null); } protected File mergeQueryableIndex( @@ -600,9 +597,8 @@ public class IndexGeneratorJob implements Jobby ) throws IOException { boolean rollup = config.getSchema().getDataSchema().getGranularitySpec().isRollup(); - return HadoopDruidIndexerConfig.INDEX_MERGER_V9.mergeQueryableIndex( - indexes, rollup, aggs, file, config.getIndexSpec(), progressIndicator, null - ); + return HadoopDruidIndexerConfig.INDEX_MERGER_V9 + .mergeQueryableIndex(indexes, rollup, aggs, file, config.getIndexSpec(), progressIndicator, null); } @Override @@ -624,9 +620,8 @@ public class IndexGeneratorJob implements Jobby } @Override - protected void reduce( - BytesWritable key, Iterable values, final Context context - ) throws IOException, InterruptedException + protected void reduce(BytesWritable key, Iterable values, final Context context) + throws IOException, InterruptedException { SortableBytes keyBytes = SortableBytes.fromBytesWritable(key); Bucket bucket = Bucket.fromGroupKey(keyBytes.getGroupKey()).lhs; @@ -775,9 +770,7 @@ public class IndexGeneratorJob implements Jobby log.info("starting merge of intermediate persisted segments."); long mergeStartTime = System.currentTimeMillis(); - mergedBase = mergeQueryableIndex( - indexes, aggregators, new File(baseFlushFile, "merged"), progressIndicator - ); + mergedBase = mergeQueryableIndex(indexes, aggregators, new File(baseFlushFile, "merged"), progressIndicator); log.info( "finished merge of intermediate persisted segments. time taken [%d] ms.", (System.currentTimeMillis() - mergeStartTime) diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java index 25f695a1cad..1a364595e62 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java @@ -412,7 +412,8 @@ public class JobHelper final FileSystem outputFS = FileSystem.get(finalIndexZipFilePath.toUri(), configuration); final AtomicLong size = new AtomicLong(0L); final DataPusher zipPusher = (DataPusher) RetryProxy.create( - DataPusher.class, new DataPusher() + DataPusher.class, + new DataPusher() { @Override public long push() throws IOException @@ -469,7 +470,8 @@ public class JobHelper throws IOException { final DataPusher descriptorPusher = (DataPusher) RetryProxy.create( - DataPusher.class, new DataPusher() + DataPusher.class, + new DataPusher() { @Override public long push() throws IOException @@ -694,7 +696,8 @@ public class JobHelper } final DataPusher zipPusher = (DataPusher) RetryProxy.create( - DataPusher.class, new DataPusher() + DataPusher.class, + new DataPusher() { @Override public long push() throws IOException diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/SortableBytes.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/SortableBytes.java index 5772da8a51c..3e6196eadcb 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/SortableBytes.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/SortableBytes.java @@ -115,10 +115,7 @@ public class SortableBytes int b1Length = ByteBuffer.wrap(b1, s1 + 4, l1 - 4).getInt(); int b2Length = ByteBuffer.wrap(b2, s2 + 4, l2 - 4).getInt(); - final int retVal = compareBytes( - b1, s1 + 8, b1Length, - b2, s2 + 8, b2Length - ); + final int retVal = compareBytes(b1, s1 + 8, b1Length, b2, s2 + 8, b2Length); return retVal; } @@ -138,15 +135,16 @@ public class SortableBytes int b1Length = ByteBuffer.wrap(b1, s1 + 4, l1 - 4).getInt(); int b2Length = ByteBuffer.wrap(b2, s2 + 4, l2 - 4).getInt(); - int retVal = compareBytes( - b1, s1 + 8, b1Length, - b2, s2 + 8, b2Length - ); + int retVal = compareBytes(b1, s1 + 8, b1Length, b2, s2 + 8, b2Length); if (retVal == 0) { retVal = compareBytes( - b1, s1 + 8 + b1Length, l1 - 8 - b1Length, - b2, s2 + 8 + b2Length, l2 - 8 - b2Length + b1, + s1 + 8 + b1Length, + l1 - 8 - b1Length, + b2, + s2 + 8 + b2Length, + l2 - 8 - b2Length ); } diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/Utils.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/Utils.java index 2baa371c840..9bfdeb15ac3 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/Utils.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/Utils.java @@ -118,14 +118,9 @@ public class Utils ); } - public static void storeStats( - JobContext job, Path path, Map stats - ) throws IOException + public static void storeStats(JobContext job, Path path, Map stats) throws IOException { - jsonMapper.writeValue( - makePathAndOutputStream(job, path, true), - stats - ); + jsonMapper.writeValue(makePathAndOutputStream(job, path, true), stats); } public static String getFailureMessage(Job failedJob, ObjectMapper jsonMapper) diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/DatasourcePathSpec.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/DatasourcePathSpec.java index 4049f764bdb..4a4509d2b78 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/DatasourcePathSpec.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/DatasourcePathSpec.java @@ -111,9 +111,7 @@ public class DatasourcePathSpec implements PathSpec } @Override - public Job addInputPaths( - HadoopDruidIndexerConfig config, Job job - ) throws IOException + public Job addInputPaths(HadoopDruidIndexerConfig config, Job job) throws IOException { if (segments == null || segments.isEmpty()) { if (ingestionSpec.isIgnoreWhenNoSegments()) { diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/MetadataStoreBasedUsedSegmentLister.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/MetadataStoreBasedUsedSegmentLister.java index 2980c431ec2..5797ac6a423 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/MetadataStoreBasedUsedSegmentLister.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/MetadataStoreBasedUsedSegmentLister.java @@ -43,9 +43,7 @@ public class MetadataStoreBasedUsedSegmentLister implements UsedSegmentLister } @Override - public List getUsedSegmentsForIntervals( - String dataSource, List intervals - ) + public List getUsedSegmentsForIntervals(String dataSource, List intervals) { return indexerMetadataStorageCoordinator.getUsedSegmentsForIntervals(dataSource, intervals); } diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/MultiplePathSpec.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/MultiplePathSpec.java index 22612fb6fe8..a6cecf61c70 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/MultiplePathSpec.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/path/MultiplePathSpec.java @@ -46,9 +46,7 @@ public class MultiplePathSpec implements PathSpec } @Override - public Job addInputPaths( - HadoopDruidIndexerConfig config, Job job - ) throws IOException + public Job addInputPaths(HadoopDruidIndexerConfig config, Job job) throws IOException { for (PathSpec spec : children) { spec.addInputPaths(config, job); diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopConverterJob.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopConverterJob.java index ea6f216b28f..f027577c2bb 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopConverterJob.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopConverterJob.java @@ -302,7 +302,8 @@ public class HadoopConverterJob } final List returnList = ImmutableList.copyOf( Lists.transform( - goodPaths, new Function() + goodPaths, + new Function() { @Nullable @Override @@ -486,10 +487,7 @@ public class HadoopConverterJob private static final String TMP_FILE_LOC_KEY = "org.apache.druid.indexer.updater.converter.reducer.tmpDir"; @Override - protected void map( - String key, String value, - final Context context - ) throws IOException, InterruptedException + protected void map(String key, String value, final Context context) throws IOException, InterruptedException { final InputSplit split = context.getInputSplit(); if (!(split instanceof DatasourceInputSplit)) { @@ -623,7 +621,8 @@ public class HadoopConverterJob throw new IOException("Bad config, missing segments"); } return Lists.transform( - segments, new Function() + segments, + new Function() { @Nullable @Override @@ -637,7 +636,8 @@ public class HadoopConverterJob @Override public RecordReader createRecordReader( - final InputSplit inputSplit, final TaskAttemptContext taskAttemptContext + final InputSplit inputSplit, + final TaskAttemptContext taskAttemptContext ) { return new RecordReader() diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopDruidConverterConfig.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopDruidConverterConfig.java index 9d0a30625ee..67c53adbb9f 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopDruidConverterConfig.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopDruidConverterConfig.java @@ -64,7 +64,9 @@ public class HadoopDruidConverterConfig public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("hadoop-converter", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("hadoop-converter", null, false, null, null, true, false) ); } } diff --git a/indexing-hadoop/src/test/java/org/apache/druid/indexer/BatchDeltaIngestionTest.java b/indexing-hadoop/src/test/java/org/apache/druid/indexer/BatchDeltaIngestionTest.java index bee94fce422..72124fa77c2 100644 --- a/indexing-hadoop/src/test/java/org/apache/druid/indexer/BatchDeltaIngestionTest.java +++ b/indexing-hadoop/src/test/java/org/apache/druid/indexer/BatchDeltaIngestionTest.java @@ -462,9 +462,7 @@ public class BatchDeltaIngestionTest new LongSumAggregatorFactory("visited_sum", "visited_num"), new HyperUniquesAggregatorFactory("unique_hosts", "host2") }, - new UniformGranularitySpec( - Granularities.DAY, Granularities.NONE, ImmutableList.of(INTERVAL_FULL) - ), + new UniformGranularitySpec(Granularities.DAY, Granularities.NONE, ImmutableList.of(INTERVAL_FULL)), null, MAPPER ), diff --git a/indexing-hadoop/src/test/java/org/apache/druid/indexer/DeterminePartitionsJobTest.java b/indexing-hadoop/src/test/java/org/apache/druid/indexer/DeterminePartitionsJobTest.java index 72ca8db50c0..51f4120752d 100644 --- a/indexing-hadoop/src/test/java/org/apache/druid/indexer/DeterminePartitionsJobTest.java +++ b/indexing-hadoop/src/test/java/org/apache/druid/indexer/DeterminePartitionsJobTest.java @@ -237,7 +237,9 @@ public class DeterminePartitionsJobTest ), new AggregatorFactory[]{new LongSumAggregatorFactory("visited_num", "visited_num")}, new UniformGranularitySpec( - Granularities.DAY, Granularities.NONE, ImmutableList.of(Intervals.of(interval)) + Granularities.DAY, + Granularities.NONE, + ImmutableList.of(Intervals.of(interval)) ), null, HadoopDruidIndexerConfig.JSON_MAPPER diff --git a/indexing-hadoop/src/test/java/org/apache/druid/indexer/IndexGeneratorCombinerTest.java b/indexing-hadoop/src/test/java/org/apache/druid/indexer/IndexGeneratorCombinerTest.java index 0929e118114..aeadd46adb6 100644 --- a/indexing-hadoop/src/test/java/org/apache/druid/indexer/IndexGeneratorCombinerTest.java +++ b/indexing-hadoop/src/test/java/org/apache/druid/indexer/IndexGeneratorCombinerTest.java @@ -81,7 +81,9 @@ public class IndexGeneratorCombinerTest new HyperUniquesAggregatorFactory("unique_hosts", "host") }, new UniformGranularitySpec( - Granularities.DAY, Granularities.NONE, ImmutableList.of(Intervals.of("2010/2011")) + Granularities.DAY, + Granularities.NONE, + ImmutableList.of(Intervals.of("2010/2011")) ), null, HadoopDruidIndexerConfig.JSON_MAPPER diff --git a/indexing-hadoop/src/test/java/org/apache/druid/indexer/IndexGeneratorJobTest.java b/indexing-hadoop/src/test/java/org/apache/druid/indexer/IndexGeneratorJobTest.java index 8b079c1bf67..75a9293c40d 100644 --- a/indexing-hadoop/src/test/java/org/apache/druid/indexer/IndexGeneratorJobTest.java +++ b/indexing-hadoop/src/test/java/org/apache/druid/indexer/IndexGeneratorJobTest.java @@ -502,9 +502,7 @@ public class IndexGeneratorJobTest Map.class ), aggs, - new UniformGranularitySpec( - Granularities.DAY, Granularities.NONE, ImmutableList.of(this.interval) - ), + new UniformGranularitySpec(Granularities.DAY, Granularities.NONE, ImmutableList.of(this.interval)), null, mapper ), diff --git a/indexing-hadoop/src/test/java/org/apache/druid/indexer/JobHelperTest.java b/indexing-hadoop/src/test/java/org/apache/druid/indexer/JobHelperTest.java index 6abdac0eda4..4aa6a5904cd 100644 --- a/indexing-hadoop/src/test/java/org/apache/druid/indexer/JobHelperTest.java +++ b/indexing-hadoop/src/test/java/org/apache/druid/indexer/JobHelperTest.java @@ -92,9 +92,7 @@ public class JobHelperTest Map.class ), new AggregatorFactory[]{new LongSumAggregatorFactory("visited_num", "visited_num")}, - new UniformGranularitySpec( - Granularities.DAY, Granularities.NONE, ImmutableList.of(this.interval) - ), + new UniformGranularitySpec(Granularities.DAY, Granularities.NONE, ImmutableList.of(this.interval)), null, HadoopDruidIndexerConfig.JSON_MAPPER ), diff --git a/indexing-hadoop/src/test/java/org/apache/druid/indexer/SortableBytesTest.java b/indexing-hadoop/src/test/java/org/apache/druid/indexer/SortableBytesTest.java index b384ff90464..daaec925635 100644 --- a/indexing-hadoop/src/test/java/org/apache/druid/indexer/SortableBytesTest.java +++ b/indexing-hadoop/src/test/java/org/apache/druid/indexer/SortableBytesTest.java @@ -48,18 +48,13 @@ public class SortableBytesTest Assert.assertEquals( -1, - WritableComparator.compareBytes( - thingie1Bytes, 0, thingie1Bytes.length, - thingie2Bytes, 0, thingie2Bytes.length - ) + WritableComparator.compareBytes(thingie1Bytes, 0, thingie1Bytes.length, thingie2Bytes, 0, thingie2Bytes.length) ); Assert.assertEquals( 0, - new SortableBytes.SortableBytesGroupingComparator().compare( - thingie1Bytes, 0, thingie1Bytes.length, - thingie2Bytes, 0, thingie2Bytes.length - ) + new SortableBytes.SortableBytesGroupingComparator() + .compare(thingie1Bytes, 0, thingie1Bytes.length, thingie2Bytes, 0, thingie2Bytes.length) ); SortableBytes reconThingie1 = SortableBytes.fromBytes(thingie1Bytes, 4, thingie1Bytes.length - 4); diff --git a/indexing-hadoop/src/test/java/org/apache/druid/indexer/hadoop/DatasourceInputFormatTest.java b/indexing-hadoop/src/test/java/org/apache/druid/indexer/hadoop/DatasourceInputFormatTest.java index 8496e86fa0b..71e55446241 100644 --- a/indexing-hadoop/src/test/java/org/apache/druid/indexer/hadoop/DatasourceInputFormatTest.java +++ b/indexing-hadoop/src/test/java/org/apache/druid/indexer/hadoop/DatasourceInputFormatTest.java @@ -151,35 +151,27 @@ public class DatasourceInputFormatTest Path path4 = new Path(JobHelper.getURIFromSegment(segments2.get(0).getSegment())); // dummy locations for test - locations = ImmutableList.of( - new LocatedFileStatus( - 1000, false, 0, 0, 0, 0, null, null, null, null, path1, - new BlockLocation[]{ - new BlockLocation(null, new String[]{"s1", "s2"}, 0, 600), - new BlockLocation(null, new String[]{"s2", "s3"}, 600, 400) - } - ), - new LocatedFileStatus( - 4000, false, 0, 0, 0, 0, null, null, null, null, path2, - new BlockLocation[]{ - new BlockLocation(null, new String[]{"s1", "s2"}, 0, 1000), - new BlockLocation(null, new String[]{"s1", "s3"}, 1000, 1200), - new BlockLocation(null, new String[]{"s2", "s3"}, 2200, 1100), - new BlockLocation(null, new String[]{"s1", "s2"}, 3300, 700) - } - ), - new LocatedFileStatus( - 500, false, 0, 0, 0, 0, null, null, null, null, path3, - new BlockLocation[]{ - new BlockLocation(null, new String[]{"s2", "s3"}, 0, 500) - } - ), - new LocatedFileStatus( - 500, false, 0, 0, 0, 0, null, null, null, null, path4, - new BlockLocation[]{ - new BlockLocation(null, new String[]{"s2", "s3"}, 0, 500) - } - ) + BlockLocation[] locations1 = { + new BlockLocation(null, new String[]{"s1", "s2"}, 0, 600), + new BlockLocation(null, new String[]{"s2", "s3"}, 600, 400) + }; + BlockLocation[] locations2 = { + new BlockLocation(null, new String[]{"s1", "s2"}, 0, 1000), + new BlockLocation(null, new String[]{"s1", "s3"}, 1000, 1200), + new BlockLocation(null, new String[]{"s2", "s3"}, 2200, 1100), + new BlockLocation(null, new String[]{"s1", "s2"}, 3300, 700) + }; + BlockLocation[] locations3 = { + new BlockLocation(null, new String[]{"s2", "s3"}, 0, 500) + }; + BlockLocation[] locations4 = { + new BlockLocation(null, new String[]{"s2", "s3"}, 0, 500) + }; + this.locations = ImmutableList.of( + new LocatedFileStatus(1000, false, 0, 0, 0, 0, null, null, null, null, path1, locations1), + new LocatedFileStatus(4000, false, 0, 0, 0, 0, null, null, null, null, path2, locations2), + new LocatedFileStatus(500, false, 0, 0, 0, 0, null, null, null, null, path3, locations3), + new LocatedFileStatus(500, false, 0, 0, 0, 0, null, null, null, null, path4, locations4) ); config = populateConfiguration(new JobConf(), segments1, 0); diff --git a/indexing-hadoop/src/test/java/org/apache/druid/indexer/path/DatasourcePathSpecTest.java b/indexing-hadoop/src/test/java/org/apache/druid/indexer/path/DatasourcePathSpecTest.java index 6256effb4ef..a229d8be348 100644 --- a/indexing-hadoop/src/test/java/org/apache/druid/indexer/path/DatasourcePathSpecTest.java +++ b/indexing-hadoop/src/test/java/org/apache/druid/indexer/path/DatasourcePathSpecTest.java @@ -342,7 +342,9 @@ public class DatasourcePathSpecTest new LongSumAggregatorFactory("visited_sum", "visited") }, new UniformGranularitySpec( - Granularities.DAY, Granularities.NONE, ImmutableList.of(Intervals.of("2000/3000")) + Granularities.DAY, + Granularities.NONE, + ImmutableList.of(Intervals.of("2000/3000")) ), null, HadoopDruidIndexerConfig.JSON_MAPPER diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/CheckPointDataSourceMetadataAction.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/CheckPointDataSourceMetadataAction.java index 769322f083c..f0ebd49be90 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/CheckPointDataSourceMetadataAction.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/CheckPointDataSourceMetadataAction.java @@ -93,9 +93,7 @@ public class CheckPointDataSourceMetadataAction implements TaskAction } @Override - public Boolean perform( - Task task, TaskActionToolbox toolbox - ) + public Boolean perform(Task task, TaskActionToolbox toolbox) { return toolbox.getSupervisorManager().checkPointDataSourceMetadata( supervisorId, diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/ResetDataSourceMetadataAction.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/ResetDataSourceMetadataAction.java index 3a46356213e..c853a00c58d 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/ResetDataSourceMetadataAction.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/ResetDataSourceMetadataAction.java @@ -59,9 +59,7 @@ public class ResetDataSourceMetadataAction implements TaskAction } @Override - public Boolean perform( - Task task, TaskActionToolbox toolbox - ) + public Boolean perform(Task task, TaskActionToolbox toolbox) { return toolbox.getSupervisorManager().resetSupervisor(dataSource, resetMetadata); } diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentMetadataUpdateAction.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentMetadataUpdateAction.java index 80a134de8c4..fd6f88aab8f 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentMetadataUpdateAction.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/actions/SegmentMetadataUpdateAction.java @@ -63,9 +63,7 @@ public class SegmentMetadataUpdateAction implements TaskAction } @Override - public Void perform( - Task task, TaskActionToolbox toolbox - ) + public Void perform(Task task, TaskActionToolbox toolbox) { TaskActionPreconditions.checkLockCoversSegments(task, toolbox.getTaskLockbox(), segments); diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/AppenderatorDriverRealtimeIndexTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/AppenderatorDriverRealtimeIndexTask.java index b7ab3a0ff77..069a55e566c 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/AppenderatorDriverRealtimeIndexTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/AppenderatorDriverRealtimeIndexTask.java @@ -242,9 +242,8 @@ public class AppenderatorDriverRealtimeIndexTask extends AbstractTask implements RealtimeAppenderatorTuningConfig tuningConfig = spec.getTuningConfig() .withBasePersistDirectory(toolbox.getPersistDir()); - final FireDepartment fireDepartmentForMetrics = new FireDepartment( - dataSchema, new RealtimeIOConfig(null, null, null), null - ); + final FireDepartment fireDepartmentForMetrics = + new FireDepartment(dataSchema, new RealtimeIOConfig(null, null, null), null); final TaskRealtimeMetricsMonitor metricsMonitor = TaskRealtimeMetricsMonitorBuilder.build( this, diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java index 4ec41283c57..f9fb0aa922c 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java @@ -890,9 +890,8 @@ public class IndexTask extends AbstractTask implements ChatHandler ) throws IOException, InterruptedException { final GranularitySpec granularitySpec = dataSchema.getGranularitySpec(); - final FireDepartment fireDepartmentForMetrics = new FireDepartment( - dataSchema, new RealtimeIOConfig(null, null, null), null - ); + final FireDepartment fireDepartmentForMetrics = + new FireDepartment(dataSchema, new RealtimeIOConfig(null, null, null), null); buildSegmentsFireDepartmentMetrics = fireDepartmentForMetrics.getMetrics(); if (toolbox.getMonitorScheduler() != null) { diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSubTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSubTask.java index dc4d9eb7153..be72fc4b756 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSubTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSubTask.java @@ -289,9 +289,8 @@ public class ParallelIndexSubTask extends AbstractTask { final DataSchema dataSchema = ingestionSchema.getDataSchema(); final GranularitySpec granularitySpec = dataSchema.getGranularitySpec(); - final FireDepartment fireDepartmentForMetrics = new FireDepartment( - dataSchema, new RealtimeIOConfig(null, null, null), null - ); + final FireDepartment fireDepartmentForMetrics = + new FireDepartment(dataSchema, new RealtimeIOConfig(null, null, null), null); final FireDepartmentMetrics fireDepartmentMetrics = fireDepartmentForMetrics.getMetrics(); if (toolbox.getMonitorScheduler() != null) { diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/hadoop/OverlordActionBasedUsedSegmentLister.java b/indexing-service/src/main/java/org/apache/druid/indexing/hadoop/OverlordActionBasedUsedSegmentLister.java index d97bf1bc9f3..c0ef8f768ff 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/hadoop/OverlordActionBasedUsedSegmentLister.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/hadoop/OverlordActionBasedUsedSegmentLister.java @@ -43,9 +43,7 @@ public class OverlordActionBasedUsedSegmentLister implements UsedSegmentLister } @Override - public List getUsedSegmentsForIntervals( - String dataSource, List intervals - ) throws IOException + public List getUsedSegmentsForIntervals(String dataSource, List intervals) throws IOException { return toolbox .getTaskActionClient() diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/HeapMemoryTaskStorage.java b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/HeapMemoryTaskStorage.java index 744e4d3d6c7..dc4c32d46f4 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/HeapMemoryTaskStorage.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/HeapMemoryTaskStorage.java @@ -222,7 +222,9 @@ public class HeapMemoryTaskStorage implements TaskStorage @Override public List> getRecentlyFinishedTaskInfo( - @Nullable Integer maxTaskStatuses, @Nullable Duration duration, @Nullable String datasource + @Nullable Integer maxTaskStatuses, + @Nullable Duration duration, + @Nullable String datasource ) { giant.lock(); diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java index 9480bf333b3..bde17ef25dc 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java @@ -780,7 +780,8 @@ public class RemoteTaskRunner implements WorkerTaskRunner, TaskLogStreamer ImmutableMap.copyOf( Maps.transformEntries( Maps.filterEntries( - zkWorkers, new Predicate>() + zkWorkers, + new Predicate>() { @Override public boolean apply(Map.Entry input) @@ -791,16 +792,7 @@ public class RemoteTaskRunner implements WorkerTaskRunner, TaskLogStreamer } } ), - new Maps.EntryTransformer() - { - @Override - public ImmutableWorkerInfo transformEntry( - String key, ZkWorker value - ) - { - return value.toImmutable(); - } - } + (String key, ZkWorker value) -> value.toImmutable() ) ), task diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunner.java b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunner.java index b4ebdf60b6f..899be15789a 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunner.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunner.java @@ -329,7 +329,8 @@ public class HttpRemoteTaskRunner implements WorkerTaskRunner, TaskLogStreamer ImmutableMap.copyOf( Maps.transformEntries( Maps.filterEntries( - workers, new Predicate>() + workers, + new Predicate>() { @Override public boolean apply(Map.Entry input) @@ -340,16 +341,7 @@ public class HttpRemoteTaskRunner implements WorkerTaskRunner, TaskLogStreamer } } ), - new Maps.EntryTransformer() - { - @Override - public ImmutableWorkerInfo transformEntry( - String key, WorkerHolder value - ) - { - return value.toImmutable(); - } - } + (String key, WorkerHolder value) -> value.toImmutable() ) ), task @@ -778,9 +770,7 @@ public class HttpRemoteTaskRunner implements WorkerTaskRunner, TaskLogStreamer } @Override - public Collection markWorkersLazy( - Predicate isLazyWorker, int maxWorkers - ) + public Collection markWorkersLazy(Predicate isLazyWorker, int maxWorkers) { synchronized (statusLock) { Iterator iterator = workers.keySet().iterator(); diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java index ebbb1cfb1f5..ad5b232d426 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java @@ -698,9 +698,8 @@ public class OverlordResource final Interval theInterval = Intervals.of(interval.replace("_", "/")); duration = theInterval.toDuration(); } - final List> taskInfoList = taskStorageQueryAdapter.getRecentlyCompletedTaskInfo( - maxCompletedTasks, duration, dataSource - ); + final List> taskInfoList = + taskStorageQueryAdapter.getRecentlyCompletedTaskInfo(maxCompletedTasks, duration, dataSource); final List completedTasks = taskInfoList.stream() .map(completeTaskTransformFunc::apply) .collect(Collectors.toList()); diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategy.java b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategy.java index 0802c489d15..3f7bde2060e 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategy.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategy.java @@ -74,7 +74,9 @@ public class JavaScriptWorkerSelectStrategy implements WorkerSelectStrategy @Override public ImmutableWorkerInfo findWorkerForTask( - WorkerTaskRunnerConfig config, ImmutableMap zkWorkers, Task task + WorkerTaskRunnerConfig config, + ImmutableMap zkWorkers, + Task task ) { fnSelector = fnSelector == null ? compileSelectorFunction() : fnSelector; diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/worker/WorkerTaskMonitor.java b/indexing-service/src/main/java/org/apache/druid/indexing/worker/WorkerTaskMonitor.java index 878e170a7fd..9aa4e5f1e15 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/worker/WorkerTaskMonitor.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/worker/WorkerTaskMonitor.java @@ -72,7 +72,11 @@ public class WorkerTaskMonitor extends WorkerTaskManager this.jsonMapper = jsonMapper; this.pathChildrenCache = new PathChildrenCache( - cf, workerCuratorCoordinator.getTaskPathForWorker(), false, true, Execs.makeThreadFactory("TaskMonitorCache-%s") + cf, + workerCuratorCoordinator.getTaskPathForWorker(), + false, + true, + Execs.makeThreadFactory("TaskMonitorCache-%s") ); this.cf = cf; this.workerCuratorCoordinator = workerCuratorCoordinator; diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/actions/RemoteTaskActionClientTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/actions/RemoteTaskActionClientTest.java index 39baa14eb07..fe4402d6d79 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/common/actions/RemoteTaskActionClientTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/actions/RemoteTaskActionClientTest.java @@ -96,9 +96,10 @@ public class RemoteTaskActionClientTest Task task = new NoopTask("id", null, 0, 0, null, null, null); RemoteTaskActionClient client = new RemoteTaskActionClient( - task, druidLeaderClient, new RetryPolicyFactory( - new RetryPolicyConfig() - ), objectMapper + task, + druidLeaderClient, + new RetryPolicyFactory(new RetryPolicyConfig()), + objectMapper ); try { result = client.submit(new LockListAction()); @@ -136,9 +137,10 @@ public class RemoteTaskActionClientTest Task task = new NoopTask("id", null, 0, 0, null, null, null); RemoteTaskActionClient client = new RemoteTaskActionClient( - task, druidLeaderClient, new RetryPolicyFactory( - objectMapper.readValue("{\"maxRetryCount\":0}", RetryPolicyConfig.class) - ), objectMapper + task, + druidLeaderClient, + new RetryPolicyFactory(objectMapper.readValue("{\"maxRetryCount\":0}", RetryPolicyConfig.class)), + objectMapper ); result = client.submit(new LockListAction()); } diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/AppenderatorDriverRealtimeIndexTaskTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/AppenderatorDriverRealtimeIndexTaskTest.java index 8e169f97c4d..5e92b2af360 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/AppenderatorDriverRealtimeIndexTaskTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/AppenderatorDriverRealtimeIndexTaskTest.java @@ -1499,7 +1499,9 @@ public class AppenderatorDriverRealtimeIndexTaskTest @Override public SegmentPublishResult announceHistoricalSegments( - Set segments, DataSourceMetadata startMetadata, DataSourceMetadata endMetadata + Set segments, + DataSourceMetadata startMetadata, + DataSourceMetadata endMetadata ) throws IOException { SegmentPublishResult result = super.announceHistoricalSegments(segments, startMetadata, endMetadata); @@ -1537,9 +1539,7 @@ public class AppenderatorDriverRealtimeIndexTaskTest ) { @Override - public QueryRunner decorate( - QueryRunner delegate, QueryToolChest> toolChest - ) + public QueryRunner decorate(QueryRunner delegate, QueryToolChest> toolChest) { return delegate; } @@ -1561,7 +1561,9 @@ public class AppenderatorDriverRealtimeIndexTaskTest { @Override public boolean registerSegmentHandoffCallback( - SegmentDescriptor descriptor, Executor exec, Runnable handOffRunnable + SegmentDescriptor descriptor, + Executor exec, + Runnable handOffRunnable ) { handOffCallbacks.put(descriptor, new Pair<>(exec, handOffRunnable)); diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskTest.java index eb80011bc1c..5f094607145 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskTest.java @@ -224,10 +224,12 @@ public class CompactionTaskTest final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector(); objectMapper.setAnnotationIntrospectors( new AnnotationIntrospectorPair( - guiceIntrospector, objectMapper.getSerializationConfig().getAnnotationIntrospector() + guiceIntrospector, + objectMapper.getSerializationConfig().getAnnotationIntrospector() ), new AnnotationIntrospectorPair( - guiceIntrospector, objectMapper.getDeserializationConfig().getAnnotationIntrospector() + guiceIntrospector, + objectMapper.getDeserializationConfig().getAnnotationIntrospector() ) ); GuiceInjectableValues injectableValues = new GuiceInjectableValues( diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IndexTaskTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IndexTaskTest.java index 9d4f6e7fb75..40a3d4fa77d 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IndexTaskTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IndexTaskTest.java @@ -1551,7 +1551,8 @@ public class IndexTaskTest if (taskAction instanceof LockAcquireAction) { return (RetType) new TaskLock( - TaskLockType.EXCLUSIVE, "groupId", + TaskLockType.EXCLUSIVE, + "groupId", "test", ((LockAcquireAction) taskAction).getInterval(), DateTimes.nowUtc().toString(), diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/RealtimeIndexTaskTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/RealtimeIndexTaskTest.java index a0a39a3df50..bb6867755b7 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/RealtimeIndexTaskTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/RealtimeIndexTaskTest.java @@ -999,9 +999,7 @@ public class RealtimeIndexTaskTest ) { @Override - public QueryRunner decorate( - QueryRunner delegate, QueryToolChest> toolChest - ) + public QueryRunner decorate(QueryRunner delegate, QueryToolChest> toolChest) { return delegate; } @@ -1033,7 +1031,9 @@ public class RealtimeIndexTaskTest { @Override public boolean registerSegmentHandoffCallback( - SegmentDescriptor descriptor, Executor exec, Runnable handOffRunnable + SegmentDescriptor descriptor, + Executor exec, + Runnable handOffRunnable ) { handOffCallbacks.put(descriptor, new Pair<>(exec, handOffRunnable)); diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/TaskSerdeTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/TaskSerdeTest.java index 98c42b7117d..c4b307001b4 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/TaskSerdeTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/TaskSerdeTest.java @@ -45,10 +45,7 @@ import org.apache.druid.segment.indexing.RealtimeIOConfig; import org.apache.druid.segment.indexing.RealtimeTuningConfig; import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec; import org.apache.druid.segment.realtime.FireDepartment; -import org.apache.druid.segment.realtime.FireDepartmentMetrics; import org.apache.druid.segment.realtime.firehose.LocalFirehoseFactory; -import org.apache.druid.segment.realtime.plumber.Plumber; -import org.apache.druid.segment.realtime.plumber.PlumberSchool; import org.apache.druid.server.security.AuthTestUtils; import org.apache.druid.timeline.DataSegment; import org.apache.druid.timeline.partition.NoneShardSpec; @@ -468,16 +465,8 @@ public class TaskSerdeTest jsonMapper ), new RealtimeIOConfig( - new LocalFirehoseFactory(new File("lol"), "rofl", null), new PlumberSchool() - { - @Override - public Plumber findPlumber( - DataSchema schema, RealtimeTuningConfig config, FireDepartmentMetrics metrics - ) - { - return null; - } - }, + new LocalFirehoseFactory(new File("lol"), "rofl", null), + (schema, config, metrics) -> null, null ), diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/firehose/IngestSegmentFirehoseFactoryTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/firehose/IngestSegmentFirehoseFactoryTest.java index 03660fead8f..97ed98b7a71 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/firehose/IngestSegmentFirehoseFactoryTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/firehose/IngestSegmentFirehoseFactoryTest.java @@ -382,10 +382,12 @@ public class IngestSegmentFirehoseFactoryTest final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector(); objectMapper.setAnnotationIntrospectors( new AnnotationIntrospectorPair( - guiceIntrospector, objectMapper.getSerializationConfig().getAnnotationIntrospector() + guiceIntrospector, + objectMapper.getSerializationConfig().getAnnotationIntrospector() ), new AnnotationIntrospectorPair( - guiceIntrospector, objectMapper.getDeserializationConfig().getAnnotationIntrospector() + guiceIntrospector, + objectMapper.getDeserializationConfig().getAnnotationIntrospector() ) ); objectMapper.setInjectableValues( diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/RemoteTaskRunnerTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/RemoteTaskRunnerTest.java index cbb381dbd48..49a0a8889a8 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/RemoteTaskRunnerTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/RemoteTaskRunnerTest.java @@ -791,7 +791,11 @@ public class RemoteTaskRunnerTest for (int i = 1; i < 13; i++) { String taskId = StringUtils.format("rt-%d", i); TestRealtimeTask task = new TestRealtimeTask( - taskId, new TaskResource(taskId, 1), "foo", TaskStatus.success(taskId), jsonMapper + taskId, + new TaskResource(taskId, 1), + "foo", + TaskStatus.success(taskId), + jsonMapper ); Future taskFuture = remoteTaskRunner.run(task); @@ -844,7 +848,11 @@ public class RemoteTaskRunnerTest for (int i = 1; i < 13; i++) { String taskId = StringUtils.format("rt-%d", i); TestRealtimeTask task = new TestRealtimeTask( - taskId, new TaskResource(taskId, 1), "foo", TaskStatus.success(taskId), jsonMapper + taskId, + new TaskResource(taskId, 1), + "foo", + TaskStatus.success(taskId), + jsonMapper ); Future taskFuture = remoteTaskRunner.run(task); diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java index f2366056ac2..602107aa635 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java @@ -442,11 +442,11 @@ public class TaskLifecycleTest { return new SegmentHandoffNotifier() { - - @Override public boolean registerSegmentHandoffCallback( - SegmentDescriptor descriptor, Executor exec, Runnable handOffRunnable + SegmentDescriptor descriptor, + Executor exec, + Runnable handOffRunnable ) { handOffCallbacks.put(descriptor, new Pair<>(exec, handOffRunnable)); diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/autoscaling/EC2AutoScalerSerdeTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/autoscaling/EC2AutoScalerSerdeTest.java index e97351311c0..d5e2a648ca8 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/autoscaling/EC2AutoScalerSerdeTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/autoscaling/EC2AutoScalerSerdeTest.java @@ -67,7 +67,10 @@ public class EC2AutoScalerSerdeTest { @Override public Object findInjectableValue( - Object o, DeserializationContext deserializationContext, BeanProperty beanProperty, Object o1 + Object o, + DeserializationContext deserializationContext, + BeanProperty beanProperty, + Object o1 ) { return null; diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunnerTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunnerTest.java index 56ec10a6be6..a1308836528 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunnerTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunnerTest.java @@ -117,7 +117,12 @@ public class HttpRemoteTaskRunnerTest ) { return HttpRemoteTaskRunnerTest.createWorkerHolder( - smileMapper, httpClient, config, workersSyncExec, listener, worker, + smileMapper, + httpClient, + config, + workersSyncExec, + listener, + worker, ImmutableList.of(), ImmutableMap.of(), new AtomicInteger(), @@ -144,11 +149,7 @@ public class HttpRemoteTaskRunnerTest ) ); - druidNodeDiscovery.listener.nodesAdded( - ImmutableList.of( - druidNode1, druidNode2 - ) - ); + druidNodeDiscovery.listener.nodesAdded(ImmutableList.of(druidNode1, druidNode2)); int numTasks = 8; List> futures = new ArrayList<>(); @@ -209,7 +210,12 @@ public class HttpRemoteTaskRunnerTest ) { return HttpRemoteTaskRunnerTest.createWorkerHolder( - smileMapper, httpClient, config, workersSyncExec, listener, worker, + smileMapper, + httpClient, + config, + workersSyncExec, + listener, + worker, ImmutableList.of(), ImmutableMap.of(task1, ImmutableList.of()), //no announcements would be received for task1 new AtomicInteger(), @@ -236,11 +242,7 @@ public class HttpRemoteTaskRunnerTest ) ); - druidNodeDiscovery.listener.nodesAdded( - ImmutableList.of( - druidNode1, druidNode2 - ) - ); + druidNodeDiscovery.listener.nodesAdded(ImmutableList.of(druidNode1, druidNode2)); taskRunner.run(task1); Future future2 = taskRunner.run(task2); @@ -337,7 +339,12 @@ public class HttpRemoteTaskRunnerTest workerHolders.put( "host:1234", (mapper, httpClient, config, exec, listener, worker) -> createWorkerHolder( - mapper, httpClient, config, exec, listener, worker, + mapper, + httpClient, + config, + exec, + listener, + worker, ImmutableList.of( TaskAnnouncement.create( task1, @@ -468,7 +475,12 @@ public class HttpRemoteTaskRunnerTest workerHolders.put( "host:1234", (mapper, httpClient, config, exec, listener, worker) -> createWorkerHolder( - mapper, httpClient, config, exec, listener, worker, + mapper, + httpClient, + config, + exec, + listener, + worker, ImmutableList.of(), ImmutableMap.of( task1, ImmutableList.of( @@ -528,7 +540,12 @@ public class HttpRemoteTaskRunnerTest workerHolders.put( "host:1234", (mapper, httpClient, config, exec, listener, worker) -> createWorkerHolder( - mapper, httpClient, config, exec, listener, worker, + mapper, + httpClient, + config, + exec, + listener, + worker, ImmutableList.of( TaskAnnouncement.create( task1, @@ -623,15 +640,18 @@ public class HttpRemoteTaskRunnerTest DiscoveryDruidNode druidNode = new DiscoveryDruidNode( new DruidNode("service", "host", false, 1234, null, true, false), NodeType.MIDDLE_MANAGER, - ImmutableMap.of( - WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip1", 2, "0") - ) + ImmutableMap.of(WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip1", 2, "0")) ); workerHolders.put( "host:1234", (mapper, httpClient, config, exec, listener, worker) -> createWorkerHolder( - mapper, httpClient, config, exec, listener, worker, + mapper, + httpClient, + config, + exec, + listener, + worker, ImmutableList.of(), ImmutableMap.of( task1, ImmutableList.of( @@ -692,7 +712,12 @@ public class HttpRemoteTaskRunnerTest workerHolders.put( "host:1234", (mapper, httpClient, config, exec, listener, worker) -> createWorkerHolder( - mapper, httpClient, config, exec, listener, worker, + mapper, + httpClient, + config, + exec, + listener, + worker, ImmutableList.of( TaskAnnouncement.create( task1, @@ -798,7 +823,12 @@ public class HttpRemoteTaskRunnerTest workerHolders.put( "host1:8080", (mapper, httpClient, config, exec, listener, worker) -> createWorkerHolder( - mapper, httpClient, config, exec, listener, worker, + mapper, + httpClient, + config, + exec, + listener, + worker, ImmutableList.of(), ImmutableMap.of( task1, ImmutableList.of( @@ -819,11 +849,7 @@ public class HttpRemoteTaskRunnerTest ) ); - druidNodeDiscovery.listener.nodesAdded( - ImmutableList.of( - druidNode1 - ) - ); + druidNodeDiscovery.listener.nodesAdded(ImmutableList.of(druidNode1)); taskRunner.run(task1); @@ -834,29 +860,26 @@ public class HttpRemoteTaskRunnerTest DiscoveryDruidNode druidNode2 = new DiscoveryDruidNode( new DruidNode("service", "host2", false, 8080, null, true, false), NodeType.MIDDLE_MANAGER, - ImmutableMap.of( - WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip2", 1, "0") - ) + ImmutableMap.of(WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip2", 1, "0")) ); workerHolders.put( "host2:8080", (mapper, httpClient, config, exec, listener, worker) -> createWorkerHolder( - mapper, httpClient, config, exec, listener, worker, + mapper, + httpClient, + config, + exec, + listener, + worker, ImmutableList.of(), - ImmutableMap.of( - task2, ImmutableList.of() - ), + ImmutableMap.of(task2, ImmutableList.of()), ticks, ImmutableSet.of() ) ); - druidNodeDiscovery.listener.nodesAdded( - ImmutableList.of( - druidNode2 - ) - ); + druidNodeDiscovery.listener.nodesAdded(ImmutableList.of(druidNode2)); taskRunner.run(task2); @@ -867,15 +890,18 @@ public class HttpRemoteTaskRunnerTest DiscoveryDruidNode druidNode3 = new DiscoveryDruidNode( new DruidNode("service", "host3", false, 8080, null, true, false), NodeType.MIDDLE_MANAGER, - ImmutableMap.of( - WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip2", 1, "0") - ) + ImmutableMap.of(WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip2", 1, "0")) ); workerHolders.put( "host3:8080", (mapper, httpClient, config, exec, listener, worker) -> createWorkerHolder( - mapper, httpClient, config, exec, listener, worker, + mapper, + httpClient, + config, + exec, + listener, + worker, ImmutableList.of(), ImmutableMap.of(), new AtomicInteger(), @@ -883,11 +909,7 @@ public class HttpRemoteTaskRunnerTest ) ); - druidNodeDiscovery.listener.nodesAdded( - ImmutableList.of( - druidNode3 - ) - ); + druidNodeDiscovery.listener.nodesAdded(ImmutableList.of(druidNode3)); Assert.assertEquals(task1.getId(), Iterables.getOnlyElement(taskRunner.getRunningTasks()).getTaskId()); Assert.assertEquals(task2.getId(), Iterables.getOnlyElement(taskRunner.getPendingTasks()).getTaskId()); @@ -1088,9 +1110,8 @@ public class HttpRemoteTaskRunnerTest EasyMock.replay(taskStorage); List listenerNotificationsAccumulator = new ArrayList<>(); - HttpRemoteTaskRunner taskRunner = createTaskRunnerForTestTaskAddedOrUpdated( - taskStorage, listenerNotificationsAccumulator - ); + HttpRemoteTaskRunner taskRunner = + createTaskRunnerForTestTaskAddedOrUpdated(taskStorage, listenerNotificationsAccumulator); Worker worker = new Worker("http", "localhost", "127.0.0.1", 1, "v1"); diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/setup/WorkerBehaviorConfigTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/setup/WorkerBehaviorConfigTest.java index da6d2668db7..d15264191af 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/setup/WorkerBehaviorConfigTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/setup/WorkerBehaviorConfigTest.java @@ -80,7 +80,10 @@ public class WorkerBehaviorConfigTest { @Override public Object findInjectableValue( - Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance + Object valueId, + DeserializationContext ctxt, + BeanProperty forProperty, + Object beanInstance ) { return null; diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/test/TestIndexerMetadataStorageCoordinator.java b/indexing-service/src/test/java/org/apache/druid/indexing/test/TestIndexerMetadataStorageCoordinator.java index 381170742ac..07afca7dc8b 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/test/TestIndexerMetadataStorageCoordinator.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/test/TestIndexerMetadataStorageCoordinator.java @@ -58,9 +58,7 @@ public class TestIndexerMetadataStorageCoordinator implements IndexerMetadataSto } @Override - public boolean resetDataSourceMetadata( - String dataSource, DataSourceMetadata dataSourceMetadata - ) + public boolean resetDataSourceMetadata(String dataSource, DataSourceMetadata dataSourceMetadata) { return false; } @@ -84,9 +82,7 @@ public class TestIndexerMetadataStorageCoordinator implements IndexerMetadataSto } @Override - public List getUsedSegmentsForIntervals( - String dataSource, List intervals - ) + public List getUsedSegmentsForIntervals(String dataSource, List intervals) { return ImmutableList.of(); } diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/worker/TaskAnnouncementTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/worker/TaskAnnouncementTest.java index 843f2b133ba..601ccbc5981 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/worker/TaskAnnouncementTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/worker/TaskAnnouncementTest.java @@ -30,12 +30,8 @@ import org.apache.druid.jackson.DefaultObjectMapper; import org.apache.druid.query.aggregation.AggregatorFactory; import org.apache.druid.segment.indexing.DataSchema; import org.apache.druid.segment.indexing.RealtimeIOConfig; -import org.apache.druid.segment.indexing.RealtimeTuningConfig; import org.apache.druid.segment.realtime.FireDepartment; -import org.apache.druid.segment.realtime.FireDepartmentMetrics; import org.apache.druid.segment.realtime.firehose.LocalFirehoseFactory; -import org.apache.druid.segment.realtime.plumber.Plumber; -import org.apache.druid.segment.realtime.plumber.PlumberSchool; import org.junit.Assert; import org.junit.Test; @@ -60,17 +56,8 @@ public class TaskAnnouncementTest new FireDepartment( new DataSchema("foo", null, new AggregatorFactory[0], null, null, new DefaultObjectMapper()), new RealtimeIOConfig( - new LocalFirehoseFactory(new File("lol"), "rofl", null), new PlumberSchool() - { - @Override - public Plumber findPlumber( - DataSchema schema, RealtimeTuningConfig config, FireDepartmentMetrics metrics - ) - { - return null; - } - - }, + new LocalFirehoseFactory(new File("lol"), "rofl", null), + (schema, config, metrics) -> null, null ), null diff --git a/indexing-service/src/test/java/org/apache/druid/server/initialization/IndexerZkConfigTest.java b/indexing-service/src/test/java/org/apache/druid/server/initialization/IndexerZkConfigTest.java index e33ed787f04..f6d8d0717a6 100644 --- a/indexing-service/src/test/java/org/apache/druid/server/initialization/IndexerZkConfigTest.java +++ b/indexing-service/src/test/java/org/apache/druid/server/initialization/IndexerZkConfigTest.java @@ -65,10 +65,7 @@ public class IndexerZkConfigTest binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(-1); // See IndexingServiceModuleHelper JsonConfigProvider.bind(binder, indexerPropertyString, IndexerZkConfig.class); - JsonConfigProvider.bind( - binder, zkServiceConfigString, - ZkPathsConfig.class - ); + JsonConfigProvider.bind(binder, zkServiceConfigString, ZkPathsConfig.class); } }; diff --git a/integration-tests/src/main/java/org/apache/druid/testing/clients/EventReceiverFirehoseTestClient.java b/integration-tests/src/main/java/org/apache/druid/testing/clients/EventReceiverFirehoseTestClient.java index 5b01c9ecf3c..ef1384070bb 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/clients/EventReceiverFirehoseTestClient.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/clients/EventReceiverFirehoseTestClient.java @@ -88,12 +88,8 @@ public class EventReceiverFirehoseTestClient { try { StatusResponseHolder response = httpClient.go( - new Request( - HttpMethod.POST, new URL(getURL()) - ).setContent( - mediaType, - objectMapper.writeValueAsBytes(events) - ), + new Request(HttpMethod.POST, new URL(getURL())) + .setContent(mediaType, objectMapper.writeValueAsBytes(events)), responseHandler ).get(); @@ -143,11 +139,7 @@ public class EventReceiverFirehoseTestClient int totalEventsPosted = 0; int expectedEventsPosted = 0; while ((s = reader.readLine()) != null) { - events.add( - this.jsonMapper.readValue( - s, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT - ) - ); + events.add(this.jsonMapper.readValue(s, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT)); ObjectMapper mapper = (totalEventsPosted % 2 == 0) ? jsonMapper : smileMapper; String mediaType = (totalEventsPosted % 2 == 0) ? MediaType.APPLICATION_JSON diff --git a/integration-tests/src/main/java/org/apache/druid/testing/clients/OverlordResourceTestClient.java b/integration-tests/src/main/java/org/apache/druid/testing/clients/OverlordResourceTestClient.java index a1d7e51b6f3..45f55d6f165 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/clients/OverlordResourceTestClient.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/clients/OverlordResourceTestClient.java @@ -234,9 +234,7 @@ public class OverlordResourceTestClient { try { StatusResponseHolder response = httpClient.go( - new Request( - HttpMethod.POST, new URL(StringUtils.format("%ssupervisor/%s/shutdown", getIndexerURL(), id)) - ), + new Request(HttpMethod.POST, new URL(StringUtils.format("%ssupervisor/%s/shutdown", getIndexerURL(), id))), responseHandler ).get(); if (!response.getStatus().equals(HttpResponseStatus.OK)) { diff --git a/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITAppenderatorDriverRealtimeIndexTaskTest.java b/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITAppenderatorDriverRealtimeIndexTaskTest.java index 4ec554da7e8..e6ca33d1d61 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITAppenderatorDriverRealtimeIndexTaskTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITAppenderatorDriverRealtimeIndexTaskTest.java @@ -102,11 +102,7 @@ public class ITAppenderatorDriverRealtimeIndexTaskTest extends AbstractITRealtim String event = line.replace(TIME_PLACEHOLDER, EVENT_FMT.print(dt)); LOG.info("sending event: [%s]\n", event); Collection> events = new ArrayList>(); - events.add( - this.jsonMapper.readValue( - event, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT - ) - ); + events.add(this.jsonMapper.readValue(event, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT)); int eventsPosted = client.postEvents(events, this.jsonMapper, MediaType.APPLICATION_JSON); if (eventsPosted != events.size()) { throw new ISE("Event not posted"); diff --git a/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITKafkaIndexingServiceTest.java b/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITKafkaIndexingServiceTest.java index 2c42de8f776..4766e0f43ce 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITKafkaIndexingServiceTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITKafkaIndexingServiceTest.java @@ -115,10 +115,7 @@ public class ITKafkaIndexingServiceTest extends AbstractIndexerTest int sessionTimeoutMs = 10000; int connectionTimeoutMs = 10000; String zkHosts = config.getZookeeperHosts(); - zkClient = new ZkClient( - zkHosts, sessionTimeoutMs, connectionTimeoutMs, - ZKStringSerializer$.MODULE$ - ); + zkClient = new ZkClient(zkHosts, sessionTimeoutMs, connectionTimeoutMs, ZKStringSerializer$.MODULE$); zkUtils = new ZkUtils(zkClient, new ZkConnection(zkHosts, sessionTimeoutMs), false); if (config.manageKafkaTopic()) { int numPartitions = 4; diff --git a/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITKafkaTest.java b/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITKafkaTest.java index 90f21c235d0..6e29c3ae097 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITKafkaTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITKafkaTest.java @@ -116,10 +116,7 @@ public class ITKafkaTest extends AbstractIndexerTest int sessionTimeoutMs = 10000; int connectionTimeoutMs = 10000; String zkHosts = config.getZookeeperHosts(); - zkClient = new ZkClient( - zkHosts, sessionTimeoutMs, connectionTimeoutMs, - ZKStringSerializer$.MODULE$ - ); + zkClient = new ZkClient(zkHosts, sessionTimeoutMs, connectionTimeoutMs, ZKStringSerializer$.MODULE$); zkUtils = new ZkUtils(zkClient, new ZkConnection(zkHosts, sessionTimeoutMs), false); if (config.manageKafkaTopic()) { int numPartitions = 1; diff --git a/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITRealtimeIndexTaskTest.java b/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITRealtimeIndexTaskTest.java index c6dd0221c2d..75c43fc3940 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITRealtimeIndexTaskTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITRealtimeIndexTaskTest.java @@ -114,11 +114,7 @@ public class ITRealtimeIndexTaskTest extends AbstractITRealtimeIndexTaskTest String event = line.replace(TIME_PLACEHOLDER, EVENT_FMT.print(dt)); LOG.info("sending event: [%s]\n", event); Collection> events = new ArrayList>(); - events.add( - this.jsonMapper.readValue( - event, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT - ) - ); + events.add(this.jsonMapper.readValue(event, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT)); int eventsPosted = client.postEvents(events, this.jsonMapper, MediaType.APPLICATION_JSON); if (eventsPosted != events.size()) { throw new ISE("Event not posted"); diff --git a/processing/src/main/java/org/apache/druid/collections/bitmap/BitSetBitmapFactory.java b/processing/src/main/java/org/apache/druid/collections/bitmap/BitSetBitmapFactory.java index f3e02396053..3ba92ba76a5 100644 --- a/processing/src/main/java/org/apache/druid/collections/bitmap/BitSetBitmapFactory.java +++ b/processing/src/main/java/org/apache/druid/collections/bitmap/BitSetBitmapFactory.java @@ -81,9 +81,7 @@ public class BitSetBitmapFactory implements BitmapFactory } @Override - public ImmutableBitmap complement( - ImmutableBitmap b, int length - ) + public ImmutableBitmap complement(ImmutableBitmap b, int length) { return null; } diff --git a/processing/src/main/java/org/apache/druid/collections/bitmap/RoaringBitmapFactory.java b/processing/src/main/java/org/apache/druid/collections/bitmap/RoaringBitmapFactory.java index a51aa571bf6..66f7bf096b6 100644 --- a/processing/src/main/java/org/apache/druid/collections/bitmap/RoaringBitmapFactory.java +++ b/processing/src/main/java/org/apache/druid/collections/bitmap/RoaringBitmapFactory.java @@ -165,16 +165,10 @@ public class RoaringBitmapFactory implements BitmapFactory } @Override - public ImmutableBitmap complement( - ImmutableBitmap b, int length - ) + public ImmutableBitmap complement(ImmutableBitmap b, int length) { return new WrappedImmutableRoaringBitmap( - ImmutableRoaringBitmap.flip( - ((WrappedImmutableRoaringBitmap) b).getBitmap(), - 0, - length - ) + ImmutableRoaringBitmap.flip(((WrappedImmutableRoaringBitmap) b).getBitmap(), 0, length) ); } } diff --git a/processing/src/main/java/org/apache/druid/jackson/DruidDefaultSerializersModule.java b/processing/src/main/java/org/apache/druid/jackson/DruidDefaultSerializersModule.java index 10bd8785337..55a39378eef 100644 --- a/processing/src/main/java/org/apache/druid/jackson/DruidDefaultSerializersModule.java +++ b/processing/src/main/java/org/apache/druid/jackson/DruidDefaultSerializersModule.java @@ -136,9 +136,7 @@ public class DruidDefaultSerializersModule extends SimpleModule new JsonDeserializer() { @Override - public ByteOrder deserialize( - JsonParser jp, DeserializationContext ctxt - ) throws IOException, JsonProcessingException + public ByteOrder deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { if (ByteOrder.BIG_ENDIAN.toString().equals(jp.getText())) { return ByteOrder.BIG_ENDIAN; diff --git a/processing/src/main/java/org/apache/druid/query/DefaultGenericQueryMetricsFactory.java b/processing/src/main/java/org/apache/druid/query/DefaultGenericQueryMetricsFactory.java index fb859dbb825..796c89a8360 100644 --- a/processing/src/main/java/org/apache/druid/query/DefaultGenericQueryMetricsFactory.java +++ b/processing/src/main/java/org/apache/druid/query/DefaultGenericQueryMetricsFactory.java @@ -34,8 +34,7 @@ public class DefaultGenericQueryMetricsFactory implements GenericQueryMetricsFac /** * Should be used only in tests, directly or indirectly (e. g. in {@link - * org.apache.druid.query.search.SearchQueryQueryToolChest#SearchQueryQueryToolChest( - * org.apache.druid.query.search.SearchQueryConfig, IntervalChunkingQueryRunnerDecorator)}). + * org.apache.druid.query.search.SearchQueryQueryToolChest#SearchQueryQueryToolChest}). */ @VisibleForTesting public static GenericQueryMetricsFactory instance() diff --git a/processing/src/main/java/org/apache/druid/query/FluentQueryRunnerBuilder.java b/processing/src/main/java/org/apache/druid/query/FluentQueryRunnerBuilder.java index c827890f8aa..5990058172b 100644 --- a/processing/src/main/java/org/apache/druid/query/FluentQueryRunnerBuilder.java +++ b/processing/src/main/java/org/apache/druid/query/FluentQueryRunnerBuilder.java @@ -49,9 +49,7 @@ public class FluentQueryRunnerBuilder } @Override - public Sequence run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { return baseRunner.run(queryPlus, responseContext); } @@ -63,25 +61,12 @@ public class FluentQueryRunnerBuilder public FluentQueryRunner applyPostMergeDecoration() { - return from( - new FinalizeResultsQueryRunner( - toolChest.postMergeQueryDecoration( - baseRunner - ), - toolChest - ) - ); + return from(new FinalizeResultsQueryRunner<>(toolChest.postMergeQueryDecoration(baseRunner), toolChest)); } public FluentQueryRunner applyPreMergeDecoration() { - return from( - new UnionQueryRunner( - toolChest.preMergeQueryDecoration( - baseRunner - ) - ) - ); + return from(new UnionQueryRunner<>(toolChest.preMergeQueryDecoration(baseRunner))); } public FluentQueryRunner emitCPUTimeMetric(ServiceEmitter emitter) @@ -99,17 +84,12 @@ public class FluentQueryRunnerBuilder public FluentQueryRunner postProcess(PostProcessingOperator postProcessing) { - return from( - postProcessing != null ? - postProcessing.postProcess(baseRunner) : baseRunner - ); + return from(postProcessing != null ? postProcessing.postProcess(baseRunner) : baseRunner); } public FluentQueryRunner mergeResults() { - return from( - toolChest.mergeResults(baseRunner) - ); + return from(toolChest.mergeResults(baseRunner)); } } } diff --git a/processing/src/main/java/org/apache/druid/query/IntervalChunkingQueryRunner.java b/processing/src/main/java/org/apache/druid/query/IntervalChunkingQueryRunner.java index 17203dbcb01..30e77325aec 100644 --- a/processing/src/main/java/org/apache/druid/query/IntervalChunkingQueryRunner.java +++ b/processing/src/main/java/org/apache/druid/query/IntervalChunkingQueryRunner.java @@ -50,8 +50,11 @@ public class IntervalChunkingQueryRunner implements QueryRunner private final ServiceEmitter emitter; public IntervalChunkingQueryRunner( - QueryRunner baseRunner, QueryToolChest> toolChest, - ExecutorService executor, QueryWatcher queryWatcher, ServiceEmitter emitter + QueryRunner baseRunner, + QueryToolChest> toolChest, + ExecutorService executor, + QueryWatcher queryWatcher, + ServiceEmitter emitter ) { this.baseRunner = baseRunner; diff --git a/processing/src/main/java/org/apache/druid/query/PrioritizedExecutorService.java b/processing/src/main/java/org/apache/druid/query/PrioritizedExecutorService.java index 3ebdc376951..1861bd63f55 100644 --- a/processing/src/main/java/org/apache/druid/query/PrioritizedExecutorService.java +++ b/processing/src/main/java/org/apache/druid/query/PrioritizedExecutorService.java @@ -210,9 +210,7 @@ class PrioritizedListenableFutureTask implements RunnableFuture, private static final Comparator PRIORITY_COMPARATOR = new Ordering() { @Override - public int compare( - PrioritizedListenableFutureTask left, PrioritizedListenableFutureTask right - ) + public int compare(PrioritizedListenableFutureTask left, PrioritizedListenableFutureTask right) { return Integer.compare(right.getPriority(), left.getPriority()); } diff --git a/processing/src/main/java/org/apache/druid/query/QueryRunnerFactory.java b/processing/src/main/java/org/apache/druid/query/QueryRunnerFactory.java index 069cb5e36ef..fc4e5a69a18 100644 --- a/processing/src/main/java/org/apache/druid/query/QueryRunnerFactory.java +++ b/processing/src/main/java/org/apache/druid/query/QueryRunnerFactory.java @@ -49,9 +49,7 @@ public interface QueryRunnerFactory> * * The vast majority of the time, this should be implemented with * - * return new ChainedExecutionQueryRunner<>( - * queryExecutor, toolChest.getOrdering(), queryWatcher, queryRunners - * ); + * return new ChainedExecutionQueryRunner<>(queryExecutor, toolChest.getOrdering(), queryWatcher, queryRunners); * * Which will allow for parallel execution up to the maximum number of processing threads allowed. * diff --git a/processing/src/main/java/org/apache/druid/query/ReportTimelineMissingSegmentQueryRunner.java b/processing/src/main/java/org/apache/druid/query/ReportTimelineMissingSegmentQueryRunner.java index cd2c8213763..f1b03a7cbdd 100644 --- a/processing/src/main/java/org/apache/druid/query/ReportTimelineMissingSegmentQueryRunner.java +++ b/processing/src/main/java/org/apache/druid/query/ReportTimelineMissingSegmentQueryRunner.java @@ -38,11 +38,10 @@ public class ReportTimelineMissingSegmentQueryRunner implements QueryRunner run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { - List missingSegments = (List) responseContext.get(Result.MISSING_SEGMENTS_KEY); + List missingSegments = + (List) responseContext.get(Result.MISSING_SEGMENTS_KEY); if (missingSegments == null) { missingSegments = Lists.newArrayList(); responseContext.put(Result.MISSING_SEGMENTS_KEY, missingSegments); diff --git a/processing/src/main/java/org/apache/druid/query/RetryQueryRunner.java b/processing/src/main/java/org/apache/druid/query/RetryQueryRunner.java index fbc12c97beb..1d440469dc1 100644 --- a/processing/src/main/java/org/apache/druid/query/RetryQueryRunner.java +++ b/processing/src/main/java/org/apache/druid/query/RetryQueryRunner.java @@ -64,9 +64,7 @@ public class RetryQueryRunner implements QueryRunner return new YieldingSequenceBase() { @Override - public Yielder toYielder( - OutType initValue, YieldingAccumulator accumulator - ) + public Yielder toYielder(OutType initValue, YieldingAccumulator accumulator) { List missingSegments = getMissingSegments(context); @@ -93,11 +91,8 @@ public class RetryQueryRunner implements QueryRunner throw new SegmentMissingException("No results found for segments[%s]", finalMissingSegs); } - return new MergeSequence<>( - queryPlus.getQuery().getResultOrdering(), - Sequences.simple(listOfSequences)).toYielder( - initValue, accumulator - ); + return new MergeSequence<>(queryPlus.getQuery().getResultOrdering(), Sequences.simple(listOfSequences)) + .toYielder(initValue, accumulator); } else { return Iterables.getOnlyElement(listOfSequences).toYielder(initValue, accumulator); } diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/cardinality/types/CardinalityAggregatorColumnSelectorStrategyFactory.java b/processing/src/main/java/org/apache/druid/query/aggregation/cardinality/types/CardinalityAggregatorColumnSelectorStrategyFactory.java index be444b683fb..51d025988c3 100644 --- a/processing/src/main/java/org/apache/druid/query/aggregation/cardinality/types/CardinalityAggregatorColumnSelectorStrategyFactory.java +++ b/processing/src/main/java/org/apache/druid/query/aggregation/cardinality/types/CardinalityAggregatorColumnSelectorStrategyFactory.java @@ -30,7 +30,8 @@ public class CardinalityAggregatorColumnSelectorStrategyFactory { @Override public CardinalityAggregatorColumnSelectorStrategy makeColumnSelectorStrategy( - ColumnCapabilities capabilities, ColumnValueSelector selector + ColumnCapabilities capabilities, + ColumnValueSelector selector ) { ValueType type = capabilities.getType(); diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java b/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java index 56979500c41..33c5492f99d 100644 --- a/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java +++ b/processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java @@ -90,9 +90,7 @@ public class HyperUniquesSerde extends ComplexMetricSerde } @Override - public void deserializeColumn( - ByteBuffer byteBuffer, ColumnBuilder columnBuilder - ) + public void deserializeColumn(ByteBuffer byteBuffer, ColumnBuilder columnBuilder) { final GenericIndexed column = GenericIndexed.read(byteBuffer, getObjectStrategy(), columnBuilder.getFileMapper()); columnBuilder.setComplexColumnSupplier(new ComplexColumnPartSupplier(getTypeName(), column)); diff --git a/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceMetadataQueryRunnerFactory.java b/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceMetadataQueryRunnerFactory.java index ec34b1fe8ed..02b72d93d6f 100644 --- a/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceMetadataQueryRunnerFactory.java +++ b/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceMetadataQueryRunnerFactory.java @@ -64,12 +64,11 @@ public class DataSourceMetadataQueryRunnerFactory @Override public QueryRunner> mergeRunners( - ExecutorService queryExecutor, Iterable>> queryRunners + ExecutorService queryExecutor, + Iterable>> queryRunners ) { - return new ChainedExecutionQueryRunner<>( - queryExecutor, queryWatcher, queryRunners - ); + return new ChainedExecutionQueryRunner<>(queryExecutor, queryWatcher, queryRunners); } @Override diff --git a/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceQueryQueryToolChest.java b/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceQueryQueryToolChest.java index 33099fc0aab..13d265186b4 100644 --- a/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceQueryQueryToolChest.java +++ b/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceQueryQueryToolChest.java @@ -114,7 +114,8 @@ public class DataSourceQueryQueryToolChest @Override public Function, Result> makePreComputeManipulatorFn( - DataSourceMetadataQuery query, MetricManipulationFn fn + DataSourceMetadataQuery query, + MetricManipulationFn fn ) { return Functions.identity(); diff --git a/processing/src/main/java/org/apache/druid/query/filter/DimFilters.java b/processing/src/main/java/org/apache/druid/query/filter/DimFilters.java index a20dd7cd429..8c368c6004e 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/DimFilters.java +++ b/processing/src/main/java/org/apache/druid/query/filter/DimFilters.java @@ -19,7 +19,6 @@ package org.apache.druid.query.filter; -import com.google.common.base.Function; import com.google.common.base.Predicates; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; @@ -63,18 +62,7 @@ public class DimFilters public static List optimize(List filters) { - return filterNulls( - Lists.transform( - filters, new Function() - { - @Override - public DimFilter apply(DimFilter input) - { - return input.optimize(); - } - } - ) - ); + return filterNulls(Lists.transform(filters, DimFilter::optimize)); } public static List filterNulls(List optimized) diff --git a/processing/src/main/java/org/apache/druid/query/filter/ValueMatcherColumnSelectorStrategyFactory.java b/processing/src/main/java/org/apache/druid/query/filter/ValueMatcherColumnSelectorStrategyFactory.java index d6bb13d3669..edecbbe0a21 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/ValueMatcherColumnSelectorStrategyFactory.java +++ b/processing/src/main/java/org/apache/druid/query/filter/ValueMatcherColumnSelectorStrategyFactory.java @@ -42,7 +42,8 @@ public class ValueMatcherColumnSelectorStrategyFactory @Override public ValueMatcherColumnSelectorStrategy makeColumnSelectorStrategy( - ColumnCapabilities capabilities, ColumnValueSelector selector + ColumnCapabilities capabilities, + ColumnValueSelector selector ) { ValueType type = capabilities.getType(); diff --git a/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/BufferHashGrouper.java b/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/BufferHashGrouper.java index 1e4cd2c486a..ca3b6c83412 100644 --- a/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/BufferHashGrouper.java +++ b/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/BufferHashGrouper.java @@ -310,9 +310,7 @@ public class BufferHashGrouper extends AbstractBufferHashGrouper mergeResults( - QueryRunner baseRunner, - GroupByQuery query, - Map responseContext - ); + Sequence mergeResults(QueryRunner baseRunner, GroupByQuery query, Map responseContext); - Sequence applyPostProcessing( - Sequence results, - GroupByQuery query - ); + Sequence applyPostProcessing(Sequence results, GroupByQuery query); Sequence processSubqueryResult( GroupByQuery subquery, @@ -86,21 +79,11 @@ public interface GroupByStrategy boolean wasQueryPushedDown ); - Sequence processSubtotalsSpec( - GroupByQuery query, - GroupByQueryResource resource, - Sequence queryResult - ); + Sequence processSubtotalsSpec(GroupByQuery query, GroupByQueryResource resource, Sequence queryResult); - QueryRunner mergeRunners( - ListeningExecutorService exec, - Iterable> queryRunners - ); + QueryRunner mergeRunners(ListeningExecutorService exec, Iterable> queryRunners); - Sequence process( - GroupByQuery query, - StorageAdapter storageAdapter - ); + Sequence process(GroupByQuery query, StorageAdapter storageAdapter); boolean supportsNestedQueryPushDown(); } diff --git a/processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV1.java b/processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV1.java index cc26139dc6f..d111650d1dd 100644 --- a/processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV1.java +++ b/processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV1.java @@ -150,9 +150,7 @@ public class GroupByStrategyV1 implements GroupByStrategy } @Override - public Sequence applyPostProcessing( - Sequence results, GroupByQuery query - ) + public Sequence applyPostProcessing(Sequence results, GroupByQuery query) { return query.postProcess(results); } @@ -268,7 +266,9 @@ public class GroupByStrategyV1 implements GroupByStrategy @Override public Sequence processSubtotalsSpec( - GroupByQuery query, GroupByQueryResource resource, Sequence queryResult + GroupByQuery query, + GroupByQueryResource resource, + Sequence queryResult ) { throw new UnsupportedOperationException("subtotalsSpec is not supported for v1 groupBy strategy."); @@ -284,10 +284,7 @@ public class GroupByStrategyV1 implements GroupByStrategy } @Override - public Sequence process( - final GroupByQuery query, - final StorageAdapter storageAdapter - ) + public Sequence process(final GroupByQuery query, final StorageAdapter storageAdapter) { return engine.process(query, storageAdapter); } diff --git a/processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV2.java b/processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV2.java index 1367fc62bbe..b3f3919b509 100644 --- a/processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV2.java +++ b/processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV2.java @@ -316,9 +316,7 @@ public class GroupByStrategyV2 implements GroupByStrategy } @Override - public Sequence applyPostProcessing( - Sequence results, GroupByQuery query - ) + public Sequence applyPostProcessing(Sequence results, GroupByQuery query) { // Don't apply limit here for inner results, that will be pushed down to the BufferHashGrouper if (query.getContextBoolean(CTX_KEY_OUTERMOST, true)) { @@ -463,10 +461,7 @@ public class GroupByStrategyV2 implements GroupByStrategy } @Override - public QueryRunner mergeRunners( - ListeningExecutorService exec, - Iterable> queryRunners - ) + public QueryRunner mergeRunners(ListeningExecutorService exec, Iterable> queryRunners) { return new GroupByMergingQueryRunnerV2( configSupplier.get(), @@ -482,10 +477,7 @@ public class GroupByStrategyV2 implements GroupByStrategy } @Override - public Sequence process( - GroupByQuery query, - StorageAdapter storageAdapter - ) + public Sequence process(GroupByQuery query, StorageAdapter storageAdapter) { return GroupByQueryEngineV2.process(query, storageAdapter, bufferPool, configSupplier.get().withOverrides(query)); } diff --git a/processing/src/main/java/org/apache/druid/query/metadata/SegmentMetadataQueryQueryToolChest.java b/processing/src/main/java/org/apache/druid/query/metadata/SegmentMetadataQueryQueryToolChest.java index 554835ae5c9..a08f3788c97 100644 --- a/processing/src/main/java/org/apache/druid/query/metadata/SegmentMetadataQueryQueryToolChest.java +++ b/processing/src/main/java/org/apache/druid/query/metadata/SegmentMetadataQueryQueryToolChest.java @@ -155,7 +155,8 @@ public class SegmentMetadataQueryQueryToolChest extends QueryToolChest makePreComputeManipulatorFn( - SegmentMetadataQuery query, MetricManipulationFn fn + SegmentMetadataQuery query, + MetricManipulationFn fn ) { return Functions.identity(); diff --git a/processing/src/main/java/org/apache/druid/query/metadata/SegmentMetadataQueryRunnerFactory.java b/processing/src/main/java/org/apache/druid/query/metadata/SegmentMetadataQueryRunnerFactory.java index 2b925b3e433..da385178e35 100644 --- a/processing/src/main/java/org/apache/druid/query/metadata/SegmentMetadataQueryRunnerFactory.java +++ b/processing/src/main/java/org/apache/druid/query/metadata/SegmentMetadataQueryRunnerFactory.java @@ -183,7 +183,8 @@ public class SegmentMetadataQueryRunnerFactory implements QueryRunnerFactory mergeRunners( - ExecutorService exec, Iterable> queryRunners + ExecutorService exec, + Iterable> queryRunners ) { final ListeningExecutorService queryExecutor = MoreExecutors.listeningDecorator(exec); diff --git a/processing/src/main/java/org/apache/druid/query/scan/ScanQueryQueryToolChest.java b/processing/src/main/java/org/apache/druid/query/scan/ScanQueryQueryToolChest.java index 72d3fdbb2f0..b031a84a82c 100644 --- a/processing/src/main/java/org/apache/druid/query/scan/ScanQueryQueryToolChest.java +++ b/processing/src/main/java/org/apache/druid/query/scan/ScanQueryQueryToolChest.java @@ -101,7 +101,8 @@ public class ScanQueryQueryToolChest extends QueryToolChest makePreComputeManipulatorFn( - ScanQuery query, MetricManipulationFn fn + ScanQuery query, + MetricManipulationFn fn ) { return Functions.identity(); @@ -119,9 +120,7 @@ public class ScanQueryQueryToolChest extends QueryToolChest() { @Override - public Sequence run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { ScanQuery scanQuery = (ScanQuery) queryPlus.getQuery(); if (scanQuery.getFilter() != null) { diff --git a/processing/src/main/java/org/apache/druid/query/scan/ScanQueryRunnerFactory.java b/processing/src/main/java/org/apache/druid/query/scan/ScanQueryRunnerFactory.java index 6a124c8c879..c627469016a 100644 --- a/processing/src/main/java/org/apache/druid/query/scan/ScanQueryRunnerFactory.java +++ b/processing/src/main/java/org/apache/druid/query/scan/ScanQueryRunnerFactory.java @@ -113,9 +113,7 @@ public class ScanQueryRunnerFactory implements QueryRunnerFactory run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { Query query = queryPlus.getQuery(); if (!(query instanceof ScanQuery)) { diff --git a/processing/src/main/java/org/apache/druid/query/search/SearchQueryQueryToolChest.java b/processing/src/main/java/org/apache/druid/query/search/SearchQueryQueryToolChest.java index 8f800938f93..94d5aefa98f 100644 --- a/processing/src/main/java/org/apache/druid/query/search/SearchQueryQueryToolChest.java +++ b/processing/src/main/java/org/apache/druid/query/search/SearchQueryQueryToolChest.java @@ -130,7 +130,8 @@ public class SearchQueryQueryToolChest extends QueryToolChest, Result> makePreComputeManipulatorFn( - SearchQuery query, MetricManipulationFn fn + SearchQuery query, + MetricManipulationFn fn ) { return Functions.identity(); @@ -333,7 +334,8 @@ public class SearchQueryQueryToolChest extends QueryToolChest> run( - QueryPlus> queryPlus, Map responseContext + QueryPlus> queryPlus, + Map responseContext ) { SearchQuery searchQuery = (SearchQuery) queryPlus.getQuery(); diff --git a/processing/src/main/java/org/apache/druid/query/search/SearchQueryRunner.java b/processing/src/main/java/org/apache/druid/query/search/SearchQueryRunner.java index 3eae4b15332..a29a92c5f31 100644 --- a/processing/src/main/java/org/apache/druid/query/search/SearchQueryRunner.java +++ b/processing/src/main/java/org/apache/druid/query/search/SearchQueryRunner.java @@ -71,7 +71,8 @@ public class SearchQueryRunner implements QueryRunner> { @Override public SearchColumnSelectorStrategy makeColumnSelectorStrategy( - ColumnCapabilities capabilities, ColumnValueSelector selector + ColumnCapabilities capabilities, + ColumnValueSelector selector ) { ValueType type = capabilities.getType(); diff --git a/processing/src/main/java/org/apache/druid/query/search/SearchQueryRunnerFactory.java b/processing/src/main/java/org/apache/druid/query/search/SearchQueryRunnerFactory.java index e806f1b7262..060ed785a81 100644 --- a/processing/src/main/java/org/apache/druid/query/search/SearchQueryRunnerFactory.java +++ b/processing/src/main/java/org/apache/druid/query/search/SearchQueryRunnerFactory.java @@ -58,12 +58,11 @@ public class SearchQueryRunnerFactory implements QueryRunnerFactory> mergeRunners( - ExecutorService queryExecutor, Iterable>> queryRunners + ExecutorService queryExecutor, + Iterable>> queryRunners ) { - return new ChainedExecutionQueryRunner>( - queryExecutor, queryWatcher, queryRunners - ); + return new ChainedExecutionQueryRunner<>(queryExecutor, queryWatcher, queryRunners); } @Override diff --git a/processing/src/main/java/org/apache/druid/query/search/UseIndexesStrategy.java b/processing/src/main/java/org/apache/druid/query/search/UseIndexesStrategy.java index 33ff8f04889..43cc6f2308a 100644 --- a/processing/src/main/java/org/apache/druid/query/search/UseIndexesStrategy.java +++ b/processing/src/main/java/org/apache/druid/query/search/UseIndexesStrategy.java @@ -224,7 +224,8 @@ public class UseIndexesStrategy extends SearchStrategy private final ImmutableBitmap timeFilteredBitmap; public IndexOnlyExecutor( - SearchQuery query, Segment segment, + SearchQuery query, + Segment segment, ImmutableBitmap timeFilteredBitmap, List dimensionSpecs ) diff --git a/processing/src/main/java/org/apache/druid/query/select/SelectBinaryFn.java b/processing/src/main/java/org/apache/druid/query/select/SelectBinaryFn.java index aa2ecac6715..534cd42f039 100644 --- a/processing/src/main/java/org/apache/druid/query/select/SelectBinaryFn.java +++ b/processing/src/main/java/org/apache/druid/query/select/SelectBinaryFn.java @@ -38,11 +38,7 @@ public class SelectBinaryFn private final PagingSpec pagingSpec; private final boolean descending; - public SelectBinaryFn( - Granularity granularity, - PagingSpec pagingSpec, - boolean descending - ) + public SelectBinaryFn(Granularity granularity, PagingSpec pagingSpec, boolean descending) { this.gran = granularity; this.pagingSpec = pagingSpec; @@ -50,9 +46,7 @@ public class SelectBinaryFn } @Override - public Result apply( - Result arg1, Result arg2 - ) + public Result apply(Result arg1, Result arg2) { if (arg1 == null) { return arg2; diff --git a/processing/src/main/java/org/apache/druid/query/select/SelectQueryEngine.java b/processing/src/main/java/org/apache/druid/query/select/SelectQueryEngine.java index 921903810e8..cc1bbaa2472 100644 --- a/processing/src/main/java/org/apache/druid/query/select/SelectQueryEngine.java +++ b/processing/src/main/java/org/apache/druid/query/select/SelectQueryEngine.java @@ -69,7 +69,8 @@ public class SelectQueryEngine { @Override public SelectColumnSelectorStrategy makeColumnSelectorStrategy( - ColumnCapabilities capabilities, ColumnValueSelector selector + ColumnCapabilities capabilities, + ColumnValueSelector selector ) { ValueType type = capabilities.getType(); diff --git a/processing/src/main/java/org/apache/druid/query/select/SelectQueryQueryToolChest.java b/processing/src/main/java/org/apache/druid/query/select/SelectQueryQueryToolChest.java index ad2ae5563e5..cb331059db3 100644 --- a/processing/src/main/java/org/apache/druid/query/select/SelectQueryQueryToolChest.java +++ b/processing/src/main/java/org/apache/druid/query/select/SelectQueryQueryToolChest.java @@ -57,6 +57,7 @@ import org.joda.time.Interval; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Collections; +import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -143,7 +144,8 @@ public class SelectQueryQueryToolChest extends QueryToolChest, Result> makePreComputeManipulatorFn( - final SelectQuery query, final MetricManipulationFn fn + final SelectQuery query, + final MetricManipulationFn fn ) { return Functions.identity(); @@ -339,7 +341,8 @@ public class SelectQueryQueryToolChest extends QueryToolChest> run( - QueryPlus> queryPlus, Map responseContext + QueryPlus> queryPlus, + Map responseContext ) { SelectQuery selectQuery = (SelectQuery) queryPlus.getQuery(); @@ -383,10 +386,13 @@ public class SelectQueryQueryToolChest extends QueryToolChest intervals = Lists.newArrayList( Iterables.transform(filteredPagingKeys, DataSegmentUtils.INTERVAL_EXTRACTOR(dataSource)) ); - Collections.sort( - intervals, query.isDescending() ? Comparators.intervalsByEndThenStart() - : Comparators.intervalsByStartThenEnd() - ); + Comparator comparator; + if (query.isDescending()) { + comparator = Comparators.intervalsByEndThenStart(); + } else { + comparator = Comparators.intervalsByStartThenEnd(); + } + Collections.sort(intervals, comparator); TreeMap granularThresholds = Maps.newTreeMap(); for (Interval interval : intervals) { diff --git a/processing/src/main/java/org/apache/druid/query/select/SelectQueryRunnerFactory.java b/processing/src/main/java/org/apache/druid/query/select/SelectQueryRunnerFactory.java index ab321625584..db94788f59c 100644 --- a/processing/src/main/java/org/apache/druid/query/select/SelectQueryRunnerFactory.java +++ b/processing/src/main/java/org/apache/druid/query/select/SelectQueryRunnerFactory.java @@ -64,12 +64,11 @@ public class SelectQueryRunnerFactory @Override public QueryRunner> mergeRunners( - ExecutorService queryExecutor, Iterable>> queryRunners + ExecutorService queryExecutor, + Iterable>> queryRunners ) { - return new ChainedExecutionQueryRunner>( - queryExecutor, queryWatcher, queryRunners - ); + return new ChainedExecutionQueryRunner<>(queryExecutor, queryWatcher, queryRunners); } @Override diff --git a/processing/src/main/java/org/apache/druid/query/spec/SpecificSegmentQueryRunner.java b/processing/src/main/java/org/apache/druid/query/spec/SpecificSegmentQueryRunner.java index 7effb68037b..c7bfad1b31f 100644 --- a/processing/src/main/java/org/apache/druid/query/spec/SpecificSegmentQueryRunner.java +++ b/processing/src/main/java/org/apache/druid/query/spec/SpecificSegmentQueryRunner.java @@ -67,14 +67,10 @@ public class SpecificSegmentQueryRunner implements QueryRunner final String newName = StringUtils.format("%s_%s_%s", query.getType(), query.getDataSource(), query.getIntervals()); final Sequence baseSequence = doNamed( - currThread, currThreadName, newName, new Supplier>() - { - @Override - public Sequence get() - { - return base.run(queryPlus, responseContext); - } - } + currThread, + currThreadName, + newName, + () -> base.run(queryPlus, responseContext) ); Sequence segmentMissingCatchingSequence = new Sequence() diff --git a/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQueryQueryToolChest.java b/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQueryQueryToolChest.java index e8a4f8d4a23..13d5521b2c2 100644 --- a/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQueryQueryToolChest.java +++ b/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQueryQueryToolChest.java @@ -131,7 +131,8 @@ public class TimeBoundaryQueryQueryToolChest @Override public Function, Result> makePreComputeManipulatorFn( - TimeBoundaryQuery query, MetricManipulationFn fn + TimeBoundaryQuery query, + MetricManipulationFn fn ) { return Functions.identity(); diff --git a/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQueryRunnerFactory.java b/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQueryRunnerFactory.java index dcf5dcd2570..c8a97fc3a86 100644 --- a/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQueryRunnerFactory.java +++ b/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQueryRunnerFactory.java @@ -71,7 +71,8 @@ public class TimeBoundaryQueryRunnerFactory @Override public QueryRunner> mergeRunners( - ExecutorService queryExecutor, Iterable>> queryRunners + ExecutorService queryExecutor, + Iterable>> queryRunners ) { return new ChainedExecutionQueryRunner<>(queryExecutor, queryWatcher, queryRunners); diff --git a/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQueryQueryToolChest.java b/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQueryQueryToolChest.java index 46d7a7c5341..1cb75c5ed99 100644 --- a/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQueryQueryToolChest.java +++ b/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQueryQueryToolChest.java @@ -354,7 +354,8 @@ public class TimeseriesQueryQueryToolChest extends QueryToolChest, Result> makePreComputeManipulatorFn( - final TimeseriesQuery query, final MetricManipulationFn fn + final TimeseriesQuery query, + final MetricManipulationFn fn ) { return makeComputeManipulatorFn(query, fn, false); @@ -362,14 +363,17 @@ public class TimeseriesQueryQueryToolChest extends QueryToolChest, Result> makePostComputeManipulatorFn( - TimeseriesQuery query, MetricManipulationFn fn + TimeseriesQuery query, + MetricManipulationFn fn ) { return makeComputeManipulatorFn(query, fn, true); } private Function, Result> makeComputeManipulatorFn( - final TimeseriesQuery query, final MetricManipulationFn fn, final boolean calculatePostAggs + final TimeseriesQuery query, + final MetricManipulationFn fn, + final boolean calculatePostAggs ) { return result -> { diff --git a/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQueryRunnerFactory.java b/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQueryRunnerFactory.java index 9bd77dc4550..2fa5762e26c 100644 --- a/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQueryRunnerFactory.java +++ b/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQueryRunnerFactory.java @@ -65,12 +65,11 @@ public class TimeseriesQueryRunnerFactory @Override public QueryRunner> mergeRunners( - ExecutorService queryExecutor, Iterable>> queryRunners + ExecutorService queryExecutor, + Iterable>> queryRunners ) { - return new ChainedExecutionQueryRunner<>( - queryExecutor, queryWatcher, queryRunners - ); + return new ChainedExecutionQueryRunner<>(queryExecutor, queryWatcher, queryRunners); } @Override diff --git a/processing/src/main/java/org/apache/druid/query/topn/AggregateTopNMetricFirstAlgorithm.java b/processing/src/main/java/org/apache/druid/query/topn/AggregateTopNMetricFirstAlgorithm.java index a8b4d2039a9..20735111935 100644 --- a/processing/src/main/java/org/apache/druid/query/topn/AggregateTopNMetricFirstAlgorithm.java +++ b/processing/src/main/java/org/apache/druid/query/topn/AggregateTopNMetricFirstAlgorithm.java @@ -55,15 +55,9 @@ public class AggregateTopNMetricFirstAlgorithm implements TopNAlgorithm resultsBufHolder = bufferPool.take(); ByteBuffer resultsBuf = resultsBufHolder.get(); diff --git a/processing/src/main/java/org/apache/druid/query/topn/TimeExtractionTopNAlgorithm.java b/processing/src/main/java/org/apache/druid/query/topn/TimeExtractionTopNAlgorithm.java index 8313d0449e3..57d1685f223 100644 --- a/processing/src/main/java/org/apache/druid/query/topn/TimeExtractionTopNAlgorithm.java +++ b/processing/src/main/java/org/apache/druid/query/topn/TimeExtractionTopNAlgorithm.java @@ -69,9 +69,7 @@ public class TimeExtractionTopNAlgorithm extends BaseTopNAlgorithm aggregatesStore - ) + protected long scanAndAggregate(TopNParams params, int[] dimValSelector, Map aggregatesStore) { if (params.getCardinality() < 0) { throw new UnsupportedOperationException("Cannot operate on a dimension with unknown cardinality"); diff --git a/processing/src/main/java/org/apache/druid/query/topn/TopNQueryQueryToolChest.java b/processing/src/main/java/org/apache/druid/query/topn/TopNQueryQueryToolChest.java index 5c5ad3eab83..a51521e1357 100644 --- a/processing/src/main/java/org/apache/druid/query/topn/TopNQueryQueryToolChest.java +++ b/processing/src/main/java/org/apache/druid/query/topn/TopNQueryQueryToolChest.java @@ -53,7 +53,6 @@ import org.apache.druid.query.dimension.DimensionSpec; import org.apache.druid.segment.DimensionHandlerUtils; import org.joda.time.DateTime; -import javax.annotation.Nullable; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -97,17 +96,7 @@ public class TopNQueryQueryToolChest extends QueryToolChest aggregatorFactories) { - return Lists.transform( - aggregatorFactories, new Function() - { - @Nullable - @Override - public String apply(@Nullable AggregatorFactory input) - { - return input.getName(); - } - } - ).toArray(new String[0]); + return aggregatorFactories.stream().map(AggregatorFactory::getName).toArray(String[]::new); } private static List prunePostAggregators(TopNQuery query) @@ -161,7 +150,8 @@ public class TopNQueryQueryToolChest extends QueryToolChest, Result> makePreComputeManipulatorFn( - final TopNQuery query, final MetricManipulationFn fn + final TopNQuery query, + final MetricManipulationFn fn ) { return new Function, Result>() @@ -221,7 +211,8 @@ public class TopNQueryQueryToolChest extends QueryToolChest, Result> makePostComputeManipulatorFn( - final TopNQuery query, final MetricManipulationFn fn + final TopNQuery query, + final MetricManipulationFn fn ) { return new Function, Result>() @@ -434,7 +425,8 @@ public class TopNQueryQueryToolChest extends QueryToolChest> run( - QueryPlus> queryPlus, Map responseContext + QueryPlus> queryPlus, + Map responseContext ) { TopNQuery topNQuery = (TopNQuery) queryPlus.getQuery(); @@ -484,7 +476,8 @@ public class TopNQueryQueryToolChest extends QueryToolChest, Result>() + resultSequence, + new Function, Result>() { @Override public Result apply(Result input) diff --git a/processing/src/main/java/org/apache/druid/query/topn/TopNQueryRunnerFactory.java b/processing/src/main/java/org/apache/druid/query/topn/TopNQueryRunnerFactory.java index aad1021c78c..3443925d3fa 100644 --- a/processing/src/main/java/org/apache/druid/query/topn/TopNQueryRunnerFactory.java +++ b/processing/src/main/java/org/apache/druid/query/topn/TopNQueryRunnerFactory.java @@ -82,12 +82,11 @@ public class TopNQueryRunnerFactory implements QueryRunnerFactory> mergeRunners( - ExecutorService queryExecutor, Iterable>> queryRunners + ExecutorService queryExecutor, + Iterable>> queryRunners ) { - return new ChainedExecutionQueryRunner<>( - queryExecutor, queryWatcher, queryRunners - ); + return new ChainedExecutionQueryRunner<>(queryExecutor, queryWatcher, queryRunners); } @Override diff --git a/processing/src/main/java/org/apache/druid/query/topn/types/NumericTopNColumnSelectorStrategy.java b/processing/src/main/java/org/apache/druid/query/topn/types/NumericTopNColumnSelectorStrategy.java index fea86a1a569..e27baf4e202 100644 --- a/processing/src/main/java/org/apache/druid/query/topn/types/NumericTopNColumnSelectorStrategy.java +++ b/processing/src/main/java/org/apache/druid/query/topn/types/NumericTopNColumnSelectorStrategy.java @@ -71,9 +71,7 @@ public abstract class NumericTopNColumnSelectorStrategy< } @Override - public Aggregator[][] getDimExtractionRowSelector( - TopNQuery query, TopNParams params, StorageAdapter storageAdapter - ) + public Aggregator[][] getDimExtractionRowSelector(TopNQuery query, TopNParams params, StorageAdapter storageAdapter) { return null; } diff --git a/processing/src/main/java/org/apache/druid/query/topn/types/TopNColumnSelectorStrategyFactory.java b/processing/src/main/java/org/apache/druid/query/topn/types/TopNColumnSelectorStrategyFactory.java index e0023c847f7..8cc820d04ba 100644 --- a/processing/src/main/java/org/apache/druid/query/topn/types/TopNColumnSelectorStrategyFactory.java +++ b/processing/src/main/java/org/apache/druid/query/topn/types/TopNColumnSelectorStrategyFactory.java @@ -37,7 +37,8 @@ public class TopNColumnSelectorStrategyFactory implements ColumnSelectorStrategy @Override public TopNColumnSelectorStrategy makeColumnSelectorStrategy( - ColumnCapabilities capabilities, ColumnValueSelector selector + ColumnCapabilities capabilities, + ColumnValueSelector selector ) { final ValueType selectorType = capabilities.getType(); diff --git a/processing/src/main/java/org/apache/druid/segment/DoubleDimensionIndexer.java b/processing/src/main/java/org/apache/druid/segment/DoubleDimensionIndexer.java index b0159128c54..0ddacfb781b 100644 --- a/processing/src/main/java/org/apache/druid/segment/DoubleDimensionIndexer.java +++ b/processing/src/main/java/org/apache/druid/segment/DoubleDimensionIndexer.java @@ -177,7 +177,10 @@ public class DoubleDimensionIndexer implements DimensionIndexer @Override public void fillBitmapsFromUnsortedEncodedKeyComponent( - Long key, int rowNum, MutableBitmap[] bitmapIndexes, BitmapFactory factory + Long key, + int rowNum, + MutableBitmap[] bitmapIndexes, + BitmapFactory factory ) { throw new UnsupportedOperationException("Numeric columns do not support bitmaps."); diff --git a/processing/src/main/java/org/apache/druid/segment/SimpleQueryableIndex.java b/processing/src/main/java/org/apache/druid/segment/SimpleQueryableIndex.java index 4fa025648bd..bd0d5fe5105 100644 --- a/processing/src/main/java/org/apache/druid/segment/SimpleQueryableIndex.java +++ b/processing/src/main/java/org/apache/druid/segment/SimpleQueryableIndex.java @@ -49,7 +49,8 @@ public class SimpleQueryableIndex extends AbstractIndex implements QueryableInde private final Map dimensionHandlers; public SimpleQueryableIndex( - Interval dataInterval, Indexed dimNames, + Interval dataInterval, + Indexed dimNames, BitmapFactory bitmapFactory, Map columns, SmooshedFileMapper fileMapper, diff --git a/processing/src/main/java/org/apache/druid/segment/StringDimensionIndexer.java b/processing/src/main/java/org/apache/druid/segment/StringDimensionIndexer.java index 19aef7344a1..3b4954600b6 100644 --- a/processing/src/main/java/org/apache/druid/segment/StringDimensionIndexer.java +++ b/processing/src/main/java/org/apache/druid/segment/StringDimensionIndexer.java @@ -765,7 +765,10 @@ public class StringDimensionIndexer implements DimensionIndexer comparator = new Ordering() { @Override - public int compare( - ImmutableRTree tree, ImmutableRTree tree1 - ) + public int compare(ImmutableRTree tree, ImmutableRTree tree1) { if (tree.size() == 0 && tree1.size() == 0) { return 0; diff --git a/processing/src/main/java/org/apache/druid/segment/filter/AndFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/AndFilter.java index 1fef033dbf5..f7f598eb7f9 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/AndFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/AndFilter.java @@ -151,7 +151,8 @@ public class AndFilter implements BooleanFilter @Override public boolean supportsSelectivityEstimation( - final ColumnSelector columnSelector, final BitmapIndexSelector indexSelector + final ColumnSelector columnSelector, + final BitmapIndexSelector indexSelector ) { for (Filter filter : filters) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java index d648e817dbf..6b7b6fdc1a5 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java @@ -131,9 +131,7 @@ public class BoundFilter implements Filter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return Filters.supportsSelectivityEstimation(this, boundDimFilter.getDimension(), columnSelector, indexSelector); } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java index 6e6da583980..eea5bcd74dc 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java @@ -142,9 +142,7 @@ public class ColumnComparisonFilter implements Filter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return false; } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/DimensionPredicateFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/DimensionPredicateFilter.java index 63d0c418c47..fe2a6a647e1 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/DimensionPredicateFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/DimensionPredicateFilter.java @@ -107,9 +107,7 @@ public class DimensionPredicateFilter implements Filter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return Filters.supportsSelectivityEstimation(this, dimension, columnSelector, indexSelector); } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/Filters.java b/processing/src/main/java/org/apache/druid/segment/filter/Filters.java index db3c6d8b482..07ae57413d8 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/Filters.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/Filters.java @@ -648,10 +648,7 @@ public class Filters } } if (andList.size() > 1) { - generateAllCombinations( - result, andList.subList(1, andList.size()), - nonAndList - ); + generateAllCombinations(result, andList.subList(1, andList.size()), nonAndList); } } } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/InFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/InFilter.java index 0b3ad14431c..18a2db358c2 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/InFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/InFilter.java @@ -149,9 +149,7 @@ public class InFilter implements Filter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return Filters.supportsSelectivityEstimation(this, dimension, columnSelector, indexSelector); } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/JavaScriptFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/JavaScriptFilter.java index 9c755d9e782..eedebe32e03 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/JavaScriptFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/JavaScriptFilter.java @@ -93,9 +93,7 @@ public class JavaScriptFilter implements Filter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return Filters.supportsSelectivityEstimation(this, dimension, columnSelector, indexSelector); } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/LikeFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/LikeFilter.java index b77e9554c21..493eb9ec72b 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/LikeFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/LikeFilter.java @@ -82,9 +82,7 @@ public class LikeFilter implements Filter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return Filters.supportsSelectivityEstimation(this, dimension, columnSelector, indexSelector); } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java index 121290409c3..20ed4ffdc91 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java @@ -77,9 +77,7 @@ public class NotFilter implements Filter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return baseFilter.supportsSelectivityEstimation(columnSelector, indexSelector); } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/OrFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/OrFilter.java index 43b9039bb9b..62a4b77c0d2 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/OrFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/OrFilter.java @@ -157,9 +157,7 @@ public class OrFilter implements BooleanFilter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { for (Filter filter : filters) { if (!filter.supportsSelectivityEstimation(columnSelector, indexSelector)) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/SelectorFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/SelectorFilter.java index 0b9433b784a..fe83220fc35 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/SelectorFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/SelectorFilter.java @@ -62,9 +62,7 @@ public class SelectorFilter implements Filter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return Filters.supportsSelectivityEstimation(this, dimension, columnSelector, indexSelector); } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java index aba0502e1e7..2ea703aa629 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java @@ -113,9 +113,7 @@ public class SpatialFilter implements Filter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return false; } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java index 4d23612a5d2..965fc1b659a 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java @@ -53,9 +53,7 @@ public class TrueFilter implements Filter } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return true; } diff --git a/processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndexSchema.java b/processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndexSchema.java index b848920ed57..87d75f8c7e2 100644 --- a/processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndexSchema.java +++ b/processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndexSchema.java @@ -183,7 +183,13 @@ public class IncrementalIndexSchema public IncrementalIndexSchema build() { return new IncrementalIndexSchema( - minTimestamp, timestampSpec, gran, virtualColumns, dimensionsSpec, metrics, rollup + minTimestamp, + timestampSpec, + gran, + virtualColumns, + dimensionsSpec, + metrics, + rollup ); } } diff --git a/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedColumnPartSerde.java b/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedColumnPartSerde.java index 373649fc4a7..136eca692fd 100644 --- a/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedColumnPartSerde.java +++ b/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedColumnPartSerde.java @@ -359,9 +359,7 @@ public class DictionaryEncodedColumnPartSerde implements ColumnPartSerde } } - private WritableSupplier readMultiValuedColumn( - VERSION version, ByteBuffer buffer, int flags - ) + private WritableSupplier readMultiValuedColumn(VERSION version, ByteBuffer buffer, int flags) { switch (version) { case UNCOMPRESSED_MULTI_VALUE: { diff --git a/processing/src/test/java/org/apache/druid/query/PrioritizedExecutorServiceTest.java b/processing/src/test/java/org/apache/druid/query/PrioritizedExecutorServiceTest.java index e97df06fbe6..a5ea85481b8 100644 --- a/processing/src/test/java/org/apache/druid/query/PrioritizedExecutorServiceTest.java +++ b/processing/src/test/java/org/apache/druid/query/PrioritizedExecutorServiceTest.java @@ -213,9 +213,7 @@ public class PrioritizedExecutorServiceTest @Test public void testOrderedExecutionEqualPriorityMix() throws ExecutionException, InterruptedException { - exec = new PrioritizedExecutorService( - exec.threadPoolExecutor, true, 0, config - ); + exec = new PrioritizedExecutorService(exec.threadPoolExecutor, true, 0, config); final int numTasks = 1_000; final List> futures = Lists.newArrayListWithExpectedSize(numTasks); final AtomicInteger hasRun = new AtomicInteger(0); diff --git a/processing/src/test/java/org/apache/druid/query/QueryRunnerTestHelper.java b/processing/src/test/java/org/apache/druid/query/QueryRunnerTestHelper.java index 14e7af3bd87..b79c5d31a27 100644 --- a/processing/src/test/java/org/apache/druid/query/QueryRunnerTestHelper.java +++ b/processing/src/test/java/org/apache/druid/query/QueryRunnerTestHelper.java @@ -168,10 +168,11 @@ public class QueryRunnerTestHelper public static final ConstantPostAggregator constant = new ConstantPostAggregator("const", 1L); public static final FieldAccessPostAggregator rowsPostAgg = new FieldAccessPostAggregator("rows", "rows"); public static final FieldAccessPostAggregator indexPostAgg = new FieldAccessPostAggregator("index", "index"); - public static final ArithmeticPostAggregator addRowsIndexConstant = - new ArithmeticPostAggregator( - addRowsIndexConstantMetric, "+", Lists.newArrayList(constant, rowsPostAgg, indexPostAgg) - ); + public static final ArithmeticPostAggregator addRowsIndexConstant = new ArithmeticPostAggregator( + addRowsIndexConstantMetric, + "+", + Lists.newArrayList(constant, rowsPostAgg, indexPostAgg) + ); // dependent on AddRowsIndexContact postAgg public static final ArithmeticPostAggregator dependentPostAgg = new ArithmeticPostAggregator( dependentPostAggMetric, @@ -262,17 +263,7 @@ public class QueryRunnerTestHelper public static Iterable transformToConstructionFeeder(Iterable in) { - return Iterables.transform( - in, new Function() - { - @Nullable - @Override - public Object[] apply(@Nullable Object input) - { - return new Object[]{input}; - } - } - ); + return Iterables.transform(in, (Function) input -> new Object[]{input}); } // simple cartesian iterable @@ -408,10 +399,7 @@ public class QueryRunnerTestHelper ) { return new FinalizeResultsQueryRunner( - new BySegmentQueryRunner( - segmentId, adapter.getDataInterval().getStart(), - factory.createRunner(adapter) - ), + new BySegmentQueryRunner<>(segmentId, adapter.getDataInterval().getStart(), factory.createRunner(adapter)), (QueryToolChest>) factory.getToolchest() ) { @@ -429,15 +417,10 @@ public class QueryRunnerTestHelper final String runnerName ) { - final QueryRunner qr = new FluentQueryRunnerBuilder(factory.getToolchest()) - .create( - new UnionQueryRunner( - new BySegmentQueryRunner( - segmentId, adapter.getDataInterval().getStart(), - factory.createRunner(adapter) - ) - ) - ) + BySegmentQueryRunner bySegmentQueryRunner = + new BySegmentQueryRunner<>(segmentId, adapter.getDataInterval().getStart(), factory.createRunner(adapter)); + final QueryRunner runner = new FluentQueryRunnerBuilder(factory.getToolchest()) + .create(new UnionQueryRunner<>(bySegmentQueryRunner)) .mergeResults() .applyPostMergeDecoration(); @@ -446,7 +429,7 @@ public class QueryRunnerTestHelper @Override public Sequence run(QueryPlus queryPlus, Map responseContext) { - return qr.run(queryPlus, responseContext); + return runner.run(queryPlus, responseContext); } @Override @@ -462,7 +445,6 @@ public class QueryRunnerTestHelper final QueryRunnerFactory> factory ) { - final QueryToolChest> toolChest = factory.getToolchest(); return new FluentQueryRunnerBuilder(toolChest) .create( diff --git a/processing/src/test/java/org/apache/druid/query/aggregation/AggregatorUtilTest.java b/processing/src/test/java/org/apache/druid/query/aggregation/AggregatorUtilTest.java index 92dc8f74e0b..f6ff6db55c5 100644 --- a/processing/src/test/java/org/apache/druid/query/aggregation/AggregatorUtilTest.java +++ b/processing/src/test/java/org/apache/druid/query/aggregation/AggregatorUtilTest.java @@ -152,23 +152,15 @@ public class AggregatorUtilTest AggregatorFactory agg1 = new DoubleSumAggregatorFactory("agg1", "value"); AggregatorFactory agg2 = new DoubleSumAggregatorFactory("agg2", "count"); PostAggregator postAgg1 = new ArithmeticPostAggregator( - null, "*", Lists.newArrayList( - new FieldAccessPostAggregator( - null, - "agg1" - ), new FieldAccessPostAggregator(null, "agg2") - ) + null, + "*", + Lists.newArrayList(new FieldAccessPostAggregator(null, "agg1"), new FieldAccessPostAggregator(null, "agg2")) ); PostAggregator postAgg2 = new ArithmeticPostAggregator( "postAgg", "/", - Lists.newArrayList( - new FieldAccessPostAggregator( - null, - "agg1" - ), new FieldAccessPostAggregator(null, "agg2") - ) + Lists.newArrayList(new FieldAccessPostAggregator(null, "agg1"), new FieldAccessPostAggregator(null, "agg2")) ); Assert.assertEquals( @@ -188,31 +180,24 @@ public class AggregatorUtilTest AggregatorFactory agg1 = new DoubleSumAggregatorFactory("Agg1", "value"); AggregatorFactory agg2 = new DoubleSumAggregatorFactory("Agg2", "count"); PostAggregator postAgg1 = new ArithmeticPostAggregator( - null, "*", Lists.newArrayList( - new FieldAccessPostAggregator( - null, - "Agg1" - ), new FieldAccessPostAggregator(null, "Agg2") - ) + null, + "*", + Lists.newArrayList(new FieldAccessPostAggregator(null, "Agg1"), new FieldAccessPostAggregator(null, "Agg2")) ); PostAggregator postAgg2 = new ArithmeticPostAggregator( "postAgg", "/", - Lists.newArrayList( - new FieldAccessPostAggregator( - null, - "Agg1" - ), new FieldAccessPostAggregator(null, "Agg2") - ) + Lists.newArrayList(new FieldAccessPostAggregator(null, "Agg1"), new FieldAccessPostAggregator(null, "Agg2")) ); Assert.assertEquals( - new Pair(Lists.newArrayList(agg1, agg2), Collections.singletonList(postAgg2)), AggregatorUtil.condensedAggregators( - Lists.newArrayList(agg1, agg2), - Lists.newArrayList(postAgg1, postAgg2), - "postAgg" - ) + new Pair<>(Lists.newArrayList(agg1, agg2), Collections.singletonList(postAgg2)), + AggregatorUtil.condensedAggregators( + Lists.newArrayList(agg1, agg2), + Lists.newArrayList(postAgg1, postAgg2), + "postAgg" + ) ); } diff --git a/processing/src/test/java/org/apache/druid/query/aggregation/cardinality/CardinalityAggregatorTest.java b/processing/src/test/java/org/apache/druid/query/aggregation/cardinality/CardinalityAggregatorTest.java index 1a563c72ac0..e720fceb5fd 100644 --- a/processing/src/test/java/org/apache/druid/query/aggregation/cardinality/CardinalityAggregatorTest.java +++ b/processing/src/test/java/org/apache/druid/query/aggregation/cardinality/CardinalityAggregatorTest.java @@ -89,25 +89,14 @@ public class CardinalityAggregatorTest this.column = Lists.newArrayList( Iterables.transform( - values, new Function() + values, + new Function() { @Nullable @Override public Integer[] apply(@Nullable String[] input) { - return Iterators.toArray( - Iterators.transform( - Iterators.forArray(input), new Function() - { - @Nullable - @Override - public Integer apply(@Nullable String input) - { - return ids.get(input); - } - } - ), Integer.class - ); + return Iterators.toArray(Iterators.transform(Iterators.forArray(input), ids::get), Integer.class); } } ) diff --git a/processing/src/test/java/org/apache/druid/query/extraction/MapLookupExtractionFnSerDeTest.java b/processing/src/test/java/org/apache/druid/query/extraction/MapLookupExtractionFnSerDeTest.java index c143b464926..9d30db7ce2f 100644 --- a/processing/src/test/java/org/apache/druid/query/extraction/MapLookupExtractionFnSerDeTest.java +++ b/processing/src/test/java/org/apache/druid/query/extraction/MapLookupExtractionFnSerDeTest.java @@ -68,12 +68,16 @@ public class MapLookupExtractionFnSerDeTest Assert.assertEquals(null, fn.apply(crazyString)); Assert.assertEquals( - crazyString, mapper.readerFor(DimExtractionFn.class).readValue( - StringUtils.format( - "{\"type\":\"lookup\",\"lookup\":{\"type\":\"map\", \"map\":%s}, \"retainMissingValue\":true}", - mapper.writeValueAsString(renames) + crazyString, + mapper + .readerFor(DimExtractionFn.class) + .readValue( + StringUtils.format( + "{\"type\":\"lookup\",\"lookup\":{\"type\":\"map\", \"map\":%s}, \"retainMissingValue\":true}", + mapper.writeValueAsString(renames) + ) ) - ).apply(crazyString) + .apply(crazyString) ); } } diff --git a/processing/src/test/java/org/apache/druid/query/groupby/GroupByLimitPushDownInsufficientBufferTest.java b/processing/src/test/java/org/apache/druid/query/groupby/GroupByLimitPushDownInsufficientBufferTest.java index 94224a7fef5..ee10a93d370 100644 --- a/processing/src/test/java/org/apache/druid/query/groupby/GroupByLimitPushDownInsufficientBufferTest.java +++ b/processing/src/test/java/org/apache/druid/query/groupby/GroupByLimitPushDownInsufficientBufferTest.java @@ -664,11 +664,8 @@ public class GroupByLimitPushDownInsufficientBufferTest Segment adapter ) { - return new FinalizeResultsQueryRunner( - new BySegmentQueryRunner( - segmentId, adapter.getDataInterval().getStart(), - factory.createRunner(adapter) - ), + return new FinalizeResultsQueryRunner<>( + new BySegmentQueryRunner<>(segmentId, adapter.getDataInterval().getStart(), factory.createRunner(adapter)), (QueryToolChest>) factory.getToolchest() ); } diff --git a/processing/src/test/java/org/apache/druid/query/groupby/GroupByLimitPushDownMultiNodeMergeTest.java b/processing/src/test/java/org/apache/druid/query/groupby/GroupByLimitPushDownMultiNodeMergeTest.java index a409a12360a..481c0d48ece 100644 --- a/processing/src/test/java/org/apache/druid/query/groupby/GroupByLimitPushDownMultiNodeMergeTest.java +++ b/processing/src/test/java/org/apache/druid/query/groupby/GroupByLimitPushDownMultiNodeMergeTest.java @@ -765,11 +765,8 @@ public class GroupByLimitPushDownMultiNodeMergeTest Segment adapter ) { - return new FinalizeResultsQueryRunner( - new BySegmentQueryRunner( - segmentId, adapter.getDataInterval().getStart(), - factory.createRunner(adapter) - ), + return new FinalizeResultsQueryRunner<>( + new BySegmentQueryRunner<>(segmentId, adapter.getDataInterval().getStart(), factory.createRunner(adapter)), (QueryToolChest>) factory.getToolchest() ); } diff --git a/processing/src/test/java/org/apache/druid/query/groupby/GroupByMultiSegmentTest.java b/processing/src/test/java/org/apache/druid/query/groupby/GroupByMultiSegmentTest.java index 5c31833c03f..2cbe5e7b0f7 100644 --- a/processing/src/test/java/org/apache/druid/query/groupby/GroupByMultiSegmentTest.java +++ b/processing/src/test/java/org/apache/druid/query/groupby/GroupByMultiSegmentTest.java @@ -404,11 +404,8 @@ public class GroupByMultiSegmentTest Segment adapter ) { - return new FinalizeResultsQueryRunner( - new BySegmentQueryRunner( - segmentId, adapter.getDataInterval().getStart(), - factory.createRunner(adapter) - ), + return new FinalizeResultsQueryRunner<>( + new BySegmentQueryRunner<>(segmentId, adapter.getDataInterval().getStart(), factory.createRunner(adapter)), (QueryToolChest>) factory.getToolchest() ); } diff --git a/processing/src/test/java/org/apache/druid/query/groupby/GroupByQueryRunnerTest.java b/processing/src/test/java/org/apache/druid/query/groupby/GroupByQueryRunnerTest.java index 20a8efd3982..50a2d1da2d3 100644 --- a/processing/src/test/java/org/apache/druid/query/groupby/GroupByQueryRunnerTest.java +++ b/processing/src/test/java/org/apache/druid/query/groupby/GroupByQueryRunnerTest.java @@ -2349,9 +2349,7 @@ public class GroupByQueryRunnerTest new QueryRunner() { @Override - public Sequence run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { // simulate two daily segments final QueryPlus queryPlus1 = queryPlus.withQuerySegmentSpec( @@ -2635,9 +2633,7 @@ public class GroupByQueryRunnerTest new QueryRunner() { @Override - public Sequence run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { // simulate two daily segments final QueryPlus queryPlus1 = queryPlus.withQuerySegmentSpec( @@ -3372,9 +3368,7 @@ public class GroupByQueryRunnerTest new QueryRunner() { @Override - public Sequence run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { // simulate two daily segments final QueryPlus queryPlus1 = queryPlus.withQuerySegmentSpec( @@ -3672,9 +3666,7 @@ public class GroupByQueryRunnerTest new QueryRunner() { @Override - public Sequence run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { // simulate two daily segments final QueryPlus queryPlus1 = queryPlus.withQuerySegmentSpec( @@ -3776,9 +3768,7 @@ public class GroupByQueryRunnerTest new QueryRunner() { @Override - public Sequence run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { // simulate two daily segments final QueryPlus queryPlus1 = queryPlus.withQuerySegmentSpec( @@ -8317,9 +8307,7 @@ public class GroupByQueryRunnerTest new QueryRunner() { @Override - public Sequence run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { // simulate two daily segments final QueryPlus queryPlus1 = queryPlus.withQuerySegmentSpec( @@ -8389,9 +8377,7 @@ public class GroupByQueryRunnerTest new QueryRunner() { @Override - public Sequence run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { // simulate two daily segments final QueryPlus queryPlus1 = queryPlus.withQuerySegmentSpec( @@ -8474,9 +8460,7 @@ public class GroupByQueryRunnerTest new QueryRunner() { @Override - public Sequence run( - QueryPlus queryPlus, Map responseContext - ) + public Sequence run(QueryPlus queryPlus, Map responseContext) { // simulate two daily segments final QueryPlus queryPlus1 = queryPlus.withQuerySegmentSpec( diff --git a/processing/src/test/java/org/apache/druid/query/groupby/NestedQueryPushDownTest.java b/processing/src/test/java/org/apache/druid/query/groupby/NestedQueryPushDownTest.java index 7f21731901f..9fd57032c23 100644 --- a/processing/src/test/java/org/apache/druid/query/groupby/NestedQueryPushDownTest.java +++ b/processing/src/test/java/org/apache/druid/query/groupby/NestedQueryPushDownTest.java @@ -937,10 +937,7 @@ public class NestedQueryPushDownTest ) { return new FinalizeResultsQueryRunner( - new BySegmentQueryRunner( - segmentId, adapter.getDataInterval().getStart(), - factory.createRunner(adapter) - ), + new BySegmentQueryRunner<>(segmentId, adapter.getDataInterval().getStart(), factory.createRunner(adapter)), (QueryToolChest>) factory.getToolchest() ); } @@ -1007,10 +1004,7 @@ public class NestedQueryPushDownTest ) { return new FinalizeResultsQueryRunner<>( - new BySegmentQueryRunner<>( - segmentId, adapter.getDataInterval().getStart(), - factory.createRunner(adapter) - ), + new BySegmentQueryRunner<>(segmentId, adapter.getDataInterval().getStart(), factory.createRunner(adapter)), (QueryToolChest>) factory.getToolchest() ); } diff --git a/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeapTest.java b/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeapTest.java index fa24a594dd1..9e38304fd82 100644 --- a/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeapTest.java +++ b/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeapTest.java @@ -41,6 +41,7 @@ public class ByteBufferMinMaxOffsetHeapTest ByteBuffer myBuffer = ByteBuffer.allocate(1000000); ByteBufferMinMaxOffsetHeap heap = new ByteBufferMinMaxOffsetHeap(myBuffer, limit, Ordering.natural(), null); + //CHECKSTYLE.OFF: Regexp ArrayList values = Lists.newArrayList( 30, 45, 81, 92, 68, 54, 66, 33, 89, 98, 87, 62, 84, 39, 13, 32, 67, 50, 21, 53, @@ -53,6 +54,7 @@ public class ByteBufferMinMaxOffsetHeapTest 23, 70, 26, 8, 64, 16, 10, 74, 7, 25, 5, 42, 47, 44, 1, 49, 99 ); + //CHECKSTYLE.ON: Regexp for (Integer value : values) { heap.addOffset(value); diff --git a/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/IntKeySerde.java b/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/IntKeySerde.java index 5f14af8853f..758b1cc976e 100644 --- a/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/IntKeySerde.java +++ b/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/IntKeySerde.java @@ -86,7 +86,8 @@ public class IntKeySerde implements Grouper.KeySerde @Override public Grouper.BufferComparator bufferComparatorWithAggregators( - AggregatorFactory[] aggregatorFactories, int[] aggregatorOffsets + AggregatorFactory[] aggregatorFactories, + int[] aggregatorOffsets ) { return KEY_COMPARATOR; diff --git a/processing/src/test/java/org/apache/druid/query/scan/MultiSegmentScanQueryTest.java b/processing/src/test/java/org/apache/druid/query/scan/MultiSegmentScanQueryTest.java index 4d1df19392c..cc6ad9d62a4 100644 --- a/processing/src/test/java/org/apache/druid/query/scan/MultiSegmentScanQueryTest.java +++ b/processing/src/test/java/org/apache/druid/query/scan/MultiSegmentScanQueryTest.java @@ -218,13 +218,14 @@ public class MultiSegmentScanQueryTest new QueryRunner() { @Override public Sequence run( - QueryPlus queryPlus, Map responseContext + QueryPlus queryPlus, + Map responseContext ) { // simulate results back from 2 historicals List> sequences = Lists.newArrayListWithExpectedSize(2); - sequences.add(factory.createRunner(segment0).run(queryPlus, new HashMap())); - sequences.add(factory.createRunner(segment1).run(queryPlus, new HashMap())); + sequences.add(factory.createRunner(segment0).run(queryPlus, new HashMap<>())); + sequences.add(factory.createRunner(segment1).run(queryPlus, new HashMap<>())); return new MergeSequence<>( queryPlus.getQuery().getResultOrdering(), Sequences.simple(sequences) diff --git a/processing/src/test/java/org/apache/druid/query/scan/ScanQueryRunnerTest.java b/processing/src/test/java/org/apache/druid/query/scan/ScanQueryRunnerTest.java index 5943bba7ae0..f4aaa98722a 100644 --- a/processing/src/test/java/org/apache/druid/query/scan/ScanQueryRunnerTest.java +++ b/processing/src/test/java/org/apache/druid/query/scan/ScanQueryRunnerTest.java @@ -546,7 +546,8 @@ public class ScanQueryRunnerTest events.add( Lists.newArrayList( Iterables.transform( - values, new Function>() + values, + new Function>() { @Override public Map apply(String input) diff --git a/processing/src/test/java/org/apache/druid/query/search/SearchBinaryFnTest.java b/processing/src/test/java/org/apache/druid/query/search/SearchBinaryFnTest.java index 4439b91dba2..ea566c46fe2 100644 --- a/processing/src/test/java/org/apache/druid/query/search/SearchBinaryFnTest.java +++ b/processing/src/test/java/org/apache/druid/query/search/SearchBinaryFnTest.java @@ -294,8 +294,8 @@ public class SearchBinaryFnTest new SearchResultValue(toHits(c, "blah:a9", "alah:a100", "blah:a100", "blah:b0", "alah:c3")) ); - Result actual = new SearchBinaryFn( - searchSortSpec, Granularities.ALL, Integer.MAX_VALUE).apply(r1, r2); + Result actual = + new SearchBinaryFn(searchSortSpec, Granularities.ALL, Integer.MAX_VALUE).apply(r1, r2); Assert.assertEquals(expected.getTimestamp(), actual.getTimestamp()); assertSearchMergeResult(expected.getValue(), actual.getValue()); } diff --git a/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerTest.java b/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerTest.java index b4e9127e038..6762091ee61 100644 --- a/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerTest.java +++ b/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerTest.java @@ -164,7 +164,8 @@ public class SearchQueryRunnerTest { @Override public Sequence> run( - QueryPlus> queryPlus, Map responseContext + QueryPlus> queryPlus, + Map responseContext ) { final QueryPlus> queryPlus1 = queryPlus.withQuerySegmentSpec( @@ -621,7 +622,8 @@ public class SearchQueryRunnerTest SearchQuery searchQuery = Druids.newSearchQueryBuilder() .dimensions( new DefaultDimensionSpec( - ColumnHolder.TIME_COLUMN_NAME, ColumnHolder.TIME_COLUMN_NAME, + ColumnHolder.TIME_COLUMN_NAME, + ColumnHolder.TIME_COLUMN_NAME, ValueType.LONG ) ) @@ -645,7 +647,8 @@ public class SearchQueryRunnerTest SearchQuery searchQuery = Druids.newSearchQueryBuilder() .dimensions( new ExtractionDimensionSpec( - ColumnHolder.TIME_COLUMN_NAME, ColumnHolder.TIME_COLUMN_NAME, + ColumnHolder.TIME_COLUMN_NAME, + ColumnHolder.TIME_COLUMN_NAME, jsExtractionFn ) ) @@ -666,7 +669,8 @@ public class SearchQueryRunnerTest SearchQuery searchQuery = Druids.newSearchQueryBuilder() .dimensions( new DefaultDimensionSpec( - QueryRunnerTestHelper.indexMetric, QueryRunnerTestHelper.indexMetric, + QueryRunnerTestHelper.indexMetric, + QueryRunnerTestHelper.indexMetric, ValueType.DOUBLE ) ) @@ -691,7 +695,8 @@ public class SearchQueryRunnerTest SearchQuery searchQuery = Druids.newSearchQueryBuilder() .dimensions( new ExtractionDimensionSpec( - QueryRunnerTestHelper.indexMetric, QueryRunnerTestHelper.indexMetric, + QueryRunnerTestHelper.indexMetric, + QueryRunnerTestHelper.indexMetric, jsExtractionFn ) ) @@ -792,14 +797,16 @@ public class SearchQueryRunnerTest int index = copy.indexOf(resultValue); if (index < 0) { fail( - expectedResults, results, + expectedResults, + results, "No result found containing " + resultValue.getDimension() + " and " + resultValue.getValue() ); } SearchHit expected = copy.remove(index); if (!resultValue.toString().equals(expected.toString())) { fail( - expectedResults, results, + expectedResults, + results, "Invalid count for " + resultValue + ".. which was expected to be " + expected.getCount() ); } diff --git a/processing/src/test/java/org/apache/druid/query/select/MultiSegmentSelectQueryTest.java b/processing/src/test/java/org/apache/druid/query/select/MultiSegmentSelectQueryTest.java index 54ff86733a3..dc5ca3cf128 100644 --- a/processing/src/test/java/org/apache/druid/query/select/MultiSegmentSelectQueryTest.java +++ b/processing/src/test/java/org/apache/druid/query/select/MultiSegmentSelectQueryTest.java @@ -259,9 +259,7 @@ public class MultiSegmentSelectQueryTest for (int i = 0; i < 4; i++) { if (query.isDescending() ^ expected[i] >= 0) { - Assert.assertEquals( - expected[i], pagingIdentifiers.get(segmentIdentifiers.get(i)).intValue() - ); + Assert.assertEquals(expected[i], pagingIdentifiers.get(segmentIdentifiers.get(i)).intValue()); } } Assert.assertEquals(expected[4], value.getEvents().size()); diff --git a/processing/src/test/java/org/apache/druid/query/spec/SpecificSegmentQueryRunnerTest.java b/processing/src/test/java/org/apache/druid/query/spec/SpecificSegmentQueryRunnerTest.java index 1a5d12fe6d8..9acfb321979 100644 --- a/processing/src/test/java/org/apache/druid/query/spec/SpecificSegmentQueryRunnerTest.java +++ b/processing/src/test/java/org/apache/druid/query/spec/SpecificSegmentQueryRunnerTest.java @@ -79,9 +79,7 @@ public class SpecificSegmentQueryRunnerTest } @Override - public Yielder toYielder( - Object initValue, YieldingAccumulator accumulator - ) + public Yielder toYielder(Object initValue, YieldingAccumulator accumulator) { throw new SegmentMissingException("FAILSAUCE"); } @@ -114,7 +112,8 @@ public class SpecificSegmentQueryRunnerTest responseContext = Maps.newHashMap(); results = queryRunner.run(QueryPlus.wrap(query), responseContext); results.toYielder( - null, new YieldingAccumulator() + null, + new YieldingAccumulator() { final List lists = Lists.newArrayList(); @Override diff --git a/processing/src/test/java/org/apache/druid/query/timeseries/TimeSeriesUnionQueryRunnerTest.java b/processing/src/test/java/org/apache/druid/query/timeseries/TimeSeriesUnionQueryRunnerTest.java index bed3521df18..4efcddb990e 100644 --- a/processing/src/test/java/org/apache/druid/query/timeseries/TimeSeriesUnionQueryRunnerTest.java +++ b/processing/src/test/java/org/apache/druid/query/timeseries/TimeSeriesUnionQueryRunnerTest.java @@ -50,9 +50,7 @@ public class TimeSeriesUnionQueryRunnerTest private final QueryRunner runner; private final boolean descending; - public TimeSeriesUnionQueryRunnerTest( - QueryRunner runner, boolean descending - ) + public TimeSeriesUnionQueryRunnerTest(QueryRunner runner, boolean descending) { this.runner = runner; this.descending = descending; diff --git a/processing/src/test/java/org/apache/druid/query/timeseries/TimeseriesQueryRunnerTest.java b/processing/src/test/java/org/apache/druid/query/timeseries/TimeseriesQueryRunnerTest.java index 60bda9309cd..2628d77ffee 100644 --- a/processing/src/test/java/org/apache/druid/query/timeseries/TimeseriesQueryRunnerTest.java +++ b/processing/src/test/java/org/apache/druid/query/timeseries/TimeseriesQueryRunnerTest.java @@ -119,7 +119,8 @@ public class TimeseriesQueryRunnerTest private final List aggregatorFactoryList; public TimeseriesQueryRunnerTest( - QueryRunner runner, boolean descending, + QueryRunner runner, + boolean descending, List aggregatorFactoryList ) { diff --git a/processing/src/test/java/org/apache/druid/query/topn/TopNQueryRunnerTest.java b/processing/src/test/java/org/apache/druid/query/topn/TopNQueryRunnerTest.java index be47ae5156a..5ebca0849de 100644 --- a/processing/src/test/java/org/apache/druid/query/topn/TopNQueryRunnerTest.java +++ b/processing/src/test/java/org/apache/druid/query/topn/TopNQueryRunnerTest.java @@ -257,9 +257,7 @@ public class TopNQueryRunnerTest return runWithMerge(query, ImmutableMap.of()); } - private Sequence> runWithMerge( - TopNQuery query, Map context - ) + private Sequence> runWithMerge(TopNQuery query, Map context) { final TopNQueryQueryToolChest chest = new TopNQueryQueryToolChest( new TopNQueryConfig(), @@ -2375,7 +2373,8 @@ public class TopNQueryRunnerTest .granularity(QueryRunnerTestHelper.allGran) .dimension( new ExtractionDimensionSpec( - QueryRunnerTestHelper.qualityDimension, QueryRunnerTestHelper.qualityDimension, + QueryRunnerTestHelper.qualityDimension, + QueryRunnerTestHelper.qualityDimension, new RegexDimExtractionFn(".(.)", false, null) ) ) @@ -3146,7 +3145,8 @@ public class TopNQueryRunnerTest .granularity(QueryRunnerTestHelper.allGran) .dimension( new ExtractionDimensionSpec( - QueryRunnerTestHelper.marketDimension, QueryRunnerTestHelper.marketDimension, + QueryRunnerTestHelper.marketDimension, + QueryRunnerTestHelper.marketDimension, new DimExtractionFn() { @Override @@ -4241,7 +4241,8 @@ public class TopNQueryRunnerTest .aggregators( Lists.newArrayList( Iterables.concat( - commonAggregators, Lists.newArrayList( + commonAggregators, + Lists.newArrayList( new FilteredAggregatorFactory( new DoubleMaxAggregatorFactory("maxIndex", "index"), extractionFilter diff --git a/processing/src/test/java/org/apache/druid/segment/CloserRule.java b/processing/src/test/java/org/apache/druid/segment/CloserRule.java index 8f87288f869..d60fce5a67b 100644 --- a/processing/src/test/java/org/apache/druid/segment/CloserRule.java +++ b/processing/src/test/java/org/apache/druid/segment/CloserRule.java @@ -41,9 +41,7 @@ public class CloserRule implements TestRule private final Closer closer = Closer.create(); @Override - public Statement apply( - final Statement base, Description description - ) + public Statement apply(final Statement base, Description description) { return new Statement() { diff --git a/processing/src/test/java/org/apache/druid/segment/CloserRuleTest.java b/processing/src/test/java/org/apache/druid/segment/CloserRuleTest.java index 800e2ffd4ac..399a6cb23ea 100644 --- a/processing/src/test/java/org/apache/druid/segment/CloserRuleTest.java +++ b/processing/src/test/java/org/apache/druid/segment/CloserRuleTest.java @@ -79,13 +79,9 @@ public class CloserRuleTest Exception ex = null; try { run( - closer, new Runnable() - { - @Override - public void run() - { - throw new ArithmeticException(msg); - } + closer, + () -> { + throw new ArithmeticException(msg); } ); } @@ -133,13 +129,9 @@ public class CloserRuleTest Throwable ex = null; try { run( - closer, new Runnable() - { - @Override - public void run() - { - throw arithmeticException; - } + closer, + () -> { + throw arithmeticException; } ); } diff --git a/processing/src/test/java/org/apache/druid/segment/IndexIOTest.java b/processing/src/test/java/org/apache/druid/segment/IndexIOTest.java index fb07f27de67..59305147c66 100644 --- a/processing/src/test/java/org/apache/druid/segment/IndexIOTest.java +++ b/processing/src/test/java/org/apache/druid/segment/IndexIOTest.java @@ -20,7 +20,6 @@ package org.apache.druid.segment; import com.google.common.base.Function; -import com.google.common.base.Predicates; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -56,6 +55,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; /** * This is mostly a test of the validator @@ -105,9 +105,7 @@ public class IndexIOTest "dim1", "dim10" ); - final List> maps = ImmutableList.of( - map, map00, map10, map0null, map1null, mapAll - ); + final List> maps = ImmutableList.of(map, map00, map10, map0null, map1null, mapAll); return Iterables.concat( // First iterable tests permutations of the maps which are expected to be equal @@ -232,17 +230,7 @@ public class IndexIOTest public static List filterNullValues(List> mapList) { - return Lists.transform( - mapList, new Function() - { - @Nullable - @Override - public Map apply(@Nullable Map input) - { - return Maps.filterValues(input, Predicates.notNull()); - } - } - ); + return Lists.transform(mapList, (Function) input -> Maps.filterValues(input, Objects::nonNull)); } private final Collection> events1; diff --git a/processing/src/test/java/org/apache/druid/segment/SchemalessTestFullTest.java b/processing/src/test/java/org/apache/druid/segment/SchemalessTestFullTest.java index 1f9ad939ea0..b58f72af777 100644 --- a/processing/src/test/java/org/apache/druid/segment/SchemalessTestFullTest.java +++ b/processing/src/test/java/org/apache/druid/segment/SchemalessTestFullTest.java @@ -945,9 +945,7 @@ public class SchemalessTestFullTest ); runTests( - new QueryableIndexSegment( - null, schemalessIndexTest.getMergedIncrementalIndex(0, 0) - ), + new QueryableIndexSegment(null, schemalessIndexTest.getMergedIncrementalIndex(0, 0)), expectedTimeseriesResults, expectedFilteredTimeSeriesResults, expectedTopNResults, @@ -1030,9 +1028,7 @@ public class SchemalessTestFullTest ); runTests( - new QueryableIndexSegment( - null, schemalessIndexTest.getMergedIncrementalIndex(1, 1) - ), + new QueryableIndexSegment(null, schemalessIndexTest.getMergedIncrementalIndex(1, 1)), expectedTimeseriesResults, expectedFilteredTimeSeriesResults, expectedTopNResults, diff --git a/processing/src/test/java/org/apache/druid/segment/data/CompressedColumnarIntsSerializerTest.java b/processing/src/test/java/org/apache/druid/segment/data/CompressedColumnarIntsSerializerTest.java index 17a7cb19816..b8520031fdb 100644 --- a/processing/src/test/java/org/apache/druid/segment/data/CompressedColumnarIntsSerializerTest.java +++ b/processing/src/test/java/org/apache/druid/segment/data/CompressedColumnarIntsSerializerTest.java @@ -83,14 +83,8 @@ public class CompressedColumnarIntsSerializerTest ); return Iterables.transform( - combinations, new Function() - { - @Override - public Object[] apply(List input) - { - return new Object[]{input.get(0), input.get(1)}; - } - } + combinations, + (Function) input -> new Object[]{input.get(0), input.get(1)} ); } @@ -119,7 +113,11 @@ public class CompressedColumnarIntsSerializerTest FileSmoosher smoosher = new FileSmoosher(temporaryFolder.newFolder()); CompressedColumnarIntsSerializer writer = new CompressedColumnarIntsSerializer( - segmentWriteOutMedium, "test", chunkFactor, byteOrder, compressionStrategy + segmentWriteOutMedium, + "test", + chunkFactor, + byteOrder, + compressionStrategy ); CompressedColumnarIntsSupplier supplierFromList = CompressedColumnarIntsSupplier.fromList( IntArrayList.wrap(vals), diff --git a/processing/src/test/java/org/apache/druid/segment/data/CompressedVSizeColumnarIntsSerializerTest.java b/processing/src/test/java/org/apache/druid/segment/data/CompressedVSizeColumnarIntsSerializerTest.java index 65cda7220a7..0c5ffa84200 100644 --- a/processing/src/test/java/org/apache/druid/segment/data/CompressedVSizeColumnarIntsSerializerTest.java +++ b/processing/src/test/java/org/apache/druid/segment/data/CompressedVSizeColumnarIntsSerializerTest.java @@ -81,14 +81,8 @@ public class CompressedVSizeColumnarIntsSerializerTest ); return Iterables.transform( - combinations, new Function() - { - @Override - public Object[] apply(List input) - { - return new Object[]{input.get(0), input.get(1)}; - } - } + combinations, + (Function) input -> new Object[]{input.get(0), input.get(1)} ); } diff --git a/processing/src/test/java/org/apache/druid/segment/data/CompressedVSizeColumnarIntsSupplierTest.java b/processing/src/test/java/org/apache/druid/segment/data/CompressedVSizeColumnarIntsSupplierTest.java index 3ba3a67f5f7..3b3d427a23a 100644 --- a/processing/src/test/java/org/apache/druid/segment/data/CompressedVSizeColumnarIntsSupplierTest.java +++ b/processing/src/test/java/org/apache/druid/segment/data/CompressedVSizeColumnarIntsSupplierTest.java @@ -58,14 +58,7 @@ public class CompressedVSizeColumnarIntsSupplierTest extends CompressionStrategy { final Iterable compressionStrategies = Iterables.transform( CompressionStrategyTest.compressionStrategies(), - new Function() - { - @Override - public CompressionStrategy apply(Object[] input) - { - return (CompressionStrategy) input[0]; - } - } + (Object[] input) -> (CompressionStrategy) input[0] ); Set> combinations = Sets.cartesianProduct( @@ -74,14 +67,8 @@ public class CompressedVSizeColumnarIntsSupplierTest extends CompressionStrategy ); return Iterables.transform( - combinations, new Function() - { - @Override - public Object[] apply(List input) - { - return new Object[]{input.get(0), input.get(1)}; - } - } + combinations, + (Function) input -> new Object[]{input.get(0), input.get(1)} ); } diff --git a/processing/src/test/java/org/apache/druid/segment/data/GenericIndexedTest.java b/processing/src/test/java/org/apache/druid/segment/data/GenericIndexedTest.java index 14690e7471b..3ba0d47a5ae 100644 --- a/processing/src/test/java/org/apache/druid/segment/data/GenericIndexedTest.java +++ b/processing/src/test/java/org/apache/druid/segment/data/GenericIndexedTest.java @@ -70,9 +70,7 @@ public class GenericIndexedTest final String[] strings = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"}; GenericIndexed deserialized = serializeAndDeserialize( - GenericIndexed.fromArray( - strings, GenericIndexed.STRING_STRATEGY - ) + GenericIndexed.fromArray(strings, GenericIndexed.STRING_STRATEGY) ); checkBasicAPIs(strings, deserialized, true); @@ -88,9 +86,7 @@ public class GenericIndexedTest final String[] strings = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "k", "j", "l"}; GenericIndexed deserialized = serializeAndDeserialize( - GenericIndexed.fromArray( - strings, GenericIndexed.STRING_STRATEGY - ) + GenericIndexed.fromArray(strings, GenericIndexed.STRING_STRATEGY) ); checkBasicAPIs(strings, deserialized, false); } @@ -130,9 +126,7 @@ public class GenericIndexedTest final ByteBuffer byteBuffer = ByteBuffer.wrap(baos.toByteArray()); Assert.assertEquals(indexed.getSerializedSize(), byteBuffer.remaining()); - GenericIndexed deserialized = GenericIndexed.read( - byteBuffer, GenericIndexed.STRING_STRATEGY - ); + GenericIndexed deserialized = GenericIndexed.read(byteBuffer, GenericIndexed.STRING_STRATEGY); Assert.assertEquals(0, byteBuffer.remaining()); return deserialized; } diff --git a/processing/src/test/java/org/apache/druid/segment/data/IncrementalIndexTest.java b/processing/src/test/java/org/apache/druid/segment/data/IncrementalIndexTest.java index 0aaffb972e2..a9c60350f4c 100644 --- a/processing/src/test/java/org/apache/druid/segment/data/IncrementalIndexTest.java +++ b/processing/src/test/java/org/apache/druid/segment/data/IncrementalIndexTest.java @@ -606,9 +606,7 @@ public class IncrementalIndexTest new Accumulator>() { @Override - public Double[] accumulate( - Double[] accumulated, Result in - ) + public Double[] accumulate(Double[] accumulated, Result in) { if (currentlyRunning.get() > 0) { concurrentlyRan.incrementAndGet(); diff --git a/processing/src/test/java/org/apache/druid/segment/data/V3CompressedVSizeColumnarMultiIntsSerializerTest.java b/processing/src/test/java/org/apache/druid/segment/data/V3CompressedVSizeColumnarMultiIntsSerializerTest.java index feff69533ff..e92b87e9012 100644 --- a/processing/src/test/java/org/apache/druid/segment/data/V3CompressedVSizeColumnarMultiIntsSerializerTest.java +++ b/processing/src/test/java/org/apache/druid/segment/data/V3CompressedVSizeColumnarMultiIntsSerializerTest.java @@ -21,9 +21,7 @@ package org.apache.druid.segment.data; import com.google.common.base.Function; import com.google.common.collect.Iterables; -import com.google.common.collect.Ordering; import com.google.common.collect.Sets; -import com.google.common.primitives.Ints; import org.apache.commons.io.IOUtils; import org.apache.druid.java.util.common.StringUtils; import org.apache.druid.java.util.common.guava.CloseQuietly; @@ -41,15 +39,16 @@ import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import javax.annotation.Nullable; import java.io.File; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.file.Files; import java.util.ArrayList; import java.util.List; +import java.util.NoSuchElementException; import java.util.Random; import java.util.Set; +import java.util.stream.IntStream; import static org.junit.Assert.assertEquals; @@ -89,14 +88,8 @@ public class V3CompressedVSizeColumnarMultiIntsSerializerTest ); return Iterables.transform( - combinations, new Function() - { - @Override - public Object[] apply(List input) - { - return new Object[]{input.get(0), input.get(1)}; - } - } + combinations, + (Function) input -> new Object[]{input.get(0), input.get(1)} ); } @@ -120,10 +113,19 @@ public class V3CompressedVSizeColumnarMultiIntsSerializerTest try (SegmentWriteOutMedium segmentWriteOutMedium = new OffHeapMemorySegmentWriteOutMedium()) { int maxValue = vals.size() > 0 ? getMaxValue(vals) : 0; CompressedColumnarIntsSerializer offsetWriter = new CompressedColumnarIntsSerializer( - segmentWriteOutMedium, "offset", offsetChunkFactor, byteOrder, compressionStrategy + segmentWriteOutMedium, + "offset", + offsetChunkFactor, + byteOrder, + compressionStrategy ); CompressedVSizeColumnarIntsSerializer valueWriter = new CompressedVSizeColumnarIntsSerializer( - segmentWriteOutMedium, "value", maxValue, valueChunkFactor, byteOrder, compressionStrategy + segmentWriteOutMedium, + "value", + maxValue, + valueChunkFactor, + byteOrder, + compressionStrategy ); V3CompressedVSizeColumnarMultiIntsSerializer writer = new V3CompressedVSizeColumnarMultiIntsSerializer(offsetWriter, valueWriter); @@ -168,19 +170,11 @@ public class V3CompressedVSizeColumnarMultiIntsSerializerTest int getMaxValue(final List vals) { - return Ordering.natural().max( - Iterables.transform( - vals, new Function() - { - @Nullable - @Override - public Integer apply(int[] input) - { - return input.length > 0 ? Ints.max(input) : 0; - } - } - ) - ); + return vals + .stream() + .mapToInt(array -> IntStream.of(array).max().orElse(0)) + .max() + .orElseThrow(NoSuchElementException::new); } @Before diff --git a/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java b/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java index 313f729f98a..95e387f89ce 100644 --- a/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java +++ b/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java @@ -343,9 +343,7 @@ public abstract class BaseFilterTest } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return false; } diff --git a/processing/src/test/java/org/apache/druid/segment/filter/ExtractionDimFilterTest.java b/processing/src/test/java/org/apache/druid/segment/filter/ExtractionDimFilterTest.java index 50d123f85b4..c7a560c1961 100644 --- a/processing/src/test/java/org/apache/druid/segment/filter/ExtractionDimFilterTest.java +++ b/processing/src/test/java/org/apache/druid/segment/filter/ExtractionDimFilterTest.java @@ -216,9 +216,7 @@ public class ExtractionDimFilterTest @Test public void testEmpty() { - Filter extractionFilter = new SelectorDimFilter( - "foo", "NFDJUKFNDSJFNS", DIM_EXTRACTION_FN - ).toFilter(); + Filter extractionFilter = new SelectorDimFilter("foo", "NFDJUKFNDSJFNS", DIM_EXTRACTION_FN).toFilter(); ImmutableBitmap immutableBitmap = extractionFilter.getBitmapIndex(BITMAP_INDEX_SELECTOR); Assert.assertEquals(0, immutableBitmap.size()); } @@ -226,9 +224,7 @@ public class ExtractionDimFilterTest @Test public void testNull() { - Filter extractionFilter = new SelectorDimFilter( - "FDHJSFFHDS", "extractDimVal", DIM_EXTRACTION_FN - ).toFilter(); + Filter extractionFilter = new SelectorDimFilter("FDHJSFFHDS", "extractDimVal", DIM_EXTRACTION_FN).toFilter(); ImmutableBitmap immutableBitmap = extractionFilter.getBitmapIndex(BITMAP_INDEX_SELECTOR); Assert.assertEquals(0, immutableBitmap.size()); } @@ -236,9 +232,7 @@ public class ExtractionDimFilterTest @Test public void testNormal() { - Filter extractionFilter = new SelectorDimFilter( - "foo", "extractDimVal", DIM_EXTRACTION_FN - ).toFilter(); + Filter extractionFilter = new SelectorDimFilter("foo", "extractDimVal", DIM_EXTRACTION_FN).toFilter(); ImmutableBitmap immutableBitmap = extractionFilter.getBitmapIndex(BITMAP_INDEX_SELECTOR); Assert.assertEquals(1, immutableBitmap.size()); } @@ -247,36 +241,24 @@ public class ExtractionDimFilterTest public void testOr() { Assert.assertEquals( - 1, Filters.toFilter( - DimFilters.or( - new ExtractionDimFilter( - "foo", - "extractDimVal", - DIM_EXTRACTION_FN, - null - ) - ) - ).getBitmapIndex(BITMAP_INDEX_SELECTOR).size() + 1, + Filters + .toFilter(DimFilters.or(new ExtractionDimFilter("foo", "extractDimVal", DIM_EXTRACTION_FN, null))) + .getBitmapIndex(BITMAP_INDEX_SELECTOR) + .size() ); Assert.assertEquals( 1, - Filters.toFilter( - DimFilters.or( - new ExtractionDimFilter( - "foo", - "extractDimVal", - DIM_EXTRACTION_FN, - null - ), - new ExtractionDimFilter( - "foo", - "DOES NOT EXIST", - DIM_EXTRACTION_FN, - null + Filters + .toFilter( + DimFilters.or( + new ExtractionDimFilter("foo", "extractDimVal", DIM_EXTRACTION_FN, null), + new ExtractionDimFilter("foo", "DOES NOT EXIST", DIM_EXTRACTION_FN, null) ) ) - ).getBitmapIndex(BITMAP_INDEX_SELECTOR).size() + .getBitmapIndex(BITMAP_INDEX_SELECTOR) + .size() ); } @@ -284,36 +266,24 @@ public class ExtractionDimFilterTest public void testAnd() { Assert.assertEquals( - 1, Filters.toFilter( - DimFilters.or( - new ExtractionDimFilter( - "foo", - "extractDimVal", - DIM_EXTRACTION_FN, - null - ) - ) - ).getBitmapIndex(BITMAP_INDEX_SELECTOR).size() + 1, + Filters + .toFilter(DimFilters.or(new ExtractionDimFilter("foo", "extractDimVal", DIM_EXTRACTION_FN, null))) + .getBitmapIndex(BITMAP_INDEX_SELECTOR) + .size() ); Assert.assertEquals( 1, - Filters.toFilter( - DimFilters.and( - new ExtractionDimFilter( - "foo", - "extractDimVal", - DIM_EXTRACTION_FN, - null - ), - new ExtractionDimFilter( - "foo", - "extractDimVal", - DIM_EXTRACTION_FN, - null + Filters + .toFilter( + DimFilters.and( + new ExtractionDimFilter("foo", "extractDimVal", DIM_EXTRACTION_FN, null), + new ExtractionDimFilter("foo", "extractDimVal", DIM_EXTRACTION_FN, null) ) ) - ).getBitmapIndex(BITMAP_INDEX_SELECTOR).size() + .getBitmapIndex(BITMAP_INDEX_SELECTOR) + .size() ); } @@ -322,30 +292,19 @@ public class ExtractionDimFilterTest { Assert.assertEquals( - 1, Filters.toFilter( - DimFilters.or( - new ExtractionDimFilter( - "foo", - "extractDimVal", - DIM_EXTRACTION_FN, - null - ) - ) - ).getBitmapIndex(BITMAP_INDEX_SELECTOR).size() + 1, + Filters + .toFilter(DimFilters.or(new ExtractionDimFilter("foo", "extractDimVal", DIM_EXTRACTION_FN, null))) + .getBitmapIndex(BITMAP_INDEX_SELECTOR) + .size() ); Assert.assertEquals( 1, - Filters.toFilter( - DimFilters.not( - new ExtractionDimFilter( - "foo", - "DOES NOT EXIST", - DIM_EXTRACTION_FN, - null - ) - ) - ).getBitmapIndex(BITMAP_INDEX_SELECTOR).size() + Filters + .toFilter(DimFilters.not(new ExtractionDimFilter("foo", "DOES NOT EXIST", DIM_EXTRACTION_FN, null))) + .getBitmapIndex(BITMAP_INDEX_SELECTOR) + .size() ); } } diff --git a/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexMultiValueSpecTest.java b/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexMultiValueSpecTest.java index d524b35187d..a80c9103b42 100644 --- a/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexMultiValueSpecTest.java +++ b/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexMultiValueSpecTest.java @@ -83,9 +83,9 @@ public class IncrementalIndexMultiValueSpecTest .buildOnheap(); index.add( new MapBasedInputRow( - 0, Arrays.asList( - "string1", "string2", "string3", "float1", "float2", "float3", "long1", "long2", "long3" - ), map + 0, + Arrays.asList("string1", "string2", "string3", "float1", "float2", "float3", "long1", "long2", "long3"), + map ) ); diff --git a/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java b/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java index de7a6fc4192..67a08b93f5a 100644 --- a/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java +++ b/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java @@ -666,9 +666,7 @@ public class IncrementalIndexStorageAdapterTest } @Override - public T getBitmapResult( - BitmapIndexSelector selector, BitmapResultFactory bitmapResultFactory - ) + public T getBitmapResult(BitmapIndexSelector selector, BitmapResultFactory bitmapResultFactory) { return bitmapResultFactory.wrapAllTrue(Filters.allTrue(selector)); } @@ -696,9 +694,7 @@ public class IncrementalIndexStorageAdapterTest } @Override - public boolean supportsSelectivityEstimation( - ColumnSelector columnSelector, BitmapIndexSelector indexSelector - ) + public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) { return true; } diff --git a/processing/src/test/java/org/apache/druid/segment/serde/HyperUniquesSerdeForTest.java b/processing/src/test/java/org/apache/druid/segment/serde/HyperUniquesSerdeForTest.java index da141e560f0..5bd56cf7e78 100644 --- a/processing/src/test/java/org/apache/druid/segment/serde/HyperUniquesSerdeForTest.java +++ b/processing/src/test/java/org/apache/druid/segment/serde/HyperUniquesSerdeForTest.java @@ -91,9 +91,7 @@ public class HyperUniquesSerdeForTest extends ComplexMetricSerde } @Override - public void deserializeColumn( - ByteBuffer byteBuffer, ColumnBuilder columnBuilder - ) + public void deserializeColumn(ByteBuffer byteBuffer, ColumnBuilder columnBuilder) { final GenericIndexed column; if (columnBuilder.getFileMapper() == null) { diff --git a/server/src/main/java/org/apache/druid/client/AbstractCuratorServerInventoryView.java b/server/src/main/java/org/apache/druid/client/AbstractCuratorServerInventoryView.java index 9e46e9c9ed2..2d0cfb0ae51 100644 --- a/server/src/main/java/org/apache/druid/client/AbstractCuratorServerInventoryView.java +++ b/server/src/main/java/org/apache/druid/client/AbstractCuratorServerInventoryView.java @@ -138,9 +138,7 @@ public abstract class AbstractCuratorServerInventoryView implemen } @Override - public DruidServer updateInventory( - DruidServer container, String inventoryKey, InventoryType inventory - ) + public DruidServer updateInventory(DruidServer container, String inventoryKey, InventoryType inventory) { return updateInnerInventory(container, inventoryKey, inventory); } diff --git a/server/src/main/java/org/apache/druid/client/BatchServerInventoryView.java b/server/src/main/java/org/apache/druid/client/BatchServerInventoryView.java index f8b1ef160c1..8c4c125e9f5 100644 --- a/server/src/main/java/org/apache/druid/client/BatchServerInventoryView.java +++ b/server/src/main/java/org/apache/druid/client/BatchServerInventoryView.java @@ -132,9 +132,7 @@ public class BatchServerInventoryView extends AbstractCuratorServerInventoryView } @Override - protected DruidServer updateInnerInventory( - DruidServer container, String inventoryKey, Set inventory - ) + protected DruidServer updateInnerInventory(DruidServer container, String inventoryKey, Set inventory) { Set filteredInventory = filterInventory(container, inventory); diff --git a/server/src/main/java/org/apache/druid/client/CacheUtil.java b/server/src/main/java/org/apache/druid/client/CacheUtil.java index 027db74b2f1..ac9c8a86f0d 100644 --- a/server/src/main/java/org/apache/druid/client/CacheUtil.java +++ b/server/src/main/java/org/apache/druid/client/CacheUtil.java @@ -42,13 +42,15 @@ public class CacheUtil final byte[] versionBytes = StringUtils.toUtf8(descriptor.getVersion()); return new Cache.NamedKey( - segmentIdentifier, ByteBuffer - .allocate(16 + versionBytes.length + 4 + queryCacheKey.length) - .putLong(segmentQueryInterval.getStartMillis()) - .putLong(segmentQueryInterval.getEndMillis()) - .put(versionBytes) - .putInt(descriptor.getPartitionNumber()) - .put(queryCacheKey).array() + segmentIdentifier, + ByteBuffer + .allocate(16 + versionBytes.length + 4 + queryCacheKey.length) + .putLong(segmentQueryInterval.getStartMillis()) + .putLong(segmentQueryInterval.getEndMillis()) + .put(versionBytes) + .putInt(descriptor.getPartitionNumber()) + .put(queryCacheKey) + .array() ); } diff --git a/server/src/main/java/org/apache/druid/client/DirectDruidClient.java b/server/src/main/java/org/apache/druid/client/DirectDruidClient.java index da2fb03b819..58b153a2b36 100644 --- a/server/src/main/java/org/apache/druid/client/DirectDruidClient.java +++ b/server/src/main/java/org/apache/druid/client/DirectDruidClient.java @@ -162,7 +162,8 @@ public class DirectDruidClient implements QueryRunner final TypeFactory typeFactory = objectMapper.getTypeFactory(); JavaType baseType = typeFactory.constructType(toolChest.getResultTypeReference()); JavaType bySegmentType = typeFactory.constructParametricType( - Result.class, typeFactory.constructParametricType(BySegmentResultValueClass.class, baseType) + Result.class, + typeFactory.constructParametricType(BySegmentResultValueClass.class, baseType) ); types = Pair.of(baseType, bySegmentType); typesMap.put(query.getClass(), types); @@ -261,7 +262,8 @@ public class DirectDruidClient implements QueryRunner if (responseContext != null) { context.putAll( objectMapper.>readValue( - responseContext, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT + responseContext, + JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT ) ); } @@ -484,7 +486,8 @@ public class DirectDruidClient implements QueryRunner openConnections.getAndIncrement(); Futures.addCallback( - future, new FutureCallback() + future, + new FutureCallback() { @Override public void onSuccess(InputStream result) diff --git a/server/src/main/java/org/apache/druid/client/FilteredHttpServerInventoryViewProvider.java b/server/src/main/java/org/apache/druid/client/FilteredHttpServerInventoryViewProvider.java index 4b9d4393cdd..af18fe01acd 100644 --- a/server/src/main/java/org/apache/druid/client/FilteredHttpServerInventoryViewProvider.java +++ b/server/src/main/java/org/apache/druid/client/FilteredHttpServerInventoryViewProvider.java @@ -55,7 +55,8 @@ public class FilteredHttpServerInventoryViewProvider implements FilteredServerIn public HttpServerInventoryView get() { return new HttpServerInventoryView( - smileMapper, httpClient, + smileMapper, + httpClient, druidNodeDiscoveryProvider, Predicates.alwaysFalse(), config diff --git a/server/src/main/java/org/apache/druid/client/FilteredServerInventoryView.java b/server/src/main/java/org/apache/druid/client/FilteredServerInventoryView.java index ff7476ded03..0d0ea6347d1 100644 --- a/server/src/main/java/org/apache/druid/client/FilteredServerInventoryView.java +++ b/server/src/main/java/org/apache/druid/client/FilteredServerInventoryView.java @@ -29,7 +29,9 @@ import java.util.concurrent.Executor; public interface FilteredServerInventoryView extends InventoryView { void registerSegmentCallback( - Executor exec, ServerView.SegmentCallback callback, Predicate> filter + Executor exec, + ServerView.SegmentCallback callback, + Predicate> filter ); void registerServerRemovedCallback(Executor exec, ServerView.ServerRemovedCallback callback); diff --git a/server/src/main/java/org/apache/druid/client/HttpServerInventoryView.java b/server/src/main/java/org/apache/druid/client/HttpServerInventoryView.java index 5705f157b0c..fc0bc6e2f0f 100644 --- a/server/src/main/java/org/apache/druid/client/HttpServerInventoryView.java +++ b/server/src/main/java/org/apache/druid/client/HttpServerInventoryView.java @@ -226,7 +226,9 @@ public class HttpServerInventoryView implements ServerInventoryView, FilteredSer @Override public void registerSegmentCallback( - Executor exec, SegmentCallback callback, Predicate> filter + Executor exec, + SegmentCallback callback, + Predicate> filter ) { if (lifecycleLock.isStarted()) { diff --git a/server/src/main/java/org/apache/druid/client/ResultLevelCacheUtil.java b/server/src/main/java/org/apache/druid/client/ResultLevelCacheUtil.java index 86e454c5fb7..7ca9dc19917 100644 --- a/server/src/main/java/org/apache/druid/client/ResultLevelCacheUtil.java +++ b/server/src/main/java/org/apache/druid/client/ResultLevelCacheUtil.java @@ -31,13 +31,9 @@ public class ResultLevelCacheUtil { private static final Logger log = new Logger(ResultLevelCacheUtil.class); - public static Cache.NamedKey computeResultLevelCacheKey( - String resultLevelCacheIdentifier - ) + public static Cache.NamedKey computeResultLevelCacheKey(String resultLevelCacheIdentifier) { - return new Cache.NamedKey( - resultLevelCacheIdentifier, StringUtils.toUtf8(resultLevelCacheIdentifier) - ); + return new Cache.NamedKey(resultLevelCacheIdentifier, StringUtils.toUtf8(resultLevelCacheIdentifier)); } public static void populate( diff --git a/server/src/main/java/org/apache/druid/client/SingleServerInventoryView.java b/server/src/main/java/org/apache/druid/client/SingleServerInventoryView.java index 8645ddf0a8e..7c4d7b1af55 100644 --- a/server/src/main/java/org/apache/druid/client/SingleServerInventoryView.java +++ b/server/src/main/java/org/apache/druid/client/SingleServerInventoryView.java @@ -74,9 +74,7 @@ public class SingleServerInventoryView extends AbstractCuratorServerInventoryVie } @Override - protected DruidServer addInnerInventory( - DruidServer container, String inventoryKey, DataSegment inventory - ) + protected DruidServer addInnerInventory(DruidServer container, String inventoryKey, DataSegment inventory) { Predicate> predicate = Predicates.or( defaultFilter, @@ -89,9 +87,7 @@ public class SingleServerInventoryView extends AbstractCuratorServerInventoryVie } @Override - protected DruidServer updateInnerInventory( - DruidServer container, String inventoryKey, DataSegment inventory - ) + protected DruidServer updateInnerInventory(DruidServer container, String inventoryKey, DataSegment inventory) { return addInnerInventory(container, inventoryKey, inventory); } diff --git a/server/src/main/java/org/apache/druid/client/cache/BytesBoundedLinkedQueue.java b/server/src/main/java/org/apache/druid/client/cache/BytesBoundedLinkedQueue.java index 6be223ade74..f996d47ae00 100644 --- a/server/src/main/java/org/apache/druid/client/cache/BytesBoundedLinkedQueue.java +++ b/server/src/main/java/org/apache/druid/client/cache/BytesBoundedLinkedQueue.java @@ -132,9 +132,7 @@ public abstract class BytesBoundedLinkedQueue extends AbstractQueue implem } @Override - public boolean offer( - E e, long timeout, TimeUnit unit - ) throws InterruptedException + public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { checkNotNull(e); checkSize(e); diff --git a/server/src/main/java/org/apache/druid/client/selector/ConnectionCountServerSelectorStrategy.java b/server/src/main/java/org/apache/druid/client/selector/ConnectionCountServerSelectorStrategy.java index 8e12aa79801..fc401c424e3 100644 --- a/server/src/main/java/org/apache/druid/client/selector/ConnectionCountServerSelectorStrategy.java +++ b/server/src/main/java/org/apache/druid/client/selector/ConnectionCountServerSelectorStrategy.java @@ -30,23 +30,21 @@ import java.util.Set; public class ConnectionCountServerSelectorStrategy implements ServerSelectorStrategy { - private static final Comparator comparator = + private static final Comparator COMPARATOR = Comparator.comparingInt(s -> s.getClient().getNumOpenConnections()); @Override public QueryableDruidServer pick(Set servers, DataSegment segment) { - return Collections.min(servers, comparator); + return Collections.min(servers, COMPARATOR); } @Override - public List pick( - Set servers, DataSegment segment, int numServersToPick - ) + public List pick(Set servers, DataSegment segment, int numServersToPick) { if (servers.size() <= numServersToPick) { return ImmutableList.copyOf(servers); } - return Ordering.from(comparator).leastOf(servers, numServersToPick); + return Ordering.from(COMPARATOR).leastOf(servers, numServersToPick); } } diff --git a/server/src/main/java/org/apache/druid/client/selector/ServerSelector.java b/server/src/main/java/org/apache/druid/client/selector/ServerSelector.java index 5e0ce0cd212..de6b58be385 100644 --- a/server/src/main/java/org/apache/druid/client/selector/ServerSelector.java +++ b/server/src/main/java/org/apache/druid/client/selector/ServerSelector.java @@ -61,9 +61,7 @@ public class ServerSelector implements DiscoverySelector return segment.get(); } - public void addServerAndUpdateSegment( - QueryableDruidServer server, DataSegment segment - ) + public void addServerAndUpdateSegment(QueryableDruidServer server, DataSegment segment) { synchronized (this) { this.segment.set(segment); diff --git a/server/src/main/java/org/apache/druid/curator/CuratorModule.java b/server/src/main/java/org/apache/druid/curator/CuratorModule.java index 115a20eb0dc..84af44389e5 100644 --- a/server/src/main/java/org/apache/druid/curator/CuratorModule.java +++ b/server/src/main/java/org/apache/druid/curator/CuratorModule.java @@ -70,9 +70,7 @@ public class CuratorModule implements Module @Provides @LazySingleton - public CuratorFramework makeCurator( - CuratorConfig config, EnsembleProvider ensembleProvider, Lifecycle lifecycle - ) + public CuratorFramework makeCurator(CuratorConfig config, EnsembleProvider ensembleProvider, Lifecycle lifecycle) { final Builder builder = CuratorFrameworkFactory.builder(); if (!Strings.isNullOrEmpty(config.getZkUser()) && !Strings.isNullOrEmpty(config.getZkPwd())) { diff --git a/server/src/main/java/org/apache/druid/curator/discovery/DiscoveryModule.java b/server/src/main/java/org/apache/druid/curator/discovery/DiscoveryModule.java index fd93c480983..28bae791a79 100644 --- a/server/src/main/java/org/apache/druid/curator/discovery/DiscoveryModule.java +++ b/server/src/main/java/org/apache/druid/curator/discovery/DiscoveryModule.java @@ -161,20 +161,27 @@ public class DiscoveryModule implements Module .in(LazySingleton.class); // internal discovery bindings. + PolyBind.createChoiceWithDefault(binder, INTERNAL_DISCOVERY_PROP, Key.get(DruidNodeAnnouncer.class), CURATOR_KEY); + PolyBind.createChoiceWithDefault( - binder, INTERNAL_DISCOVERY_PROP, Key.get(DruidNodeAnnouncer.class), CURATOR_KEY + binder, + INTERNAL_DISCOVERY_PROP, + Key.get(DruidNodeDiscoveryProvider.class), + CURATOR_KEY ); PolyBind.createChoiceWithDefault( - binder, INTERNAL_DISCOVERY_PROP, Key.get(DruidNodeDiscoveryProvider.class), CURATOR_KEY + binder, + INTERNAL_DISCOVERY_PROP, + Key.get(DruidLeaderSelector.class, Coordinator.class), + CURATOR_KEY ); PolyBind.createChoiceWithDefault( - binder, INTERNAL_DISCOVERY_PROP, Key.get(DruidLeaderSelector.class, () -> Coordinator.class), CURATOR_KEY - ); - - PolyBind.createChoiceWithDefault( - binder, INTERNAL_DISCOVERY_PROP, Key.get(DruidLeaderSelector.class, () -> IndexingService.class), CURATOR_KEY + binder, + INTERNAL_DISCOVERY_PROP, + Key.get(DruidLeaderSelector.class, IndexingService.class), + CURATOR_KEY ); PolyBind.optionBinder(binder, Key.get(DruidNodeDiscoveryProvider.class)) @@ -196,8 +203,10 @@ public class DiscoveryModule implements Module PolyBind.optionBinder(binder, Key.get(DruidLeaderSelector.class, IndexingService.class)) .addBinding(CURATOR_KEY) - .toProvider(new DruidLeaderSelectorProvider( - (zkPathsConfig) -> ZKPaths.makePath(zkPathsConfig.getOverlordPath(), "_OVERLORD")) + .toProvider( + new DruidLeaderSelectorProvider( + (zkPathsConfig) -> ZKPaths.makePath(zkPathsConfig.getOverlordPath(), "_OVERLORD") + ) ) .in(LazySingleton.class); } diff --git a/server/src/main/java/org/apache/druid/guice/DruidBinders.java b/server/src/main/java/org/apache/druid/guice/DruidBinders.java index a447a571512..bcb54ed3f0b 100644 --- a/server/src/main/java/org/apache/druid/guice/DruidBinders.java +++ b/server/src/main/java/org/apache/druid/guice/DruidBinders.java @@ -36,14 +36,18 @@ public class DruidBinders public static MapBinder, QueryRunnerFactory> queryRunnerFactoryBinder(Binder binder) { return MapBinder.newMapBinder( - binder, new TypeLiteral>(){}, TypeLiteral.get(QueryRunnerFactory.class) + binder, + new TypeLiteral>(){}, + TypeLiteral.get(QueryRunnerFactory.class) ); } public static MapBinder, QueryToolChest> queryToolChestBinder(Binder binder) { return MapBinder.newMapBinder( - binder, new TypeLiteral>(){}, new TypeLiteral(){} + binder, + new TypeLiteral>(){}, + new TypeLiteral(){} ); } diff --git a/server/src/main/java/org/apache/druid/guice/LocalDataStorageDruidModule.java b/server/src/main/java/org/apache/druid/guice/LocalDataStorageDruidModule.java index db1ed09dd92..7086d296a7a 100644 --- a/server/src/main/java/org/apache/druid/guice/LocalDataStorageDruidModule.java +++ b/server/src/main/java/org/apache/druid/guice/LocalDataStorageDruidModule.java @@ -55,11 +55,17 @@ public class LocalDataStorageDruidModule implements DruidModule bindDeepStorageLocal(binder); PolyBind.createChoice( - binder, "druid.storage.type", Key.get(DataSegmentPusher.class), Key.get(LocalDataSegmentPusher.class) + binder, + "druid.storage.type", + Key.get(DataSegmentPusher.class), + Key.get(LocalDataSegmentPusher.class) ); PolyBind.createChoice( - binder, "druid.storage.type", Key.get(DataSegmentKiller.class), Key.get(LocalDataSegmentKiller.class) + binder, + "druid.storage.type", + Key.get(DataSegmentKiller.class), + Key.get(LocalDataSegmentKiller.class) ); PolyBind.createChoice(binder, "druid.storage.type", Key.get(DataSegmentFinder.class), null); diff --git a/server/src/main/java/org/apache/druid/guice/http/HttpClientModule.java b/server/src/main/java/org/apache/druid/guice/http/HttpClientModule.java index d81aa368b74..fd173f864b9 100644 --- a/server/src/main/java/org/apache/druid/guice/http/HttpClientModule.java +++ b/server/src/main/java/org/apache/druid/guice/http/HttpClientModule.java @@ -19,7 +19,7 @@ package org.apache.druid.guice.http; -import com.google.common.collect.Sets; +import com.google.common.collect.ImmutableSet; import com.google.inject.Binder; import com.google.inject.Inject; import com.google.inject.Module; @@ -51,9 +51,8 @@ public class HttpClientModule implements Module return new HttpClientModule("druid.global.http", EscalatedGlobal.class); } - private static Set> ESCALATING_ANNOTATIONS = Sets.newHashSet( - EscalatedGlobal.class, EscalatedClient.class - ); + private static final Set> ESCALATING_ANNOTATIONS = + ImmutableSet.of(EscalatedGlobal.class, EscalatedClient.class); private final String propertyPrefix; private Annotation annotation = null; diff --git a/server/src/main/java/org/apache/druid/metadata/DerbyMetadataStorageActionHandler.java b/server/src/main/java/org/apache/druid/metadata/DerbyMetadataStorageActionHandler.java index 3b24c3c7a1a..039a6427f02 100644 --- a/server/src/main/java/org/apache/druid/metadata/DerbyMetadataStorageActionHandler.java +++ b/server/src/main/java/org/apache/druid/metadata/DerbyMetadataStorageActionHandler.java @@ -48,7 +48,10 @@ public class DerbyMetadataStorageActionHandler> createCompletedTaskInfoQuery( - Handle handle, DateTime timestamp, @Nullable Integer maxNumStatuses, @Nullable String dataSource + Handle handle, + DateTime timestamp, + @Nullable Integer maxNumStatuses, + @Nullable String dataSource ) { String sql = StringUtils.format( diff --git a/server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java b/server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java index ccd23733513..3dd15e651d0 100644 --- a/server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java +++ b/server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java @@ -116,9 +116,7 @@ public class IndexerSQLMetadataStorageCoordinator implements IndexerMetadataStor } @Override - public List getUsedSegmentsForIntervals( - final String dataSource, final List intervals - ) + public List getUsedSegmentsForIntervals(final String dataSource, final List intervals) { return connector.retryWithHandle( new HandleCallback>() @@ -1012,9 +1010,8 @@ public class IndexerSQLMetadataStorageCoordinator implements IndexerMetadataStor } @Override - public boolean resetDataSourceMetadata( - final String dataSource, final DataSourceMetadata dataSourceMetadata - ) throws IOException + public boolean resetDataSourceMetadata(final String dataSource, final DataSourceMetadata dataSourceMetadata) + throws IOException { final byte[] newCommitMetadataBytes = jsonMapper.writeValueAsBytes(dataSourceMetadata); final String newCommitMetadataSha1 = BaseEncoding.base16().encode( diff --git a/server/src/main/java/org/apache/druid/metadata/MySQLMetadataStorageActionHandler.java b/server/src/main/java/org/apache/druid/metadata/MySQLMetadataStorageActionHandler.java index 67260ba2368..9765eae73af 100644 --- a/server/src/main/java/org/apache/druid/metadata/MySQLMetadataStorageActionHandler.java +++ b/server/src/main/java/org/apache/druid/metadata/MySQLMetadataStorageActionHandler.java @@ -46,7 +46,10 @@ public class MySQLMetadataStorageActionHandler> createCompletedTaskInfoQuery( - Handle handle, DateTime timestamp, @Nullable Integer maxNumStatuses, @Nullable String dataSource + Handle handle, + DateTime timestamp, + @Nullable Integer maxNumStatuses, + @Nullable String dataSource ) { String sql = StringUtils.format( diff --git a/server/src/main/java/org/apache/druid/metadata/MySQLMetadataStorageActionHandlerFactory.java b/server/src/main/java/org/apache/druid/metadata/MySQLMetadataStorageActionHandlerFactory.java index 81c27ace75e..0af63ba1d63 100644 --- a/server/src/main/java/org/apache/druid/metadata/MySQLMetadataStorageActionHandlerFactory.java +++ b/server/src/main/java/org/apache/druid/metadata/MySQLMetadataStorageActionHandlerFactory.java @@ -35,8 +35,10 @@ public class MySQLMetadataStorageActionHandlerFactory extends SQLMetadataStorage } @Override - public MetadataStorageActionHandler create( - String entryType, MetadataStorageActionHandlerTypes payloadTypes + public + MetadataStorageActionHandler create( + String entryType, + MetadataStorageActionHandlerTypes payloadTypes ) { return new MySQLMetadataStorageActionHandler<>( diff --git a/server/src/main/java/org/apache/druid/metadata/PostgreSQLMetadataStorageActionHandler.java b/server/src/main/java/org/apache/druid/metadata/PostgreSQLMetadataStorageActionHandler.java index 78455d512fb..2f902365e74 100644 --- a/server/src/main/java/org/apache/druid/metadata/PostgreSQLMetadataStorageActionHandler.java +++ b/server/src/main/java/org/apache/druid/metadata/PostgreSQLMetadataStorageActionHandler.java @@ -46,7 +46,10 @@ public class PostgreSQLMetadataStorageActionHandler> createCompletedTaskInfoQuery( - Handle handle, DateTime timestamp, @Nullable Integer maxNumStatuses, @Nullable String dataSource + Handle handle, + DateTime timestamp, + @Nullable Integer maxNumStatuses, + @Nullable String dataSource ) { String sql = StringUtils.format( diff --git a/server/src/main/java/org/apache/druid/metadata/PostgreSQLMetadataStorageActionHandlerFactory.java b/server/src/main/java/org/apache/druid/metadata/PostgreSQLMetadataStorageActionHandlerFactory.java index 247b8b157d6..329b7a52474 100644 --- a/server/src/main/java/org/apache/druid/metadata/PostgreSQLMetadataStorageActionHandlerFactory.java +++ b/server/src/main/java/org/apache/druid/metadata/PostgreSQLMetadataStorageActionHandlerFactory.java @@ -35,8 +35,10 @@ public class PostgreSQLMetadataStorageActionHandlerFactory extends SQLMetadataSt } @Override - public MetadataStorageActionHandler create( - String entryType, MetadataStorageActionHandlerTypes payloadTypes + public + MetadataStorageActionHandler create( + String entryType, + MetadataStorageActionHandlerTypes payloadTypes ) { return new PostgreSQLMetadataStorageActionHandler<>( diff --git a/server/src/main/java/org/apache/druid/metadata/SQLMetadataRuleManagerProvider.java b/server/src/main/java/org/apache/druid/metadata/SQLMetadataRuleManagerProvider.java index 940af6cfe86..318f6d70868 100644 --- a/server/src/main/java/org/apache/druid/metadata/SQLMetadataRuleManagerProvider.java +++ b/server/src/main/java/org/apache/druid/metadata/SQLMetadataRuleManagerProvider.java @@ -70,7 +70,10 @@ public class SQLMetadataRuleManagerProvider implements MetadataRuleManagerProvid { connector.createRulesTable(); SQLMetadataRuleManager.createDefaultRule( - dbi, dbTables.getRulesTable(), config.getDefaultRule(), jsonMapper + dbi, + dbTables.getRulesTable(), + config.getDefaultRule(), + jsonMapper ); } diff --git a/server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java b/server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java index acf149445be..25bd11bcacc 100644 --- a/server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java +++ b/server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java @@ -484,9 +484,7 @@ public class SQLMetadataSegmentManager implements MetadataSegmentManager return; } - final Collection segmentsFinal = Collections2.filter( - segments, Predicates.notNull() - ); + final Collection segmentsFinal = Collections2.filter(segments, Predicates.notNull()); log.info("Polled and found %,d segments in the database", segments.size()); diff --git a/server/src/main/java/org/apache/druid/metadata/SQLServerMetadataStorageActionHandler.java b/server/src/main/java/org/apache/druid/metadata/SQLServerMetadataStorageActionHandler.java index e52e6380da4..4845fc91643 100644 --- a/server/src/main/java/org/apache/druid/metadata/SQLServerMetadataStorageActionHandler.java +++ b/server/src/main/java/org/apache/druid/metadata/SQLServerMetadataStorageActionHandler.java @@ -46,7 +46,10 @@ public class SQLServerMetadataStorageActionHandler> createCompletedTaskInfoQuery( - Handle handle, DateTime timestamp, @Nullable Integer maxNumStatuses, @Nullable String dataSource + Handle handle, + DateTime timestamp, + @Nullable Integer maxNumStatuses, + @Nullable String dataSource ) { String sql = maxNumStatuses == null ? "SELECT " : "SELECT TOP (:n) "; diff --git a/server/src/main/java/org/apache/druid/metadata/SQLServerMetadataStorageActionHandlerFactory.java b/server/src/main/java/org/apache/druid/metadata/SQLServerMetadataStorageActionHandlerFactory.java index 1b9dacb0ef7..af672517534 100644 --- a/server/src/main/java/org/apache/druid/metadata/SQLServerMetadataStorageActionHandlerFactory.java +++ b/server/src/main/java/org/apache/druid/metadata/SQLServerMetadataStorageActionHandlerFactory.java @@ -35,8 +35,10 @@ public class SQLServerMetadataStorageActionHandlerFactory extends SQLMetadataSto } @Override - public MetadataStorageActionHandler create( - String entryType, MetadataStorageActionHandlerTypes payloadTypes + public + MetadataStorageActionHandler create( + String entryType, + MetadataStorageActionHandlerTypes payloadTypes ) { return new SQLServerMetadataStorageActionHandler<>( diff --git a/server/src/main/java/org/apache/druid/query/ResultLevelCachingQueryRunner.java b/server/src/main/java/org/apache/druid/query/ResultLevelCachingQueryRunner.java index 494df57f6b5..3efd9469dce 100644 --- a/server/src/main/java/org/apache/druid/query/ResultLevelCachingQueryRunner.java +++ b/server/src/main/java/org/apache/druid/query/ResultLevelCachingQueryRunner.java @@ -176,9 +176,7 @@ public class ResultLevelCachingQueryRunner implements QueryRunner return StringUtils.fromUtf8(Arrays.copyOfRange(cachedResult, Integer.BYTES, etagLength + Integer.BYTES)); } - private Sequence deserializeResults( - final byte[] cachedResult, CacheStrategy strategy, String resultSetId - ) + private Sequence deserializeResults(final byte[] cachedResult, CacheStrategy strategy, String resultSetId) { if (cachedResult == null) { log.error("Cached result set is null"); diff --git a/server/src/main/java/org/apache/druid/query/lookup/LookupModule.java b/server/src/main/java/org/apache/druid/query/lookup/LookupModule.java index 318abb9ab2d..9f14b0d4224 100644 --- a/server/src/main/java/org/apache/druid/query/lookup/LookupModule.java +++ b/server/src/main/java/org/apache/druid/query/lookup/LookupModule.java @@ -147,9 +147,7 @@ class LookupListeningResource extends ListenerResource }) { @Override - public Response handleUpdates( - InputStream inputStream, ObjectMapper mapper - ) + public Response handleUpdates(InputStream inputStream, ObjectMapper mapper) { final LookupsState state; try { diff --git a/server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java b/server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java index 6a6ca6cd5a4..da6ca4b5e98 100644 --- a/server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java +++ b/server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java @@ -283,10 +283,7 @@ public class LookupReferencesManager builder.addAll(oldState.pendingNotices); builder.add(notice); - return new LookupUpdateState( - oldState.lookupMap, builder.build(), oldState.noticesBeingHandled - - ); + return new LookupUpdateState(oldState.lookupMap, builder.build(), oldState.noticesBeingHandled); } ); LockSupport.unpark(mainThread); diff --git a/server/src/main/java/org/apache/druid/segment/realtime/appenderator/DefaultOfflineAppenderatorFactory.java b/server/src/main/java/org/apache/druid/segment/realtime/appenderator/DefaultOfflineAppenderatorFactory.java index 5464d3f0b29..be85e2c9d27 100644 --- a/server/src/main/java/org/apache/druid/segment/realtime/appenderator/DefaultOfflineAppenderatorFactory.java +++ b/server/src/main/java/org/apache/druid/segment/realtime/appenderator/DefaultOfflineAppenderatorFactory.java @@ -52,9 +52,7 @@ public class DefaultOfflineAppenderatorFactory implements AppenderatorFactory } @Override - public Appenderator build( - DataSchema schema, RealtimeTuningConfig config, FireDepartmentMetrics metrics - ) + public Appenderator build(DataSchema schema, RealtimeTuningConfig config, FireDepartmentMetrics metrics) { return Appenderators.createOffline(schema, config, metrics, dataSegmentPusher, objectMapper, indexIO, indexMerger); } diff --git a/server/src/main/java/org/apache/druid/segment/realtime/firehose/EventReceiverFirehoseFactory.java b/server/src/main/java/org/apache/druid/segment/realtime/firehose/EventReceiverFirehoseFactory.java index 14b7a19a8ea..f3b7b8035ad 100644 --- a/server/src/main/java/org/apache/druid/segment/realtime/firehose/EventReceiverFirehoseFactory.java +++ b/server/src/main/java/org/apache/druid/segment/realtime/firehose/EventReceiverFirehoseFactory.java @@ -245,7 +245,8 @@ public class EventReceiverFirehoseFactory implements FirehoseFactory> events = null; try { events = objectMapper.readValue( - countingInputStream, new TypeReference>>() + countingInputStream, + new TypeReference>>() { } ); diff --git a/server/src/main/java/org/apache/druid/segment/realtime/firehose/IngestSegmentFirehose.java b/server/src/main/java/org/apache/druid/segment/realtime/firehose/IngestSegmentFirehose.java index e39111c65be..7a39423f6fd 100644 --- a/server/src/main/java/org/apache/druid/segment/realtime/firehose/IngestSegmentFirehose.java +++ b/server/src/main/java/org/apache/druid/segment/realtime/firehose/IngestSegmentFirehose.java @@ -70,7 +70,8 @@ public class IngestSegmentFirehose implements Firehose Sequence rows = Sequences.concat( Iterables.transform( - adapters, new Function>() + adapters, + new Function>() { @Nullable @Override diff --git a/server/src/main/java/org/apache/druid/segment/realtime/plumber/CoordinatorBasedSegmentHandoffNotifier.java b/server/src/main/java/org/apache/druid/segment/realtime/plumber/CoordinatorBasedSegmentHandoffNotifier.java index c84bd9467ee..6d062151e83 100644 --- a/server/src/main/java/org/apache/druid/segment/realtime/plumber/CoordinatorBasedSegmentHandoffNotifier.java +++ b/server/src/main/java/org/apache/druid/segment/realtime/plumber/CoordinatorBasedSegmentHandoffNotifier.java @@ -60,9 +60,7 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot } @Override - public boolean registerSegmentHandoffCallback( - SegmentDescriptor descriptor, Executor exec, Runnable handOffRunnable - ) + public boolean registerSegmentHandoffCallback(SegmentDescriptor descriptor, Executor exec, Runnable handOffRunnable) { log.info("Adding SegmentHandoffCallback for dataSource[%s] Segment[%s]", dataSource, descriptor); Pair prev = handOffCallbacks.putIfAbsent( diff --git a/server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java b/server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java index e8dfd217c6d..507e8f22efc 100644 --- a/server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java +++ b/server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java @@ -335,9 +335,7 @@ public class RealtimePlumber implements Plumber try { for (Pair pair : indexesToPersist) { metrics.incrementRowOutputCount( - persistHydrant( - pair.lhs, schema, pair.rhs, metadataElems - ) + persistHydrant(pair.lhs, schema, pair.rhs, metadataElems) ); } committer.run(); diff --git a/server/src/main/java/org/apache/druid/server/AsyncManagementForwardingServlet.java b/server/src/main/java/org/apache/druid/server/AsyncManagementForwardingServlet.java index 3bd31c54a74..63d8472cd80 100644 --- a/server/src/main/java/org/apache/druid/server/AsyncManagementForwardingServlet.java +++ b/server/src/main/java/org/apache/druid/server/AsyncManagementForwardingServlet.java @@ -98,12 +98,14 @@ public class AsyncManagementForwardingServlet extends AsyncProxyServlet } else if (requestURI.startsWith(ARBITRARY_COORDINATOR_BASE_PATH)) { currentLeader = coordLeaderSelector.getCurrentLeader(); request.setAttribute( - MODIFIED_PATH_ATTRIBUTE, request.getRequestURI().substring(ARBITRARY_COORDINATOR_BASE_PATH.length()) + MODIFIED_PATH_ATTRIBUTE, + request.getRequestURI().substring(ARBITRARY_COORDINATOR_BASE_PATH.length()) ); } else if (requestURI.startsWith(ARBITRARY_OVERLORD_BASE_PATH)) { currentLeader = overlordLeaderSelector.getCurrentLeader(); request.setAttribute( - MODIFIED_PATH_ATTRIBUTE, request.getRequestURI().substring(ARBITRARY_OVERLORD_BASE_PATH.length()) + MODIFIED_PATH_ATTRIBUTE, + request.getRequestURI().substring(ARBITRARY_OVERLORD_BASE_PATH.length()) ); } else { handleBadRequest(response, StringUtils.format("Unsupported proxy destination [%s]", request.getRequestURI())); @@ -126,7 +128,9 @@ public class AsyncManagementForwardingServlet extends AsyncProxyServlet @Override protected void sendProxyRequest( - HttpServletRequest clientRequest, HttpServletResponse proxyResponse, Request proxyRequest + HttpServletRequest clientRequest, + HttpServletResponse proxyResponse, + Request proxyRequest ) { proxyRequest.timeout(httpClientConfig.getReadTimeout().getMillis(), TimeUnit.MILLISECONDS); diff --git a/server/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java b/server/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java index 8546d845894..4835b7faad6 100644 --- a/server/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java +++ b/server/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java @@ -345,9 +345,7 @@ public class AsyncQueryForwardingServlet extends AsyncProxyServlet implements Qu } @Override - protected Response.Listener newProxyResponseListener( - HttpServletRequest request, HttpServletResponse response - ) + protected Response.Listener newProxyResponseListener(HttpServletRequest request, HttpServletResponse response) { final Query query = (Query) request.getAttribute(QUERY_ATTRIBUTE); if (query != null) { diff --git a/server/src/main/java/org/apache/druid/server/coordination/BatchDataSegmentAnnouncer.java b/server/src/main/java/org/apache/druid/server/coordination/BatchDataSegmentAnnouncer.java index ffbf75f963b..e8c50642cc5 100644 --- a/server/src/main/java/org/apache/druid/server/coordination/BatchDataSegmentAnnouncer.java +++ b/server/src/main/java/org/apache/druid/server/coordination/BatchDataSegmentAnnouncer.java @@ -357,7 +357,8 @@ public class BatchDataSegmentAnnouncer implements DataSegmentAnnouncer } try { return jsonMapper.readValue( - bytes, new TypeReference>() + bytes, + new TypeReference>() { } ); diff --git a/server/src/main/java/org/apache/druid/server/coordination/SegmentLoadDropHandler.java b/server/src/main/java/org/apache/druid/server/coordination/SegmentLoadDropHandler.java index a740652a993..d7499ccca67 100644 --- a/server/src/main/java/org/apache/druid/server/coordination/SegmentLoadDropHandler.java +++ b/server/src/main/java/org/apache/druid/server/coordination/SegmentLoadDropHandler.java @@ -274,7 +274,9 @@ public class SegmentLoadDropHandler implements DataSegmentChangeHandler catch (IOException e) { removeSegment(segment, callback, false); throw new SegmentLoadingException( - e, "Failed to write to disk segment info cache file[%s]", segmentInfoCacheFile + e, + "Failed to write to disk segment info cache file[%s]", + segmentInfoCacheFile ); } } diff --git a/server/src/main/java/org/apache/druid/server/coordinator/CoordinatorStats.java b/server/src/main/java/org/apache/druid/server/coordinator/CoordinatorStats.java index 98842c319ab..3cc9b1c9ba9 100644 --- a/server/src/main/java/org/apache/druid/server/coordinator/CoordinatorStats.java +++ b/server/src/main/java/org/apache/druid/server/coordinator/CoordinatorStats.java @@ -137,7 +137,8 @@ public class CoordinatorStats (final String statName, final Object2LongOpenHashMap urStat) -> { final Object2LongOpenHashMap myStat = perTierStats.computeIfAbsent( - statName, ignored -> new Object2LongOpenHashMap<>() + statName, + name -> new Object2LongOpenHashMap<>() ); for (final Object2LongMap.Entry entry : urStat.object2LongEntrySet()) { diff --git a/server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java b/server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java index 7ce949e37b2..c7e31a1a70f 100644 --- a/server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java +++ b/server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java @@ -186,9 +186,7 @@ public class CostBalancerStrategy implements BalancerStrategy } @Override - public ServerHolder findNewSegmentHomeReplicator( - DataSegment proposalSegment, List serverHolders - ) + public ServerHolder findNewSegmentHomeReplicator(DataSegment proposalSegment, List serverHolders) { ServerHolder holder = chooseBestServer(proposalSegment, serverHolders, false).rhs; if (holder != null && !holder.isServingSegment(proposalSegment)) { @@ -199,9 +197,7 @@ public class CostBalancerStrategy implements BalancerStrategy @Override - public ServerHolder findNewSegmentHomeBalancer( - DataSegment proposalSegment, List serverHolders - ) + public ServerHolder findNewSegmentHomeBalancer(DataSegment proposalSegment, List serverHolders) { return chooseBestServer(proposalSegment, serverHolders, true).rhs; } @@ -317,7 +313,9 @@ public class CostBalancerStrategy implements BalancerStrategy } protected double computeCost( - final DataSegment proposalSegment, final ServerHolder server, final boolean includeCurrentServer + final DataSegment proposalSegment, + final ServerHolder server, + final boolean includeCurrentServer ) { final long proposalSegmentSize = proposalSegment.getSize(); diff --git a/server/src/main/java/org/apache/druid/server/coordinator/DiskNormalizedCostBalancerStrategy.java b/server/src/main/java/org/apache/druid/server/coordinator/DiskNormalizedCostBalancerStrategy.java index 1447bf5c121..2e065be24a1 100644 --- a/server/src/main/java/org/apache/druid/server/coordinator/DiskNormalizedCostBalancerStrategy.java +++ b/server/src/main/java/org/apache/druid/server/coordinator/DiskNormalizedCostBalancerStrategy.java @@ -35,7 +35,9 @@ public class DiskNormalizedCostBalancerStrategy extends CostBalancerStrategy */ @Override protected double computeCost( - final DataSegment proposalSegment, final ServerHolder server, final boolean includeCurrentServer + final DataSegment proposalSegment, + final ServerHolder server, + final boolean includeCurrentServer ) { double cost = super.computeCost(proposalSegment, server, includeCurrentServer); diff --git a/server/src/main/java/org/apache/druid/server/coordinator/HttpLoadQueuePeon.java b/server/src/main/java/org/apache/druid/server/coordinator/HttpLoadQueuePeon.java index 4b4498019da..a095a346830 100644 --- a/server/src/main/java/org/apache/druid/server/coordinator/HttpLoadQueuePeon.java +++ b/server/src/main/java/org/apache/druid/server/coordinator/HttpLoadQueuePeon.java @@ -207,9 +207,8 @@ public class HttpLoadQueuePeon extends LoadQueuePeon log.debug("Received NO CONTENT reseponse from [%s]", serverId); } else if (HttpServletResponse.SC_OK == responseHandler.getStatus()) { try { - List statuses = jsonMapper.readValue( - result, RESPONSE_ENTITY_TYPE_REF - ); + List statuses = + jsonMapper.readValue(result, RESPONSE_ENTITY_TYPE_REF); log.debug("Server[%s] returned status response [%s].", serverId, statuses); synchronized (lock) { if (stopped) { diff --git a/server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorCleanupUnneeded.java b/server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorCleanupUnneeded.java index f7604835a25..853df3909d4 100644 --- a/server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorCleanupUnneeded.java +++ b/server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorCleanupUnneeded.java @@ -72,10 +72,7 @@ public class DruidCoordinatorCleanupUnneeded implements DruidCoordinatorHelper LoadQueuePeon queuePeon = params.getLoadManagementPeons().get(server.getName()); if (!queuePeon.getSegmentsToDrop().contains(segment)) { - queuePeon.dropSegment( - segment, () -> { - } - ); + queuePeon.dropSegment(segment, () -> {}); stats.addToTieredStat("unneededCount", server.getTier(), 1); log.info( "Dropping uneeded segment [%s] from server [%s] in tier [%s]", diff --git a/server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorLogger.java b/server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorLogger.java index d2af99ccb41..340ea93b9ea 100644 --- a/server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorLogger.java +++ b/server/src/main/java/org/apache/druid/server/coordinator/helper/DruidCoordinatorLogger.java @@ -111,25 +111,13 @@ public class DruidCoordinatorLogger implements DruidCoordinatorHelper } ); - emitTieredStats( - emitter, "segment/cost/raw", - stats, "initialCost" - ); + emitTieredStats(emitter, "segment/cost/raw", stats, "initialCost"); - emitTieredStats( - emitter, "segment/cost/normalization", - stats, "normalization" - ); + emitTieredStats(emitter, "segment/cost/normalization", stats, "normalization"); - emitTieredStats( - emitter, "segment/moved/count", - stats, "movedCount" - ); + emitTieredStats(emitter, "segment/moved/count", stats, "movedCount"); - emitTieredStats( - emitter, "segment/deleted/count", - stats, "deletedCount" - ); + emitTieredStats(emitter, "segment/deleted/count", stats, "deletedCount"); stats.forEachTieredStat( "normalizedInitialCostTimesOneThousand", diff --git a/server/src/main/java/org/apache/druid/server/coordinator/rules/BroadcastDistributionRule.java b/server/src/main/java/org/apache/druid/server/coordinator/rules/BroadcastDistributionRule.java index 99f7089a060..0e3936428ed 100644 --- a/server/src/main/java/org/apache/druid/server/coordinator/rules/BroadcastDistributionRule.java +++ b/server/src/main/java/org/apache/druid/server/coordinator/rules/BroadcastDistributionRule.java @@ -35,9 +35,7 @@ public abstract class BroadcastDistributionRule implements Rule private static final EmittingLogger log = new EmittingLogger(BroadcastDistributionRule.class); @Override - public CoordinatorStats run( - DruidCoordinator coordinator, DruidCoordinatorRuntimeParams params, DataSegment segment - ) + public CoordinatorStats run(DruidCoordinator coordinator, DruidCoordinatorRuntimeParams params, DataSegment segment) { // Find servers which holds the segments of co-located data source final Set loadServerHolders = new HashSet<>(); diff --git a/server/src/main/java/org/apache/druid/server/http/MetadataResource.java b/server/src/main/java/org/apache/druid/server/http/MetadataResource.java index d4db1186710..043e1b39709 100644 --- a/server/src/main/java/org/apache/druid/server/http/MetadataResource.java +++ b/server/src/main/java/org/apache/druid/server/http/MetadataResource.java @@ -158,8 +158,8 @@ public class MetadataResource Function> raGenerator = segment -> Collections.singletonList( AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(segment.getDataSource())); - final Iterable authorizedSegments = AuthorizationUtils.filterAuthorizedResources( - req, metadataSegments::iterator, raGenerator, authorizerMapper); + final Iterable authorizedSegments = + AuthorizationUtils.filterAuthorizedResources(req, metadataSegments::iterator, raGenerator, authorizerMapper); final StreamingOutput stream = outputStream -> { final JsonFactory jsonFactory = jsonMapper.getFactory(); diff --git a/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java b/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java index 78b17446912..bb0cb5147ea 100644 --- a/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java +++ b/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java @@ -448,9 +448,7 @@ public class JettyServerModule extends JerseyServletModule @Provides @Singleton - public JettyMonitor getJettyMonitor( - DataSourceTaskIdHolder dataSourceTaskIdHolder - ) + public JettyMonitor getJettyMonitor(DataSourceTaskIdHolder dataSourceTaskIdHolder) { return new JettyMonitor(dataSourceTaskIdHolder.getDataSource(), dataSourceTaskIdHolder.getTaskId()); } @@ -468,9 +466,7 @@ public class JettyServerModule extends JerseyServletModule public boolean doMonitor(ServiceEmitter emitter) { final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder(); - MonitorUtils.addDimensionsToBuilder( - builder, dimensions - ); + MonitorUtils.addDimensionsToBuilder(builder, dimensions); emitter.emit(builder.build("jetty/numOpenConnections", activeConnections.get())); return true; } diff --git a/server/src/main/java/org/apache/druid/server/lookup/cache/LookupCoordinatorManager.java b/server/src/main/java/org/apache/druid/server/lookup/cache/LookupCoordinatorManager.java index 09a0a0969e8..0f90c83935c 100644 --- a/server/src/main/java/org/apache/druid/server/lookup/cache/LookupCoordinatorManager.java +++ b/server/src/main/java/org/apache/druid/server/lookup/cache/LookupCoordinatorManager.java @@ -386,7 +386,8 @@ public class LookupCoordinatorManager TimeUnit.MILLISECONDS ); Futures.addCallback( - backgroundManagerFuture, new FutureCallback() + backgroundManagerFuture, + new FutureCallback() { @Override public void onSuccess(@Nullable Object result) diff --git a/server/src/main/java/org/apache/druid/server/router/JavaScriptTieredBrokerSelectorStrategy.java b/server/src/main/java/org/apache/druid/server/router/JavaScriptTieredBrokerSelectorStrategy.java index 35f62560661..347fcf0c1c8 100644 --- a/server/src/main/java/org/apache/druid/server/router/JavaScriptTieredBrokerSelectorStrategy.java +++ b/server/src/main/java/org/apache/druid/server/router/JavaScriptTieredBrokerSelectorStrategy.java @@ -70,9 +70,7 @@ public class JavaScriptTieredBrokerSelectorStrategy implements TieredBrokerSelec } @Override - public Optional getBrokerServiceName( - TieredBrokerConfig config, Query query - ) + public Optional getBrokerServiceName(TieredBrokerConfig config, Query query) { fnSelector = fnSelector == null ? compileSelectorFunction() : fnSelector; return Optional.fromNullable(fnSelector.apply(config, query)); diff --git a/server/src/main/java/org/apache/druid/server/security/AllowAllAuthenticator.java b/server/src/main/java/org/apache/druid/server/security/AllowAllAuthenticator.java index 6767a79e66b..3898621502d 100644 --- a/server/src/main/java/org/apache/druid/server/security/AllowAllAuthenticator.java +++ b/server/src/main/java/org/apache/druid/server/security/AllowAllAuthenticator.java @@ -77,9 +77,8 @@ public class AllowAllAuthenticator implements Authenticator } @Override - public void doFilter( - ServletRequest request, ServletResponse response, FilterChain chain - ) throws IOException, ServletException + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { request.setAttribute(AuthConfig.DRUID_AUTHENTICATION_RESULT, ALLOW_ALL_RESULT); chain.doFilter(request, response); diff --git a/server/src/main/java/org/apache/druid/server/security/AllowOptionsResourceFilter.java b/server/src/main/java/org/apache/druid/server/security/AllowOptionsResourceFilter.java index 200df990c4d..c47b220942b 100644 --- a/server/src/main/java/org/apache/druid/server/security/AllowOptionsResourceFilter.java +++ b/server/src/main/java/org/apache/druid/server/security/AllowOptionsResourceFilter.java @@ -48,9 +48,8 @@ public class AllowOptionsResourceFilter implements Filter } @Override - public void doFilter( - ServletRequest request, ServletResponse response, FilterChain chain - ) throws IOException, ServletException + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { HttpServletRequest httpReq = (HttpServletRequest) request; diff --git a/server/src/main/java/org/apache/druid/server/security/AnonymousAuthenticator.java b/server/src/main/java/org/apache/druid/server/security/AnonymousAuthenticator.java index 893528dab53..7cfe76c5204 100644 --- a/server/src/main/java/org/apache/druid/server/security/AnonymousAuthenticator.java +++ b/server/src/main/java/org/apache/druid/server/security/AnonymousAuthenticator.java @@ -94,9 +94,8 @@ public class AnonymousAuthenticator implements Authenticator } @Override - public void doFilter( - ServletRequest request, ServletResponse response, FilterChain chain - ) throws IOException, ServletException + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { request.setAttribute(AuthConfig.DRUID_AUTHENTICATION_RESULT, anonymousResult); chain.doFilter(request, response); diff --git a/server/src/main/java/org/apache/druid/server/security/AuthenticationWrappingFilter.java b/server/src/main/java/org/apache/druid/server/security/AuthenticationWrappingFilter.java index 8ed55dee461..c796056ecd1 100644 --- a/server/src/main/java/org/apache/druid/server/security/AuthenticationWrappingFilter.java +++ b/server/src/main/java/org/apache/druid/server/security/AuthenticationWrappingFilter.java @@ -49,9 +49,8 @@ public class AuthenticationWrappingFilter implements Filter } @Override - public void doFilter( - ServletRequest request, ServletResponse response, FilterChain chain - ) throws IOException, ServletException + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { // If there's already an auth result, then we have authenticated already, skip this. if (request.getAttribute(AuthConfig.DRUID_AUTHENTICATION_RESULT) != null) { diff --git a/server/src/main/java/org/apache/druid/server/security/PreResponseAuthorizationCheckFilter.java b/server/src/main/java/org/apache/druid/server/security/PreResponseAuthorizationCheckFilter.java index deedcc3dc21..415ac811d20 100644 --- a/server/src/main/java/org/apache/druid/server/security/PreResponseAuthorizationCheckFilter.java +++ b/server/src/main/java/org/apache/druid/server/security/PreResponseAuthorizationCheckFilter.java @@ -69,9 +69,8 @@ public class PreResponseAuthorizationCheckFilter implements Filter } @Override - public void doFilter( - ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain - ) throws IOException, ServletException + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) + throws IOException, ServletException { final HttpServletResponse response = (HttpServletResponse) servletResponse; final HttpServletRequest request = (HttpServletRequest) servletRequest; diff --git a/server/src/main/java/org/apache/druid/server/security/SecuritySanityCheckFilter.java b/server/src/main/java/org/apache/druid/server/security/SecuritySanityCheckFilter.java index 2021ef3c135..be71e4631c1 100644 --- a/server/src/main/java/org/apache/druid/server/security/SecuritySanityCheckFilter.java +++ b/server/src/main/java/org/apache/druid/server/security/SecuritySanityCheckFilter.java @@ -67,9 +67,8 @@ public class SecuritySanityCheckFilter implements Filter } @Override - public void doFilter( - ServletRequest request, ServletResponse response, FilterChain chain - ) throws IOException, ServletException + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { HttpServletResponse httpResponse = (HttpServletResponse) response; OutputStream out = httpResponse.getOutputStream(); diff --git a/server/src/main/java/org/apache/druid/server/security/UnsecuredResourceFilter.java b/server/src/main/java/org/apache/druid/server/security/UnsecuredResourceFilter.java index cb696ad45bb..6f797711df1 100644 --- a/server/src/main/java/org/apache/druid/server/security/UnsecuredResourceFilter.java +++ b/server/src/main/java/org/apache/druid/server/security/UnsecuredResourceFilter.java @@ -40,9 +40,8 @@ public class UnsecuredResourceFilter implements Filter } @Override - public void doFilter( - ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain - ) throws IOException, ServletException + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) + throws IOException, ServletException { // PreResponseAuthorizationCheckFilter checks that this attribute is set, // but the value doesn't matter since we skip authorization checks for requests that go through this filter diff --git a/server/src/test/java/org/apache/druid/client/BrokerServerViewTest.java b/server/src/test/java/org/apache/druid/client/BrokerServerViewTest.java index b8ed6bf466e..b630b8ec6c3 100644 --- a/server/src/test/java/org/apache/druid/client/BrokerServerViewTest.java +++ b/server/src/test/java/org/apache/druid/client/BrokerServerViewTest.java @@ -302,7 +302,8 @@ public class BrokerServerViewTest extends CuratorTestBase public void registerSegmentCallback(Executor exec, final SegmentCallback callback) { super.registerSegmentCallback( - exec, new SegmentCallback() + exec, + new SegmentCallback() { @Override public CallbackAction segmentAdded(DruidServerMetadata server, DataSegment segment) diff --git a/server/src/test/java/org/apache/druid/client/CachingClusteredClientFunctionalityTest.java b/server/src/test/java/org/apache/druid/client/CachingClusteredClientFunctionalityTest.java index 9cec0227aac..47407215af0 100644 --- a/server/src/test/java/org/apache/druid/client/CachingClusteredClientFunctionalityTest.java +++ b/server/src/test/java/org/apache/druid/client/CachingClusteredClientFunctionalityTest.java @@ -198,7 +198,8 @@ public class CachingClusteredClientFunctionalityTest @Override public QueryableDruidServer pick( - Int2ObjectRBTreeMap> prioritizedServers, DataSegment segment + Int2ObjectRBTreeMap> prioritizedServers, + DataSegment segment ) { return new QueryableDruidServer( diff --git a/server/src/test/java/org/apache/druid/client/CachingClusteredClientTest.java b/server/src/test/java/org/apache/druid/client/CachingClusteredClientTest.java index 573c5c92465..1f9b4fc2051 100644 --- a/server/src/test/java/org/apache/druid/client/CachingClusteredClientTest.java +++ b/server/src/test/java/org/apache/druid/client/CachingClusteredClientTest.java @@ -356,7 +356,8 @@ public class CachingClusteredClientTest delegate.submit((Callable) pair.rhs) : delegate.submit((Runnable) pair.rhs); Futures.addCallback( - future, new FutureCallback() + future, + new FutureCallback() { @Override public void onSuccess(@Nullable Object result) @@ -1288,7 +1289,10 @@ public class CachingClusteredClientTest makeSelectResults(dimensions, metrics, DateTimes.of("2011-01-02"), ImmutableMap.of("a", "c", "rows", 5)), Intervals.of("2011-01-05/2011-01-10"), - makeSelectResults(dimensions, metrics, DateTimes.of("2011-01-05"), + makeSelectResults( + dimensions, + metrics, + DateTimes.of("2011-01-05"), DateTimes.of("2011-01-06"), DateTimes.of("2011-01-07"), ImmutableMap.of("a", "f", "rows", 7), ImmutableMap.of("a", "ff"), DateTimes.of("2011-01-08"), ImmutableMap.of("a", "g", "rows", 8), @@ -1296,7 +1300,10 @@ public class CachingClusteredClientTest ), Intervals.of("2011-01-05/2011-01-10"), - makeSelectResults(dimensions, metrics, DateTimes.of("2011-01-05T01"), ImmutableMap.of("a", "d", "rows", 5), + makeSelectResults( + dimensions, + metrics, + DateTimes.of("2011-01-05T01"), ImmutableMap.of("a", "d", "rows", 5), DateTimes.of("2011-01-06T01"), ImmutableMap.of("a", "e", "rows", 6), DateTimes.of("2011-01-07T01"), ImmutableMap.of("a", "f", "rows", 7), DateTimes.of("2011-01-08T01"), ImmutableMap.of("a", "g", "rows", 8), @@ -1314,7 +1321,10 @@ public class CachingClusteredClientTest ); HashMap context = new HashMap(); TestHelper.assertExpectedResults( - makeSelectResults(dimensions, metrics, DateTimes.of("2011-01-01"), ImmutableMap.of("a", "b", "rows", 1), + makeSelectResults( + dimensions, + metrics, + DateTimes.of("2011-01-01"), ImmutableMap.of("a", "b", "rows", 1), DateTimes.of("2011-01-02"), ImmutableMap.of("a", "c", "rows", 5), DateTimes.of("2011-01-05"), DateTimes.of("2011-01-05T01"), ImmutableMap.of("a", "d", "rows", 5), @@ -1358,7 +1368,8 @@ public class CachingClusteredClientTest Intervals.of("2011-01-05/2011-01-10"), makeSelectResults( - dimensions, metrics, + dimensions, + metrics, DateTimes.of("2011-01-05"), ImmutableMap.of("a", "d", "rows", 5), DateTimes.of("2011-01-06"), ImmutableMap.of("a", "e", "rows", 6), DateTimes.of("2011-01-07"), ImmutableMap.of("a", "f", "rows", 7), @@ -1368,7 +1379,8 @@ public class CachingClusteredClientTest Intervals.of("2011-01-05/2011-01-10"), makeSelectResults( - dimensions, metrics, + dimensions, + metrics, DateTimes.of("2011-01-05T01"), ImmutableMap.of("a", "d", "rows", 5), DateTimes.of("2011-01-06T01"), ImmutableMap.of("a", "e", "rows", 6), DateTimes.of("2011-01-07T01"), ImmutableMap.of("a", "f", "rows", 7), @@ -1388,7 +1400,8 @@ public class CachingClusteredClientTest HashMap context = new HashMap(); TestHelper.assertExpectedResults( makeSelectResults( - dimensions, metrics, + dimensions, + metrics, DateTimes.of("2011-01-01"), ImmutableMap.of("a", "b", "rows", 1), DateTimes.of("2011-01-02"), ImmutableMap.of("a", "c", "rows", 5), DateTimes.of("2011-01-05"), ImmutableMap.of("a", "d", "rows", 5), @@ -1411,7 +1424,8 @@ public class CachingClusteredClientTest .build(); TestHelper.assertExpectedResults( makeSelectResults( - dimensions, metrics, + dimensions, + metrics, DateTimes.of("2011-01-01"), ImmutableMap.of("a2", "b", "rows", 1), DateTimes.of("2011-01-02"), ImmutableMap.of("a2", "c", "rows", 5), DateTimes.of("2011-01-05"), ImmutableMap.of("a2", "d", "rows", 5), @@ -1740,7 +1754,12 @@ public class CachingClusteredClientTest } private ServerSelector makeMockSingleDimensionSelector( - DruidServer server, String dimension, String start, String end, int partitionNum) + DruidServer server, + String dimension, + String start, + String end, + int partitionNum + ) { DataSegment segment = EasyMock.createNiceMock(DataSegment.class); EasyMock.expect(segment.getIdentifier()).andReturn(DATA_SOURCE).anyTimes(); @@ -2255,7 +2274,9 @@ public class CachingClusteredClientTest } private Sequence> toQueryableTopNResults( - Iterable segmentIds, Iterable intervals, Iterable>> results + Iterable segmentIds, + Iterable intervals, + Iterable>> results ) { return Sequences.simple( @@ -2289,7 +2310,9 @@ public class CachingClusteredClientTest } private Sequence> toQueryableSearchResults( - Iterable segmentIds, Iterable intervals, Iterable>> results + Iterable segmentIds, + Iterable intervals, + Iterable>> results ) { return Sequences.simple( @@ -2323,7 +2346,9 @@ public class CachingClusteredClientTest } private Sequence> toQueryableSelectResults( - Iterable segmentIds, Iterable intervals, Iterable>> results + Iterable segmentIds, + Iterable intervals, + Iterable>> results ) { return Sequences.simple( @@ -2357,7 +2382,9 @@ public class CachingClusteredClientTest } private Sequence toQueryableGroupByResults( - Iterable segmentIds, Iterable intervals, Iterable> results + Iterable segmentIds, + Iterable intervals, + Iterable> results ) { return Sequences.simple( @@ -2563,7 +2590,11 @@ public class CachingClusteredClientTest return retVal; } - private Iterable> makeSelectResults(Set dimensions, Set metrics, Object... objects) + private Iterable> makeSelectResults( + Set dimensions, + Set metrics, + Object... objects + ) { List> retVal = Lists.newArrayList(); int index = 0; @@ -2576,11 +2607,11 @@ public class CachingClusteredClientTest values.add(new EventHolder(null, 0, (Map) objects[index++])); } - retVal.add(new Result<>( + Result result = new Result<>( timestamp, - new SelectResultValue(ImmutableMap.of(timestamp.toString(), 0), - dimensions, metrics, values) - )); + new SelectResultValue(ImmutableMap.of(timestamp.toString(), 0), dimensions, metrics, values) + ); + retVal.add(result); } return retVal; } diff --git a/server/src/test/java/org/apache/druid/client/CoordinatorServerViewTest.java b/server/src/test/java/org/apache/druid/client/CoordinatorServerViewTest.java index 9d054f375b9..619baf4b8aa 100644 --- a/server/src/test/java/org/apache/druid/client/CoordinatorServerViewTest.java +++ b/server/src/test/java/org/apache/druid/client/CoordinatorServerViewTest.java @@ -298,7 +298,8 @@ public class CoordinatorServerViewTest extends CuratorTestBase public void registerSegmentCallback(Executor exec, final SegmentCallback callback) { super.registerSegmentCallback( - exec, new SegmentCallback() + exec, + new SegmentCallback() { @Override public CallbackAction segmentAdded(DruidServerMetadata server, DataSegment segment) diff --git a/server/src/test/java/org/apache/druid/client/HttpServerInventoryViewTest.java b/server/src/test/java/org/apache/druid/client/HttpServerInventoryViewTest.java index 683d52c8522..01097e61754 100644 --- a/server/src/test/java/org/apache/druid/client/HttpServerInventoryViewTest.java +++ b/server/src/test/java/org/apache/druid/client/HttpServerInventoryViewTest.java @@ -201,18 +201,14 @@ public class HttpServerInventoryViewTest new ServerView.SegmentCallback() { @Override - public ServerView.CallbackAction segmentAdded( - DruidServerMetadata server, DataSegment segment - ) + public ServerView.CallbackAction segmentAdded(DruidServerMetadata server, DataSegment segment) { segmentAddLathces.get(segment.getIdentifier()).countDown(); return ServerView.CallbackAction.CONTINUE; } @Override - public ServerView.CallbackAction segmentRemoved( - DruidServerMetadata server, DataSegment segment - ) + public ServerView.CallbackAction segmentRemoved(DruidServerMetadata server, DataSegment segment) { segmentDropLatches.get(segment.getIdentifier()).countDown(); return ServerView.CallbackAction.CONTINUE; @@ -302,7 +298,8 @@ public class HttpServerInventoryViewTest @Override public ListenableFuture go( - Request request, HttpResponseHandler httpResponseHandler + Request request, + HttpResponseHandler httpResponseHandler ) { throw new UnsupportedOperationException("Not Implemented."); @@ -310,7 +307,9 @@ public class HttpServerInventoryViewTest @Override public ListenableFuture go( - Request request, HttpResponseHandler httpResponseHandler, Duration duration + Request request, + HttpResponseHandler httpResponseHandler, + Duration duration ) { if (requestNum.getAndIncrement() == 0) { diff --git a/server/src/test/java/org/apache/druid/client/cache/CacheDistributionTest.java b/server/src/test/java/org/apache/druid/client/cache/CacheDistributionTest.java index ab908055c2c..79de6ac6e68 100644 --- a/server/src/test/java/org/apache/druid/client/cache/CacheDistributionTest.java +++ b/server/src/test/java/org/apache/druid/client/cache/CacheDistributionTest.java @@ -19,7 +19,6 @@ package org.apache.druid.client.cache; -import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; @@ -37,7 +36,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import javax.annotation.Nullable; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.util.Arrays; @@ -56,7 +54,9 @@ public class CacheDistributionTest public static Iterable data() { List hash = ImmutableList.of( - DefaultHashAlgorithm.FNV1A_64_HASH, DefaultHashAlgorithm.KETAMA_HASH, MemcachedCache.MURMUR3_128 + DefaultHashAlgorithm.FNV1A_64_HASH, + DefaultHashAlgorithm.KETAMA_HASH, + MemcachedCache.MURMUR3_128 ); List repetitions = Arrays.asList(160, 500, 1000, 2500, 5000); @@ -64,17 +64,7 @@ public class CacheDistributionTest Sets.newLinkedHashSet(hash), Sets.newLinkedHashSet(repetitions) ); - return Iterables.transform( - values, new Function, Object[]>() - { - @Nullable - @Override - public Object[] apply(List input) - { - return input.toArray(); - } - } - ); + return Iterables.transform(values, List::toArray); } final HashAlgorithm hash; diff --git a/server/src/test/java/org/apache/druid/client/cache/CacheMonitorTest.java b/server/src/test/java/org/apache/druid/client/cache/CacheMonitorTest.java index 2eee29cba36..6330244bd4b 100644 --- a/server/src/test/java/org/apache/druid/client/cache/CacheMonitorTest.java +++ b/server/src/test/java/org/apache/druid/client/cache/CacheMonitorTest.java @@ -43,7 +43,9 @@ public class CacheMonitorTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test-inject", null, false, null, null, true, false) ); } } @@ -62,7 +64,9 @@ public class CacheMonitorTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test-inject", null, false, null, null, true, false) ); binder.bind(Cache.class).toInstance(MapCache.create(0)); } diff --git a/server/src/test/java/org/apache/druid/client/cache/MemcachedCacheTest.java b/server/src/test/java/org/apache/druid/client/cache/MemcachedCacheTest.java index 31840d0ca61..ac13395c11d 100644 --- a/server/src/test/java/org/apache/druid/client/cache/MemcachedCacheTest.java +++ b/server/src/test/java/org/apache/druid/client/cache/MemcachedCacheTest.java @@ -353,9 +353,7 @@ class MockMemcachedClient implements MemcachedClientIF } @Override - public Future append( - String s, T t, Transcoder tTranscoder - ) + public Future append(String s, T t, Transcoder tTranscoder) { return null; } @@ -379,9 +377,7 @@ class MockMemcachedClient implements MemcachedClientIF } @Override - public Future prepend( - String s, T t, Transcoder tTranscoder - ) + public Future prepend(String s, T t, Transcoder tTranscoder) { return null; } @@ -399,17 +395,13 @@ class MockMemcachedClient implements MemcachedClientIF } @Override - public Future asyncCAS( - String s, long l, int i, Object o - ) + public Future asyncCAS(String s, long l, int i, Object o) { return null; } @Override - public OperationFuture asyncCAS( - String s, long l, int i, T t, Transcoder tTranscoder - ) + public OperationFuture asyncCAS(String s, long l, int i, T t, Transcoder tTranscoder) { return null; } @@ -433,9 +425,7 @@ class MockMemcachedClient implements MemcachedClientIF } @Override - public CASResponse cas( - String s, long l, T t, Transcoder tTranscoder - ) + public CASResponse cas(String s, long l, T t, Transcoder tTranscoder) { return null; } @@ -1004,9 +994,7 @@ class MockMemcachedClient implements MemcachedClientIF } @Override - public CountDownLatch broadcastOp( - BroadcastOpFactory broadcastOpFactory, Collection memcachedNodes - ) + public CountDownLatch broadcastOp(BroadcastOpFactory broadcastOpFactory, Collection memcachedNodes) { return null; } diff --git a/server/src/test/java/org/apache/druid/client/client/BatchServerInventoryViewTest.java b/server/src/test/java/org/apache/druid/client/client/BatchServerInventoryViewTest.java index d2ae93adddc..c002469624c 100644 --- a/server/src/test/java/org/apache/druid/client/client/BatchServerInventoryViewTest.java +++ b/server/src/test/java/org/apache/druid/client/client/BatchServerInventoryViewTest.java @@ -206,9 +206,7 @@ public class BatchServerInventoryViewTest } ) { @Override - protected DruidServer addInnerInventory( - DruidServer container, String inventoryKey, Set inventory - ) + protected DruidServer addInnerInventory(DruidServer container, String inventoryKey, Set inventory) { DruidServer server = super.addInnerInventory(container, inventoryKey, inventory); inventoryUpdateCounter.incrementAndGet(); diff --git a/server/src/test/java/org/apache/druid/curator/inventory/CuratorInventoryManagerTest.java b/server/src/test/java/org/apache/druid/curator/inventory/CuratorInventoryManagerTest.java index d95f861ed6d..120db3a4258 100644 --- a/server/src/test/java/org/apache/druid/curator/inventory/CuratorInventoryManagerTest.java +++ b/server/src/test/java/org/apache/druid/curator/inventory/CuratorInventoryManagerTest.java @@ -62,8 +62,11 @@ public class CuratorInventoryManagerTest extends CuratorTestBase public void testSanity() throws Exception { final MapStrategy strategy = new MapStrategy(); - CuratorInventoryManager, Integer> manager = new CuratorInventoryManager, Integer>( - curator, new StringInventoryManagerConfig("/container", "/inventory"), exec, strategy + CuratorInventoryManager, Integer> manager = new CuratorInventoryManager<>( + curator, + new StringInventoryManagerConfig("/container", "/inventory"), + exec, + strategy ); curator.start(); diff --git a/server/src/test/java/org/apache/druid/initialization/InitializationTest.java b/server/src/test/java/org/apache/druid/initialization/InitializationTest.java index f53a07819a9..820eed5318f 100644 --- a/server/src/test/java/org/apache/druid/initialization/InitializationTest.java +++ b/server/src/test/java/org/apache/druid/initialization/InitializationTest.java @@ -134,14 +134,17 @@ public class InitializationTest { Injector startupInjector = GuiceInjectors.makeStartupInjector(); Injector injector = Initialization.makeInjectorWithModules( - startupInjector, ImmutableList.of( + startupInjector, + ImmutableList.of( new com.google.inject.Module() { @Override public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test-inject", null, false, null, null, true, false) ); } } @@ -163,16 +166,7 @@ public class InitializationTest final URLClassLoader loader = Initialization.getClassLoaderForExtension(some_extension_dir, false); final URL[] expectedURLs = new URL[]{a_jar.toURI().toURL(), b_jar.toURI().toURL(), c_jar.toURI().toURL()}; final URL[] actualURLs = loader.getURLs(); - Arrays.sort( - actualURLs, new Comparator() - { - @Override - public int compare(URL o1, URL o2) - { - return o1.getPath().compareTo(o2.getPath()); - } - } - ); + Arrays.sort(actualURLs, Comparator.comparing(URL::getPath)); Assert.assertArrayEquals(expectedURLs, actualURLs); } diff --git a/server/src/test/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinatorTest.java b/server/src/test/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinatorTest.java index f13105ebcea..372bbee3e21 100644 --- a/server/src/test/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinatorTest.java +++ b/server/src/test/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinatorTest.java @@ -211,7 +211,8 @@ public class IndexerSQLMetadataStorageCoordinatorTest { for (final DataSegment segment : SEGMENTS) { Assert.assertEquals( - 1, (int) derbyConnector.getDBI().withHandle( + 1, + (int) derbyConnector.getDBI().withHandle( new HandleCallback() { @Override diff --git a/server/src/test/java/org/apache/druid/metadata/SQLMetadataRuleManagerTest.java b/server/src/test/java/org/apache/druid/metadata/SQLMetadataRuleManagerTest.java index 64f479b905a..5641a23c9d0 100644 --- a/server/src/test/java/org/apache/druid/metadata/SQLMetadataRuleManagerTest.java +++ b/server/src/test/java/org/apache/druid/metadata/SQLMetadataRuleManagerTest.java @@ -144,8 +144,10 @@ public class SQLMetadataRuleManagerTest AuditEntry entry = auditEntries.get(0); Assert.assertEquals( - rules, mapper.readValue( - entry.getPayload(), new TypeReference>() + rules, + mapper.readValue( + entry.getPayload(), + new TypeReference>() { } ) @@ -187,8 +189,10 @@ public class SQLMetadataRuleManagerTest Assert.assertEquals(2, auditEntries.size()); for (AuditEntry entry : auditEntries) { Assert.assertEquals( - rules, mapper.readValue( - entry.getPayload(), new TypeReference>() + rules, + mapper.readValue( + entry.getPayload(), + new TypeReference>() { } ) diff --git a/server/src/test/java/org/apache/druid/query/dimension/LookupDimensionSpecTest.java b/server/src/test/java/org/apache/druid/query/dimension/LookupDimensionSpecTest.java index 0346a99b1e7..f5dd8d0f165 100644 --- a/server/src/test/java/org/apache/druid/query/dimension/LookupDimensionSpecTest.java +++ b/server/src/test/java/org/apache/druid/query/dimension/LookupDimensionSpecTest.java @@ -47,24 +47,20 @@ import java.util.Map; public class LookupDimensionSpecTest { private static final Map STRING_MAP = ImmutableMap.of("key", "value", "key2", "value2"); - private static LookupExtractor MAP_LOOKUP_EXTRACTOR = new MapLookupExtractor( - STRING_MAP, true); + private static LookupExtractor MAP_LOOKUP_EXTRACTOR = new MapLookupExtractor(STRING_MAP, true); private static final LookupReferencesManager LOOKUP_REF_MANAGER = EasyMock.createMock(LookupReferencesManager.class); static { - EasyMock.expect(LOOKUP_REF_MANAGER.get(EasyMock.eq("lookupName"))).andReturn( - new LookupExtractorFactoryContainer( - "v0", - new MapLookupExtractorFactory(STRING_MAP, false) - ) - ).anyTimes(); + EasyMock + .expect(LOOKUP_REF_MANAGER.get(EasyMock.eq("lookupName"))) + .andReturn(new LookupExtractorFactoryContainer("v0", new MapLookupExtractorFactory(STRING_MAP, false))) + .anyTimes(); EasyMock.replay(LOOKUP_REF_MANAGER); } - private final DimensionSpec lookupDimSpec = new LookupDimensionSpec("dimName", "outputName", MAP_LOOKUP_EXTRACTOR, false, null, null, null, - true - ); + private final DimensionSpec lookupDimSpec = + new LookupDimensionSpec("dimName", "outputName", MAP_LOOKUP_EXTRACTOR, false, null, null, null, true); @Parameters diff --git a/server/src/test/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfigTest.java b/server/src/test/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfigTest.java index a199a6ece11..cf7573b988f 100644 --- a/server/src/test/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfigTest.java +++ b/server/src/test/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfigTest.java @@ -50,12 +50,13 @@ public class LookupListeningAnnouncerConfigTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test-inject", null, false, null, null, true, false) ); - binder.bind(Key.get( - String.class, - Names.named(DataSourceTaskIdHolder.DATA_SOURCE_BINDING) - )).toInstance("some_datasource"); + binder + .bind(Key.get(String.class, Names.named(DataSourceTaskIdHolder.DATA_SOURCE_BINDING))) + .toInstance("some_datasource"); } }, new LookupModule() diff --git a/server/src/test/java/org/apache/druid/segment/indexing/granularity/UniformGranularityTest.java b/server/src/test/java/org/apache/druid/segment/indexing/granularity/UniformGranularityTest.java index ee5f43cf979..24b0e425a60 100644 --- a/server/src/test/java/org/apache/druid/segment/indexing/granularity/UniformGranularityTest.java +++ b/server/src/test/java/org/apache/druid/segment/indexing/granularity/UniformGranularityTest.java @@ -164,7 +164,8 @@ public class UniformGranularityTest ); equalsCheck( - spec, new UniformGranularitySpec( + spec, + new UniformGranularitySpec( Granularities.DAY, null, Lists.newArrayList( @@ -198,7 +199,8 @@ public class UniformGranularityTest ); notEqualsCheck( - spec, new UniformGranularitySpec( + spec, + new UniformGranularitySpec( Granularities.YEAR, null, Lists.newArrayList( @@ -210,7 +212,8 @@ public class UniformGranularityTest ) ); notEqualsCheck( - spec, new UniformGranularitySpec( + spec, + new UniformGranularitySpec( Granularities.DAY, null, Lists.newArrayList( @@ -222,7 +225,8 @@ public class UniformGranularityTest ) ); notEqualsCheck( - spec, new UniformGranularitySpec( + spec, + new UniformGranularitySpec( Granularities.DAY, Granularities.ALL, Lists.newArrayList( @@ -239,15 +243,15 @@ public class UniformGranularityTest public void testPeriodSegmentGranularity() { final GranularitySpec spec = new UniformGranularitySpec( - new PeriodGranularity(new Period("P1D"), null, DateTimes.inferTzfromString("America/Los_Angeles")), - null, - Lists.newArrayList( - Intervals.of("2012-01-08T00-08:00/2012-01-11T00-08:00"), - Intervals.of("2012-01-07T00-08:00/2012-01-08T00-08:00"), - Intervals.of("2012-01-03T00-08:00/2012-01-04T00-08:00"), - Intervals.of("2012-01-01T00-08:00/2012-01-03T00-08:00"), - Intervals.of("2012-09-01T00-07:00/2012-09-03T00-07:00") - ) + new PeriodGranularity(new Period("P1D"), null, DateTimes.inferTzfromString("America/Los_Angeles")), + null, + Lists.newArrayList( + Intervals.of("2012-01-08T00-08:00/2012-01-11T00-08:00"), + Intervals.of("2012-01-07T00-08:00/2012-01-08T00-08:00"), + Intervals.of("2012-01-03T00-08:00/2012-01-04T00-08:00"), + Intervals.of("2012-01-01T00-08:00/2012-01-03T00-08:00"), + Intervals.of("2012-09-01T00-07:00/2012-09-03T00-07:00") + ) ); Assert.assertTrue(spec.bucketIntervals().isPresent()); @@ -262,15 +266,15 @@ public class UniformGranularityTest final ISOChronology chrono = ISOChronology.getInstance(DateTimes.inferTzfromString("America/Los_Angeles")); final ArrayList expectedIntervals = Lists.newArrayList( - new Interval("2012-01-01/2012-01-02", chrono).toDurationMillis(), - new Interval("2012-01-02/2012-01-03", chrono).toDurationMillis(), - new Interval("2012-01-03/2012-01-04", chrono).toDurationMillis(), - new Interval("2012-01-07/2012-01-08", chrono).toDurationMillis(), - new Interval("2012-01-08/2012-01-09", chrono).toDurationMillis(), - new Interval("2012-01-09/2012-01-10", chrono).toDurationMillis(), - new Interval("2012-01-10/2012-01-11", chrono).toDurationMillis(), - new Interval("2012-09-01/2012-09-02", chrono).toDurationMillis(), - new Interval("2012-09-02/2012-09-03", chrono).toDurationMillis() + new Interval("2012-01-01/2012-01-02", chrono).toDurationMillis(), + new Interval("2012-01-02/2012-01-03", chrono).toDurationMillis(), + new Interval("2012-01-03/2012-01-04", chrono).toDurationMillis(), + new Interval("2012-01-07/2012-01-08", chrono).toDurationMillis(), + new Interval("2012-01-08/2012-01-09", chrono).toDurationMillis(), + new Interval("2012-01-09/2012-01-10", chrono).toDurationMillis(), + new Interval("2012-01-10/2012-01-11", chrono).toDurationMillis(), + new Interval("2012-09-01/2012-09-02", chrono).toDurationMillis(), + new Interval("2012-09-02/2012-09-03", chrono).toDurationMillis() ); Assert.assertEquals(expectedIntervals, actualIntervals); diff --git a/server/src/test/java/org/apache/druid/segment/loading/LoadSpecTest.java b/server/src/test/java/org/apache/druid/segment/loading/LoadSpecTest.java index 63c8b9b8b99..57b322aa87b 100644 --- a/server/src/test/java/org/apache/druid/segment/loading/LoadSpecTest.java +++ b/server/src/test/java/org/apache/druid/segment/loading/LoadSpecTest.java @@ -86,12 +86,8 @@ public class LoadSpecTest final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector(); mapper.setAnnotationIntrospectors( - new AnnotationIntrospectorPair( - guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector() - ), - new AnnotationIntrospectorPair( - guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector() - ) + new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), + new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()) ); } diff --git a/server/src/test/java/org/apache/druid/segment/realtime/RealtimeManagerTest.java b/server/src/test/java/org/apache/druid/segment/realtime/RealtimeManagerTest.java index 54fce4c9e95..8d2a45cada2 100644 --- a/server/src/test/java/org/apache/druid/segment/realtime/RealtimeManagerTest.java +++ b/server/src/test/java/org/apache/druid/segment/realtime/RealtimeManagerTest.java @@ -74,7 +74,6 @@ import org.apache.druid.segment.indexing.RealtimeTuningConfig; import org.apache.druid.segment.indexing.TuningConfigs; import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec; import org.apache.druid.segment.realtime.plumber.Plumber; -import org.apache.druid.segment.realtime.plumber.PlumberSchool; import org.apache.druid.segment.realtime.plumber.Sink; import org.apache.druid.server.coordination.DataSegmentServerAnnouncer; import org.apache.druid.timeline.partition.LinearShardSpec; @@ -178,30 +177,12 @@ public class RealtimeManagerTest return new TestFirehose(rows.iterator()); } }, - new PlumberSchool() - { - @Override - public Plumber findPlumber( - DataSchema schema, RealtimeTuningConfig config, FireDepartmentMetrics metrics - ) - { - return plumber; - } - }, + (schema, config, metrics) -> plumber, null ); RealtimeIOConfig ioConfig2 = new RealtimeIOConfig( null, - new PlumberSchool() - { - @Override - public Plumber findPlumber( - DataSchema schema, RealtimeTuningConfig config, FireDepartmentMetrics metrics - ) - { - return plumber2; - } - }, + (schema, config, metrics) -> plumber2, new FirehoseFactoryV2() { @Override diff --git a/server/src/test/java/org/apache/druid/segment/realtime/appenderator/AppenderatorTest.java b/server/src/test/java/org/apache/druid/segment/realtime/appenderator/AppenderatorTest.java index 95e05935132..e5643752dd4 100644 --- a/server/src/test/java/org/apache/druid/segment/realtime/appenderator/AppenderatorTest.java +++ b/server/src/test/java/org/apache/druid/segment/realtime/appenderator/AppenderatorTest.java @@ -49,7 +49,6 @@ import org.junit.Test; import java.util.Arrays; import java.util.Collections; -import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -798,20 +797,16 @@ public class AppenderatorTest { final List xsSorted = Lists.newArrayList(xs); Collections.sort( - xsSorted, new Comparator() - { - @Override - public int compare(T a, T b) - { - if (a instanceof SegmentIdentifier && b instanceof SegmentIdentifier) { - return ((SegmentIdentifier) a).getIdentifierAsString() - .compareTo(((SegmentIdentifier) b).getIdentifierAsString()); - } else if (a instanceof DataSegment && b instanceof DataSegment) { - return ((DataSegment) a).getIdentifier() - .compareTo(((DataSegment) b).getIdentifier()); - } else { - throw new IllegalStateException("WTF??"); - } + xsSorted, + (a, b) -> { + if (a instanceof SegmentIdentifier && b instanceof SegmentIdentifier) { + return ((SegmentIdentifier) a).getIdentifierAsString() + .compareTo(((SegmentIdentifier) b).getIdentifierAsString()); + } else if (a instanceof DataSegment && b instanceof DataSegment) { + return ((DataSegment) a).getIdentifier() + .compareTo(((DataSegment) b).getIdentifier()); + } else { + throw new IllegalStateException("WTF??"); } } ); diff --git a/server/src/test/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriverFailTest.java b/server/src/test/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriverFailTest.java index 4867691d805..3ec8c263ed5 100644 --- a/server/src/test/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriverFailTest.java +++ b/server/src/test/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriverFailTest.java @@ -468,7 +468,9 @@ public class StreamAppenderatorDriverFailTest extends EasyMockSupport @Override public ListenableFuture push( - Collection identifiers, Committer committer, boolean useUniquePath + Collection identifiers, + Committer committer, + boolean useUniquePath ) { if (pushEnabled) { @@ -527,17 +529,13 @@ public class StreamAppenderatorDriverFailTest extends EasyMockSupport } @Override - public QueryRunner getQueryRunnerForIntervals( - Query query, Iterable intervals - ) + public QueryRunner getQueryRunnerForIntervals(Query query, Iterable intervals) { throw new UnsupportedOperationException(); } @Override - public QueryRunner getQueryRunnerForSegments( - Query query, Iterable specs - ) + public QueryRunner getQueryRunnerForSegments(Query query, Iterable specs) { throw new UnsupportedOperationException(); } diff --git a/server/src/test/java/org/apache/druid/segment/realtime/plumber/CoordinatorBasedSegmentHandoffNotifierTest.java b/server/src/test/java/org/apache/druid/segment/realtime/plumber/CoordinatorBasedSegmentHandoffNotifierTest.java index 4151ef26dc3..15964158073 100644 --- a/server/src/test/java/org/apache/druid/segment/realtime/plumber/CoordinatorBasedSegmentHandoffNotifierTest.java +++ b/server/src/test/java/org/apache/druid/segment/realtime/plumber/CoordinatorBasedSegmentHandoffNotifierTest.java @@ -53,12 +53,8 @@ public class CoordinatorBasedSegmentHandoffNotifierTest @Test public void testHandoffCallbackNotCalled() { - Interval interval = Intervals.of( - "2011-04-01/2011-04-02" - ); - SegmentDescriptor descriptor = new SegmentDescriptor( - interval, "v1", 2 - ); + Interval interval = Intervals.of("2011-04-01/2011-04-02"); + SegmentDescriptor descriptor = new SegmentDescriptor(interval, "v1", 2); DataSegment segment = new DataSegment( "test_ds", interval, @@ -104,12 +100,8 @@ public class CoordinatorBasedSegmentHandoffNotifierTest @Test public void testHandoffCallbackCalled() { - Interval interval = Intervals.of( - "2011-04-01/2011-04-02" - ); - SegmentDescriptor descriptor = new SegmentDescriptor( - interval, "v1", 2 - ); + Interval interval = Intervals.of("2011-04-01/2011-04-02"); + SegmentDescriptor descriptor = new SegmentDescriptor(interval, "v1", 2); DataSegment segment = new DataSegment( "test_ds", interval, diff --git a/server/src/test/java/org/apache/druid/server/AsyncManagementForwardingServletTest.java b/server/src/test/java/org/apache/druid/server/AsyncManagementForwardingServletTest.java index c2269e441b7..05546864c8a 100644 --- a/server/src/test/java/org/apache/druid/server/AsyncManagementForwardingServletTest.java +++ b/server/src/test/java/org/apache/druid/server/AsyncManagementForwardingServletTest.java @@ -124,7 +124,9 @@ public class AsyncManagementForwardingServletTest extends BaseJettyTest { return Initialization.makeInjectorWithModules(GuiceInjectors.makeStartupInjector(), ImmutableList.of((binder) -> { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test", "localhost", false, null, null, true, false) ); binder.bind(JettyServerInitializer.class).to(ProxyJettyServerInit.class).in(LazySingleton.class); LifecycleModule.register(binder, Server.class); diff --git a/server/src/test/java/org/apache/druid/server/ClientInfoResourceTest.java b/server/src/test/java/org/apache/druid/server/ClientInfoResourceTest.java index ec11f43b200..60b633d2262 100644 --- a/server/src/test/java/org/apache/druid/server/ClientInfoResourceTest.java +++ b/server/src/test/java/org/apache/druid/server/ClientInfoResourceTest.java @@ -80,14 +80,18 @@ public class ClientInfoResourceTest addSegment(timeline, server, "2015-02-01/2015-02-07", ImmutableList.of("d1"), ImmutableList.of("m1"), "v1"); addSegment(timeline, server, "2015-02-07/2015-02-13", ImmutableList.of("d1"), ImmutableList.of("m1"), "v1"); addSegmentWithShardSpec( - timeline, server, "2015-02-03/2015-02-05", + timeline, + server, + "2015-02-03/2015-02-05", ImmutableList.of("d1", "d2"), ImmutableList.of("m1", "m2"), "v2", new NumberedShardSpec(0, 2) ); addSegmentWithShardSpec( - timeline, server, "2015-02-03/2015-02-05", + timeline, + server, + "2015-02-03/2015-02-05", ImmutableList.of("d1", "d2", "d3"), ImmutableList.of("m1", "m2", "m3"), "v2", @@ -111,7 +115,9 @@ public class ClientInfoResourceTest // imcomplete segment addSegmentWithShardSpec( - timeline, server, "2015-04-03/2015-04-05", + timeline, + server, + "2015-04-03/2015-04-05", ImmutableList.of("d4"), ImmutableList.of("m4"), "v7", @@ -126,10 +132,7 @@ public class ClientInfoResourceTest EasyMock.replay(serverInventoryView, timelineServerView); - resource = getResourceTestHelper( - serverInventoryView, timelineServerView, - new SegmentMetadataQueryConfig() - ); + resource = getResourceTestHelper(serverInventoryView, timelineServerView, new SegmentMetadataQueryConfig()); } @Test @@ -195,15 +198,14 @@ public class ClientInfoResourceTest public void testGetDatasourceWithConfiguredDefaultInterval() { ClientInfoResource defaultResource = getResourceTestHelper( - serverInventoryView, timelineServerView, + serverInventoryView, + timelineServerView, new SegmentMetadataQueryConfig("P100Y") ); Map expected = ImmutableMap.of( - KEY_DIMENSIONS, - ImmutableSet.of("d1", "d2", "d3", "d4", "d5"), - KEY_METRICS, - ImmutableSet.of("m1", "m2", "m3", "m4", "m5") + KEY_DIMENSIONS, ImmutableSet.of("d1", "d2", "d3", "d4", "d5"), + KEY_METRICS, ImmutableSet.of("m1", "m2", "m3", "m4", "m5") ); Map actual = defaultResource.getDatasource(dataSource, null, null); diff --git a/server/src/test/java/org/apache/druid/server/QueryResourceTest.java b/server/src/test/java/org/apache/druid/server/QueryResourceTest.java index bcf557b029a..dcfeb0bf341 100644 --- a/server/src/test/java/org/apache/druid/server/QueryResourceTest.java +++ b/server/src/test/java/org/apache/druid/server/QueryResourceTest.java @@ -87,9 +87,7 @@ public class QueryResourceTest public static final QuerySegmentWalker testSegmentWalker = new QuerySegmentWalker() { @Override - public QueryRunner getQueryRunnerForIntervals( - Query query, Iterable intervals - ) + public QueryRunner getQueryRunnerForIntervals(Query query, Iterable intervals) { return new QueryRunner() { @@ -102,9 +100,7 @@ public class QueryResourceTest } @Override - public QueryRunner getQueryRunnerForSegments( - Query query, Iterable specs - ) + public QueryRunner getQueryRunnerForSegments(Query query, Iterable specs) { return getQueryRunnerForIntervals(null, null); } diff --git a/server/src/test/java/org/apache/druid/server/coordination/ChangeRequestHttpSyncerTest.java b/server/src/test/java/org/apache/druid/server/coordination/ChangeRequestHttpSyncerTest.java index a362e206e3b..f4dd564e13e 100644 --- a/server/src/test/java/org/apache/druid/server/coordination/ChangeRequestHttpSyncerTest.java +++ b/server/src/test/java/org/apache/druid/server/coordination/ChangeRequestHttpSyncerTest.java @@ -167,7 +167,8 @@ public class ChangeRequestHttpSyncerTest @Override public ListenableFuture go( - Request request, HttpResponseHandler httpResponseHandler + Request request, + HttpResponseHandler httpResponseHandler ) { throw new UnsupportedOperationException("Not Implemented."); @@ -175,7 +176,9 @@ public class ChangeRequestHttpSyncerTest @Override public ListenableFuture go( - Request request, HttpResponseHandler httpResponseHandler, Duration duration + Request request, + HttpResponseHandler httpResponseHandler, + Duration duration ) { if (requestNum.getAndIncrement() == 0) { diff --git a/server/src/test/java/org/apache/druid/server/coordination/SegmentLoadDropHandlerTest.java b/server/src/test/java/org/apache/druid/server/coordination/SegmentLoadDropHandlerTest.java index 4799f3f2c1a..05eb35e4f72 100644 --- a/server/src/test/java/org/apache/druid/server/coordination/SegmentLoadDropHandlerTest.java +++ b/server/src/test/java/org/apache/druid/server/coordination/SegmentLoadDropHandlerTest.java @@ -24,8 +24,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ThreadFactoryBuilder; import org.apache.druid.java.util.common.Intervals; +import org.apache.druid.java.util.common.concurrent.Execs; import org.apache.druid.java.util.common.concurrent.ScheduledExecutorFactory; import org.apache.druid.java.util.common.logger.Logger; import org.apache.druid.segment.IndexIO; @@ -179,14 +179,10 @@ public class SegmentLoadDropHandlerTest Override normal behavoir by adding the runnable to a list so that you can make sure all the shceduled runnables are executed by explicitly calling run() on each item in the list */ - return new ScheduledThreadPoolExecutor( - corePoolSize, new ThreadFactoryBuilder().setDaemon(true).setNameFormat(nameFormat).build() - ) + return new ScheduledThreadPoolExecutor(corePoolSize, Execs.makeThreadFactory(nameFormat)) { @Override - public ScheduledFuture schedule( - Runnable command, long delay, TimeUnit unit - ) + public ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit) { scheduledRunnable.add(command); return null; diff --git a/server/src/test/java/org/apache/druid/server/coordination/ServerManagerTest.java b/server/src/test/java/org/apache/druid/server/coordination/ServerManagerTest.java index 3107539e6f6..7c28658173f 100644 --- a/server/src/test/java/org/apache/druid/server/coordination/ServerManagerTest.java +++ b/server/src/test/java/org/apache/druid/server/coordination/ServerManagerTest.java @@ -536,23 +536,22 @@ public class ServerManagerTest Assert.assertTrue(segment.getNumReferences() > 0); segmentReferences.add(segment); adapters.add((SegmentForTesting) segment.getBaseSegment()); - return new BlockingQueryRunner>( - new NoopQueryRunner>(), waitLatch, waitYieldLatch, notifyLatch - ); + return new BlockingQueryRunner<>(new NoopQueryRunner<>(), waitLatch, waitYieldLatch, notifyLatch); } @Override public QueryRunner> mergeRunners( - ExecutorService queryExecutor, Iterable>> queryRunners + ExecutorService queryExecutor, + Iterable>> queryRunners ) { - return new ConcatQueryRunner>(Sequences.simple(queryRunners)); + return new ConcatQueryRunner<>(Sequences.simple(queryRunners)); } @Override public QueryToolChest, SearchQuery> getToolchest() { - return new NoopQueryToolChest, SearchQuery>(); + return new NoopQueryToolChest<>(); } public List getAdapters() @@ -714,7 +713,8 @@ public class ServerManagerTest @Override public Yielder toYielder( - final OutType initValue, final YieldingAccumulator accumulator + final OutType initValue, + final YieldingAccumulator accumulator ) { notifyLatch.countDown(); diff --git a/server/src/test/java/org/apache/druid/server/coordination/ZkCoordinatorTest.java b/server/src/test/java/org/apache/druid/server/coordination/ZkCoordinatorTest.java index 945e96809e5..4b82cdb18bd 100644 --- a/server/src/test/java/org/apache/druid/server/coordination/ZkCoordinatorTest.java +++ b/server/src/test/java/org/apache/druid/server/coordination/ZkCoordinatorTest.java @@ -139,8 +139,11 @@ public class ZkCoordinatorTest extends CuratorTestBase String segmentZkPath = ZKPaths.makePath(zkPaths.getLoadQueuePath(), me.getName(), segment.getIdentifier()); - curator.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath( - segmentZkPath, jsonMapper.writeValueAsBytes(new SegmentChangeRequestLoad(segment))); + curator + .create() + .creatingParentsIfNeeded() + .withMode(CreateMode.EPHEMERAL) + .forPath(segmentZkPath, jsonMapper.writeValueAsBytes(new SegmentChangeRequestLoad(segment))); loadLatch.await(); @@ -148,8 +151,11 @@ public class ZkCoordinatorTest extends CuratorTestBase Thread.sleep(100); } - curator.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath( - segmentZkPath, jsonMapper.writeValueAsBytes(new SegmentChangeRequestDrop(segment))); + curator + .create() + .creatingParentsIfNeeded() + .withMode(CreateMode.EPHEMERAL) + .forPath(segmentZkPath, jsonMapper.writeValueAsBytes(new SegmentChangeRequestDrop(segment))); dropLatch.await(); diff --git a/server/src/test/java/org/apache/druid/server/coordinator/CostBalancerStrategyTest.java b/server/src/test/java/org/apache/druid/server/coordinator/CostBalancerStrategyTest.java index 8e26a959a91..4f8b2934092 100644 --- a/server/src/test/java/org/apache/druid/server/coordinator/CostBalancerStrategyTest.java +++ b/server/src/test/java/org/apache/druid/server/coordinator/CostBalancerStrategyTest.java @@ -111,8 +111,15 @@ public class CostBalancerStrategyTest { // Not using EasyMock as it hampers the performance of multithreads. DataSegment segment = new DataSegment( - dataSource, interval, String.valueOf(index), new ConcurrentHashMap<>(), - Lists.newArrayList(), Lists.newArrayList(), null, 0, index * 100L + dataSource, + interval, + String.valueOf(index), + new ConcurrentHashMap<>(), + Lists.newArrayList(), + Lists.newArrayList(), + null, + 0, + index * 100L ); return segment; } diff --git a/server/src/test/java/org/apache/druid/server/coordinator/DiskNormalizedCostBalancerStrategyTest.java b/server/src/test/java/org/apache/druid/server/coordinator/DiskNormalizedCostBalancerStrategyTest.java index 88fe93a88ed..f7b519d37c6 100644 --- a/server/src/test/java/org/apache/druid/server/coordinator/DiskNormalizedCostBalancerStrategyTest.java +++ b/server/src/test/java/org/apache/druid/server/coordinator/DiskNormalizedCostBalancerStrategyTest.java @@ -109,8 +109,15 @@ public class DiskNormalizedCostBalancerStrategyTest { // Not using EasyMock as it hampers the performance of multithreads. DataSegment segment = new DataSegment( - dataSource, interval, String.valueOf(index), new ConcurrentHashMap<>(), - Lists.newArrayList(), Lists.newArrayList(), null, 0, index * 100L + dataSource, + interval, + String.valueOf(index), + new ConcurrentHashMap<>(), + Lists.newArrayList(), + Lists.newArrayList(), + null, + 0, + index * 100L ); return segment; } diff --git a/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorBalancerTest.java b/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorBalancerTest.java index 053fedb8253..52d4812f357 100644 --- a/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorBalancerTest.java +++ b/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorBalancerTest.java @@ -403,17 +403,13 @@ public class DruidCoordinatorBalancerTest } @Override - public ServerHolder findNewSegmentHomeBalancer( - DataSegment proposalSegment, List serverHolders - ) + public ServerHolder findNewSegmentHomeBalancer(DataSegment proposalSegment, List serverHolders) { return delegate.findNewSegmentHomeBalancer(proposalSegment, serverHolders); } @Override - public ServerHolder findNewSegmentHomeReplicator( - DataSegment proposalSegment, List serverHolders - ) + public ServerHolder findNewSegmentHomeReplicator(DataSegment proposalSegment, List serverHolders) { return delegate.findNewSegmentHomeReplicator(proposalSegment, serverHolders); } @@ -425,9 +421,7 @@ public class DruidCoordinatorBalancerTest } @Override - public void emitStats( - String tier, CoordinatorStats stats, List serverHolderList - ) + public void emitStats(String tier, CoordinatorStats stats, List serverHolderList) { delegate.emitStats(tier, stats, serverHolderList); } diff --git a/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorTest.java b/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorTest.java index 0a871daaaed..b2692258bc1 100644 --- a/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorTest.java +++ b/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorTest.java @@ -367,9 +367,7 @@ public class DruidCoordinatorTest extends CuratorTestBase new PathChildrenCacheListener() { @Override - public void childEvent( - CuratorFramework curatorFramework, PathChildrenCacheEvent pathChildrenCacheEvent - ) + public void childEvent(CuratorFramework curatorFramework, PathChildrenCacheEvent pathChildrenCacheEvent) { if (pathChildrenCacheEvent.getType().equals(PathChildrenCacheEvent.Type.CHILD_ADDED)) { if (assignSegmentLatch.getCount() > 0) { @@ -449,7 +447,11 @@ public class DruidCoordinatorTest extends CuratorTestBase druidCoordinatorConfig ); final PathChildrenCache pathChildrenCacheCold = new PathChildrenCache( - curator, loadPathCold, true, true, Execs.singleThreaded("coordinator_test_path_children_cache_cold-%d") + curator, + loadPathCold, + true, + true, + Execs.singleThreaded("coordinator_test_path_children_cache_cold-%d") ); loadManagementPeons.putAll(ImmutableMap.of("hot", loadQueuePeon, "cold", loadQueuePeonCold)); @@ -577,8 +579,15 @@ public class DruidCoordinatorTest extends CuratorTestBase { // Not using EasyMock as it hampers the performance of multithreads. DataSegment segment = new DataSegment( - dataSource, interval, "dummy_version", new ConcurrentHashMap<>(), - Lists.newArrayList(), Lists.newArrayList(), null, 0, 0L + dataSource, + interval, + "dummy_version", + new ConcurrentHashMap<>(), + Lists.newArrayList(), + Lists.newArrayList(), + null, + 0, + 0L ); return segment; } diff --git a/server/src/test/java/org/apache/druid/server/coordinator/HttpLoadQueuePeonTest.java b/server/src/test/java/org/apache/druid/server/coordinator/HttpLoadQueuePeonTest.java index 6b65fae290b..a85491480f9 100644 --- a/server/src/test/java/org/apache/druid/server/coordinator/HttpLoadQueuePeonTest.java +++ b/server/src/test/java/org/apache/druid/server/coordinator/HttpLoadQueuePeonTest.java @@ -195,7 +195,8 @@ public class HttpLoadQueuePeonTest @Override public ListenableFuture go( - Request request, HttpResponseHandler httpResponseHandler + Request request, + HttpResponseHandler httpResponseHandler ) { throw new UnsupportedOperationException("Not Implemented."); @@ -203,7 +204,9 @@ public class HttpLoadQueuePeonTest @Override public ListenableFuture go( - Request request, HttpResponseHandler httpResponseHandler, Duration duration + Request request, + HttpResponseHandler httpResponseHandler, + Duration duration ) { HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK); diff --git a/server/src/test/java/org/apache/druid/server/coordinator/LoadQueuePeonTest.java b/server/src/test/java/org/apache/druid/server/coordinator/LoadQueuePeonTest.java index d47755cc184..68abe69bdd3 100644 --- a/server/src/test/java/org/apache/druid/server/coordinator/LoadQueuePeonTest.java +++ b/server/src/test/java/org/apache/druid/server/coordinator/LoadQueuePeonTest.java @@ -176,9 +176,7 @@ public class LoadQueuePeonTest extends CuratorTestBase new PathChildrenCacheListener() { @Override - public void childEvent( - CuratorFramework client, PathChildrenCacheEvent event - ) throws Exception + public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception { if (event.getType() == PathChildrenCacheEvent.Type.CHILD_ADDED) { DataSegmentChangeRequest request = jsonMapper.readValue( @@ -194,7 +192,8 @@ public class LoadQueuePeonTest extends CuratorTestBase for (DataSegment segment : segmentToDrop) { loadQueuePeon.dropSegment( - segment, new LoadPeonCallback() + segment, + new LoadPeonCallback() { @Override public void execute() @@ -207,7 +206,8 @@ public class LoadQueuePeonTest extends CuratorTestBase for (DataSegment segment : segmentToLoad) { loadQueuePeon.loadSegment( - segment, new LoadPeonCallback() + segment, + new LoadPeonCallback() { @Override public void execute() @@ -260,12 +260,10 @@ public class LoadQueuePeonTest extends CuratorTestBase Assert.assertTrue(timing.forWaiting().awaitLatch(loadRequestSignal[requestSignalIdx.get()])); Assert.assertNotNull(curator.checkExists().forPath(loadRequestPath)); Assert.assertEquals( - segment, ((SegmentChangeRequestLoad) jsonMapper.readValue( - curator.getData() - .decompressed() - .forPath(loadRequestPath), - DataSegmentChangeRequest.class - )).getSegment() + segment, + ((SegmentChangeRequestLoad) jsonMapper + .readValue(curator.getData().decompressed().forPath(loadRequestPath), DataSegmentChangeRequest.class)) + .getSegment() ); requestSignalIdx.incrementAndGet(); @@ -305,9 +303,7 @@ public class LoadQueuePeonTest extends CuratorTestBase new PathChildrenCacheListener() { @Override - public void childEvent( - CuratorFramework client, PathChildrenCacheEvent event - ) + public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) { if (event.getType() == PathChildrenCacheEvent.Type.CHILD_ADDED) { loadRequestSignal.countDown(); @@ -318,7 +314,8 @@ public class LoadQueuePeonTest extends CuratorTestBase loadQueueCache.start(); loadQueuePeon.loadSegment( - segment, new LoadPeonCallback() + segment, + new LoadPeonCallback() { @Override public void execute() @@ -332,12 +329,10 @@ public class LoadQueuePeonTest extends CuratorTestBase Assert.assertTrue(timing.forWaiting().awaitLatch(loadRequestSignal)); Assert.assertNotNull(curator.checkExists().forPath(loadRequestPath)); Assert.assertEquals( - segment, ((SegmentChangeRequestLoad) jsonMapper.readValue( - curator.getData() - .decompressed() - .forPath(loadRequestPath), - DataSegmentChangeRequest.class - )).getSegment() + segment, + ((SegmentChangeRequestLoad) jsonMapper + .readValue(curator.getData().decompressed().forPath(loadRequestPath), DataSegmentChangeRequest.class)) + .getSegment() ); // don't simulate completion of load request here diff --git a/server/src/test/java/org/apache/druid/server/coordinator/cost/SegmentsCostCacheTest.java b/server/src/test/java/org/apache/druid/server/coordinator/cost/SegmentsCostCacheTest.java index ea8d0339d46..6fd96ed64bb 100644 --- a/server/src/test/java/org/apache/druid/server/coordinator/cost/SegmentsCostCacheTest.java +++ b/server/src/test/java/org/apache/druid/server/coordinator/cost/SegmentsCostCacheTest.java @@ -95,13 +95,14 @@ public class SegmentsCostCacheTest { DataSegment segmentA = createSegment(DATA_SOURCE, shifted1HInterval(REFERENCE_TIME, 0), 100); DataSegment segmentB = createSegment( - DATA_SOURCE, shifted1HInterval(REFERENCE_TIME, (int) TimeUnit.DAYS.toHours(50)), 100 + DATA_SOURCE, + shifted1HInterval(REFERENCE_TIME, (int) TimeUnit.DAYS.toHours(50)), + 100 ); - SegmentsCostCache.Bucket.Builder prototype = SegmentsCostCache.Bucket.builder(new Interval( - REFERENCE_TIME.minusHours(5), - REFERENCE_TIME.plusHours(5) - )); + SegmentsCostCache.Bucket.Builder prototype = SegmentsCostCache.Bucket.builder( + new Interval(REFERENCE_TIME.minusHours(5), REFERENCE_TIME.plusHours(5)) + ); prototype.addSegment(segmentA); SegmentsCostCache.Bucket bucket = prototype.build(); diff --git a/server/src/test/java/org/apache/druid/server/http/LookupCoordinatorResourceTest.java b/server/src/test/java/org/apache/druid/server/http/LookupCoordinatorResourceTest.java index 2e0819c0480..621479b8a2e 100644 --- a/server/src/test/java/org/apache/druid/server/http/LookupCoordinatorResourceTest.java +++ b/server/src/test/java/org/apache/druid/server/http/LookupCoordinatorResourceTest.java @@ -86,10 +86,8 @@ public class LookupCoordinatorResourceTest ImmutableMap.of(LOOKUP_NAME, SINGLE_LOOKUP), null, null ); - private static final Map> NODES_LOOKUP_STATE = ImmutableMap - .of( - LOOKUP_NODE, LOOKUP_STATE - ); + private static final Map> NODES_LOOKUP_STATE = + ImmutableMap.of(LOOKUP_NODE, LOOKUP_STATE); @Test public void testSimpleGet() @@ -1076,9 +1074,7 @@ public class LookupCoordinatorResourceTest final Response response = lookupCoordinatorResource.getSpecificNodeStatus(LOOKUP_TIER, LOOKUP_NODE); Assert.assertEquals(200, response.getStatus()); - Assert.assertEquals( - LOOKUP_STATE, response.getEntity() - ); + Assert.assertEquals(LOOKUP_STATE, response.getEntity()); EasyMock.verify(lookupCoordinatorManager); } diff --git a/server/src/test/java/org/apache/druid/server/initialization/JettyQosTest.java b/server/src/test/java/org/apache/druid/server/initialization/JettyQosTest.java index 0ecb53ed03f..fca71f5ef52 100644 --- a/server/src/test/java/org/apache/druid/server/initialization/JettyQosTest.java +++ b/server/src/test/java/org/apache/druid/server/initialization/JettyQosTest.java @@ -71,7 +71,9 @@ public class JettyQosTest extends BaseJettyTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test", "localhost", false, null, null, true, false) ); binder.bind(JettyServerInitializer.class).to(JettyServerInit.class).in(LazySingleton.class); Jerseys.addResource(binder, SlowResource.class); diff --git a/server/src/test/java/org/apache/druid/server/initialization/JettyTest.java b/server/src/test/java/org/apache/druid/server/initialization/JettyTest.java index 0c2cd8aba62..a8009633b5b 100644 --- a/server/src/test/java/org/apache/druid/server/initialization/JettyTest.java +++ b/server/src/test/java/org/apache/druid/server/initialization/JettyTest.java @@ -87,7 +87,9 @@ public class JettyTest extends BaseJettyTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test", "localhost", false, null, null, true, false) ); binder.bind(JettyServerInitializer.class).to(JettyServerInit.class).in(LazySingleton.class); @@ -99,7 +101,6 @@ public class JettyTest extends BaseJettyTest multibinder.addBinding().toInstance( new ServletFilterHolder() { - @Override public String getPath() { @@ -129,7 +130,8 @@ public class JettyTest extends BaseJettyTest { return null; } - }); + } + ); Jerseys.addResource(binder, SlowResource.class); Jerseys.addResource(binder, ExceptionResource.class); diff --git a/server/src/test/java/org/apache/druid/server/lookup/cache/LookupCoordinatorManagerTest.java b/server/src/test/java/org/apache/druid/server/lookup/cache/LookupCoordinatorManagerTest.java index 3e6bb436b88..aa32b81156a 100644 --- a/server/src/test/java/org/apache/druid/server/lookup/cache/LookupCoordinatorManagerTest.java +++ b/server/src/test/java/org/apache/druid/server/lookup/cache/LookupCoordinatorManagerTest.java @@ -1030,91 +1030,74 @@ public class LookupCoordinatorManagerTest public void testLookupManagementLoop() throws Exception { Map lookup1 = ImmutableMap.of( - "lookup1", new LookupExtractorFactoryMapContainer( - "v1", ImmutableMap.of("k1", "v1") - ) + "lookup1", new LookupExtractorFactoryMapContainer("v1", ImmutableMap.of("k1", "v1")) ); - Map> configuredLookups = - ImmutableMap.of( - "tier1", - lookup1 - ); + Map> configuredLookups = ImmutableMap.of("tier1", lookup1); EasyMock.reset(configManager); - EasyMock.expect(configManager.watch( - EasyMock.eq(LookupCoordinatorManager.LOOKUP_CONFIG_KEY), - EasyMock.anyObject(), - EasyMock.isNull() - )).andReturn( - new AtomicReference<>(configuredLookups)).once(); + EasyMock + .expect( + configManager.watch( + EasyMock.eq(LookupCoordinatorManager.LOOKUP_CONFIG_KEY), + EasyMock.anyObject(), + EasyMock.isNull() + ) + ) + .andReturn(new AtomicReference<>(configuredLookups)) + .once(); EasyMock.replay(configManager); HostAndPortWithScheme host1 = HostAndPortWithScheme.fromParts("http", "host1", 1234); HostAndPortWithScheme host2 = HostAndPortWithScheme.fromParts("http", "host2", 3456); EasyMock.reset(lookupNodeDiscovery); - EasyMock.expect( - lookupNodeDiscovery.getNodesInTier("tier1") - ).andReturn(ImmutableList.of(host1, host2)).anyTimes(); + EasyMock + .expect(lookupNodeDiscovery.getNodesInTier("tier1")) + .andReturn(ImmutableList.of(host1, host2)) + .anyTimes(); EasyMock.replay(lookupNodeDiscovery); - LookupCoordinatorManager.LookupsCommunicator lookupsCommunicator = EasyMock.createMock(LookupCoordinatorManager.LookupsCommunicator.class); - EasyMock.expect( - lookupsCommunicator.getLookupStateForNode( - host1 - ) - ).andReturn( - new LookupsState<>( - ImmutableMap.of("lookup0", new LookupExtractorFactoryMapContainer("v1", ImmutableMap.of("k0", "v0"))), null, null - ) - ).once(); - - LookupsState host1UpdatedState = new LookupsState<>( - lookup1, null, null - ); - - EasyMock.expect( - lookupsCommunicator.updateNode( - host1, + LookupCoordinatorManager.LookupsCommunicator lookupsCommunicator = + EasyMock.createMock(LookupCoordinatorManager.LookupsCommunicator.class); + EasyMock + .expect(lookupsCommunicator.getLookupStateForNode(host1)) + .andReturn( new LookupsState<>( + ImmutableMap.of("lookup0", new LookupExtractorFactoryMapContainer("v1", ImmutableMap.of("k0", "v0"))), null, - lookup1, - ImmutableSet.of("lookup0") + null ) ) - ).andReturn( - host1UpdatedState - ).once(); + .once(); + + LookupsState host1UpdatedState = new LookupsState<>(lookup1, null, null); + + EasyMock + .expect(lookupsCommunicator.updateNode(host1, new LookupsState<>(null, lookup1, ImmutableSet.of("lookup0")))) + .andReturn(host1UpdatedState) + .once(); - EasyMock.expect( - lookupsCommunicator.getLookupStateForNode( - host2 - ) - ).andReturn( - new LookupsState<>( - ImmutableMap.of("lookup3", new LookupExtractorFactoryMapContainer("v1", ImmutableMap.of("k0", "v0")), - "lookup1", new LookupExtractorFactoryMapContainer("v0", ImmutableMap.of("k0", "v0"))), - null, null - ) - ).once(); - - LookupsState host2UpdatedState = new LookupsState<>( - null, lookup1, null - ); - - EasyMock.expect( - lookupsCommunicator.updateNode( - host2, + EasyMock + .expect(lookupsCommunicator.getLookupStateForNode(host2)) + .andReturn( new LookupsState<>( + ImmutableMap.of( + "lookup3", new LookupExtractorFactoryMapContainer("v1", ImmutableMap.of("k0", "v0")), + "lookup1", new LookupExtractorFactoryMapContainer("v0", ImmutableMap.of("k0", "v0")) + ), null, - lookup1, - ImmutableSet.of("lookup3") + null ) ) - ).andReturn( - host2UpdatedState - ).once(); + .once(); + + LookupsState host2UpdatedState = new LookupsState<>(null, lookup1, null); + + EasyMock + .expect(lookupsCommunicator.updateNode(host2, new LookupsState<>(null, lookup1, ImmutableSet.of("lookup3")))) + .andReturn(host2UpdatedState) + .once(); EasyMock.replay(lookupsCommunicator); diff --git a/server/src/test/java/org/apache/druid/server/metrics/MetricsModuleTest.java b/server/src/test/java/org/apache/druid/server/metrics/MetricsModuleTest.java index bd50406aaed..a94d6cc9370 100644 --- a/server/src/test/java/org/apache/druid/server/metrics/MetricsModuleTest.java +++ b/server/src/test/java/org/apache/druid/server/metrics/MetricsModuleTest.java @@ -42,12 +42,13 @@ public class MetricsModuleTest GuiceInjectors.makeStartupInjector(), ImmutableList.of(new Module() { - @Override public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test-inject", null, false, null, null, true, false) ); } }) @@ -67,17 +68,16 @@ public class MetricsModuleTest GuiceInjectors.makeStartupInjector(), ImmutableList.of(new Module() { - @Override public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test-inject", null, false, null, null, true, false) ); - binder.bind(Key.get( - String.class, - Names.named(DataSourceTaskIdHolder.DATA_SOURCE_BINDING) - )).toInstance(dataSource); + binder.bind(Key.get(String.class, Names.named(DataSourceTaskIdHolder.DATA_SOURCE_BINDING))) + .toInstance(dataSource); binder.bind(Key.get(String.class, Names.named(DataSourceTaskIdHolder.TASK_ID_BINDING))) .toInstance(taskId); } diff --git a/server/src/test/java/org/apache/druid/server/shard/SingleDimensionShardSpecTest.java b/server/src/test/java/org/apache/druid/server/shard/SingleDimensionShardSpecTest.java index b4ee4f57aeb..0111c3a9b00 100644 --- a/server/src/test/java/org/apache/druid/server/shard/SingleDimensionShardSpecTest.java +++ b/server/src/test/java/org/apache/druid/server/shard/SingleDimensionShardSpecTest.java @@ -50,7 +50,7 @@ public class SingleDimensionShardSpecTest Map>>> tests = ImmutableMap.>>>builder() .put( makeSpec(null, null), - makeList( + makeListOfPairs( true, null, true, "a", true, "h", @@ -60,7 +60,7 @@ public class SingleDimensionShardSpecTest ) .put( makeSpec(null, "m"), - makeList( + makeListOfPairs( true, null, true, "a", true, "h", @@ -70,7 +70,7 @@ public class SingleDimensionShardSpecTest ) .put( makeSpec("a", "h"), - makeList( + makeListOfPairs( false, null, true, "a", false, "h", @@ -80,7 +80,7 @@ public class SingleDimensionShardSpecTest ) .put( makeSpec("d", "u"), - makeList( + makeListOfPairs( false, null, false, "a", true, "h", @@ -90,7 +90,7 @@ public class SingleDimensionShardSpecTest ) .put( makeSpec("h", null), - makeList( + makeListOfPairs( false, null, false, "a", true, "h", @@ -167,7 +167,7 @@ public class SingleDimensionShardSpecTest return value == null ? ImmutableMap.of() : ImmutableMap.of("billy", value); } - private List>> makeList(Object... arguments) + private List>> makeListOfPairs(Object... arguments) { Preconditions.checkState(arguments.length % 2 == 0); diff --git a/services/src/main/java/org/apache/druid/cli/CliCoordinator.java b/services/src/main/java/org/apache/druid/cli/CliCoordinator.java index 5e4cd062e7f..dd4aa53caa0 100644 --- a/services/src/main/java/org/apache/druid/cli/CliCoordinator.java +++ b/services/src/main/java/org/apache/druid/cli/CliCoordinator.java @@ -237,8 +237,13 @@ public class CliCoordinator extends ServerRunnable ) { return new LoadQueueTaskMaster( - curator, jsonMapper, factory.create(1, "Master-PeonExec--%d"), - Executors.newSingleThreadExecutor(), config, httpClient, zkPaths + curator, + jsonMapper, + factory.create(1, "Master-PeonExec--%d"), + Executors.newSingleThreadExecutor(), + config, + httpClient, + zkPaths ); } } diff --git a/services/src/main/java/org/apache/druid/cli/CliMiddleManager.java b/services/src/main/java/org/apache/druid/cli/CliMiddleManager.java index 8fa80e57ff9..e266233f826 100644 --- a/services/src/main/java/org/apache/druid/cli/CliMiddleManager.java +++ b/services/src/main/java/org/apache/druid/cli/CliMiddleManager.java @@ -109,11 +109,12 @@ public class CliMiddleManager extends ServerRunnable Key.get(RowIngestionMetersFactory.class), Key.get(DropwizardRowIngestionMetersFactory.class) ); - final MapBinder rowIngestionMetersHandlerProviderBinder = PolyBind.optionBinder( - binder, Key.get(RowIngestionMetersFactory.class) - ); - rowIngestionMetersHandlerProviderBinder.addBinding("dropwizard") - .to(DropwizardRowIngestionMetersFactory.class).in(LazySingleton.class); + final MapBinder rowIngestionMetersHandlerProviderBinder = + PolyBind.optionBinder(binder, Key.get(RowIngestionMetersFactory.class)); + rowIngestionMetersHandlerProviderBinder + .addBinding("dropwizard") + .to(DropwizardRowIngestionMetersFactory.class) + .in(LazySingleton.class); binder.bind(DropwizardRowIngestionMetersFactory.class).in(LazySingleton.class); diff --git a/services/src/main/java/org/apache/druid/cli/CliOverlord.java b/services/src/main/java/org/apache/druid/cli/CliOverlord.java index 45299a83d77..038ad837c4d 100644 --- a/services/src/main/java/org/apache/druid/cli/CliOverlord.java +++ b/services/src/main/java/org/apache/druid/cli/CliOverlord.java @@ -202,11 +202,12 @@ public class CliOverlord extends ServerRunnable Key.get(RowIngestionMetersFactory.class), Key.get(DropwizardRowIngestionMetersFactory.class) ); - final MapBinder rowIngestionMetersHandlerProviderBinder = PolyBind.optionBinder( - binder, Key.get(RowIngestionMetersFactory.class) - ); - rowIngestionMetersHandlerProviderBinder.addBinding("dropwizard") - .to(DropwizardRowIngestionMetersFactory.class).in(LazySingleton.class); + final MapBinder rowIngestionMetersHandlerProviderBinder = + PolyBind.optionBinder(binder, Key.get(RowIngestionMetersFactory.class)); + rowIngestionMetersHandlerProviderBinder + .addBinding("dropwizard") + .to(DropwizardRowIngestionMetersFactory.class) + .in(LazySingleton.class); binder.bind(DropwizardRowIngestionMetersFactory.class).in(LazySingleton.class); configureTaskStorage(binder); @@ -247,12 +248,13 @@ public class CliOverlord extends ServerRunnable JsonConfigProvider.bind(binder, "druid.indexer.storage", TaskStorageConfig.class); PolyBind.createChoice( - binder, "druid.indexer.storage.type", Key.get(TaskStorage.class), Key.get(HeapMemoryTaskStorage.class) - ); - final MapBinder storageBinder = PolyBind.optionBinder( binder, - Key.get(TaskStorage.class) + "druid.indexer.storage.type", + Key.get(TaskStorage.class), + Key.get(HeapMemoryTaskStorage.class) ); + final MapBinder storageBinder = + PolyBind.optionBinder(binder, Key.get(TaskStorage.class)); storageBinder.addBinding("local").to(HeapMemoryTaskStorage.class); binder.bind(HeapMemoryTaskStorage.class).in(LazySingleton.class); diff --git a/services/src/main/java/org/apache/druid/cli/CliPeon.java b/services/src/main/java/org/apache/druid/cli/CliPeon.java index 3ce347c6c5e..991429bc57b 100644 --- a/services/src/main/java/org/apache/druid/cli/CliPeon.java +++ b/services/src/main/java/org/apache/druid/cli/CliPeon.java @@ -173,11 +173,12 @@ public class CliPeon extends GuiceRunnable Key.get(RowIngestionMetersFactory.class), Key.get(DropwizardRowIngestionMetersFactory.class) ); - final MapBinder rowIngestionMetersHandlerProviderBinder = PolyBind.optionBinder( - binder, Key.get(RowIngestionMetersFactory.class) - ); - rowIngestionMetersHandlerProviderBinder.addBinding("dropwizard") - .to(DropwizardRowIngestionMetersFactory.class).in(LazySingleton.class); + final MapBinder rowIngestionMetersHandlerProviderBinder = + PolyBind.optionBinder(binder, Key.get(RowIngestionMetersFactory.class)); + rowIngestionMetersHandlerProviderBinder + .addBinding("dropwizard") + .to(DropwizardRowIngestionMetersFactory.class) + .in(LazySingleton.class); binder.bind(DropwizardRowIngestionMetersFactory.class).in(LazySingleton.class); PolyBind.createChoice( @@ -186,13 +187,16 @@ public class CliPeon extends GuiceRunnable Key.get(ChatHandlerProvider.class), Key.get(ServiceAnnouncingChatHandlerProvider.class) ); - final MapBinder handlerProviderBinder = PolyBind.optionBinder( - binder, Key.get(ChatHandlerProvider.class) - ); - handlerProviderBinder.addBinding("announce") - .to(ServiceAnnouncingChatHandlerProvider.class).in(LazySingleton.class); - handlerProviderBinder.addBinding("noop") - .to(NoopChatHandlerProvider.class).in(LazySingleton.class); + final MapBinder handlerProviderBinder = + PolyBind.optionBinder(binder, Key.get(ChatHandlerProvider.class)); + handlerProviderBinder + .addBinding("announce") + .to(ServiceAnnouncingChatHandlerProvider.class) + .in(LazySingleton.class); + handlerProviderBinder + .addBinding("noop") + .to(NoopChatHandlerProvider.class) + .in(LazySingleton.class); binder.bind(ServiceAnnouncingChatHandlerProvider.class).in(LazySingleton.class); binder.bind(NoopChatHandlerProvider.class).in(LazySingleton.class); @@ -272,21 +276,23 @@ public class CliPeon extends GuiceRunnable Key.get(TaskActionClientFactory.class), Key.get(RemoteTaskActionClientFactory.class) ); - final MapBinder taskActionBinder = PolyBind.optionBinder( - binder, Key.get(TaskActionClientFactory.class) - ); - taskActionBinder.addBinding("local") - .to(LocalTaskActionClientFactory.class).in(LazySingleton.class); + final MapBinder taskActionBinder = + PolyBind.optionBinder(binder, Key.get(TaskActionClientFactory.class)); + taskActionBinder + .addBinding("local") + .to(LocalTaskActionClientFactory.class) + .in(LazySingleton.class); // all of these bindings are so that we can run the peon in local mode JsonConfigProvider.bind(binder, "druid.indexer.storage", TaskStorageConfig.class); binder.bind(TaskStorage.class).to(HeapMemoryTaskStorage.class).in(LazySingleton.class); binder.bind(TaskActionToolbox.class).in(LazySingleton.class); - binder.bind(IndexerMetadataStorageCoordinator.class).to(IndexerSQLMetadataStorageCoordinator.class).in( - LazySingleton.class - ); - taskActionBinder.addBinding("remote") - .to(RemoteTaskActionClientFactory.class).in(LazySingleton.class); - + binder.bind(IndexerMetadataStorageCoordinator.class) + .to(IndexerSQLMetadataStorageCoordinator.class) + .in(LazySingleton.class); + taskActionBinder + .addBinding("remote") + .to(RemoteTaskActionClientFactory.class) + .in(LazySingleton.class); } @Provides diff --git a/services/src/main/java/org/apache/druid/cli/GuiceRunnable.java b/services/src/main/java/org/apache/druid/cli/GuiceRunnable.java index a1ec9d21ab8..fd169505461 100644 --- a/services/src/main/java/org/apache/druid/cli/GuiceRunnable.java +++ b/services/src/main/java/org/apache/druid/cli/GuiceRunnable.java @@ -65,9 +65,7 @@ public abstract class GuiceRunnable implements Runnable public Injector makeInjector() { try { - return Initialization.makeInjectorWithModules( - baseInjector, getModules() - ); + return Initialization.makeInjectorWithModules(baseInjector, getModules()); } catch (Exception e) { throw Throwables.propagate(e); diff --git a/services/src/main/java/org/apache/druid/cli/InsertSegment.java b/services/src/main/java/org/apache/druid/cli/InsertSegment.java index 16bf5a03dd4..3e8afd7766f 100644 --- a/services/src/main/java/org/apache/druid/cli/InsertSegment.java +++ b/services/src/main/java/org/apache/druid/cli/InsertSegment.java @@ -77,7 +77,9 @@ public class InsertSegment extends GuiceRunnable new QueryableModule(), new QueryRunnerFactoryModule(), binder -> JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("tools", "localhost", false, -1, null, true, false) + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("tools", "localhost", false, -1, null, true, false) ) ); } diff --git a/services/src/main/java/org/apache/druid/cli/RouterJettyServerInitializer.java b/services/src/main/java/org/apache/druid/cli/RouterJettyServerInitializer.java index 25e70bf0cf5..42b4b98c6bd 100644 --- a/services/src/main/java/org/apache/druid/cli/RouterJettyServerInitializer.java +++ b/services/src/main/java/org/apache/druid/cli/RouterJettyServerInitializer.java @@ -99,7 +99,8 @@ public class RouterJettyServerInitializer implements JettyServerInitializer if (managementProxyConfig.isEnabled()) { ServletHolder managementForwardingServletHolder = buildServletHolder( - asyncManagementForwardingServlet, globalHttpClientConfig + asyncManagementForwardingServlet, + globalHttpClientConfig ); root.addServlet(managementForwardingServletHolder, "/druid/coordinator/*"); root.addServlet(managementForwardingServletHolder, "/druid/indexer/*"); diff --git a/services/src/main/java/org/apache/druid/guice/RealtimeModule.java b/services/src/main/java/org/apache/druid/guice/RealtimeModule.java index a062fb2acee..5285c5c5ec7 100644 --- a/services/src/main/java/org/apache/druid/guice/RealtimeModule.java +++ b/services/src/main/java/org/apache/druid/guice/RealtimeModule.java @@ -74,11 +74,12 @@ public class RealtimeModule implements Module Key.get(RowIngestionMetersFactory.class), Key.get(DropwizardRowIngestionMetersFactory.class) ); - final MapBinder rowIngestionMetersHandlerProviderBinder = PolyBind.optionBinder( - binder, Key.get(RowIngestionMetersFactory.class) - ); - rowIngestionMetersHandlerProviderBinder.addBinding("dropwizard") - .to(DropwizardRowIngestionMetersFactory.class).in(LazySingleton.class); + final MapBinder rowIngestionMetersHandlerProviderBinder = + PolyBind.optionBinder(binder, Key.get(RowIngestionMetersFactory.class)); + rowIngestionMetersHandlerProviderBinder + .addBinding("dropwizard") + .to(DropwizardRowIngestionMetersFactory.class) + .in(LazySingleton.class); binder.bind(DropwizardRowIngestionMetersFactory.class).in(LazySingleton.class); PolyBind.createChoice( @@ -87,13 +88,16 @@ public class RealtimeModule implements Module Key.get(ChatHandlerProvider.class), Key.get(ServiceAnnouncingChatHandlerProvider.class) ); - final MapBinder handlerProviderBinder = PolyBind.optionBinder( - binder, Key.get(ChatHandlerProvider.class) - ); - handlerProviderBinder.addBinding("announce") - .to(ServiceAnnouncingChatHandlerProvider.class).in(LazySingleton.class); - handlerProviderBinder.addBinding("noop") - .to(NoopChatHandlerProvider.class).in(LazySingleton.class); + final MapBinder handlerProviderBinder = + PolyBind.optionBinder(binder, Key.get(ChatHandlerProvider.class)); + handlerProviderBinder + .addBinding("announce") + .to(ServiceAnnouncingChatHandlerProvider.class) + .in(LazySingleton.class); + handlerProviderBinder + .addBinding("noop") + .to(NoopChatHandlerProvider.class) + .in(LazySingleton.class); JsonConfigProvider.bind(binder, "druid.realtime", RealtimeManagerConfig.class); binder.bind( diff --git a/services/src/test/java/org/apache/druid/cli/validate/DruidJsonValidatorTest.java b/services/src/test/java/org/apache/druid/cli/validate/DruidJsonValidatorTest.java index e25b9113ed5..79260b639eb 100644 --- a/services/src/test/java/org/apache/druid/cli/validate/DruidJsonValidatorTest.java +++ b/services/src/test/java/org/apache/druid/cli/validate/DruidJsonValidatorTest.java @@ -36,10 +36,7 @@ import org.apache.druid.segment.indexing.RealtimeIOConfig; import org.apache.druid.segment.indexing.RealtimeTuningConfig; import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec; import org.apache.druid.segment.realtime.FireDepartment; -import org.apache.druid.segment.realtime.FireDepartmentMetrics; import org.apache.druid.segment.realtime.firehose.LocalFirehoseFactory; -import org.apache.druid.segment.realtime.plumber.Plumber; -import org.apache.druid.segment.realtime.plumber.PlumberSchool; import org.apache.druid.timeline.partition.NoneShardSpec; import org.joda.time.Period; import org.junit.After; @@ -154,16 +151,8 @@ public class DruidJsonValidatorTest jsonMapper ), new RealtimeIOConfig( - new LocalFirehoseFactory(new File("lol"), "rofl", null), new PlumberSchool() - { - @Override - public Plumber findPlumber( - DataSchema schema, RealtimeTuningConfig config, FireDepartmentMetrics metrics - ) - { - return null; - } - }, + new LocalFirehoseFactory(new File("lol"), "rofl", null), + (schema, config, metrics) -> null, null ), diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/filtration/Bounds.java b/sql/src/main/java/org/apache/druid/sql/calcite/filtration/Bounds.java index 868c117129e..2af0baf3332 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/filtration/Bounds.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/filtration/Bounds.java @@ -80,10 +80,9 @@ public class Bounds } else if (upper == null) { return bound.isLowerStrict() ? Range.greaterThan(lower) : Range.atLeast(lower); } else { - return Range.range( - lower, bound.isLowerStrict() ? BoundType.OPEN : BoundType.CLOSED, - upper, bound.isUpperStrict() ? BoundType.OPEN : BoundType.CLOSED - ); + BoundType lowerBoundType = bound.isLowerStrict() ? BoundType.OPEN : BoundType.CLOSED; + BoundType upperBoundType = bound.isUpperStrict() ? BoundType.OPEN : BoundType.CLOSED; + return Range.range(lower, lowerBoundType, upper, upperBoundType); } } diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java b/sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java index 8a1dbc87ab3..3990ded6980 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java @@ -315,8 +315,13 @@ public class SystemSchema extends AbstractSchema Function, Iterable> raGenerator = segment -> Collections .singletonList(AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(segment.getKey().getDataSource())); - final Iterable> authorizedSegments = AuthorizationUtils.filterAuthorizedResources( - authenticationResult, () -> availableSegmentEntries, raGenerator, authorizerMapper); + final Iterable> authorizedSegments = + AuthorizationUtils.filterAuthorizedResources( + authenticationResult, + () -> availableSegmentEntries, + raGenerator, + authorizerMapper + ); return authorizedSegments.iterator(); } @@ -333,7 +338,11 @@ public class SystemSchema extends AbstractSchema AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(segment.getDataSource())); final Iterable authorizedSegments = AuthorizationUtils.filterAuthorizedResources( - authenticationResult, () -> it, raGenerator, authorizerMapper); + authenticationResult, + () -> it, + raGenerator, + authorizerMapper + ); return wrap(authorizedSegments.iterator(), it); } @@ -627,7 +636,11 @@ public class SystemSchema extends AbstractSchema AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(task.getDataSource())); final Iterable authorizedTasks = AuthorizationUtils.filterAuthorizedResources( - authenticationResult, () -> it, raGenerator, authorizerMapper); + authenticationResult, + () -> it, + raGenerator, + authorizerMapper + ); return wrap(authorizedTasks.iterator(), it); } diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/schema/SystemSchemaTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/schema/SystemSchemaTest.java index 528d9725217..f80201e1459 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/schema/SystemSchemaTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/schema/SystemSchemaTest.java @@ -332,17 +332,25 @@ public class SystemSchemaTest extends CalciteTestBase // segment 3 is published but not served // segment 2 is served by 2 servers, so num_replicas=2 - final SystemSchema.SegmentsTable segmentsTable = EasyMock.createMockBuilder(SystemSchema.SegmentsTable.class).withConstructor( - druidSchema, client, mapper, responseHandler, authMapper).createMock(); + final SystemSchema.SegmentsTable segmentsTable = EasyMock + .createMockBuilder(SystemSchema.SegmentsTable.class) + .withConstructor(druidSchema, client, mapper, responseHandler, authMapper) + .createMock(); EasyMock.replay(segmentsTable); - EasyMock.expect(client.makeRequest(HttpMethod.GET, "/druid/coordinator/v1/metadata/segments")).andReturn(request).anyTimes(); + EasyMock + .expect(client.makeRequest(HttpMethod.GET, "/druid/coordinator/v1/metadata/segments")) + .andReturn(request) + .anyTimes(); SettableFuture future = SettableFuture.create(); EasyMock.expect(client.goAsync(request, responseHandler)).andReturn(future).once(); final int ok = HttpServletResponse.SC_OK; EasyMock.expect(responseHandler.getStatus()).andReturn(ok).once(); - EasyMock.expect(request.getUrl()).andReturn(new URL("http://test-host:1234/druid/coordinator/v1/metadata/segments")).anyTimes(); + EasyMock + .expect(request.getUrl()) + .andReturn(new URL("http://test-host:1234/druid/coordinator/v1/metadata/segments")) + .anyTimes(); AppendableByteArrayInputStream in = new AppendableByteArrayInputStream(); //published but unavailable segments diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/util/CalciteTests.java b/sql/src/test/java/org/apache/druid/sql/calcite/util/CalciteTests.java index 8ba21cc8992..0bea3a5bcee 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/util/CalciteTests.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/util/CalciteTests.java @@ -156,9 +156,7 @@ public class CalciteTests return new Authorizer() { @Override - public Access authorize( - AuthenticationResult authenticationResult, Resource resource, Action action - ) + public Access authorize(AuthenticationResult authenticationResult, Resource resource, Action action) { if (authenticationResult.getIdentity().equals(TEST_SUPERUSER_NAME)) { return Access.OK;