From 6906b130e487ec92e8f943ca565fe24ecd1f8a02 Mon Sep 17 00:00:00 2001 From: leventov Date: Sat, 5 Aug 2017 01:40:12 +0300 Subject: [PATCH] Enforce correct spacing with Checkstyle --- .../java/io/druid/data/input/FirehoseV2.java | 2 +- .../druid/data/input/impl/DimensionsSpec.java | 2 +- .../druid/data/input/impl/InputRowParser.java | 4 +- .../java/io/druid/guice/JsonConfigurator.java | 2 +- .../io/druid/data/input/MapBasedRowTest.java | 2 +- .../input/impl/DimensionsSpecSerdeTest.java | 4 +- .../input/impl/FileIteratingFirehoseTest.java | 2 +- .../java/io/druid/guice/PolyBindTest.java | 9 +-- .../CompressedIndexedIntsBenchmark.java | 2 +- .../CompressedVSizeIndexedBenchmark.java | 2 +- .../druid/benchmark/FlattenJSONProfile.java | 4 +- .../StupidPoolConcurrencyBenchmark.java | 2 +- .../benchmark/TopNTypeInterfaceBenchmark.java | 4 +- .../indexing/IndexMergeBenchmark.java | 2 +- .../indexing/IndexPersistBenchmark.java | 2 +- .../benchmark/query/QueryBenchmarkUtil.java | 2 +- .../CostBalancerStrategyBenchmark.java | 6 +- .../spatial/search/PolygonBoundTest.java | 6 +- codestyle/checkstyle-suppressions.xml | 8 ++ codestyle/checkstyle.xml | 22 ++++++ .../collections/OrderedMergeSequence.java | 2 +- .../druid/common/guava/CombiningSequence.java | 6 +- .../java/io/druid/common/utils/JodaUtils.java | 2 +- .../java/io/druid/common/utils/PropUtils.java | 2 +- .../collections/CombiningIterableTest.java | 4 +- .../collections/CombiningIteratorTest.java | 8 +- .../io/druid/collections/IntListTest.java | 12 +-- .../collections/OrderedMergeSequenceTest.java | 35 +------- .../collections/StupidResourceHolderTest.java | 2 +- .../io/druid/common/utils/PropUtilsTest.java | 16 ++-- .../common/utils/SerializerUtilsTest.java | 58 +++++++------- .../io/druid/common/utils/SocketUtilTest.java | 4 +- .../io/druid/common/utils/UUIDUtilsTest.java | 2 +- .../TwitterSpritzerFirehoseFactory.java | 2 +- .../extendedset/intset/AbstractIntSet.java | 2 +- .../extendedset/intset/ConciseSetUtils.java | 2 +- .../intset/ImmutableConciseSet.java | 2 +- .../DruidToTimelineMetricConverter.java | 6 +- .../SendAllTimelineEventConverter.java | 2 +- ...istBasedDruidToTimelineEventConverter.java | 2 +- .../AmbariMetricsEmitterConfigTest.java | 2 +- .../DruidToWhiteListBasedConverterTest.java | 2 +- .../storage/azure/AzureDataSegmentKiller.java | 2 +- .../io/druid/storage/azure/AzureTaskLogs.java | 2 +- .../cassandra/CassandraDataSegmentPuller.java | 4 +- .../cassandra/CassandraDataSegmentPusher.java | 2 +- .../DistinctCountTimeseriesQueryTest.java | 2 +- .../google/GoogleDataSegmentKiller.java | 2 +- .../google/GoogleDataSegmentPusher.java | 2 +- .../druid/storage/google/GoogleTaskLogs.java | 2 +- .../DruidToGraphiteEventConverter.java | 6 +- .../DruidToWhiteListBasedConverterTest.java | 2 +- .../input/orc/DruidOrcInputFormatTest.java | 4 +- .../orc/OrcHadoopInputRowParserTest.java | 2 +- .../rabbitmq/RabbitMQProducerMain.java | 21 +++-- .../druid/query/scan/ScanQueryRunnerTest.java | 5 +- .../aggregation/TimestampAggregator.java | 2 +- .../TimestampAggregatorFactory.java | 8 +- .../TimestampBufferAggregator.java | 2 +- .../TimestampAggregationSelectTest.java | 2 +- .../TimestampGroupByAggregationTest.java | 4 +- .../TimestampMinMaxAggregatorTest.java | 4 +- .../druid/segment/MapVirtualColumnTest.java | 4 +- .../theta/SketchEstimatePostAggregator.java | 2 +- .../theta/SketchEstimateWithErrorBounds.java | 2 +- .../theta/SketchAggregationTest.java | 4 +- .../SketchEstimateWithErrorBoundsTest.java | 2 +- .../storage/hdfs/HdfsDataSegmentPusher.java | 2 +- .../common/tasklogs/HdfsTaskLogsTest.java | 2 +- .../loading/HdfsDataSegmentFinderTest.java | 2 +- .../hdfs/HdfsDataSegmentPusherTest.java | 6 +- .../histogram/ApproximateHistogram.java | 2 +- .../ApproximateHistogramErrorBenchmark.java | 10 +-- .../histogram/ApproximateHistogramTest.java | 26 +++--- .../kafka/KafkaEightFirehoseFactory.java | 2 +- .../kafka/KafkaDataSourceMetadata.java | 2 +- .../kafka/supervisor/KafkaSupervisorTest.java | 79 ++++++++++--------- .../namespace/cache/CacheSchedulerTest.java | 7 +- .../io/druid/server/lookup/DataFetcher.java | 4 +- .../server/lookup/LoadingLookupFactory.java | 4 +- .../io/druid/server/lookup/PollingLookup.java | 2 +- .../cache/polling/OnHeapPollingCache.java | 6 +- .../server/lookup/LoadingLookupTest.java | 4 +- .../lookup/PollingLookupSerDeserTest.java | 2 +- .../lookup/jdbc/JdbcDataFetcherTest.java | 4 +- .../postgresql/PostgreSQLConnector.java | 2 +- .../input/protobuf/ProtoTestEventWrapper.java | 2 +- .../druid/storage/s3/S3DataSegmentFinder.java | 2 +- .../storage/s3/S3DataSegmentFinderTest.java | 4 +- .../storage/s3/S3DataSegmentMoverTest.java | 2 +- .../s3/S3DataSegmentPusherConfigTest.java | 6 +- .../variance/VarianceGroupByQueryTest.java | 2 +- .../variance/VarianceTimeseriesQueryTest.java | 2 +- .../variance/VarianceTopNQueryTest.java | 2 +- .../hll/HyperLogLogCollectorBenchmark.java | 16 ++-- .../druid/hll/HyperLogLogCollectorTest.java | 18 ++--- .../hll/HyperLogLogSerdeBenchmarkTest.java | 8 +- .../io/druid/indexer/IndexGeneratorJob.java | 2 +- .../indexer/path/GranularityPathSpec.java | 2 +- .../java/io/druid/indexer/path/PathSpec.java | 14 ++-- .../indexer/updater/HadoopConverterJob.java | 6 +- .../java/io/druid/indexer/BucketTest.java | 16 ++-- .../indexer/DeterminePartitionsJobTest.java | 32 ++++---- .../io/druid/indexer/HadoopIOPeonTest.java | 2 +- .../indexer/IndexGeneratorCombinerTest.java | 6 +- .../druid/indexer/IndexGeneratorJobTest.java | 2 +- .../hadoop/DatasourceInputSplitTest.java | 2 +- .../hadoop/DatasourceRecordReaderTest.java | 2 +- .../path/GranularUnprocessedPathSpecTest.java | 2 +- .../indexer/path/GranularityPathSpecTest.java | 2 +- .../indexer/path/StaticPathSpecTest.java | 2 +- .../actions/RemoteTaskActionClient.java | 2 +- .../common/config/TaskStorageConfig.java | 2 +- ...ConvertSegmentBackwardsCompatibleTask.java | 2 +- .../druid/indexing/common/task/MoveTask.java | 8 +- .../indexing/overlord/ForkingTaskRunner.java | 8 +- .../overlord/HeapMemoryTaskStorage.java | 12 +-- .../overlord/MetadataTaskStorage.java | 2 +- .../druid/indexing/overlord/TaskLockbox.java | 12 +-- .../io/druid/indexing/overlord/TaskQueue.java | 16 ++-- .../helpers/TaskLogAutoCleanerConfig.java | 4 +- .../common/RetryPolicyFactoryTest.java | 2 +- .../indexing/common/TaskToolboxTest.java | 21 ++--- .../common/task/MergeTaskBaseTest.java | 15 ++-- .../common/tasklogs/FileTaskLogsTest.java | 2 +- .../indexing/overlord/TaskLockboxTest.java | 4 +- .../helpers/TaskLogAutoCleanerConfigTest.java | 2 +- .../http/OverlordRedirectInfoTest.java | 2 +- ...lDistributionWorkerSelectStrategyTest.java | 12 +-- .../JavaScriptWorkerSelectStrategyTest.java | 8 +- .../druid/indexing/test/TestServerView.java | 2 +- .../worker/WorkerTaskMonitorTest.java | 4 +- .../worker/http/WorkerResourceTest.java | 2 +- .../initialization/IndexerZkConfigTest.java | 4 +- .../druid/testing/utils/LoggerListener.java | 2 +- .../tests/indexer/AbstractIndexerTest.java | 2 +- .../java/util/common/CompressionUtils.java | 2 +- .../druid/java/util/common/StringUtils.java | 2 +- .../druid/java/util/common/collect/Utils.java | 4 +- .../common/concurrent/ScheduledExecutors.java | 2 +- .../util/common/guava/DroppingIterator.java | 4 +- .../java/util/common/guava/MergeIterator.java | 4 +- .../guava/nary/SortedMergeIterable.java | 2 +- .../guava/nary/SortedMergeIterator.java | 6 +- .../common/parsers/ToLowerCaseParser.java | 2 +- .../java/util/common/GranularityTest.java | 17 ++-- .../java/util/common/StreamUtilsTest.java | 2 +- .../util/common/guava/ConcatSequenceTest.java | 6 +- .../parsers/FlatTextFormatParserTest.java | 2 +- .../common/parsers/JSONPathParserTest.java | 4 +- .../io/druid/jackson/DefaultObjectMapper.java | 2 +- .../java/io/druid/jackson/SegmentsModule.java | 4 +- .../druid/jackson/StringComparatorModule.java | 2 +- .../IntervalChunkingQueryRunnerDecorator.java | 2 +- .../druid/query/ResultMergeQueryRunner.java | 2 +- .../aggregation/FloatMinBufferAggregator.java | 2 +- .../io/druid/query/aggregation/Histogram.java | 16 ++-- .../HistogramBufferAggregator.java | 6 +- .../query/aggregation/HistogramVisual.java | 6 +- ...gregatorColumnSelectorStrategyFactory.java | 2 +- .../last/FloatLastAggregatorFactory.java | 2 +- .../query/extraction/MapLookupExtractor.java | 4 +- .../java/io/druid/query/filter/DimFilter.java | 34 ++++---- .../io/druid/query/filter/DimFilterUtils.java | 2 +- ...bleValueMatcherColumnSelectorStrategy.java | 2 +- ...oatValueMatcherColumnSelectorStrategy.java | 2 +- ...ongValueMatcherColumnSelectorStrategy.java | 2 +- ...ingValueMatcherColumnSelectorStrategy.java | 2 +- .../epinephelinae/GroupByQueryEngineV2.java | 2 +- .../epinephelinae/RowBasedGrouperHelper.java | 4 +- .../query/lookup/LookupReferencesManager.java | 2 +- .../query/lookup/LookupSnapshotTaker.java | 4 +- .../metadata/metadata/ColumnIncluderator.java | 6 +- .../metadata/SegmentMetadataQuery.java | 4 +- .../query/ordering/StringComparators.java | 2 +- .../search/SearchQueryQueryToolChest.java | 14 ++-- .../druid/query/select/SelectQueryEngine.java | 2 +- .../io/druid/query/spec/QuerySegmentSpec.java | 8 +- .../TimeBoundaryQueryQueryToolChest.java | 2 +- .../druid/query/topn/PooledTopNAlgorithm.java | 18 ++--- .../query/topn/TopNQueryQueryToolChest.java | 4 +- .../TopNColumnSelectorStrategyFactory.java | 2 +- .../java/io/druid/segment/ColumnSelector.java | 4 +- .../main/java/io/druid/segment/Cursor.java | 4 +- .../druid/segment/DimensionHandlerUtils.java | 2 +- .../main/java/io/druid/segment/IndexSpec.java | 2 +- .../main/java/io/druid/segment/Metadata.java | 2 +- .../QueryableIndexIndexableAdapter.java | 2 +- .../druid/segment/column/ColumnBuilder.java | 3 +- .../column/SimpleDictionaryEncodedColumn.java | 4 +- .../io/druid/segment/data/CachingIndexed.java | 2 +- .../data/CompressedIntsIndexedSupplier.java | 9 ++- .../segment/data/CompressionFactory.java | 6 +- .../druid/segment/data/IndexedIterable.java | 2 +- .../segment/data/IntersectingOffset.java | 4 +- .../io/druid/segment/data/UnioningOffset.java | 2 +- .../io/druid/segment/filter/BoundFilter.java | 3 +- .../io/druid/segment/filter/OrFilter.java | 4 +- .../incremental/IncrementalIndexAdapter.java | 4 +- .../incremental/OffheapIncrementalIndex.java | 2 +- .../serde/DoubleGenericColumnPartSerde.java | 2 +- .../io/druid/guice/ExtensionsConfigTest.java | 2 +- .../guice/SegmentMetadataQueryConfigTest.java | 2 +- .../io/druid/query/RetryQueryRunnerTest.java | 4 +- .../aggregation/AggregationTestHelper.java | 6 +- .../aggregation/DoubleMaxAggregationTest.java | 2 +- .../aggregation/DoubleMinAggregationTest.java | 2 +- .../aggregation/FilteredAggregatorTest.java | 4 +- .../aggregation/HistogramAggregatorTest.java | 10 +-- .../query/aggregation/HistogramTest.java | 18 ++--- .../JavaScriptAggregatorBenchmark.java | 4 +- .../aggregation/JavaScriptAggregatorTest.java | 4 +- .../aggregation/LongMaxAggregationTest.java | 6 +- .../aggregation/LongMinAggregationTest.java | 6 +- .../first/DoubleFirstAggregationTest.java | 4 +- .../first/FloatFirstAggregationTest.java | 4 +- .../first/LongFirstAggregationTest.java | 4 +- .../last/DoubleLastAggregationTest.java | 4 +- .../last/FloatLastAggregationTest.java | 4 +- .../last/LongLastAggregationTest.java | 4 +- ...nalizingFieldAccessPostAggregatorTest.java | 16 ++-- .../DataSourceMetadataQueryTest.java | 2 +- .../JavaScriptExtractionFnTest.java | 8 +- .../extraction/LowerExtractionFnTest.java | 4 +- .../extraction/MapLookupExtractorTest.java | 2 +- .../SubstringDimExtractionFnTest.java | 18 ++--- .../TimeFormatExtractionFnTest.java | 30 +++---- .../extraction/UpperExtractionFnTest.java | 4 +- .../query/filter/BoundDimFilterTest.java | 2 +- .../query/groupby/GroupByQueryRunnerTest.java | 36 ++++----- .../GroupByTimeseriesQueryRunnerTest.java | 2 +- .../ByteBufferMinMaxOffsetHeapTest.java | 18 ++--- .../query/groupby/having/HavingSpecTest.java | 16 ++-- .../groupby/orderby/DefaultLimitSpecTest.java | 8 +- .../groupby/orderby/TopNSequenceTest.java | 40 +++++----- .../query/ordering/StringComparatorsTest.java | 30 +++---- .../query/select/SelectQueryRunnerTest.java | 7 +- .../TimeBoundaryQueryRunnerTest.java | 8 +- .../TimeSeriesUnionQueryRunnerTest.java | 2 +- .../TimeseriesQueryRunnerBonusTest.java | 2 +- .../timeseries/TimeseriesQueryRunnerTest.java | 6 +- .../query/timeseries/TimeseriesQueryTest.java | 2 +- .../druid/query/topn/TopNQueryRunnerTest.java | 8 +- .../druid/query/topn/TopNUnionQueryTest.java | 4 +- .../java/io/druid/segment/AppendTest.java | 30 +++---- .../io/druid/segment/IndexMergerTestBase.java | 2 +- .../druid/segment/SchemalessTestFullTest.java | 5 +- .../segment/SchemalessTestSimpleTest.java | 8 +- .../test/java/io/druid/segment/TestIndex.java | 4 +- .../data/BenchmarkIndexibleWrites.java | 12 +-- .../segment/data/BitmapSerdeFactoryTest.java | 4 +- ...ompressedVSizeIntsIndexedSupplierTest.java | 6 +- .../filter/ColumnComparisonFilterTest.java | 12 +-- .../io/druid/segment/filter/InFilterTest.java | 4 +- .../druid/segment/filter/RegexFilterTest.java | 12 +-- .../segment/filter/SearchQueryFilterTest.java | 12 +-- .../segment/filter/TimeFilteringTest.java | 2 +- .../druid/client/HttpServerInventoryView.java | 2 +- .../client/cache/ByteCountingLRUMap.java | 4 +- .../io/druid/client/cache/HybridCache.java | 4 +- .../io/druid/client/cache/LZ4Transcoder.java | 2 +- .../client/cache/MemcacheClientPool.java | 2 +- .../io/druid/client/cache/MemcachedCache.java | 3 +- .../discovery/ServerDiscoverySelector.java | 2 +- .../inventory/CuratorInventoryManager.java | 2 +- .../Log4jShutterDownerModule.java | 2 +- ...QLMetadataStorageActionHandlerFactory.java | 4 +- .../io/druid/segment/indexing/DataSchema.java | 2 +- .../firehose/WikipediaIrcDecoder.java | 8 +- .../DataSegmentChangeRequest.java | 10 +-- .../SegmentChangeRequestHistory.java | 2 +- .../SegmentChangeRequestsSnapshot.java | 2 +- .../server/coordination/ZkCoordinator.java | 2 +- .../coordination/broker/DruidBroker.java | 2 +- .../coordinator/BalancerStrategyFactory.java | 2 +- .../DiskNormalizedCostBalancerStrategy.java | 8 +- .../server/coordinator/DruidCoordinator.java | 2 +- .../DruidCoordinatorRuntimeParams.java | 4 +- .../server/coordinator/LoadQueuePeon.java | 2 +- .../http/LookupCoordinatorResource.java | 4 +- .../security/DatasourceResourceFilter.java | 2 +- .../http/security/RulesResourceFilter.java | 2 +- .../server/initialization/ZkPathsConfig.java | 8 +- .../jetty/JettyServerInitUtils.java | 2 +- .../jetty/ServletFilterHolder.java | 2 +- .../server/log/EmittingRequestLogger.java | 2 +- .../cache/LookupCoordinatorManager.java | 11 ++- ...avaScriptTieredBrokerSelectorStrategy.java | 4 +- .../client/CachingClusteredClientTest.java | 10 +-- .../druid/client/DirectDruidClientTest.java | 4 +- .../client/cache/ByteCountingLRUMapTest.java | 6 +- .../cache/BytesBoundedLinkedQueueTest.java | 2 +- .../druid/client/cache/CacheConfigTest.java | 2 +- .../client/cache/CacheDistributionTest.java | 8 +- .../client/BatchServerInventoryViewTest.java | 4 +- .../indexing/ClientAppendQueryTest.java | 2 +- .../indexing/ClientConversionQueryTest.java | 2 +- .../client/indexing/ClientMergeQueryTest.java | 2 +- .../guice/DruidProcessingModuleTest.java | 2 +- .../initialization/InitializationTest.java | 2 +- .../druid/segment/loading/LoadSpecTest.java | 2 +- .../loading/LocalDataSegmentKillerTest.java | 2 +- .../segment/realtime/RealtimeManagerTest.java | 9 +-- .../firehose/EventReceiverFirehoseTest.java | 4 +- .../druid/server/ClientInfoResourceTest.java | 4 +- .../java/io/druid/server/DruidNodeTest.java | 12 +-- .../io/druid/server/StatusResourceTest.java | 2 +- .../server/audit/SQLAuditManagerTest.java | 4 +- .../SegmentChangeRequestHistoryTest.java | 14 ++-- .../coordinator/DruidCoordinatorTest.java | 8 +- .../server/coordinator/ServerHolderTest.java | 2 +- .../rules/ForeverLoadRuleTest.java | 6 +- .../rules/IntervalLoadRuleTest.java | 2 +- .../coordinator/rules/PeriodLoadRuleTest.java | 6 +- .../http/CoordinatorRedirectInfoTest.java | 2 +- .../server/log/FileRequestLoggerTest.java | 3 +- .../cache/LookupCoordinatorManagerTest.java | 2 +- .../shard/SingleDimensionShardSpecTest.java | 2 +- .../druid/cli/CliInternalHadoopIndexer.java | 2 +- .../CoordinatorJettyServerInitializer.java | 2 +- .../java/io/druid/cli/PullDependencies.java | 5 +- 321 files changed, 929 insertions(+), 928 deletions(-) diff --git a/api/src/main/java/io/druid/data/input/FirehoseV2.java b/api/src/main/java/io/druid/data/input/FirehoseV2.java index 69ead44276da..05f72cc8609b 100644 --- a/api/src/main/java/io/druid/data/input/FirehoseV2.java +++ b/api/src/main/java/io/druid/data/input/FirehoseV2.java @@ -63,7 +63,7 @@ public interface FirehoseV2 extends Closeable /** * @return The current row */ - public InputRow currRow() ; + public InputRow currRow(); /** * Returns a Committer that will "commit" everything read up to the point at which makeCommitter() is called. diff --git a/api/src/main/java/io/druid/data/input/impl/DimensionsSpec.java b/api/src/main/java/io/druid/data/input/impl/DimensionsSpec.java index 3028a7260b73..ecbfb9788871 100644 --- a/api/src/main/java/io/druid/data/input/impl/DimensionsSpec.java +++ b/api/src/main/java/io/druid/data/input/impl/DimensionsSpec.java @@ -101,7 +101,7 @@ public DimensionsSpec( dimensionSchemaMap.put(schema.getName(), schema); } - for(SpatialDimensionSchema spatialSchema : spatialDims) { + for (SpatialDimensionSchema spatialSchema : spatialDims) { DimensionSchema newSchema = DimensionsSpec.convertSpatialSchema(spatialSchema); this.dimensions.add(newSchema); dimensionSchemaMap.put(newSchema.getName(), newSchema); diff --git a/api/src/main/java/io/druid/data/input/impl/InputRowParser.java b/api/src/main/java/io/druid/data/input/impl/InputRowParser.java index c9850bebde99..13c7cc18edf5 100644 --- a/api/src/main/java/io/druid/data/input/impl/InputRowParser.java +++ b/api/src/main/java/io/druid/data/input/impl/InputRowParser.java @@ -31,9 +31,9 @@ }) public interface InputRowParser { - public InputRow parse(T input) ; + public InputRow parse(T input); public ParseSpec getParseSpec(); - public InputRowParser withParseSpec(ParseSpec parseSpec) ; + public InputRowParser withParseSpec(ParseSpec parseSpec); } diff --git a/api/src/main/java/io/druid/guice/JsonConfigurator.java b/api/src/main/java/io/druid/guice/JsonConfigurator.java index 2327be61fba0..ff5c4fc067f5 100644 --- a/api/src/main/java/io/druid/guice/JsonConfigurator.java +++ b/api/src/main/java/io/druid/guice/JsonConfigurator.java @@ -83,7 +83,7 @@ public T configurate(Properties props, String propertyPrefix, Class clazz try { // If it's a String Jackson wants it to be quoted, so check if it's not an object or array and quote. String modifiedPropValue = propValue; - if (! (modifiedPropValue.startsWith("[") || modifiedPropValue.startsWith("{"))) { + if (!(modifiedPropValue.startsWith("[") || modifiedPropValue.startsWith("{"))) { modifiedPropValue = jsonMapper.writeValueAsString(propValue); } value = jsonMapper.readValue(modifiedPropValue, Object.class); diff --git a/api/src/test/java/io/druid/data/input/MapBasedRowTest.java b/api/src/test/java/io/druid/data/input/MapBasedRowTest.java index d3192abf2014..8d98e11ddcf0 100644 --- a/api/src/test/java/io/druid/data/input/MapBasedRowTest.java +++ b/api/src/test/java/io/druid/data/input/MapBasedRowTest.java @@ -32,7 +32,7 @@ public void testGetLongMetricFromString() { MapBasedRow row = new MapBasedRow( new DateTime(), - ImmutableMap.builder() + ImmutableMap.builder() .put("k0", "-1.2") .put("k1", "1.23") .put("k2", "1.8") diff --git a/api/src/test/java/io/druid/data/input/impl/DimensionsSpecSerdeTest.java b/api/src/test/java/io/druid/data/input/impl/DimensionsSpecSerdeTest.java index 1512bc971ada..3bc8f86b776b 100644 --- a/api/src/test/java/io/druid/data/input/impl/DimensionsSpecSerdeTest.java +++ b/api/src/test/java/io/druid/data/input/impl/DimensionsSpecSerdeTest.java @@ -68,8 +68,8 @@ public void testDimensionsSpecSerde() throws Exception List expectedSpatials = Arrays.asList( new SpatialDimensionSchema("DDT", null), - new SpatialDimensionSchema("DDT2", Arrays.asList("A","B")), - new SpatialDimensionSchema("IMPR", Arrays.asList("S","P","Q","R")) + new SpatialDimensionSchema("DDT2", Arrays.asList("A", "B")), + new SpatialDimensionSchema("IMPR", Arrays.asList("S", "P", "Q", "R")) ); Assert.assertEquals(expected, actual); diff --git a/api/src/test/java/io/druid/data/input/impl/FileIteratingFirehoseTest.java b/api/src/test/java/io/druid/data/input/impl/FileIteratingFirehoseTest.java index 7b60959901fe..7335fcbea385 100644 --- a/api/src/test/java/io/druid/data/input/impl/FileIteratingFirehoseTest.java +++ b/api/src/test/java/io/druid/data/input/impl/FileIteratingFirehoseTest.java @@ -61,7 +61,7 @@ public static Collection constructorFeeder() throws IOException final List args = new ArrayList<>(); for (int numSkipHeadRows = 0; numSkipHeadRows < 3; numSkipHeadRows++) { for (List texts : inputTexts) { - args.add(new Object[] { texts, numSkipHeadRows }); + args.add(new Object[] {texts, numSkipHeadRows}); } } diff --git a/api/src/test/java/io/druid/guice/PolyBindTest.java b/api/src/test/java/io/druid/guice/PolyBindTest.java index af090e62cbde..0d1815e6f604 100644 --- a/api/src/test/java/io/druid/guice/PolyBindTest.java +++ b/api/src/test/java/io/druid/guice/PolyBindTest.java @@ -82,11 +82,10 @@ public void configure(Binder binder) gogoSallyBinder.addBinding("a").to(GoA.class); gogoSallyBinder.addBinding("b").to(GoB.class); - PolyBind.createChoice( - binder, "billy", Key.get(Gogo.class, Names.named("reverse")), Key.get(GoB.class) - ); - final MapBinder annotatedGogoBinder = PolyBind.optionBinder( - binder, Key.get(Gogo.class, Names.named("reverse")) + PolyBind.createChoice(binder, "billy", Key.get(Gogo.class, Names.named("reverse")), Key.get(GoB.class)); + final MapBinder annotatedGogoBinder = PolyBind.optionBinder( + binder, + Key.get(Gogo.class, Names.named("reverse")) ); annotatedGogoBinder.addBinding("a").to(GoB.class); annotatedGogoBinder.addBinding("b").to(GoA.class); diff --git a/benchmarks/src/main/java/io/druid/benchmark/CompressedIndexedIntsBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/CompressedIndexedIntsBenchmark.java index 9a5bf336e65e..307ef5d67d4a 100644 --- a/benchmarks/src/main/java/io/druid/benchmark/CompressedIndexedIntsBenchmark.java +++ b/benchmarks/src/main/java/io/druid/benchmark/CompressedIndexedIntsBenchmark.java @@ -95,7 +95,7 @@ public void setup() throws IOException int rowToAccess = rand.nextInt(vals.length); // Skip already selected rows if any while (filter.get(rowToAccess)) { - rowToAccess = (rowToAccess+1) % vals.length; + rowToAccess = (rowToAccess + 1) % vals.length; } filter.set(rowToAccess); } diff --git a/benchmarks/src/main/java/io/druid/benchmark/CompressedVSizeIndexedBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/CompressedVSizeIndexedBenchmark.java index 106854cd0386..c0b1c7f10973 100644 --- a/benchmarks/src/main/java/io/druid/benchmark/CompressedVSizeIndexedBenchmark.java +++ b/benchmarks/src/main/java/io/druid/benchmark/CompressedVSizeIndexedBenchmark.java @@ -126,7 +126,7 @@ public VSizeIndexedInts apply(int[] input) int rowToAccess = rand.nextInt(rows.size()); // Skip already selected rows if any while (filter.get(rowToAccess)) { - rowToAccess = (rowToAccess+1) % rows.size(); + rowToAccess = (rowToAccess + 1) % rows.size(); } filter.set(rowToAccess); } diff --git a/benchmarks/src/main/java/io/druid/benchmark/FlattenJSONProfile.java b/benchmarks/src/main/java/io/druid/benchmark/FlattenJSONProfile.java index 37e16c9b42dd..b435bc12d0af 100644 --- a/benchmarks/src/main/java/io/druid/benchmark/FlattenJSONProfile.java +++ b/benchmarks/src/main/java/io/druid/benchmark/FlattenJSONProfile.java @@ -95,12 +95,12 @@ public static void main(String[] args) throws Exception control.clearCPUData(); Thread.sleep(5000); control.startCPUSampling(null); - for(int i = 0; i < numEvents; i++) { + for (int i = 0; i < numEvents; i++) { //parsedMap = parser.parse(fjp.nestedInputs.get(i)); parsedMap = fjp.parseFlat(forcedParser); //parsedMap = fjp.parseFlat(parser); //parsedMap = fjp.parseNested(nestedPar); - if(parsedMap != null) { + if (parsedMap != null) { j++; } } diff --git a/benchmarks/src/main/java/io/druid/benchmark/StupidPoolConcurrencyBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/StupidPoolConcurrencyBenchmark.java index 887baf432687..300f8e14a8be 100644 --- a/benchmarks/src/main/java/io/druid/benchmark/StupidPoolConcurrencyBenchmark.java +++ b/benchmarks/src/main/java/io/druid/benchmark/StupidPoolConcurrencyBenchmark.java @@ -84,7 +84,7 @@ public Object get() @OutputTimeUnit(TimeUnit.MICROSECONDS) public void hammerQueue(BenchmarkPool pool, Blackhole blackhole) throws IOException { - try(ResourceHolder holder = pool.pool.take()){ + try (ResourceHolder holder = pool.pool.take()) { blackhole.consume(holder); } } diff --git a/benchmarks/src/main/java/io/druid/benchmark/TopNTypeInterfaceBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/TopNTypeInterfaceBenchmark.java index 542642962edc..f3fa2fb1751c 100644 --- a/benchmarks/src/main/java/io/druid/benchmark/TopNTypeInterfaceBenchmark.java +++ b/benchmarks/src/main/java/io/druid/benchmark/TopNTypeInterfaceBenchmark.java @@ -250,11 +250,11 @@ public void setup() throws IOException queryBuilder.threshold(threshold); stringQuery = queryBuilder.build(); - TopNQueryBuilder longBuilder = SCHEMA_QUERY_MAP.get("basic").get("long"); + TopNQueryBuilder longBuilder = SCHEMA_QUERY_MAP.get("basic").get("long"); longBuilder.threshold(threshold); longQuery = longBuilder.build(); - TopNQueryBuilder floatBuilder = SCHEMA_QUERY_MAP.get("basic").get("float"); + TopNQueryBuilder floatBuilder = SCHEMA_QUERY_MAP.get("basic").get("float"); floatBuilder.threshold(threshold); floatQuery = floatBuilder.build(); diff --git a/benchmarks/src/main/java/io/druid/benchmark/indexing/IndexMergeBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/indexing/IndexMergeBenchmark.java index 2b2967b71fca..842c7245e3df 100644 --- a/benchmarks/src/main/java/io/druid/benchmark/indexing/IndexMergeBenchmark.java +++ b/benchmarks/src/main/java/io/druid/benchmark/indexing/IndexMergeBenchmark.java @@ -105,7 +105,7 @@ public int columnCacheSizeBytes() @Setup public void setup() throws IOException { - log.info("SETUP CALLED AT " + + System.currentTimeMillis()); + log.info("SETUP CALLED AT " + System.currentTimeMillis()); if (ComplexMetrics.getSerdeForType("hyperUnique") == null) { ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde(HyperLogLogHash.getDefault())); diff --git a/benchmarks/src/main/java/io/druid/benchmark/indexing/IndexPersistBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/indexing/IndexPersistBenchmark.java index b59ab7ccf9d7..c5e41f08fd4c 100644 --- a/benchmarks/src/main/java/io/druid/benchmark/indexing/IndexPersistBenchmark.java +++ b/benchmarks/src/main/java/io/druid/benchmark/indexing/IndexPersistBenchmark.java @@ -103,7 +103,7 @@ public int columnCacheSizeBytes() @Setup public void setup() throws IOException { - log.info("SETUP CALLED AT " + + System.currentTimeMillis()); + log.info("SETUP CALLED AT " + System.currentTimeMillis()); if (ComplexMetrics.getSerdeForType("hyperUnique") == null) { ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde(HyperLogLogHash.getDefault())); diff --git a/benchmarks/src/main/java/io/druid/benchmark/query/QueryBenchmarkUtil.java b/benchmarks/src/main/java/io/druid/benchmark/query/QueryBenchmarkUtil.java index 3336d2946ffe..0ffe8cce4f2c 100644 --- a/benchmarks/src/main/java/io/druid/benchmark/query/QueryBenchmarkUtil.java +++ b/benchmarks/src/main/java/io/druid/benchmark/query/QueryBenchmarkUtil.java @@ -47,7 +47,7 @@ public static > QueryRunner makeQueryRunner( segmentId, adapter.getDataInterval().getStart(), factory.createRunner(adapter) ), - (QueryToolChest>)factory.getToolchest() + (QueryToolChest>) factory.getToolchest() ); } diff --git a/benchmarks/src/main/java/io/druid/server/coordinator/CostBalancerStrategyBenchmark.java b/benchmarks/src/main/java/io/druid/server/coordinator/CostBalancerStrategyBenchmark.java index a30b5f2fa19e..ef4eca1ca57a 100644 --- a/benchmarks/src/main/java/io/druid/server/coordinator/CostBalancerStrategyBenchmark.java +++ b/benchmarks/src/main/java/io/druid/server/coordinator/CostBalancerStrategyBenchmark.java @@ -57,8 +57,8 @@ public void setupDummyCluster() Random r = new Random(1234); segments = new ArrayList<>(n); - for(int i = 0; i < n; ++i) { - final DateTime t = t0.minusHours(r.nextInt(365 * 24) - 365*12); + for (int i = 0; i < n; ++i) { + final DateTime t = t0.minusHours(r.nextInt(365 * 24) - 365 * 12); segments.add(createSegment(t)); } } @@ -85,7 +85,7 @@ DataSegment createSegment(DateTime t) public double measureCostStrategySingle() throws InterruptedException { double totalCost = 0; - for(DataSegment s : segments) { + for (DataSegment s : segments) { totalCost += CostBalancerStrategy.computeJointSegmentsCost(segment, s); } return totalCost; diff --git a/bytebuffer-collections/src/test/java/io/druid/collections/spatial/search/PolygonBoundTest.java b/bytebuffer-collections/src/test/java/io/druid/collections/spatial/search/PolygonBoundTest.java index b9c3812e4274..de10fd8c52c4 100755 --- a/bytebuffer-collections/src/test/java/io/druid/collections/spatial/search/PolygonBoundTest.java +++ b/bytebuffer-collections/src/test/java/io/druid/collections/spatial/search/PolygonBoundTest.java @@ -50,7 +50,7 @@ public void testCacheKey() @Test public void testContains() { - final PolygonBound triangle = PolygonBound.from(new float[]{1f, 4f, 7f}, new float[]{ 1f, 4f, 1f}); + final PolygonBound triangle = PolygonBound.from(new float[]{1f, 4f, 7f}, new float[]{1f, 4f, 1f}); final float delta = 1e-5f; Assert.assertTrue(triangle.contains(new float[]{1f, 1f})); @@ -64,11 +64,11 @@ public void testContains() Assert.assertFalse(triangle.contains(new float[]{1f, 5f})); Assert.assertTrue(triangle.contains(new float[]{3f, 2f})); - final PolygonBound rightTriangle = PolygonBound.from(new float[]{1f, 1f, 5f}, new float[]{ 1f, 5f, 1f}); + final PolygonBound rightTriangle = PolygonBound.from(new float[]{1f, 1f, 5f}, new float[]{1f, 5f, 1f}); Assert.assertTrue(rightTriangle.contains(new float[]{1f, 5f})); Assert.assertTrue(rightTriangle.contains(new float[]{2f, 4f})); - Assert.assertTrue(rightTriangle.contains(new float[]{2f - delta , 4f})); + Assert.assertTrue(rightTriangle.contains(new float[]{2f - delta, 4f})); Assert.assertFalse(rightTriangle.contains(new float[]{2f + delta, 4f})); Assert.assertTrue(rightTriangle.contains(new float[]{2f, 4f - delta})); Assert.assertFalse(rightTriangle.contains(new float[]{2f, 4f + delta})); diff --git a/codestyle/checkstyle-suppressions.xml b/codestyle/checkstyle-suppressions.xml index eedddb162c53..1a0071dfb391 100644 --- a/codestyle/checkstyle-suppressions.xml +++ b/codestyle/checkstyle-suppressions.xml @@ -37,6 +37,14 @@ + + + + + + + + diff --git a/codestyle/checkstyle.xml b/codestyle/checkstyle.xml index 9d51b54a7b30..e7c7ae24ce1d 100644 --- a/codestyle/checkstyle.xml +++ b/codestyle/checkstyle.xml @@ -68,6 +68,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/java/io/druid/collections/OrderedMergeSequence.java b/common/src/main/java/io/druid/collections/OrderedMergeSequence.java index 19d02be9164b..1568701ee89f 100644 --- a/common/src/main/java/io/druid/collections/OrderedMergeSequence.java +++ b/common/src/main/java/io/druid/collections/OrderedMergeSequence.java @@ -203,7 +203,7 @@ public boolean isDone() public void close() throws IOException { Closer closer = Closer.create(); - while(!pQueue.isEmpty()) { + while (!pQueue.isEmpty()) { closer.register(pQueue.remove()); } closer.close(); diff --git a/common/src/main/java/io/druid/common/guava/CombiningSequence.java b/common/src/main/java/io/druid/common/guava/CombiningSequence.java index 58cd46bc31a6..e59481a59553 100644 --- a/common/src/main/java/io/druid/common/guava/CombiningSequence.java +++ b/common/src/main/java/io/druid/common/guava/CombiningSequence.java @@ -92,17 +92,17 @@ private Yielder makeYielder( final OutType retVal; final boolean finalFinalValue; - if(!yielder.isDone()) { + if (!yielder.isDone()) { retVal = combiningAccumulator.getRetVal(); finalYielder = null; finalFinalValue = false; } else { - if(!finalValue && combiningAccumulator.accumulatedSomething()) { + if (!finalValue && combiningAccumulator.accumulatedSomething()) { combiningAccumulator.accumulateLastValue(); retVal = combiningAccumulator.getRetVal(); finalFinalValue = true; - if(!combiningAccumulator.yielded()) { + if (!combiningAccumulator.yielded()) { return Yielders.done(retVal, yielder); } else { finalYielder = Yielders.done(null, yielder); diff --git a/common/src/main/java/io/druid/common/utils/JodaUtils.java b/common/src/main/java/io/druid/common/utils/JodaUtils.java index ee5798bf2cec..bc46320774dc 100644 --- a/common/src/main/java/io/druid/common/utils/JodaUtils.java +++ b/common/src/main/java/io/druid/common/utils/JodaUtils.java @@ -60,7 +60,7 @@ public static ArrayList condenseIntervals(Iterable intervals if (currInterval.abuts(next)) { currInterval = new Interval(currInterval.getStart(), next.getEnd()); - } else if(currInterval.overlaps(next)) { + } else if (currInterval.overlaps(next)) { DateTime nextEnd = next.getEnd(); DateTime currEnd = currInterval.getEnd(); currInterval = new Interval( diff --git a/common/src/main/java/io/druid/common/utils/PropUtils.java b/common/src/main/java/io/druid/common/utils/PropUtils.java index 1d73834ebd52..bb5171575c85 100644 --- a/common/src/main/java/io/druid/common/utils/PropUtils.java +++ b/common/src/main/java/io/druid/common/utils/PropUtils.java @@ -59,7 +59,7 @@ public static int getPropertyAsInt(Properties props, String property, Integer de return Integer.parseInt(retVal); } catch (NumberFormatException e) { - throw new ISE(e, "Property[%s] is expected to be an int, it is not[%s].",property, retVal); + throw new ISE(e, "Property[%s] is expected to be an int, it is not[%s].", property, retVal); } } } diff --git a/common/src/test/java/io/druid/collections/CombiningIterableTest.java b/common/src/test/java/io/druid/collections/CombiningIterableTest.java index b87c739e6d5b..9bb98ad129fa 100644 --- a/common/src/test/java/io/druid/collections/CombiningIterableTest.java +++ b/common/src/test/java/io/druid/collections/CombiningIterableTest.java @@ -49,8 +49,8 @@ public void testCreateSplatted() iterators, Ordering.natural() ); - Assert.assertEquals(mergedLists.size(),Iterables.size(actualIterable)); + Assert.assertEquals(mergedLists.size(), Iterables.size(actualIterable)); Set actualHashset = Sets.newHashSet(actualIterable); - Assert.assertEquals(actualHashset,mergedLists); + Assert.assertEquals(actualHashset, mergedLists); } } diff --git a/common/src/test/java/io/druid/collections/CombiningIteratorTest.java b/common/src/test/java/io/druid/collections/CombiningIteratorTest.java index 9b50e9debaf4..168fa1723015 100644 --- a/common/src/test/java/io/druid/collections/CombiningIteratorTest.java +++ b/common/src/test/java/io/druid/collections/CombiningIteratorTest.java @@ -45,7 +45,7 @@ public void setUp() peekIterator = EasyMock.createMock(PeekingIterator.class); comparator = EasyMock.createMock(Comparator.class); binaryFn = EasyMock.createMock(BinaryFn.class); - testingIterator = CombiningIterator.create(peekIterator,comparator,binaryFn); + testingIterator = CombiningIterator.create(peekIterator, comparator, binaryFn); } @After @@ -62,7 +62,7 @@ public void testHasNext() EasyMock.replay(peekIterator); boolean actual = testingIterator.hasNext(); EasyMock.verify(peekIterator); - Assert.assertEquals("The hasNext function is broken",expected,actual); + Assert.assertEquals("The hasNext function is broken", expected, actual); } @Test @@ -75,7 +75,7 @@ public void testFalseBranchNext() EasyMock.replay(peekIterator); Object res = testingIterator.next(); EasyMock.verify(peekIterator); - Assert.assertNull("Should be null",res); + Assert.assertNull("Should be null", res); } @Test @@ -102,7 +102,7 @@ public void testNext() EasyMock.replay(comparator); String actual = testingIterator.next(); - Assert.assertEquals(resString,actual); + Assert.assertEquals(resString, actual); EasyMock.verify(peekIterator); EasyMock.verify(comparator); diff --git a/common/src/test/java/io/druid/collections/IntListTest.java b/common/src/test/java/io/druid/collections/IntListTest.java index 0b03f97765ca..a46c2f61420f 100644 --- a/common/src/test/java/io/druid/collections/IntListTest.java +++ b/common/src/test/java/io/druid/collections/IntListTest.java @@ -83,7 +83,7 @@ public void testExceptionInGet() @Test public void testToArray() { - int[] inputArray = {1,3,4}; + int[] inputArray = {1, 3, 4}; IntList list = new IntList(); for (int i = 0; i < inputArray.length; i++) { list.add(inputArray[i]); @@ -97,10 +97,10 @@ public void testNullCaseGetBaseList() { final int intSize = 2; IntList list = new IntList(intSize); - list.set(2 * intSize,100); + list.set(2 * intSize, 100); IntBuffer outBuffer; outBuffer = list.getBaseList(0); - Assert.assertNull("Should be Null",outBuffer); + Assert.assertNull("Should be Null", outBuffer); } @Test @@ -108,13 +108,13 @@ public void testGetBaseList() { int listSize = 2; IntList list = new IntList(listSize); - int[] expectedArray = {1,2}; + int[] expectedArray = {1, 2}; list.add(expectedArray[0]); list.add(expectedArray[1]); IntBuffer outputBuffer = list.getBaseList(0); - Assert.assertEquals("Buffer size does not match",2, outputBuffer.limit()); + Assert.assertEquals("Buffer size does not match", 2, outputBuffer.limit()); int[] actualArray = new int[outputBuffer.capacity()]; outputBuffer.get(actualArray); - Assert.assertArrayEquals("Arrays are not matching",expectedArray, actualArray); + Assert.assertArrayEquals("Arrays are not matching", expectedArray, actualArray); } } diff --git a/common/src/test/java/io/druid/collections/OrderedMergeSequenceTest.java b/common/src/test/java/io/druid/collections/OrderedMergeSequenceTest.java index 3958f53012e7..07220f5dd4ac 100644 --- a/common/src/test/java/io/druid/collections/OrderedMergeSequenceTest.java +++ b/common/src/test/java/io/druid/collections/OrderedMergeSequenceTest.java @@ -19,22 +19,18 @@ package io.druid.collections; -import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Ordering; - import io.druid.java.util.common.guava.BaseSequence; import io.druid.java.util.common.guava.MergeSequence; import io.druid.java.util.common.guava.Sequence; import io.druid.java.util.common.guava.SequenceTestHelper; import io.druid.java.util.common.guava.Sequences; import io.druid.java.util.common.guava.TestSequence; - import org.junit.Assert; import org.junit.Test; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -288,19 +284,7 @@ private OrderedMergeSequence makeMergedSequence( { return new OrderedMergeSequence( ordering, - Sequences.simple( - Lists.transform( // OMG WTF, the java type system really annoys me at times... - seqs, - new Function, Sequence>() - { - @Override - public Sequence apply(@Nullable TestSequence input) - { - return input; - } - } - ) - ) + Sequences.simple((List>) (List) seqs) ); } @@ -309,22 +293,7 @@ private MergeSequence makeUnorderedMergedSequence( List> seqs ) { - return new MergeSequence( - ordering, - Sequences.simple( - Lists.transform( // OMG WTF, the java type system really annoys me at times... - seqs, - new Function, Sequence>() - { - @Override - public Sequence apply(@Nullable TestSequence input) - { - return input; - } - } - ) - ) - ); + return new MergeSequence(ordering, Sequences.simple(seqs)); } @Test diff --git a/common/src/test/java/io/druid/collections/StupidResourceHolderTest.java b/common/src/test/java/io/druid/collections/StupidResourceHolderTest.java index 89b80bfb3d40..43d0bc506f22 100644 --- a/common/src/test/java/io/druid/collections/StupidResourceHolderTest.java +++ b/common/src/test/java/io/druid/collections/StupidResourceHolderTest.java @@ -34,7 +34,7 @@ public void testCreateAndGet() throws IOException String expected = "String"; resourceHolder = StupidResourceHolder.create(expected); String actual = resourceHolder.get(); - Assert.assertEquals(expected,actual); + Assert.assertEquals(expected, actual); resourceHolder.close(); } } diff --git a/common/src/test/java/io/druid/common/utils/PropUtilsTest.java b/common/src/test/java/io/druid/common/utils/PropUtilsTest.java index 036625dae5da..b96975f727c1 100644 --- a/common/src/test/java/io/druid/common/utils/PropUtilsTest.java +++ b/common/src/test/java/io/druid/common/utils/PropUtilsTest.java @@ -32,22 +32,22 @@ public class PropUtilsTest public void testNotSpecifiedGetProperty() { Properties prop = new Properties(); - PropUtils.getProperty(prop,""); + PropUtils.getProperty(prop, ""); } @Test public void testGetProperty() { Properties prop = new Properties(); - prop.setProperty("key","value"); - Assert.assertEquals("value", PropUtils.getProperty(prop,"key")); + prop.setProperty("key", "value"); + Assert.assertEquals("value", PropUtils.getProperty(prop, "key")); } @Test(expected = ISE.class) public void testNotSpecifiedGetPropertyAsInt() { Properties prop = new Properties(); - PropUtils.getPropertyAsInt(prop,"",null); + PropUtils.getPropertyAsInt(prop, "", null); } @Test @@ -55,7 +55,7 @@ public void testDefaultValueGetPropertyAsInt() { Properties prop = new Properties(); int defaultValue = 1; - int result = PropUtils.getPropertyAsInt(prop,"",defaultValue); + int result = PropUtils.getPropertyAsInt(prop, "", defaultValue); Assert.assertEquals(defaultValue, result); } @@ -65,7 +65,7 @@ public void testParseGetPropertyAsInt() Properties prop = new Properties(); int expectedValue = 1; prop.setProperty("key", Integer.toString(expectedValue)); - int result = PropUtils.getPropertyAsInt(prop,"key"); + int result = PropUtils.getPropertyAsInt(prop, "key"); Assert.assertEquals(expectedValue, result); } @@ -73,7 +73,7 @@ public void testParseGetPropertyAsInt() public void testFormatExceptionGetPropertyAsInt() { Properties prop = new Properties(); - prop.setProperty("key","1-value"); - PropUtils.getPropertyAsInt(prop,"key",null); + prop.setProperty("key", "1-value"); + PropUtils.getPropertyAsInt(prop, "key", null); } } diff --git a/common/src/test/java/io/druid/common/utils/SerializerUtilsTest.java b/common/src/test/java/io/druid/common/utils/SerializerUtilsTest.java index 9182f5168627..3d80776131cc 100644 --- a/common/src/test/java/io/druid/common/utils/SerializerUtilsTest.java +++ b/common/src/test/java/io/druid/common/utils/SerializerUtilsTest.java @@ -37,15 +37,15 @@ public class SerializerUtilsTest { private SerializerUtils serializerUtils; - private final float delta = 0; - private final String [] strings = {"1#","2","3"}; - private final int [] ints = {1,2,3}; - private final float [] floats = {1.1f,2,3}; - private final long [] longs = {3,2,1}; - private byte [] stringsByte; - private byte [] intsByte; - private byte [] floatsByte; - private byte [] longsByte; + private final float delta = 0; + private final String[] strings = {"1#", "2", "3"}; + private final int[] ints = {1, 2, 3}; + private final float[] floats = {1.1f, 2, 3}; + private final long[] longs = {3, 2, 1}; + private byte[] stringsByte; + private byte[] intsByte; + private byte[] floatsByte; + private byte[] longsByte; private ByteArrayOutputStream outStream; @Before @@ -54,8 +54,8 @@ public void setUpByteArrays() throws IOException ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bos); out.writeInt(strings.length); - for (int i = 0;i < strings.length;i++) { - byte [] stringBytes = StringUtils.toUtf8(strings[i]); + for (int i = 0; i < strings.length; i++) { + byte[] stringBytes = StringUtils.toUtf8(strings[i]); out.writeInt(stringBytes.length); out.write(StringUtils.toUtf8(strings[i])); } @@ -65,7 +65,7 @@ public void setUpByteArrays() throws IOException bos = new ByteArrayOutputStream(); out = new DataOutputStream(bos); out.writeInt(ints.length); - for (int i = 0;i < ints.length;i++) { + for (int i = 0; i < ints.length; i++) { out.writeInt(ints[i]); } out.close(); @@ -74,7 +74,7 @@ public void setUpByteArrays() throws IOException bos = new ByteArrayOutputStream(); out = new DataOutputStream(bos); out.writeInt(floats.length); - for (int i = 0;i < ints.length;i++) { + for (int i = 0; i < ints.length; i++) { out.writeFloat(floats[i]); } out.close(); @@ -83,7 +83,7 @@ public void setUpByteArrays() throws IOException bos = new ByteArrayOutputStream(); out = new DataOutputStream(bos); out.writeInt(longs.length); - for (int i = 0;i < longs.length;i++) { + for (int i = 0; i < longs.length; i++) { out.writeLong(longs[i]); } out.close(); @@ -97,7 +97,7 @@ public void setUpByteArrays() throws IOException public void testWriteInts() throws IOException { serializerUtils.writeInts(outStream, ints); - byte [] actuals = outStream.toByteArray(); + byte[] actuals = outStream.toByteArray(); Assert.assertArrayEquals(intsByte, actuals); } @@ -105,11 +105,11 @@ public void testWriteInts() throws IOException public void testWriteIntList() throws IOException { IntList list = new IntList(); - for (int i = 0;i < ints.length;i++) { + for (int i = 0; i < ints.length; i++) { list.add(ints[i]); } serializerUtils.writeInts(outStream, list); - byte [] actuals = outStream.toByteArray(); + byte[] actuals = outStream.toByteArray(); Assert.assertArrayEquals(intsByte, actuals); } @@ -117,7 +117,7 @@ public void testWriteIntList() throws IOException public void testWriteFloats() throws IOException { serializerUtils.writeFloats(outStream, floats); - byte [] actuals = outStream.toByteArray(); + byte[] actuals = outStream.toByteArray(); Assert.assertArrayEquals(floatsByte, actuals); } @@ -133,23 +133,23 @@ public void testChannelWritefloat() throws IOException } float expected = serializerUtils.readFloat(inputstream); float actuals = floats[index]; - Assert.assertEquals(expected, actuals,delta); + Assert.assertEquals(expected, actuals, delta); } @Test public void testWriteLongs() throws IOException { serializerUtils.writeLongs(outStream, longs); - byte [] actuals = outStream.toByteArray(); - Assert.assertArrayEquals(longsByte,actuals); + byte[] actuals = outStream.toByteArray(); + Assert.assertArrayEquals(longsByte, actuals); } @Test public void testWriteStrings() throws IOException { serializerUtils.writeStrings(outStream, strings); - byte [] actuals = outStream.toByteArray(); - Assert.assertArrayEquals(stringsByte,actuals); + byte[] actuals = outStream.toByteArray(); + Assert.assertArrayEquals(stringsByte, actuals); } @Test @@ -170,7 +170,7 @@ public void testChannelWritelong() throws IOException public void testReadInts() throws IOException { ByteArrayInputStream inputstream = new ByteArrayInputStream(intsByte); - int [] actuals = serializerUtils.readInts(inputstream); + int[] actuals = serializerUtils.readInts(inputstream); inputstream.close(); Assert.assertArrayEquals(ints, actuals); } @@ -179,7 +179,7 @@ public void testReadInts() throws IOException public void testReadFloats() throws IOException { ByteArrayInputStream inputstream = new ByteArrayInputStream(floatsByte); - float [] actuals = serializerUtils.readFloats(inputstream); + float[] actuals = serializerUtils.readFloats(inputstream); inputstream.close(); Assert.assertArrayEquals(floats, actuals, delta); } @@ -188,16 +188,16 @@ public void testReadFloats() throws IOException public void testReadLongs() throws IOException { ByteArrayInputStream inputstream = new ByteArrayInputStream(longsByte); - long [] actuals = serializerUtils.readLongs(inputstream); + long[] actuals = serializerUtils.readLongs(inputstream); inputstream.close(); Assert.assertArrayEquals(longs, actuals); } @Test - public void testReadStrings()throws IOException + public void testReadStrings() throws IOException { ByteArrayInputStream inputstream = new ByteArrayInputStream(stringsByte); - String [] actuals = serializerUtils.readStrings(inputstream); + String[] actuals = serializerUtils.readStrings(inputstream); inputstream.close(); Assert.assertArrayEquals(strings, actuals); } @@ -222,7 +222,7 @@ public void testByteBufferReadStrings() throws IOException ByteBuffer buffer = ByteBuffer.allocate(stringsByte.length); buffer.put(stringsByte); buffer.flip(); - String [] actuals = serializerUtils.readStrings(buffer); + String[] actuals = serializerUtils.readStrings(buffer); Assert.assertArrayEquals(strings, actuals); } diff --git a/common/src/test/java/io/druid/common/utils/SocketUtilTest.java b/common/src/test/java/io/druid/common/utils/SocketUtilTest.java index be24255ae5f6..e28e9848ae4b 100644 --- a/common/src/test/java/io/druid/common/utils/SocketUtilTest.java +++ b/common/src/test/java/io/druid/common/utils/SocketUtilTest.java @@ -32,8 +32,8 @@ public class SocketUtilTest public void testSocketUtil() { int port = SocketUtil.findOpenPort(0); - Assert.assertThat("Port is greater than the maximum port 0xffff",port, OrderingComparison.lessThanOrEqualTo(MAX_PORT)); - Assert.assertThat("Port is less than minimum port 0",port, OrderingComparison.greaterThanOrEqualTo(0)); + Assert.assertThat("Port is greater than the maximum port 0xffff", port, OrderingComparison.lessThanOrEqualTo(MAX_PORT)); + Assert.assertThat("Port is less than minimum port 0", port, OrderingComparison.greaterThanOrEqualTo(0)); } @Test(expected = IllegalArgumentException.class) diff --git a/common/src/test/java/io/druid/common/utils/UUIDUtilsTest.java b/common/src/test/java/io/druid/common/utils/UUIDUtilsTest.java index a7d5385ba185..008c8d6f9430 100644 --- a/common/src/test/java/io/druid/common/utils/UUIDUtilsTest.java +++ b/common/src/test/java/io/druid/common/utils/UUIDUtilsTest.java @@ -53,7 +53,7 @@ public static Collection constructorFeeder() } } } - for(String possibleArg : possibleArgs){ + for (String possibleArg : possibleArgs) { args.add(new String[]{possibleArg}); } return Collections2.transform( diff --git a/examples/src/main/java/io/druid/examples/twitter/TwitterSpritzerFirehoseFactory.java b/examples/src/main/java/io/druid/examples/twitter/TwitterSpritzerFirehoseFactory.java index a110d5d12df1..8f11561df428 100644 --- a/examples/src/main/java/io/druid/examples/twitter/TwitterSpritzerFirehoseFactory.java +++ b/examples/src/main/java/io/druid/examples/twitter/TwitterSpritzerFirehoseFactory.java @@ -352,7 +352,7 @@ public String apply(HashtagEntity input) theMap.put("location", hasUser ? user.getLocation() : ""); theMap.put("verified", hasUser ? user.isVerified() : ""); - theMap.put("ts",status.getCreatedAt().getTime()); + theMap.put("ts", status.getCreatedAt().getTime()); List dimensions = Lists.newArrayList(theMap.keySet()); diff --git a/extendedset/src/main/java/io/druid/extendedset/intset/AbstractIntSet.java b/extendedset/src/main/java/io/druid/extendedset/intset/AbstractIntSet.java index 6bd0e24153a8..5ca571d622de 100755 --- a/extendedset/src/main/java/io/druid/extendedset/intset/AbstractIntSet.java +++ b/extendedset/src/main/java/io/druid/extendedset/intset/AbstractIntSet.java @@ -471,7 +471,7 @@ public String toString() StringBuilder sb = new StringBuilder(); sb.append('['); - for (; ; ) { + while (true) { int e = itr.next(); sb.append(e); if (!itr.hasNext()) { diff --git a/extendedset/src/main/java/io/druid/extendedset/intset/ConciseSetUtils.java b/extendedset/src/main/java/io/druid/extendedset/intset/ConciseSetUtils.java index 6c3ece0797e1..35438fcb7f67 100755 --- a/extendedset/src/main/java/io/druid/extendedset/intset/ConciseSetUtils.java +++ b/extendedset/src/main/java/io/druid/extendedset/intset/ConciseSetUtils.java @@ -335,6 +335,6 @@ public static int clearBitsAfterInLastWord(int lastWord, int lastSetBit) public static int onesUntil(int bit) { - return 0x80000000 | ((1<(); - if(!Strings.isNullOrEmpty(namespacePrefix)) { + if (!Strings.isNullOrEmpty(namespacePrefix)) { metricNameBuilder.add(namespacePrefix); } metricNameBuilder.add(AmbariMetricsEmitter.sanitize(serviceMetricEvent.getService())); diff --git a/extensions-contrib/ambari-metrics-emitter/src/main/java/io/druid/emitter/ambari/metrics/WhiteListBasedDruidToTimelineEventConverter.java b/extensions-contrib/ambari-metrics-emitter/src/main/java/io/druid/emitter/ambari/metrics/WhiteListBasedDruidToTimelineEventConverter.java index 0db81b07f068..5d2a46290962 100644 --- a/extensions-contrib/ambari-metrics-emitter/src/main/java/io/druid/emitter/ambari/metrics/WhiteListBasedDruidToTimelineEventConverter.java +++ b/extensions-contrib/ambari-metrics-emitter/src/main/java/io/druid/emitter/ambari/metrics/WhiteListBasedDruidToTimelineEventConverter.java @@ -172,7 +172,7 @@ public TimelineMetric druidEventToTimelineMetric(ServiceMetricEvent serviceMetri return null; } final ImmutableList.Builder metricNameBuilder = new ImmutableList.Builder<>(); - if(!Strings.isNullOrEmpty(namespacePrefix)) { + if (!Strings.isNullOrEmpty(namespacePrefix)) { metricNameBuilder.add(namespacePrefix); } metricNameBuilder.add(AmbariMetricsEmitter.sanitize(serviceMetricEvent.getService())); diff --git a/extensions-contrib/ambari-metrics-emitter/src/test/java/io/druid/emitter/ambari/metrics/AmbariMetricsEmitterConfigTest.java b/extensions-contrib/ambari-metrics-emitter/src/test/java/io/druid/emitter/ambari/metrics/AmbariMetricsEmitterConfigTest.java index 55814c7480ce..40ce8dd54930 100644 --- a/extensions-contrib/ambari-metrics-emitter/src/test/java/io/druid/emitter/ambari/metrics/AmbariMetricsEmitterConfigTest.java +++ b/extensions-contrib/ambari-metrics-emitter/src/test/java/io/druid/emitter/ambari/metrics/AmbariMetricsEmitterConfigTest.java @@ -71,7 +71,7 @@ public void testSerDeDruidToTimelineEventConverter() throws IOException { SendAllTimelineEventConverter sendAllConverter = new SendAllTimelineEventConverter("prefix", "druid"); DruidToTimelineMetricConverter serde = mapper.reader(DruidToTimelineMetricConverter.class) - .readValue( mapper.writeValueAsBytes(sendAllConverter)); + .readValue(mapper.writeValueAsBytes(sendAllConverter)); Assert.assertEquals(sendAllConverter, serde); WhiteListBasedDruidToTimelineEventConverter whiteListBasedDruidToTimelineEventConverter = new WhiteListBasedDruidToTimelineEventConverter( diff --git a/extensions-contrib/ambari-metrics-emitter/src/test/java/io/druid/emitter/ambari/metrics/DruidToWhiteListBasedConverterTest.java b/extensions-contrib/ambari-metrics-emitter/src/test/java/io/druid/emitter/ambari/metrics/DruidToWhiteListBasedConverterTest.java index 383ab8218ec7..9ce284329c08 100644 --- a/extensions-contrib/ambari-metrics-emitter/src/test/java/io/druid/emitter/ambari/metrics/DruidToWhiteListBasedConverterTest.java +++ b/extensions-contrib/ambari-metrics-emitter/src/test/java/io/druid/emitter/ambari/metrics/DruidToWhiteListBasedConverterTest.java @@ -28,7 +28,7 @@ public class DruidToWhiteListBasedConverterTest @Test public void testSanitize() { - String test = "host name.yahoo.com:8080"; + String test = "host name.yahoo.com:8080"; Assert.assertEquals("host_name_yahoo_com:8080", AmbariMetricsEmitter.sanitize(test)); } } diff --git a/extensions-contrib/azure-extensions/src/main/java/io/druid/storage/azure/AzureDataSegmentKiller.java b/extensions-contrib/azure-extensions/src/main/java/io/druid/storage/azure/AzureDataSegmentKiller.java index b901f62fa58e..9c4a6007b4e6 100644 --- a/extensions-contrib/azure-extensions/src/main/java/io/druid/storage/azure/AzureDataSegmentKiller.java +++ b/extensions-contrib/azure-extensions/src/main/java/io/druid/storage/azure/AzureDataSegmentKiller.java @@ -60,7 +60,7 @@ public void kill(DataSegment segment) throws SegmentLoadingException try { azureStorage.emptyCloudBlobDirectory(containerName, dirPath); } - catch(StorageException e){ + catch (StorageException e) { throw new SegmentLoadingException(e, "Couldn't kill segment[%s]: [%s]", segment.getIdentifier(), e.getExtendedErrorInformation() == null ? null : e.getExtendedErrorInformation().getErrorMessage()); } catch (URISyntaxException e) { diff --git a/extensions-contrib/azure-extensions/src/main/java/io/druid/storage/azure/AzureTaskLogs.java b/extensions-contrib/azure-extensions/src/main/java/io/druid/storage/azure/AzureTaskLogs.java index 6525bff7e882..f4b6093ed760 100644 --- a/extensions-contrib/azure-extensions/src/main/java/io/druid/storage/azure/AzureTaskLogs.java +++ b/extensions-contrib/azure-extensions/src/main/java/io/druid/storage/azure/AzureTaskLogs.java @@ -105,7 +105,7 @@ public InputStream openStream() throws IOException return stream; } - catch(Exception e) { + catch (Exception e) { throw new IOException(e); } } diff --git a/extensions-contrib/cassandra-storage/src/main/java/io/druid/storage/cassandra/CassandraDataSegmentPuller.java b/extensions-contrib/cassandra-storage/src/main/java/io/druid/storage/cassandra/CassandraDataSegmentPuller.java index 469cd9a0ee71..703bf80564aa 100644 --- a/extensions-contrib/cassandra-storage/src/main/java/io/druid/storage/cassandra/CassandraDataSegmentPuller.java +++ b/extensions-contrib/cassandra-storage/src/main/java/io/druid/storage/cassandra/CassandraDataSegmentPuller.java @@ -100,8 +100,8 @@ public FileUtils.FileCopyResult call() throws Exception catch (Exception e) { throw new SegmentLoadingException(e, "Unable to copy key [%s] to file [%s]", key, tmpFile.getAbsolutePath()); } - try{ - final FileUtils.FileCopyResult result = CompressionUtils.unzip(tmpFile, outDir); + try { + final FileUtils.FileCopyResult result = CompressionUtils.unzip(tmpFile, outDir); log.info( "Pull of file[%s] completed in %,d millis (%s bytes)", key, System.currentTimeMillis() - startTime, result.size() diff --git a/extensions-contrib/cassandra-storage/src/main/java/io/druid/storage/cassandra/CassandraDataSegmentPusher.java b/extensions-contrib/cassandra-storage/src/main/java/io/druid/storage/cassandra/CassandraDataSegmentPusher.java index 37cbea4623bd..3595147ace85 100644 --- a/extensions-contrib/cassandra-storage/src/main/java/io/druid/storage/cassandra/CassandraDataSegmentPusher.java +++ b/extensions-contrib/cassandra-storage/src/main/java/io/druid/storage/cassandra/CassandraDataSegmentPusher.java @@ -56,7 +56,7 @@ public CassandraDataSegmentPusher( ObjectMapper jsonMapper) { super(config); - this.jsonMapper=jsonMapper; + this.jsonMapper = jsonMapper; } @Override diff --git a/extensions-contrib/distinctcount/src/test/java/io/druid/query/aggregation/distinctcount/DistinctCountTimeseriesQueryTest.java b/extensions-contrib/distinctcount/src/test/java/io/druid/query/aggregation/distinctcount/DistinctCountTimeseriesQueryTest.java index d56eeb69413e..eeb6dfbf85e6 100644 --- a/extensions-contrib/distinctcount/src/test/java/io/druid/query/aggregation/distinctcount/DistinctCountTimeseriesQueryTest.java +++ b/extensions-contrib/distinctcount/src/test/java/io/druid/query/aggregation/distinctcount/DistinctCountTimeseriesQueryTest.java @@ -47,7 +47,7 @@ public class DistinctCountTimeseriesQueryTest @Test public void testTopNWithDistinctCountAgg() throws Exception { - TimeseriesQueryEngine engine = new TimeseriesQueryEngine(); + TimeseriesQueryEngine engine = new TimeseriesQueryEngine(); IncrementalIndex index = new IncrementalIndex.Builder() .setIndexSchema( diff --git a/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentKiller.java b/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentKiller.java index 41780ee85645..b7fbdc162a23 100644 --- a/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentKiller.java +++ b/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentKiller.java @@ -55,7 +55,7 @@ public void kill(DataSegment segment) throws SegmentLoadingException storage.delete(bucket, indexPath); storage.delete(bucket, descriptorPath); } - catch(IOException e) { + catch (IOException e) { throw new SegmentLoadingException(e, "Couldn't kill segment[%s]: [%s]", segment.getIdentifier(), e.getMessage()); } } diff --git a/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentPusher.java b/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentPusher.java index adb3874e5e27..527e7e14025e 100644 --- a/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentPusher.java +++ b/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentPusher.java @@ -163,7 +163,7 @@ String buildPath(final String path) public Map makeLoadSpec(URI finalIndexZipFilePath) { // remove the leading "/" - return makeLoadSpec(config.getBucket(),finalIndexZipFilePath.getPath().substring(1)); + return makeLoadSpec(config.getBucket(), finalIndexZipFilePath.getPath().substring(1)); } private Map makeLoadSpec(String bucket, String path) diff --git a/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleTaskLogs.java b/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleTaskLogs.java index 9ec0f20275ff..8d0fbfd055a4 100644 --- a/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleTaskLogs.java +++ b/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleTaskLogs.java @@ -94,7 +94,7 @@ public InputStream openStream() throws IOException return stream; } - catch(Exception e) { + catch (Exception e) { throw new IOException(e); } } diff --git a/extensions-contrib/graphite-emitter/src/main/java/io/druid/emitter/graphite/DruidToGraphiteEventConverter.java b/extensions-contrib/graphite-emitter/src/main/java/io/druid/emitter/graphite/DruidToGraphiteEventConverter.java index 9d89b0c89724..673fa2af2af7 100644 --- a/extensions-contrib/graphite-emitter/src/main/java/io/druid/emitter/graphite/DruidToGraphiteEventConverter.java +++ b/extensions-contrib/graphite-emitter/src/main/java/io/druid/emitter/graphite/DruidToGraphiteEventConverter.java @@ -25,9 +25,9 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = WhiteListBasedConverter.class) -@JsonSubTypes(value= { - @JsonSubTypes.Type(name="all", value = SendAllGraphiteEventConverter.class), - @JsonSubTypes.Type(name="whiteList", value = WhiteListBasedConverter.class) +@JsonSubTypes(value = { + @JsonSubTypes.Type(name = "all", value = SendAllGraphiteEventConverter.class), + @JsonSubTypes.Type(name = "whiteList", value = WhiteListBasedConverter.class) }) public interface DruidToGraphiteEventConverter diff --git a/extensions-contrib/graphite-emitter/src/test/java/io/druid/emitter/graphite/DruidToWhiteListBasedConverterTest.java b/extensions-contrib/graphite-emitter/src/test/java/io/druid/emitter/graphite/DruidToWhiteListBasedConverterTest.java index 7f92025ec0b9..f6e1fcb0a155 100644 --- a/extensions-contrib/graphite-emitter/src/test/java/io/druid/emitter/graphite/DruidToWhiteListBasedConverterTest.java +++ b/extensions-contrib/graphite-emitter/src/test/java/io/druid/emitter/graphite/DruidToWhiteListBasedConverterTest.java @@ -28,7 +28,7 @@ public class DruidToWhiteListBasedConverterTest @Test public void testSanitize() { - String test = "host name.yahoo.com:8080"; + String test = "host name.yahoo.com:8080"; Assert.assertEquals("host_name_yahoo_com:8080", GraphiteEmitter.sanitize(test)); } } diff --git a/extensions-contrib/orc-extensions/src/test/java/io/druid/data/input/orc/DruidOrcInputFormatTest.java b/extensions-contrib/orc-extensions/src/test/java/io/druid/data/input/orc/DruidOrcInputFormatTest.java index 60cd33d56f90..9b0939219b38 100644 --- a/extensions-contrib/orc-extensions/src/test/java/io/druid/data/input/orc/DruidOrcInputFormatTest.java +++ b/extensions-contrib/orc-extensions/src/test/java/io/druid/data/input/orc/DruidOrcInputFormatTest.java @@ -90,7 +90,7 @@ public void testRead() throws IOException, InterruptedException TaskAttemptContext context = new TaskAttemptContextImpl(job.getConfiguration(), new TaskAttemptID()); RecordReader reader = inputFormat.createRecordReader(split, context); - OrcHadoopInputRowParser parser = (OrcHadoopInputRowParser)config.getParser(); + OrcHadoopInputRowParser parser = (OrcHadoopInputRowParser) config.getParser(); reader.initialize(split, context); @@ -98,7 +98,7 @@ public void testRead() throws IOException, InterruptedException OrcStruct data = (OrcStruct) reader.getCurrentValue(); - MapBasedInputRow row = (MapBasedInputRow)parser.parse(data); + MapBasedInputRow row = (MapBasedInputRow) parser.parse(data); Assert.assertTrue(row.getEvent().keySet().size() == 4); Assert.assertEquals(new DateTime(timestamp), row.getTimestamp()); diff --git a/extensions-contrib/orc-extensions/src/test/java/io/druid/data/input/orc/OrcHadoopInputRowParserTest.java b/extensions-contrib/orc-extensions/src/test/java/io/druid/data/input/orc/OrcHadoopInputRowParserTest.java index ad2a0d5352f7..93d57e55ef68 100644 --- a/extensions-contrib/orc-extensions/src/test/java/io/druid/data/input/orc/OrcHadoopInputRowParserTest.java +++ b/extensions-contrib/orc-extensions/src/test/java/io/druid/data/input/orc/OrcHadoopInputRowParserTest.java @@ -58,7 +58,7 @@ public class OrcHadoopInputRowParserTest @Before public void setUp() { - injector = Initialization.makeInjectorWithModules( + injector = Initialization.makeInjectorWithModules( GuiceInjectors.makeStartupInjector(), ImmutableList.of( new Module() diff --git a/extensions-contrib/rabbitmq/src/test/java/io/druid/examples/rabbitmq/RabbitMQProducerMain.java b/extensions-contrib/rabbitmq/src/test/java/io/druid/examples/rabbitmq/RabbitMQProducerMain.java index ee8884d043a6..b713eaae8bd3 100644 --- a/extensions-contrib/rabbitmq/src/test/java/io/druid/examples/rabbitmq/RabbitMQProducerMain.java +++ b/extensions-contrib/rabbitmq/src/test/java/io/druid/examples/rabbitmq/RabbitMQProducerMain.java @@ -130,41 +130,40 @@ public static void main(String[] args) CommandLine cmd = null; - try{ + try { cmd = new BasicParser().parse(options, args); - } - catch(ParseException e){ + catch (ParseException e) { formatter.printHelp("RabbitMQProducerMain", e.getMessage(), options, null); System.exit(1); } - if(cmd.hasOption("h")) { + if (cmd.hasOption("h")) { formatter.printHelp("RabbitMQProducerMain", options); System.exit(2); } ConnectionFactory factory = new ConnectionFactory(); - if(cmd.hasOption("b")){ + if (cmd.hasOption("b")) { factory.setHost(cmd.getOptionValue("b")); } - if(cmd.hasOption("u")){ + if (cmd.hasOption("u")) { factory.setUsername(cmd.getOptionValue("u")); } - if(cmd.hasOption("p")){ + if (cmd.hasOption("p")) { factory.setPassword(cmd.getOptionValue("p")); } - if(cmd.hasOption("v")){ + if (cmd.hasOption("v")) { factory.setVirtualHost(cmd.getOptionValue("v")); } - if(cmd.hasOption("n")){ + if (cmd.hasOption("n")) { factory.setPort(Integer.parseInt(cmd.getOptionValue("n"))); } String exchange = cmd.getOptionValue("e"); String routingKey = "default.routing.key"; - if(cmd.hasOption("k")){ + if (cmd.hasOption("k")) { routingKey = cmd.getOptionValue("k"); } @@ -203,7 +202,7 @@ public static void main(String[] args) timer.add(Calendar.SECOND, interval); Thread.sleep(delay); - } while((!single && stop.after(timer.getTime()))); + } while ((!single && stop.after(timer.getTime()))); connection.close(); } diff --git a/extensions-contrib/scan-query/src/test/java/io/druid/query/scan/ScanQueryRunnerTest.java b/extensions-contrib/scan-query/src/test/java/io/druid/query/scan/ScanQueryRunnerTest.java index 5caa401f84bc..a90b4430094b 100644 --- a/extensions-contrib/scan-query/src/test/java/io/druid/query/scan/ScanQueryRunnerTest.java +++ b/extensions-contrib/scan-query/src/test/java/io/druid/query/scan/ScanQueryRunnerTest.java @@ -370,8 +370,9 @@ public void testSelectWithFilterLookupExtractionFn() Lists.newArrayList() ); Iterable resultsOptimize = Sequences.toList( - toolChest.postMergeQueryDecoration(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner))). - run(query, Maps.newHashMap()), Lists.newArrayList() + toolChest + .postMergeQueryDecoration(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner))) + .run(query, Maps.newHashMap()), Lists.newArrayList() ); final List>> events = toEvents( diff --git a/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampAggregator.java b/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampAggregator.java index 8ad1b5f46ce9..ecd4921fcea2 100644 --- a/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampAggregator.java +++ b/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampAggregator.java @@ -30,7 +30,7 @@ public class TimestampAggregator implements Aggregator static long combineValues(Object lhs, Object rhs) { - return Math.max(((Number)lhs).longValue(), ((Number)rhs).longValue()); + return Math.max(((Number) lhs).longValue(), ((Number) rhs).longValue()); } private final ObjectColumnSelector selector; diff --git a/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampAggregatorFactory.java b/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampAggregatorFactory.java index c0e8dd35e647..4466aa92a51b 100644 --- a/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampAggregatorFactory.java +++ b/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampAggregatorFactory.java @@ -116,7 +116,7 @@ public Object deserialize(Object object) @Override public Object finalizeComputation(Object object) { - return new DateTime((long)object); + return new DateTime((long) object); } @Override @@ -206,11 +206,11 @@ public int hashCode() static Long convertLong(TimestampSpec timestampSpec, Object input) { if (input instanceof Number) { - return ((Number)input).longValue(); + return ((Number) input).longValue(); } else if (input instanceof DateTime) { - return ((DateTime)input).getMillis(); + return ((DateTime) input).getMillis(); } else if (input instanceof Timestamp) { - return ((Timestamp)input).getTime(); + return ((Timestamp) input).getTime(); } else if (input instanceof String) { return timestampSpec.parseDateTime(input).getMillis(); } diff --git a/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampBufferAggregator.java b/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampBufferAggregator.java index d14544a2f401..1d70deb75896 100644 --- a/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampBufferAggregator.java +++ b/extensions-contrib/time-min-max/src/main/java/io/druid/query/aggregation/TimestampBufferAggregator.java @@ -57,7 +57,7 @@ public void aggregate(ByteBuffer buf, int position) Long newTime = TimestampAggregatorFactory.convertLong(timestampSpec, selector.get()); if (newTime != null) { long prev = buf.getLong(position); - buf.putLong(position, comparator.compare(prev, newTime) > 0 ? prev: newTime); + buf.putLong(position, comparator.compare(prev, newTime) > 0 ? prev : newTime); } } diff --git a/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampAggregationSelectTest.java b/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampAggregationSelectTest.java index 8ec8362fc003..025bc6abd284 100644 --- a/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampAggregationSelectTest.java +++ b/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampAggregationSelectTest.java @@ -60,7 +60,7 @@ public class TimestampAggregationSelectTest private Timestamp[] values = new Timestamp[10]; - @Parameterized.Parameters(name="{index}: Test for {0}") + @Parameterized.Parameters(name = "{index}: Test for {0}") public static Iterable constructorFeeder() { return Iterables.transform( diff --git a/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampGroupByAggregationTest.java b/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampGroupByAggregationTest.java index 42a780a511f5..2e5fa43d6909 100644 --- a/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampGroupByAggregationTest.java +++ b/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampGroupByAggregationTest.java @@ -57,7 +57,7 @@ public class TimestampGroupByAggregationTest private Timestamp[] values = new Timestamp[10]; - @Parameterized.Parameters(name="{index}: Test for {0}, config = {1}") + @Parameterized.Parameters(name = "{index}: Test for {0}, config = {1}") public static Iterable constructorFeeder() { final List constructors = Lists.newArrayList(); @@ -182,6 +182,6 @@ public void testSimpleDataIngestionAndGroupByTest() throws Exception List results = Sequences.toList(seq, Lists.newArrayList()); Assert.assertEquals(36, results.size()); - Assert.assertEquals(expected, ((MapBasedRow)results.get(0)).getEvent().get(groupByField)); + Assert.assertEquals(expected, ((MapBasedRow) results.get(0)).getEvent().get(groupByField)); } } diff --git a/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampMinMaxAggregatorTest.java b/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampMinMaxAggregatorTest.java index 340864ab479b..56bdfba06867 100644 --- a/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampMinMaxAggregatorTest.java +++ b/extensions-contrib/time-min-max/src/test/java/io/druid/query/aggregation/TimestampMinMaxAggregatorTest.java @@ -66,7 +66,7 @@ public class TimestampMinMaxAggregatorTest Timestamp.valueOf("2014-01-02 02:00:00") }; - @Parameterized.Parameters(name="{index}: Test for {0}") + @Parameterized.Parameters(name = "{index}: Test for {0}") public static Iterable constructorFeeder() { return Iterables.transform( @@ -102,7 +102,7 @@ public TimestampMinMaxAggregatorTest(String aggType, Class constructorFeeder() throws IOException Arrays.asList("ts", "dim", "keys", "values"), false, 0 - ) - , "utf8" + ), + "utf8" ); CharSource input = CharSource.wrap( diff --git a/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimatePostAggregator.java b/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimatePostAggregator.java index 496f7afb69fa..130580086bf1 100644 --- a/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimatePostAggregator.java +++ b/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimatePostAggregator.java @@ -83,7 +83,7 @@ public int compare(Object o1, Object o2) @Override public Object compute(Map combinedAggregators) { - SketchHolder holder = (SketchHolder)field.compute(combinedAggregators); + SketchHolder holder = (SketchHolder) field.compute(combinedAggregators); if (errorBoundsStdDev != null) { return holder.getEstimateWithErrorBounds(errorBoundsStdDev); } else { diff --git a/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimateWithErrorBounds.java b/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimateWithErrorBounds.java index 1babde4d8060..cacc548cc6b8 100644 --- a/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimateWithErrorBounds.java +++ b/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimateWithErrorBounds.java @@ -76,7 +76,7 @@ public String toString() return "SketchEstimateWithErrorBounds{" + "estimate=" + Double.toString(estimate) + ", highBound=" + Double.toString(highBound) + - ", lowBound="+ Double.toString(lowBound) + + ", lowBound=" + Double.toString(lowBound) + ", numStdDev=" + Integer.toString(numStdDev) + "}"; } diff --git a/extensions-core/datasketches/src/test/java/io/druid/query/aggregation/datasketches/theta/SketchAggregationTest.java b/extensions-core/datasketches/src/test/java/io/druid/query/aggregation/datasketches/theta/SketchAggregationTest.java index 70f35218a821..e98c74bb7062 100644 --- a/extensions-core/datasketches/src/test/java/io/druid/query/aggregation/datasketches/theta/SketchAggregationTest.java +++ b/extensions-core/datasketches/src/test/java/io/druid/query/aggregation/datasketches/theta/SketchAggregationTest.java @@ -370,7 +370,7 @@ public void testSketchAggregatorFactoryComparator() Comparator comparator = SketchHolder.COMPARATOR; Assert.assertEquals(0, comparator.compare(null, null)); - Union union1 = (Union) SetOperation.builder().build(1<<4, Family.UNION); + Union union1 = (Union) SetOperation.builder().build(1 << 4, Family.UNION); union1.update("a"); union1.update("b"); Sketch sketch1 = union1.getResult(); @@ -378,7 +378,7 @@ public void testSketchAggregatorFactoryComparator() Assert.assertEquals(-1, comparator.compare(null, SketchHolder.of(sketch1))); Assert.assertEquals(1, comparator.compare(SketchHolder.of(sketch1), null)); - Union union2 = (Union) SetOperation.builder().build(1<<4, Family.UNION); + Union union2 = (Union) SetOperation.builder().build(1 << 4, Family.UNION); union2.update("a"); union2.update("b"); union2.update("c"); diff --git a/extensions-core/datasketches/src/test/java/io/druid/query/aggregation/datasketches/theta/SketchEstimateWithErrorBoundsTest.java b/extensions-core/datasketches/src/test/java/io/druid/query/aggregation/datasketches/theta/SketchEstimateWithErrorBoundsTest.java index cc68615a6bcf..2613fb62d043 100644 --- a/extensions-core/datasketches/src/test/java/io/druid/query/aggregation/datasketches/theta/SketchEstimateWithErrorBoundsTest.java +++ b/extensions-core/datasketches/src/test/java/io/druid/query/aggregation/datasketches/theta/SketchEstimateWithErrorBoundsTest.java @@ -34,7 +34,7 @@ public void testSerde() throws IOException { ObjectMapper mapper = new DefaultObjectMapper(); - SketchEstimateWithErrorBounds est = new SketchEstimateWithErrorBounds(100.0,101.5,98.5,2); + SketchEstimateWithErrorBounds est = new SketchEstimateWithErrorBounds(100.0, 101.5, 98.5, 2); Assert.assertEquals(est, mapper.readValue( mapper.writeValueAsString(est), SketchEstimateWithErrorBounds.class)); diff --git a/extensions-core/hdfs-storage/src/main/java/io/druid/storage/hdfs/HdfsDataSegmentPusher.java b/extensions-core/hdfs-storage/src/main/java/io/druid/storage/hdfs/HdfsDataSegmentPusher.java index 59a837089dbd..33a85ac2147a 100644 --- a/extensions-core/hdfs-storage/src/main/java/io/druid/storage/hdfs/HdfsDataSegmentPusher.java +++ b/extensions-core/hdfs-storage/src/main/java/io/druid/storage/hdfs/HdfsDataSegmentPusher.java @@ -199,7 +199,7 @@ public OutputStream openStream() throws IOException @Override public Map makeLoadSpec(URI finalIndexZipFilePath) { - return ImmutableMap.of("type", "hdfs", "path", finalIndexZipFilePath.toString()); + return ImmutableMap.of("type", "hdfs", "path", finalIndexZipFilePath.toString()); } /** diff --git a/extensions-core/hdfs-storage/src/test/java/io/druid/indexing/common/tasklogs/HdfsTaskLogsTest.java b/extensions-core/hdfs-storage/src/test/java/io/druid/indexing/common/tasklogs/HdfsTaskLogsTest.java index 9b645a2abd7c..981fb51bf257 100644 --- a/extensions-core/hdfs-storage/src/test/java/io/druid/indexing/common/tasklogs/HdfsTaskLogsTest.java +++ b/extensions-core/hdfs-storage/src/test/java/io/druid/indexing/common/tasklogs/HdfsTaskLogsTest.java @@ -98,7 +98,7 @@ public void testKill() throws Exception //is necessary to separate 2 file creations by a timestamp that would result in only one //of them getting deleted Thread.sleep(1500); - long time = (System.currentTimeMillis()/1000)*1000; + long time = (System.currentTimeMillis() / 1000) * 1000; Assert.assertTrue(fs.getFileStatus(new Path(logDirPath, "log1")).getModificationTime() < time); Files.write("log2content", logFile, Charsets.UTF_8); diff --git a/extensions-core/hdfs-storage/src/test/java/io/druid/segment/loading/HdfsDataSegmentFinderTest.java b/extensions-core/hdfs-storage/src/test/java/io/druid/segment/loading/HdfsDataSegmentFinderTest.java index 752253570d7e..cc0e19929ae5 100644 --- a/extensions-core/hdfs-storage/src/test/java/io/druid/segment/loading/HdfsDataSegmentFinderTest.java +++ b/extensions-core/hdfs-storage/src/test/java/io/druid/segment/loading/HdfsDataSegmentFinderTest.java @@ -185,7 +185,7 @@ public void setUp() throws IOException descriptor3 = new Path(dataSourceDir, "interval3/v2/0/" + DESCRIPTOR_JSON); descriptor4_0 = new Path(dataSourceDir, "interval4/v1/0/" + DESCRIPTOR_JSON); descriptor4_1 = new Path(dataSourceDir, "interval4/v1/1/" + DESCRIPTOR_JSON); - descriptor5 = new Path(dataSourceDir, "interval5/v1/1/" + "1_" +DESCRIPTOR_JSON); + descriptor5 = new Path(dataSourceDir, "interval5/v1/1/" + "1_" + DESCRIPTOR_JSON); indexZip1 = new Path(descriptor1.getParent(), INDEX_ZIP); indexZip2 = new Path(descriptor2.getParent(), INDEX_ZIP); indexZip3 = new Path(descriptor3.getParent(), INDEX_ZIP); diff --git a/extensions-core/hdfs-storage/src/test/java/io/druid/storage/hdfs/HdfsDataSegmentPusherTest.java b/extensions-core/hdfs-storage/src/test/java/io/druid/storage/hdfs/HdfsDataSegmentPusherTest.java index 7caa3214d3c7..e12f0ed516cd 100644 --- a/extensions-core/hdfs-storage/src/test/java/io/druid/storage/hdfs/HdfsDataSegmentPusherTest.java +++ b/extensions-core/hdfs-storage/src/test/java/io/druid/storage/hdfs/HdfsDataSegmentPusherTest.java @@ -540,7 +540,7 @@ public void shouldMakeDefaultSegmentOutputPathIfNotHDFS() -1 ), JobHelper.INDEX_ZIP, - new LocalDataSegmentPusher( new LocalDataSegmentPusherConfig(), objectMapper) + new LocalDataSegmentPusher(new LocalDataSegmentPusherConfig(), objectMapper) ); Assert.assertEquals( "file:/tmp/dru:id/data:test/the:data:source/2012-07-10T05:00:00.000Z_2012-07-10T06:00:00.000Z/some:brand:new:" @@ -563,7 +563,7 @@ public void shouldMakeDefaultSegmentOutputPathIfNotHDFS() -1 ), JobHelper.DESCRIPTOR_JSON, - new LocalDataSegmentPusher( new LocalDataSegmentPusherConfig(), objectMapper) + new LocalDataSegmentPusher(new LocalDataSegmentPusherConfig(), objectMapper) ); Assert.assertEquals( "file:/tmp/dru:id/data:test/the:data:source/2012-07-10T05:00:00.000Z_2012-07-10T06:00:00.000Z/some:brand:new:" @@ -586,7 +586,7 @@ public void shouldMakeDefaultSegmentOutputPathIfNotHDFS() -1 ), new TaskAttemptID("abc", 123, TaskType.REDUCE, 1, 0), - new LocalDataSegmentPusher( new LocalDataSegmentPusherConfig(), objectMapper) + new LocalDataSegmentPusher(new LocalDataSegmentPusherConfig(), objectMapper) ); Assert.assertEquals( "file:/tmp/dru:id/data:test/the:data:source/2012-07-10T05:00:00.000Z_2012-07-10T06:00:00.000Z/some:brand:new:" diff --git a/extensions-core/histogram/src/main/java/io/druid/query/aggregation/histogram/ApproximateHistogram.java b/extensions-core/histogram/src/main/java/io/druid/query/aggregation/histogram/ApproximateHistogram.java index a35d705c2341..494b18681ec3 100644 --- a/extensions-core/histogram/src/main/java/io/druid/query/aggregation/histogram/ApproximateHistogram.java +++ b/extensions-core/histogram/src/main/java/io/druid/query/aggregation/histogram/ApproximateHistogram.java @@ -855,7 +855,7 @@ protected int ruleCombineBins( * ApproximateHistogram merged = new ApproximateHistogram(mergedBinCount, mergedPositions, mergedBins); * * int targetSize = merged.binCount() - numMerge; - * while(merged.binCount() > targetSize) { + * while (merged.binCount() > targetSize) { * merged.merge(merged.minDeltaIndex()); * } * diff --git a/extensions-core/histogram/src/test/java/io/druid/query/aggregation/histogram/ApproximateHistogramErrorBenchmark.java b/extensions-core/histogram/src/test/java/io/druid/query/aggregation/histogram/ApproximateHistogramErrorBenchmark.java index 867bd13fbf71..7e7cc2e855e0 100644 --- a/extensions-core/histogram/src/test/java/io/druid/query/aggregation/histogram/ApproximateHistogramErrorBenchmark.java +++ b/extensions-core/histogram/src/test/java/io/druid/query/aggregation/histogram/ApproximateHistogramErrorBenchmark.java @@ -164,26 +164,26 @@ private float[] getErrors() float err1 = 0; float err2 = 0; for (int j = 0; j < hcounts.length; j++) { - err1 += (float)Math.abs((hcounts[j] - ahcounts1[j]) / numValues); - err2 += (float)Math.abs((hcounts[j] - ahcounts2[j]) / numValues); + err1 += (float) Math.abs((hcounts[j] - ahcounts1[j]) / numValues); + err2 += (float) Math.abs((hcounts[j] - ahcounts2[j]) / numValues); } if (debug) { float sum = 0; for (double v : hcounts) { - sum += (float)v; + sum += (float) v; } System.out.println("Exact Histogram Sum:"); System.out.println(sum); sum = 0; for (double v : ahcounts1) { - sum += (float)v; + sum += (float) v; } System.out.println("Approximate Histogram Sum:"); System.out.println(sum); sum = 0; for (double v : ahcounts2) { - sum += (float)v; + sum += (float) v; } System.out.println("Approximate Histogram Rule Fold Sum:"); System.out.println(sum); diff --git a/extensions-core/histogram/src/test/java/io/druid/query/aggregation/histogram/ApproximateHistogramTest.java b/extensions-core/histogram/src/test/java/io/druid/query/aggregation/histogram/ApproximateHistogramTest.java index 31eff16cdbab..f75485a9a95b 100644 --- a/extensions-core/histogram/src/test/java/io/druid/query/aggregation/histogram/ApproximateHistogramTest.java +++ b/extensions-core/histogram/src/test/java/io/druid/query/aggregation/histogram/ApproximateHistogramTest.java @@ -221,7 +221,7 @@ public void testFoldSpeed() final int numRand = 10000; ApproximateHistogram h = new ApproximateHistogram(combinedHistSize); Random rand = new Random(0); - //for(int i = 0; i < 200; ++i) h.offer((float)(rand.nextGaussian() * 50.0)); + //for (int i = 0; i < 200; ++i) h.offer((float)(rand.nextGaussian() * 50.0)); long tFold = 0; int count = 5000000; // May be a bug that randNums are not used, should be resolved if testFoldSpeed() becomes a jUnit test again @@ -234,10 +234,10 @@ public void testFoldSpeed() List randHist = Lists.newLinkedList(); Iterator it = Iterators.cycle(randHist); - for(int k = 0; k < numRand; ++k) { + for (int k = 0; k < numRand; ++k) { ApproximateHistogram tmp = new ApproximateHistogram(histSize); for (int i = 0; i < 20; ++i) { - tmp.offer((float) (rand.nextGaussian() + (double)k)); + tmp.offer((float) (rand.nextGaussian() + (double) k)); } randHist.add(tmp); } @@ -539,40 +539,40 @@ public void testBuckets3() @Test public void testBuckets4() { - final float[] values = new float[]{0f, 0f, 0.01f, 0.51f, 0.6f,0.8f}; - ApproximateHistogram h = buildHistogram(50, values, 0.5f,1f); - Histogram h3 = h.toHistogram(0.2f,0); + final float[] values = new float[]{0f, 0f, 0.01f, 0.51f, 0.6f, 0.8f}; + ApproximateHistogram h = buildHistogram(50, values, 0.5f, 1f); + Histogram h3 = h.toHistogram(0.2f, 0); Assert.assertArrayEquals( "Expected counts match actual counts", - new double[]{3f,2f,1f}, + new double[]{3f, 2f, 1f}, h3.getCounts(), 0.1f ); Assert.assertArrayEquals( "expected breaks match actual breaks", - new double[]{-0.2f,0.5f,0.7f,0.9f}, + new double[]{-0.2f, 0.5f, 0.7f, 0.9f}, h3.getBreaks(), 0.1f ); } @Test public void testBuckets5() { - final float[] values = new float[]{0.1f,0.5f,0.6f}; - ApproximateHistogram h = buildHistogram(50, values, 0f,1f); - Histogram h4 = h.toHistogram(0.5f,0); + final float[] values = new float[]{0.1f, 0.5f, 0.6f}; + ApproximateHistogram h = buildHistogram(50, values, 0f, 1f); + Histogram h4 = h.toHistogram(0.5f, 0); Assert.assertArrayEquals( "Expected counts match actual counts", - new double[]{2,1}, + new double[]{2, 1}, h4.getCounts(), 0.1f ); Assert.assertArrayEquals( "Expected breaks match actual breaks", - new double[]{0f,0.5f,1f}, + new double[]{0f, 0.5f, 1f}, h4.getBreaks(), 0.1f ); diff --git a/extensions-core/kafka-eight/src/main/java/io/druid/firehose/kafka/KafkaEightFirehoseFactory.java b/extensions-core/kafka-eight/src/main/java/io/druid/firehose/kafka/KafkaEightFirehoseFactory.java index dd63153ce92c..ed55aeb69c00 100644 --- a/extensions-core/kafka-eight/src/main/java/io/druid/firehose/kafka/KafkaEightFirehoseFactory.java +++ b/extensions-core/kafka-eight/src/main/java/io/druid/firehose/kafka/KafkaEightFirehoseFactory.java @@ -129,7 +129,7 @@ public InputRow nextRow() IF the CRC is caused within the wire transfer, this is not the best way to handel CRC. Probably it is better to shutdown the fireHose without commit and start it again. */ - log.error(e,"Message failed its checksum and it is corrupt, will skip it"); + log.error(e, "Message failed its checksum and it is corrupt, will skip it"); return null; } } diff --git a/extensions-core/kafka-indexing-service/src/main/java/io/druid/indexing/kafka/KafkaDataSourceMetadata.java b/extensions-core/kafka-indexing-service/src/main/java/io/druid/indexing/kafka/KafkaDataSourceMetadata.java index b0b0d7be5c78..a99eb704295e 100644 --- a/extensions-core/kafka-indexing-service/src/main/java/io/druid/indexing/kafka/KafkaDataSourceMetadata.java +++ b/extensions-core/kafka-indexing-service/src/main/java/io/druid/indexing/kafka/KafkaDataSourceMetadata.java @@ -113,7 +113,7 @@ public DataSourceMetadata minus(DataSourceMetadata other) final Map newMap = Maps.newHashMap(); for (Map.Entry entry : kafkaPartitions.getPartitionOffsetMap().entrySet()) { - if(!that.getKafkaPartitions().getPartitionOffsetMap().containsKey(entry.getKey())) { + if (!that.getKafkaPartitions().getPartitionOffsetMap().containsKey(entry.getKey())) { newMap.put(entry.getKey(), entry.getValue()); } } diff --git a/extensions-core/kafka-indexing-service/src/test/java/io/druid/indexing/kafka/supervisor/KafkaSupervisorTest.java b/extensions-core/kafka-indexing-service/src/test/java/io/druid/indexing/kafka/supervisor/KafkaSupervisorTest.java index 84ef4e92c5ef..249e6d8aab0b 100644 --- a/extensions-core/kafka-indexing-service/src/test/java/io/druid/indexing/kafka/supervisor/KafkaSupervisorTest.java +++ b/extensions-core/kafka-indexing-service/src/test/java/io/druid/indexing/kafka/supervisor/KafkaSupervisorTest.java @@ -497,51 +497,56 @@ public void testKillIncompatibleTasks() throws Exception supervisor = getSupervisor(2, 1, true, "PT1H", null, false); addSomeEvents(1); - Task id1 = createKafkaIndexTask( // unexpected # of partitions (kill) - "id1", - DATASOURCE, - "index_kafka_testDS__some_other_sequenceName", - new KafkaPartitions("topic", ImmutableMap.of(0, 0L)), - new KafkaPartitions("topic", ImmutableMap.of(0, 10L)), - null + // unexpected # of partitions (kill) + Task id1 = createKafkaIndexTask( + "id1", + DATASOURCE, + "index_kafka_testDS__some_other_sequenceName", + new KafkaPartitions("topic", ImmutableMap.of(0, 0L)), + new KafkaPartitions("topic", ImmutableMap.of(0, 10L)), + null ); - Task id2 = createKafkaIndexTask( // correct number of partitions and ranges (don't kill) - "id2", - DATASOURCE, - "sequenceName-0", - new KafkaPartitions("topic", ImmutableMap.of(0, 0L, 1, 0L, 2, 0L)), - new KafkaPartitions("topic", ImmutableMap.of(0, 333L, 1, 333L, 2, 333L)), - null + // correct number of partitions and ranges (don't kill) + Task id2 = createKafkaIndexTask( + "id2", + DATASOURCE, + "sequenceName-0", + new KafkaPartitions("topic", ImmutableMap.of(0, 0L, 1, 0L, 2, 0L)), + new KafkaPartitions("topic", ImmutableMap.of(0, 333L, 1, 333L, 2, 333L)), + null ); - Task id3 = createKafkaIndexTask( // unexpected range on partition 2 (kill) - "id3", - DATASOURCE, - "index_kafka_testDS__some_other_sequenceName", - new KafkaPartitions("topic", ImmutableMap.of(0, 0L, 1, 0L, 2, 1L)), - new KafkaPartitions("topic", ImmutableMap.of(0, 333L, 1, 333L, 2, 330L)), - null + // unexpected range on partition 2 (kill) + Task id3 = createKafkaIndexTask( + "id3", + DATASOURCE, + "index_kafka_testDS__some_other_sequenceName", + new KafkaPartitions("topic", ImmutableMap.of(0, 0L, 1, 0L, 2, 1L)), + new KafkaPartitions("topic", ImmutableMap.of(0, 333L, 1, 333L, 2, 330L)), + null ); - Task id4 = createKafkaIndexTask( // different datasource (don't kill) - "id4", - "other-datasource", - "index_kafka_testDS_d927edff33c4b3f", - new KafkaPartitions("topic", ImmutableMap.of(0, 0L)), - new KafkaPartitions("topic", ImmutableMap.of(0, 10L)), - null + // different datasource (don't kill) + Task id4 = createKafkaIndexTask( + "id4", + "other-datasource", + "index_kafka_testDS_d927edff33c4b3f", + new KafkaPartitions("topic", ImmutableMap.of(0, 0L)), + new KafkaPartitions("topic", ImmutableMap.of(0, 10L)), + null ); - Task id5 = new RealtimeIndexTask( // non KafkaIndexTask (don't kill) - "id5", - null, - new FireDepartment( - dataSchema, - new RealtimeIOConfig(null, null, null), - null - ), - null + // non KafkaIndexTask (don't kill) + Task id5 = new RealtimeIndexTask( + "id5", + null, + new FireDepartment( + dataSchema, + new RealtimeIOConfig(null, null, null), + null + ), + null ); List existingTasks = ImmutableList.of(id1, id2, id3, id4, id5); diff --git a/extensions-core/lookups-cached-global/src/test/java/io/druid/server/lookup/namespace/cache/CacheSchedulerTest.java b/extensions-core/lookups-cached-global/src/test/java/io/druid/server/lookup/namespace/cache/CacheSchedulerTest.java index 189bb7b61bfc..c1a167db9424 100644 --- a/extensions-core/lookups-cached-global/src/test/java/io/druid/server/lookup/namespace/cache/CacheSchedulerTest.java +++ b/extensions-core/lookups-cached-global/src/test/java/io/druid/server/lookup/namespace/cache/CacheSchedulerTest.java @@ -138,7 +138,7 @@ public CacheScheduler.VersionedCache generateCache( final CacheScheduler scheduler ) throws InterruptedException { - Thread.sleep(2);// To make absolutely sure there is a unique currentTimeMillis + Thread.sleep(2); // To make absolutely sure there is a unique currentTimeMillis String version = Long.toString(System.currentTimeMillis()); CacheScheduler.VersionedCache versionedCache = scheduler.createVersionedCache(id, version); // Don't actually read off disk because TravisCI doesn't like that @@ -303,10 +303,9 @@ public void testSimpleDelete() throws InterruptedException, TimeoutException, Ex testDelete(); } - public void testDelete() - throws InterruptedException, TimeoutException, ExecutionException + public void testDelete() throws InterruptedException, TimeoutException, ExecutionException { - final long period = 1_000L;// Give it some time between attempts to update + final long period = 1_000L; // Give it some time between attempts to update final UriExtractionNamespace namespace = getUriExtractionNamespace(period); CacheScheduler.Entry entry = scheduler.scheduleAndWait(namespace, 10_000); Assert.assertNotNull(entry); diff --git a/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/DataFetcher.java b/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/DataFetcher.java index 7495f7ebd98e..e9f137401b18 100644 --- a/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/DataFetcher.java +++ b/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/DataFetcher.java @@ -47,7 +47,7 @@ public interface DataFetcher * * @return Returns an {@link Iterable} of key-value pairs. */ - Iterable> fetchAll(); + Iterable> fetchAll(); /** * Function to perform a one item lookup. @@ -66,7 +66,7 @@ public interface DataFetcher * * @return Returns a {@link Iterable} containing the pair of existing key-value. */ - Iterable> fetch(Iterable keys); + Iterable> fetch(Iterable keys); /** * Function used to perform reverse lookup diff --git a/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/LoadingLookupFactory.java b/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/LoadingLookupFactory.java index 4c6b57bffa42..9c28e3a6936d 100644 --- a/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/LoadingLookupFactory.java +++ b/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/LoadingLookupFactory.java @@ -46,7 +46,7 @@ public class LoadingLookupFactory implements LookupExtractorFactory @JsonProperty("reverseLoadingCacheSpec") private final LoadingCache> reverseLoadingCache; - private final String id = Integer.toHexString(System.identityHashCode(this)); + private final String id = Integer.toHexString(System.identityHashCode(this)); private final LoadingLookup loadingLookup; private final AtomicBoolean started = new AtomicBoolean(false); @@ -56,7 +56,7 @@ public LoadingLookupFactory( @JsonProperty("reverseLoadingCacheSpec") LoadingCache> reverseLoadingCache ) { - this(dataFetcher, loadingCache, reverseLoadingCache, new LoadingLookup(dataFetcher,loadingCache,reverseLoadingCache)); + this(dataFetcher, loadingCache, reverseLoadingCache, new LoadingLookup(dataFetcher, loadingCache, reverseLoadingCache)); } protected LoadingLookupFactory( diff --git a/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/PollingLookup.java b/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/PollingLookup.java index c58e0330f3f9..b3ae59d9ea01 100644 --- a/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/PollingLookup.java +++ b/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/PollingLookup.java @@ -60,7 +60,7 @@ public class PollingLookup extends LookupExtractor private final ListenableFuture pollFuture; - private final String id = Integer.toHexString(System.identityHashCode(this)); + private final String id = Integer.toHexString(System.identityHashCode(this)); public PollingLookup( long pollPeriodMs, diff --git a/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/cache/polling/OnHeapPollingCache.java b/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/cache/polling/OnHeapPollingCache.java index c40534599a60..e0dfc838bc87 100644 --- a/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/cache/polling/OnHeapPollingCache.java +++ b/extensions-core/lookups-cached-single/src/main/java/io/druid/server/lookup/cache/polling/OnHeapPollingCache.java @@ -45,8 +45,8 @@ public OnHeapPollingCache(Iterable> entries) immutableReverseMap = ImmutableMap.of(); } else { ImmutableSet.Builder setOfValuesBuilder = ImmutableSet.builder(); - ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); - for (Map.Entry entry: entries + ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); + for (Map.Entry entry: entries ) { setOfValuesBuilder.add(entry.getValue()); mapBuilder.put(entry.getKey(), entry.getValue()); @@ -103,7 +103,7 @@ public void close() public static class OnHeapPollingCacheProvider implements PollingCacheFactory { @Override - public PollingCache makeOf(Iterable> entries) + public PollingCache makeOf(Iterable> entries) { return new OnHeapPollingCache(entries); } diff --git a/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/LoadingLookupTest.java b/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/LoadingLookupTest.java index 9e648dd82dc0..66e864ed6250 100644 --- a/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/LoadingLookupTest.java +++ b/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/LoadingLookupTest.java @@ -57,7 +57,7 @@ public void testApply() throws ExecutionException { EasyMock.expect(lookupCache.get(EasyMock.eq("key"), EasyMock.anyObject(Callable.class))).andReturn("value").once(); EasyMock.replay(lookupCache); - Assert.assertEquals(ImmutableMap.of("key","value"), loadingLookup.applyAll(ImmutableSet.of("key"))); + Assert.assertEquals(ImmutableMap.of("key", "value"), loadingLookup.applyAll(ImmutableSet.of("key"))); EasyMock.verify(lookupCache); } @@ -68,7 +68,7 @@ public void testUnapplyAll() throws ExecutionException .andReturn(Lists.newArrayList("key")) .once(); EasyMock.replay(reverseLookupCache); - Assert.assertEquals(ImmutableMap.of("value",Lists.newArrayList("key")), loadingLookup.unapplyAll(ImmutableSet.of("value"))); + Assert.assertEquals(ImmutableMap.of("value", Lists.newArrayList("key")), loadingLookup.unapplyAll(ImmutableSet.of("value"))); EasyMock.verify(reverseLookupCache); } diff --git a/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/PollingLookupSerDeserTest.java b/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/PollingLookupSerDeserTest.java index ce86d2abd0a3..1edd8e845be0 100644 --- a/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/PollingLookupSerDeserTest.java +++ b/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/PollingLookupSerDeserTest.java @@ -79,7 +79,7 @@ public MockDataFetcher() } @Override - public Iterable> fetchAll() + public Iterable> fetchAll() { return Collections.emptyMap().entrySet(); } diff --git a/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/jdbc/JdbcDataFetcherTest.java b/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/jdbc/JdbcDataFetcherTest.java index 27ebf511ab83..41c29b0b04c9 100644 --- a/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/jdbc/JdbcDataFetcherTest.java +++ b/extensions-core/lookups-cached-single/src/test/java/io/druid/server/lookup/jdbc/JdbcDataFetcherTest.java @@ -100,7 +100,7 @@ public void testFetch() throws InterruptedException @Test public void testFetchAll() { - ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); + ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); for (Map.Entry entry: jdbcDataFetcher.fetchAll() ) { mapBuilder.put(entry.getKey(), entry.getValue()); @@ -111,7 +111,7 @@ public void testFetchAll() @Test public void testFetchKeys() { - ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); + ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); for (Map.Entry entry: jdbcDataFetcher.fetch(lookupMap.keySet()) ) { mapBuilder.put(entry.getKey(), entry.getValue()); diff --git a/extensions-core/postgresql-metadata-storage/src/main/java/io/druid/metadata/storage/postgresql/PostgreSQLConnector.java b/extensions-core/postgresql-metadata-storage/src/main/java/io/druid/metadata/storage/postgresql/PostgreSQLConnector.java index 78189ce42912..58e0b79ac9b7 100644 --- a/extensions-core/postgresql-metadata-storage/src/main/java/io/druid/metadata/storage/postgresql/PostgreSQLConnector.java +++ b/extensions-core/postgresql-metadata-storage/src/main/java/io/druid/metadata/storage/postgresql/PostgreSQLConnector.java @@ -171,7 +171,7 @@ public DBI getDBI() @Override protected boolean connectorIsTransientException(Throwable e) { - if(e instanceof SQLException) { + if (e instanceof SQLException) { final String sqlState = ((SQLException) e).getSQLState(); // limited to errors that are likely to be resolved within a few retries // retry on connection errors and insufficient resources diff --git a/extensions-core/protobuf-extensions/src/test/java/io/druid/data/input/protobuf/ProtoTestEventWrapper.java b/extensions-core/protobuf-extensions/src/test/java/io/druid/data/input/protobuf/ProtoTestEventWrapper.java index 8a63067a76da..314044f5696b 100644 --- a/extensions-core/protobuf-extensions/src/test/java/io/druid/data/input/protobuf/ProtoTestEventWrapper.java +++ b/extensions-core/protobuf-extensions/src/test/java/io/druid/data/input/protobuf/ProtoTestEventWrapper.java @@ -3256,7 +3256,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( internal_static_prototest_ProtoTestEvent_Foo_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_prototest_ProtoTestEvent_Foo_descriptor, - new java.lang.String[]{"Bar",} + new java.lang.String[]{"Bar"} ); } diff --git a/extensions-core/s3-extensions/src/main/java/io/druid/storage/s3/S3DataSegmentFinder.java b/extensions-core/s3-extensions/src/main/java/io/druid/storage/s3/S3DataSegmentFinder.java index 6eb7f79fe7ce..d6d773640e8e 100644 --- a/extensions-core/s3-extensions/src/main/java/io/druid/storage/s3/S3DataSegmentFinder.java +++ b/extensions-core/s3-extensions/src/main/java/io/druid/storage/s3/S3DataSegmentFinder.java @@ -71,7 +71,7 @@ public Set findSegments(String workingDirPath, boolean updateDescri workingDirPath.length() == 0 ? config.getBaseKey() : workingDirPath, config.getMaxListingLength()); - while(objectsIterator.hasNext()) { + while (objectsIterator.hasNext()) { StorageObject storageObject = objectsIterator.next(); storageObject.closeDataInputStream(); diff --git a/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentFinderTest.java b/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentFinderTest.java index 64f4aed74274..00e017000892 100644 --- a/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentFinderTest.java +++ b/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentFinderTest.java @@ -378,7 +378,7 @@ public boolean apply(@Nullable String input) startOffset = keys.indexOf(priorLastKey) + 1; } - int endOffset = startOffset + (int)maxListingLength; // exclusive + int endOffset = startOffset + (int) maxListingLength; // exclusive if (endOffset > keys.size()) { endOffset = keys.size(); } @@ -389,7 +389,7 @@ public boolean apply(@Nullable String input) } List objects = Lists.newArrayList(); - for(String objectKey : keys.subList(startOffset, endOffset)) { + for (String objectKey : keys.subList(startOffset, endOffset)) { objects.add(getObjectDetails(bucketName, objectKey)); } diff --git a/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentMoverTest.java b/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentMoverTest.java index 90bcac57b664..4b9653219c80 100644 --- a/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentMoverTest.java +++ b/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentMoverTest.java @@ -206,7 +206,7 @@ public Map moveObject( ) throws ServiceException { moved = true; - if(isObjectInBucket(sourceBucketName, sourceObjectKey)) { + if (isObjectInBucket(sourceBucketName, sourceObjectKey)) { this.putObject(destinationBucketName, new S3Object(destinationObject.getKey())); storage.get(sourceBucketName).remove(sourceObjectKey); } diff --git a/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentPusherConfigTest.java b/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentPusherConfigTest.java index 8398909e8371..8c4d9befd3b4 100644 --- a/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentPusherConfigTest.java +++ b/extensions-core/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentPusherConfigTest.java @@ -39,7 +39,7 @@ public class S3DataSegmentPusherConfigTest public void testSerialization() throws IOException { String jsonConfig = "{\"bucket\":\"bucket1\",\"baseKey\":\"dataSource1\"," - +"\"disableAcl\":false,\"maxListingLength\":2000,\"useS3aSchema\":false}"; + + "\"disableAcl\":false,\"maxListingLength\":2000,\"useS3aSchema\":false}"; S3DataSegmentPusherConfig config = jsonMapper.readValue(jsonConfig, S3DataSegmentPusherConfig.class); Assert.assertEquals(jsonConfig, jsonMapper.writeValueAsString(config)); @@ -50,7 +50,7 @@ public void testSerializationWithDefaults() throws IOException { String jsonConfig = "{\"bucket\":\"bucket1\",\"baseKey\":\"dataSource1\"}"; String expectedJsonConfig = "{\"bucket\":\"bucket1\",\"baseKey\":\"dataSource1\"," - +"\"disableAcl\":false,\"maxListingLength\":1000,\"useS3aSchema\":false}"; + + "\"disableAcl\":false,\"maxListingLength\":1000,\"useS3aSchema\":false}"; S3DataSegmentPusherConfig config = jsonMapper.readValue(jsonConfig, S3DataSegmentPusherConfig.class); Assert.assertEquals(expectedJsonConfig, jsonMapper.writeValueAsString(config)); @@ -60,7 +60,7 @@ public void testSerializationWithDefaults() throws IOException public void testSerializationValidatingMaxListingLength() throws IOException { String jsonConfig = "{\"bucket\":\"bucket1\",\"baseKey\":\"dataSource1\"," - +"\"disableAcl\":false,\"maxListingLength\":-1}"; + + "\"disableAcl\":false,\"maxListingLength\":-1}"; Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); S3DataSegmentPusherConfig config = jsonMapper.readValue(jsonConfig, S3DataSegmentPusherConfig.class); diff --git a/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceGroupByQueryTest.java b/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceGroupByQueryTest.java index 131b84b52fb4..703d8483743c 100644 --- a/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceGroupByQueryTest.java +++ b/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceGroupByQueryTest.java @@ -62,7 +62,7 @@ public class VarianceGroupByQueryTest private final GroupByQueryRunnerFactory factory; private final String testName; - @Parameterized.Parameters(name="{0}") + @Parameterized.Parameters(name = "{0}") public static Collection constructorFeeder() throws IOException { return GroupByQueryRunnerTest.constructorFeeder(); diff --git a/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceTimeseriesQueryTest.java b/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceTimeseriesQueryTest.java index 91e93d85271a..88b2288bc932 100644 --- a/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceTimeseriesQueryTest.java +++ b/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceTimeseriesQueryTest.java @@ -44,7 +44,7 @@ @RunWith(Parameterized.class) public class VarianceTimeseriesQueryTest { - @Parameterized.Parameters(name="{0}:descending={1}") + @Parameterized.Parameters(name = "{0}:descending={1}") public static Iterable constructorFeeder() throws IOException { return TimeseriesQueryRunnerTest.constructorFeeder(); diff --git a/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceTopNQueryTest.java b/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceTopNQueryTest.java index f3a9441b8a34..22985f299990 100644 --- a/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceTopNQueryTest.java +++ b/extensions-core/stats/src/test/java/io/druid/query/aggregation/variance/VarianceTopNQueryTest.java @@ -51,7 +51,7 @@ @RunWith(Parameterized.class) public class VarianceTopNQueryTest { - @Parameterized.Parameters(name="{0}") + @Parameterized.Parameters(name = "{0}") public static Iterable constructorFeeder() throws IOException { return QueryRunnerTestHelper.transformToConstructionFeeder(TopNQueryRunnerTest.queryRunners()); diff --git a/hll/src/test/java/io/druid/hll/HyperLogLogCollectorBenchmark.java b/hll/src/test/java/io/druid/hll/HyperLogLogCollectorBenchmark.java index d35d78f76d03..981a893161ab 100644 --- a/hll/src/test/java/io/druid/hll/HyperLogLogCollectorBenchmark.java +++ b/hll/src/test/java/io/druid/hll/HyperLogLogCollectorBenchmark.java @@ -60,7 +60,7 @@ protected void setUp() throws Exception Random rand = new Random(0); int defaultOffset = 0; - switch(alignment) { + switch (alignment) { case "default": alignSource = false; alignTarget = false; @@ -81,9 +81,9 @@ protected void setUp() throws Exception ); int pos = 0; - for(int i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { HyperLogLogCollector c = HyperLogLogCollector.makeLatestCollector(); - for(int k = 0; k < 40; ++k) { + for (int k = 0; k < 40; ++k) { c.add(fn.hashInt(++val).asBytes()); } final ByteBuffer sparseHeapCopy = c.toByteBuffer(); @@ -91,9 +91,9 @@ protected void setUp() throws Exception final ByteBuffer buf; - final int offset = random ? (int)(rand.nextDouble() * 64) : defaultOffset; + final int offset = random ? (int) (rand.nextDouble() * 64) : defaultOffset; - if(alignSource && (pos % CACHE_LINE) != offset) { + if (alignSource && (pos % CACHE_LINE) != offset) { pos += (pos % CACHE_LINE) < offset ? offset - (pos % CACHE_LINE) : (CACHE_LINE + offset - pos % CACHE_LINE); } @@ -118,8 +118,8 @@ private ByteBuffer allocateEmptyHLLBuffer(boolean direct, boolean aligned, int o final int size = HyperLogLogCollector.getLatestNumBytesForDenseStorage(); final byte[] EMPTY_BYTES = HyperLogLogCollector.makeEmptyVersionedByteArray(); final ByteBuffer buf; - if(direct) { - if(aligned) { + if (direct) { + if (aligned) { buf = ByteBuffers.allocateAlignedByteBuffer(size + offset, CACHE_LINE); buf.position(offset); buf.mark(); @@ -146,7 +146,7 @@ public double timeFold(int reps) throws Exception final ByteBuffer buf = allocateEmptyHLLBuffer(targetIsDirect, alignTarget, 0); for (int k = 0; k < reps; ++k) { - for(int i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) { final int pos = positions[i]; final int size = sizes[i]; diff --git a/hll/src/test/java/io/druid/hll/HyperLogLogCollectorTest.java b/hll/src/test/java/io/druid/hll/HyperLogLogCollectorTest.java index 2e07f777cedc..853fc98542e9 100644 --- a/hll/src/test/java/io/druid/hll/HyperLogLogCollectorTest.java +++ b/hll/src/test/java/io/druid/hll/HyperLogLogCollectorTest.java @@ -489,7 +489,7 @@ private ByteBuffer makeCollectorBuffer(int offset, byte[] initialBytes, int rema } final short numNonZeroInRemaining = computeNumNonZero((byte) remainingBytes); - numNonZero += (short)((HyperLogLogCollector.NUM_BYTES_FOR_BUCKETS - initialBytes.length) * numNonZeroInRemaining); + numNonZero += (short) ((HyperLogLogCollector.NUM_BYTES_FOR_BUCKETS - initialBytes.length) * numNonZeroInRemaining); ByteBuffer biggerOffset = ByteBuffer.allocate(HyperLogLogCollector.getLatestNumBytesForDenseStorage()); biggerOffset.put(HLLCV1.VERSION); @@ -705,17 +705,17 @@ public void testHighBits() throws Exception public void testMaxOverflow() { HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector(); - collector.add((short)23, (byte)16); + collector.add((short) 23, (byte) 16); Assert.assertEquals(23, collector.getMaxOverflowRegister()); Assert.assertEquals(16, collector.getMaxOverflowValue()); Assert.assertEquals(0, collector.getRegisterOffset()); Assert.assertEquals(0, collector.getNumNonZeroRegisters()); - collector.add((short)56, (byte)17); + collector.add((short) 56, (byte) 17); Assert.assertEquals(56, collector.getMaxOverflowRegister()); Assert.assertEquals(17, collector.getMaxOverflowValue()); - collector.add((short)43, (byte)16); + collector.add((short) 43, (byte) 16); Assert.assertEquals(56, collector.getMaxOverflowRegister()); Assert.assertEquals(17, collector.getMaxOverflowValue()); Assert.assertEquals(0, collector.getRegisterOffset()); @@ -727,10 +727,10 @@ public void testMergeMaxOverflow() { // no offset HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector(); - collector.add((short)23, (byte)16); + collector.add((short) 23, (byte) 16); HyperLogLogCollector other = HyperLogLogCollector.makeLatestCollector(); - collector.add((short)56, (byte)17); + collector.add((short) 56, (byte) 17); collector.fold(other); Assert.assertEquals(56, collector.getMaxOverflowRegister()); @@ -740,11 +740,11 @@ public void testMergeMaxOverflow() // fill up all the buckets so we reach a registerOffset of 49 collector = HyperLogLogCollector.makeLatestCollector(); fillBuckets(collector, (byte) 0, (byte) 49); - collector.add((short)23, (byte)65); + collector.add((short) 23, (byte) 65); other = HyperLogLogCollector.makeLatestCollector(); fillBuckets(other, (byte) 0, (byte) 43); - other.add((short)47, (byte)67); + other.add((short) 47, (byte) 67); collector.fold(other); Assert.assertEquals(47, collector.getMaxOverflowRegister()); @@ -792,7 +792,7 @@ public HyperLogLogCollector apply( Collection> permutations = Collections2.permutations(collectors); - for(List permutation : permutations) { + for (List permutation : permutations) { HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector(); for (HyperLogLogCollector foldee : permutation) { diff --git a/hll/src/test/java/io/druid/hll/HyperLogLogSerdeBenchmarkTest.java b/hll/src/test/java/io/druid/hll/HyperLogLogSerdeBenchmarkTest.java index 672a6e2b464a..7fb056bb76f7 100644 --- a/hll/src/test/java/io/druid/hll/HyperLogLogSerdeBenchmarkTest.java +++ b/hll/src/test/java/io/druid/hll/HyperLogLogSerdeBenchmarkTest.java @@ -143,12 +143,12 @@ public ByteBuffer toByteBuffer() for (int i = 0; i < NUM_BYTES_FOR_BUCKETS; ++i) { if (zipperBuffer[i] != 0) { final short val = (short) (0xffff & (i + startPosition - initialPosition)); - if(byteOrder.equals(ByteOrder.LITTLE_ENDIAN)){ + if (byteOrder.equals(ByteOrder.LITTLE_ENDIAN)) { tempBuffer[outBufferPos + 0] = (byte) (0xff & val); - tempBuffer[outBufferPos + 1] = (byte) (0xff & (val>>8)); - }else{ + tempBuffer[outBufferPos + 1] = (byte) (0xff & (val >> 8)); + } else { tempBuffer[outBufferPos + 1] = (byte) (0xff & val); - tempBuffer[outBufferPos + 0] = (byte) (0xff & (val>>8)); + tempBuffer[outBufferPos + 0] = (byte) (0xff & (val >> 8)); } tempBuffer[outBufferPos + 2] = zipperBuffer[i]; outBufferPos += 3; diff --git a/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java b/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java index 1545bf424a5f..4336d1c3c939 100644 --- a/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java +++ b/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java @@ -712,7 +712,7 @@ indexes, aggregators, new File(baseFlushFile, "merged"), progressIndicator // ShardSpec to be published. final ShardSpec shardSpecForPublishing; if (config.isForceExtendableShardSpecs()) { - shardSpecForPublishing = new NumberedShardSpec(shardSpecForPartitioning.getPartitionNum(),config.getShardSpecCount(bucket)); + shardSpecForPublishing = new NumberedShardSpec(shardSpecForPartitioning.getPartitionNum(), config.getShardSpecCount(bucket)); } else { shardSpecForPublishing = shardSpecForPartitioning; } diff --git a/indexing-hadoop/src/main/java/io/druid/indexer/path/GranularityPathSpec.java b/indexing-hadoop/src/main/java/io/druid/indexer/path/GranularityPathSpec.java index cf1de7974492..ee99b0512a31 100644 --- a/indexing-hadoop/src/main/java/io/druid/indexer/path/GranularityPathSpec.java +++ b/indexing-hadoop/src/main/java/io/druid/indexer/path/GranularityPathSpec.java @@ -125,7 +125,7 @@ public Job addInputPaths(HadoopDruidIndexerConfig config, Job job) throws IOExce Pattern fileMatcher = Pattern.compile(filePattern); DateTimeFormatter customFormatter = null; - if(pathFormat != null) { + if (pathFormat != null) { customFormatter = DateTimeFormat.forPattern(pathFormat); } diff --git a/indexing-hadoop/src/main/java/io/druid/indexer/path/PathSpec.java b/indexing-hadoop/src/main/java/io/druid/indexer/path/PathSpec.java index aa4eb19a7883..12cb1ed55a8e 100644 --- a/indexing-hadoop/src/main/java/io/druid/indexer/path/PathSpec.java +++ b/indexing-hadoop/src/main/java/io/druid/indexer/path/PathSpec.java @@ -28,13 +28,13 @@ /** */ -@JsonTypeInfo(use= JsonTypeInfo.Id.NAME, property="type") -@JsonSubTypes(value={ - @JsonSubTypes.Type(name="granular_unprocessed", value=GranularUnprocessedPathSpec.class), - @JsonSubTypes.Type(name="granularity", value=GranularityPathSpec.class), - @JsonSubTypes.Type(name="static", value=StaticPathSpec.class), - @JsonSubTypes.Type(name="dataSource", value=DatasourcePathSpec.class), - @JsonSubTypes.Type(name="multi", value=MultiplePathSpec.class) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") +@JsonSubTypes(value = { + @JsonSubTypes.Type(name = "granular_unprocessed", value = GranularUnprocessedPathSpec.class), + @JsonSubTypes.Type(name = "granularity", value = GranularityPathSpec.class), + @JsonSubTypes.Type(name = "static", value = StaticPathSpec.class), + @JsonSubTypes.Type(name = "dataSource", value = DatasourcePathSpec.class), + @JsonSubTypes.Type(name = "multi", value = MultiplePathSpec.class) }) public interface PathSpec { diff --git a/indexing-hadoop/src/main/java/io/druid/indexer/updater/HadoopConverterJob.java b/indexing-hadoop/src/main/java/io/druid/indexer/updater/HadoopConverterJob.java index 26f908ce5a5f..d19fc4026fed 100644 --- a/indexing-hadoop/src/main/java/io/druid/indexer/updater/HadoopConverterJob.java +++ b/indexing-hadoop/src/main/java/io/druid/indexer/updater/HadoopConverterJob.java @@ -237,7 +237,7 @@ public List run() throws IOException } converterConfigIntoConfiguration(converterConfig, segments, jobConf); - jobConf.setNumReduceTasks(0);// Map only. Number of map tasks determined by input format + jobConf.setNumReduceTasks(0); // Map only. Number of map tasks determined by input format jobConf.setWorkingDirectory(new Path(converterConfig.getDistributedSuccessCache())); setJobName(jobConf, segments); @@ -344,7 +344,7 @@ public DataSegment apply(final Path input) } } catch (InterruptedException | ClassNotFoundException e) { - RuntimeException exception = Throwables.propagate(e); + RuntimeException exception = Throwables.propagate(e); throwable = exception; throw exception; } @@ -505,7 +505,7 @@ protected void map( final String tmpDirLoc = context.getConfiguration().get(TMP_FILE_LOC_KEY); final File tmpDir = Paths.get(tmpDirLoc).toFile(); - final DataSegment segment = Iterables.getOnlyElement(((DatasourceInputSplit) split).getSegments()).getSegment(); + final DataSegment segment = Iterables.getOnlyElement(((DatasourceInputSplit) split).getSegments()).getSegment(); final HadoopDruidConverterConfig config = converterConfigFromConfiguration(context.getConfiguration()); diff --git a/indexing-hadoop/src/test/java/io/druid/indexer/BucketTest.java b/indexing-hadoop/src/test/java/io/druid/indexer/BucketTest.java index adf871413f59..ec026eeaede9 100644 --- a/indexing-hadoop/src/test/java/io/druid/indexer/BucketTest.java +++ b/indexing-hadoop/src/test/java/io/druid/indexer/BucketTest.java @@ -54,10 +54,10 @@ public class BucketTest { byte[] firstPart = {1, 1, 0, 10}; byte[] secondPart = {2, 4, 0, 5}; - byte[] expectedGroupParts = bucket.toGroupKey(firstPart,secondPart); + byte[] expectedGroupParts = bucket.toGroupKey(firstPart, secondPart); Pair actualPair = Bucket.fromGroupKey(expectedGroupParts); Assert.assertEquals("Bucket is not matching", bucket, actualPair.lhs); - Assert.assertArrayEquals("Parts not matching", Bytes.concat(firstPart,secondPart), actualPair.rhs); + Assert.assertArrayEquals("Parts not matching", Bytes.concat(firstPart, secondPart), actualPair.rhs); } @Test public void testToString() @@ -67,7 +67,7 @@ public class BucketTest ", partitionNum=" + partitionNum + ", shardNum=" + shardNum + '}'; - Assert.assertEquals(bucket.toString(),expectedString); + Assert.assertEquals(bucket.toString(), expectedString); } @Test public void testEquals() @@ -79,10 +79,10 @@ public class BucketTest Assert.assertFalse("Objects do not have the same partitionNum", bucket.equals(new Bucket(shardNum, time, partitionNum + 1))); Assert.assertFalse("Objects do not have the same shardNum", - bucket.equals(new Bucket(shardNum + 1,time,partitionNum))); - Assert.assertFalse("Objects do not have the same time",bucket.equals(new Bucket(shardNum,new DateTime(),partitionNum))); - Assert.assertFalse("Object do have NULL time",bucket.equals(new Bucket(shardNum,null,partitionNum))); - Assert.assertTrue("Objects must be the same",bucket.equals(new Bucket(shardNum, time, partitionNum))); + bucket.equals(new Bucket(shardNum + 1, time, partitionNum))); + Assert.assertFalse("Objects do not have the same time", bucket.equals(new Bucket(shardNum, new DateTime(), partitionNum))); + Assert.assertFalse("Object do have NULL time", bucket.equals(new Bucket(shardNum, null, partitionNum))); + Assert.assertTrue("Objects must be the same", bucket.equals(new Bucket(shardNum, time, partitionNum))); } @@ -90,7 +90,7 @@ public class BucketTest { int hashCode = bucket.hashCode(); Assert.assertThat(hashCode, OrderingComparison.greaterThanOrEqualTo(31 * partitionNum + shardNum)); - bucket = new Bucket(shardNum,null,partitionNum); + bucket = new Bucket(shardNum, null, partitionNum); hashCode = bucket.hashCode(); Assert.assertEquals(hashCode, (31 * partitionNum + shardNum)); } diff --git a/indexing-hadoop/src/test/java/io/druid/indexer/DeterminePartitionsJobTest.java b/indexing-hadoop/src/test/java/io/druid/indexer/DeterminePartitionsJobTest.java index 96d3cf9092c7..a802d3ca0376 100644 --- a/indexing-hadoop/src/test/java/io/druid/indexer/DeterminePartitionsJobTest.java +++ b/indexing-hadoop/src/test/java/io/druid/indexer/DeterminePartitionsJobTest.java @@ -78,11 +78,11 @@ public static Collection constructFeed() new int[]{5}, new String[][][]{ { - { null, "c.example.com" }, - { "c.example.com", "e.example.com" }, - { "e.example.com", "g.example.com" }, - { "g.example.com", "i.example.com" }, - { "i.example.com", null } + {null, "c.example.com"}, + {"c.example.com", "e.example.com"}, + {"e.example.com", "g.example.com"}, + {"g.example.com", "i.example.com"}, + {"i.example.com", null } } }, ImmutableList.of( @@ -106,11 +106,11 @@ public static Collection constructFeed() new int[]{5}, new String[][][]{ { - { null, "c.example.com"}, - { "c.example.com", "e.example.com" }, - { "e.example.com", "g.example.com" }, - { "g.example.com", "i.example.com" }, - { "i.example.com", null } + {null, "c.example.com"}, + {"c.example.com", "e.example.com"}, + {"e.example.com", "g.example.com"}, + {"g.example.com", "i.example.com"}, + {"i.example.com", null} } }, ImmutableList.of( @@ -144,16 +144,16 @@ public static Collection constructFeed() new int[]{2, 2, 2}, new String[][][]{ { - { null, "f.example.com" }, - { "f.example.com", null } + {null, "f.example.com"}, + {"f.example.com", null} }, { - { null, "f.example.com" }, - { "f.example.com", null } + {null, "f.example.com"}, + {"f.example.com", null} }, { - { null, "f.example.com" }, - { "f.example.com", null } + {null, "f.example.com"}, + {"f.example.com", null} } }, ImmutableList.of( diff --git a/indexing-hadoop/src/test/java/io/druid/indexer/HadoopIOPeonTest.java b/indexing-hadoop/src/test/java/io/druid/indexer/HadoopIOPeonTest.java index 546d7ac3cedd..2522487e1761 100644 --- a/indexing-hadoop/src/test/java/io/druid/indexer/HadoopIOPeonTest.java +++ b/indexing-hadoop/src/test/java/io/druid/indexer/HadoopIOPeonTest.java @@ -49,7 +49,7 @@ public class HadoopIOPeonTest EasyMock.expect(mockJobContext.getConfiguration()).andReturn(jobConfig).anyTimes(); EasyMock.replay(mockJobContext); - ioPeon = new HadoopIOPeon(mockJobContext,new Path(tmpFolder.newFile().getParent()),overwritesFiles); + ioPeon = new HadoopIOPeon(mockJobContext, new Path(tmpFolder.newFile().getParent()), overwritesFiles); } @After public void tearDown() diff --git a/indexing-hadoop/src/test/java/io/druid/indexer/IndexGeneratorCombinerTest.java b/indexing-hadoop/src/test/java/io/druid/indexer/IndexGeneratorCombinerTest.java index 7e6f33a98481..0815581fbf37 100644 --- a/indexing-hadoop/src/test/java/io/druid/indexer/IndexGeneratorCombinerTest.java +++ b/indexing-hadoop/src/test/java/io/druid/indexer/IndexGeneratorCombinerTest.java @@ -187,7 +187,7 @@ public void testMultipleRowsMerged() throws Exception Assert.assertEquals(ImmutableList.of(), capturedRow.getDimension("host")); Assert.assertEquals(Arrays.asList("bar", "foo"), capturedRow.getDimension("keywords")); Assert.assertEquals(15, capturedRow.getLongMetric("visited_sum")); - Assert.assertEquals(2.0, (Double)HyperUniquesAggregatorFactory.estimateCardinality(capturedRow.getRaw("unique_hosts")), 0.001); + Assert.assertEquals(2.0, (Double) HyperUniquesAggregatorFactory.estimateCardinality(capturedRow.getRaw("unique_hosts")), 0.001); } @Test @@ -250,13 +250,13 @@ public void testMultipleRowsNotMerged() throws Exception Assert.assertEquals(Collections.singletonList("host1"), capturedRow1.getDimension("host")); Assert.assertEquals(Arrays.asList("bar", "foo"), capturedRow1.getDimension("keywords")); Assert.assertEquals(10, capturedRow1.getLongMetric("visited_sum")); - Assert.assertEquals(1.0, (Double)HyperUniquesAggregatorFactory.estimateCardinality(capturedRow1.getRaw("unique_hosts")), 0.001); + Assert.assertEquals(1.0, (Double) HyperUniquesAggregatorFactory.estimateCardinality(capturedRow1.getRaw("unique_hosts")), 0.001); InputRow capturedRow2 = InputRowSerde.fromBytes(captureVal2.getValue().getBytes(), aggregators); Assert.assertEquals(Arrays.asList("host", "keywords"), capturedRow2.getDimensions()); Assert.assertEquals(Collections.singletonList("host2"), capturedRow2.getDimension("host")); Assert.assertEquals(Arrays.asList("bar", "foo"), capturedRow2.getDimension("keywords")); Assert.assertEquals(5, capturedRow2.getLongMetric("visited_sum")); - Assert.assertEquals(1.0, (Double)HyperUniquesAggregatorFactory.estimateCardinality(capturedRow2.getRaw("unique_hosts")), 0.001); + Assert.assertEquals(1.0, (Double) HyperUniquesAggregatorFactory.estimateCardinality(capturedRow2.getRaw("unique_hosts")), 0.001); } } diff --git a/indexing-hadoop/src/test/java/io/druid/indexer/IndexGeneratorJobTest.java b/indexing-hadoop/src/test/java/io/druid/indexer/IndexGeneratorJobTest.java index bc72a60c362f..5c2425b1f34e 100644 --- a/indexing-hadoop/src/test/java/io/druid/indexer/IndexGeneratorJobTest.java +++ b/indexing-hadoop/src/test/java/io/druid/indexer/IndexGeneratorJobTest.java @@ -375,7 +375,7 @@ public static Collection constructFeed() // Run each baseConstructor with/without forceExtendableShardSpecs. final List constructors = Lists.newArrayList(); for (Object[] baseConstructor : baseConstructors) { - for (int forceExtendableShardSpecs = 0; forceExtendableShardSpecs < 2 ; forceExtendableShardSpecs++) { + for (int forceExtendableShardSpecs = 0; forceExtendableShardSpecs < 2; forceExtendableShardSpecs++) { final Object[] fullConstructor = new Object[baseConstructor.length + 1]; System.arraycopy(baseConstructor, 0, fullConstructor, 0, baseConstructor.length); fullConstructor[baseConstructor.length] = forceExtendableShardSpecs == 0; diff --git a/indexing-hadoop/src/test/java/io/druid/indexer/hadoop/DatasourceInputSplitTest.java b/indexing-hadoop/src/test/java/io/druid/indexer/hadoop/DatasourceInputSplitTest.java index 0017850e2c6c..dcbb3d6483ae 100644 --- a/indexing-hadoop/src/test/java/io/druid/indexer/hadoop/DatasourceInputSplitTest.java +++ b/indexing-hadoop/src/test/java/io/druid/indexer/hadoop/DatasourceInputSplitTest.java @@ -60,7 +60,7 @@ public void testSerde() throws Exception interval ) ), - new String[] { "server1", "server2", "server3"} + new String[] {"server1", "server2", "server3"} ); ByteArrayDataOutput out = ByteStreams.newDataOutput(); diff --git a/indexing-hadoop/src/test/java/io/druid/indexer/hadoop/DatasourceRecordReaderTest.java b/indexing-hadoop/src/test/java/io/druid/indexer/hadoop/DatasourceRecordReaderTest.java index b910e9b49b00..0919320616ea 100644 --- a/indexing-hadoop/src/test/java/io/druid/indexer/hadoop/DatasourceRecordReaderTest.java +++ b/indexing-hadoop/src/test/java/io/druid/indexer/hadoop/DatasourceRecordReaderTest.java @@ -84,7 +84,7 @@ public void testSanity() throws Exception Assert.assertEquals(0, rr.getProgress(), 0.0001); List rows = Lists.newArrayList(); - while(rr.nextKeyValue()) { + while (rr.nextKeyValue()) { rows.add(rr.getCurrentValue()); } verifyRows(rows); diff --git a/indexing-hadoop/src/test/java/io/druid/indexer/path/GranularUnprocessedPathSpecTest.java b/indexing-hadoop/src/test/java/io/druid/indexer/path/GranularUnprocessedPathSpecTest.java index 7b2a70b112cc..dee0fa0f66ac 100644 --- a/indexing-hadoop/src/test/java/io/druid/indexer/path/GranularUnprocessedPathSpecTest.java +++ b/indexing-hadoop/src/test/java/io/druid/indexer/path/GranularUnprocessedPathSpecTest.java @@ -30,6 +30,6 @@ public void testSetGetMaxBuckets() GranularUnprocessedPathSpec granularUnprocessedPathSpec = new GranularUnprocessedPathSpec(); int maxBuckets = 5; granularUnprocessedPathSpec.setMaxBuckets(maxBuckets); - Assert.assertEquals(maxBuckets,granularUnprocessedPathSpec.getMaxBuckets()); + Assert.assertEquals(maxBuckets, granularUnprocessedPathSpec.getMaxBuckets()); } } diff --git a/indexing-hadoop/src/test/java/io/druid/indexer/path/GranularityPathSpecTest.java b/indexing-hadoop/src/test/java/io/druid/indexer/path/GranularityPathSpecTest.java index 8a3952f0fb5f..6317f1be1111 100644 --- a/indexing-hadoop/src/test/java/io/druid/indexer/path/GranularityPathSpecTest.java +++ b/indexing-hadoop/src/test/java/io/druid/indexer/path/GranularityPathSpecTest.java @@ -281,7 +281,7 @@ private void testSerde( // Double-check Jackson's lower-case enum support sb.append(jsonMapper.writeValueAsString(granularity)); sb.append(","); - if(inputFormat != null) { + if (inputFormat != null) { sb.append("\"inputFormat\" : \""); sb.append(inputFormat.getName()); sb.append("\","); diff --git a/indexing-hadoop/src/test/java/io/druid/indexer/path/StaticPathSpecTest.java b/indexing-hadoop/src/test/java/io/druid/indexer/path/StaticPathSpecTest.java index 7cc9a3fdf203..ae75d6637db3 100644 --- a/indexing-hadoop/src/test/java/io/druid/indexer/path/StaticPathSpecTest.java +++ b/indexing-hadoop/src/test/java/io/druid/indexer/path/StaticPathSpecTest.java @@ -70,7 +70,7 @@ private void testSerde(String path, Class inputFormat) throws Exception sb.append("{\"paths\" : \""); sb.append(path); sb.append("\","); - if(inputFormat != null) { + if (inputFormat != null) { sb.append("\"inputFormat\" : \""); sb.append(inputFormat.getName()); sb.append("\","); diff --git a/indexing-service/src/main/java/io/druid/indexing/common/actions/RemoteTaskActionClient.java b/indexing-service/src/main/java/io/druid/indexing/common/actions/RemoteTaskActionClient.java index a908f19fd4e6..7c0ac1680a9b 100644 --- a/indexing-service/src/main/java/io/druid/indexing/common/actions/RemoteTaskActionClient.java +++ b/indexing-service/src/main/java/io/druid/indexing/common/actions/RemoteTaskActionClient.java @@ -151,7 +151,7 @@ public RetType submit(TaskAction taskAction) throws IOExcepti private long jitter(long input) { final double jitter = random.nextGaussian() * input / 4.0; - long retval = input + (long)jitter; + long retval = input + (long) jitter; return retval < 0 ? 0 : retval; } diff --git a/indexing-service/src/main/java/io/druid/indexing/common/config/TaskStorageConfig.java b/indexing-service/src/main/java/io/druid/indexing/common/config/TaskStorageConfig.java index 1e78ccf3db65..e69eb7515291 100644 --- a/indexing-service/src/main/java/io/druid/indexing/common/config/TaskStorageConfig.java +++ b/indexing-service/src/main/java/io/druid/indexing/common/config/TaskStorageConfig.java @@ -37,7 +37,7 @@ public TaskStorageConfig( @JsonProperty("recentlyFinishedThreshold") Period period ) { - if(period != null) { + if (period != null) { this.recentlyFinishedThreshold = period.toStandardDuration(); } } diff --git a/indexing-service/src/main/java/io/druid/indexing/common/task/ConvertSegmentBackwardsCompatibleTask.java b/indexing-service/src/main/java/io/druid/indexing/common/task/ConvertSegmentBackwardsCompatibleTask.java index 5deed5d7fd45..0a2b9d2a12be 100644 --- a/indexing-service/src/main/java/io/druid/indexing/common/task/ConvertSegmentBackwardsCompatibleTask.java +++ b/indexing-service/src/main/java/io/druid/indexing/common/task/ConvertSegmentBackwardsCompatibleTask.java @@ -46,7 +46,7 @@ public ConvertSegmentBackwardsCompatibleTask( segment, indexSpec, force == null ? false : force, - validate ==null ? false : validate, + validate == null ? false : validate, null ); } diff --git a/indexing-service/src/main/java/io/druid/indexing/common/task/MoveTask.java b/indexing-service/src/main/java/io/druid/indexing/common/task/MoveTask.java index 1680726de791..190ea2c9eb7c 100644 --- a/indexing-service/src/main/java/io/druid/indexing/common/task/MoveTask.java +++ b/indexing-service/src/main/java/io/druid/indexing/common/task/MoveTask.java @@ -75,11 +75,11 @@ public TaskStatus run(TaskToolbox toolbox) throws Exception // Confirm we have a lock (will throw if there isn't exactly one element) final TaskLock myLock = Iterables.getOnlyElement(getTaskLocks(toolbox)); - if(!myLock.getDataSource().equals(getDataSource())) { + if (!myLock.getDataSource().equals(getDataSource())) { throw new ISE("WTF?! Lock dataSource[%s] != task dataSource[%s]", myLock.getDataSource(), getDataSource()); } - if(!myLock.getInterval().equals(getInterval())) { + if (!myLock.getInterval().equals(getInterval())) { throw new ISE("WTF?! Lock interval[%s] != task interval[%s]", myLock.getInterval(), getInterval()); } @@ -89,8 +89,8 @@ public TaskStatus run(TaskToolbox toolbox) throws Exception .submit(new SegmentListUnusedAction(myLock.getDataSource(), myLock.getInterval())); // Verify none of these segments have versions > lock version - for(final DataSegment unusedSegment : unusedSegments) { - if(unusedSegment.getVersion().compareTo(myLock.getVersion()) > 0) { + for (final DataSegment unusedSegment : unusedSegments) { + if (unusedSegment.getVersion().compareTo(myLock.getVersion()) > 0) { throw new ISE( "WTF?! Unused segment[%s] has version[%s] > task version[%s]", unusedSegment.getIdentifier(), diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/ForkingTaskRunner.java b/indexing-service/src/main/java/io/druid/indexing/overlord/ForkingTaskRunner.java index fce07084a55e..9e17bfe9fd95 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/ForkingTaskRunner.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/ForkingTaskRunner.java @@ -238,7 +238,7 @@ public TaskStatus call() int tlsChildPort = -1; int childChatHandlerPort = -1; - if(serverConfig.isPlaintext()) { + if (serverConfig.isPlaintext()) { if (config.isSeparateIngestionEndpoint()) { Pair portPair = portFinder.findTwoConsecutiveUnusedPorts(); childPort = portPair.lhs; @@ -248,7 +248,7 @@ public TaskStatus call() } } - if(serverConfig.isTls()) { + if (serverConfig.isTls()) { tlsChildPort = tlsPortFinder.findUnusedPort(); } @@ -500,10 +500,10 @@ public TaskStatus call() } } - if(serverConfig.isPlaintext()) { + if (serverConfig.isPlaintext()) { portFinder.markPortUnused(childPort); } - if(serverConfig.isTls()) { + if (serverConfig.isTls()) { tlsPortFinder.markPortUnused(tlsChildPort); } if (childChatHandlerPort > 0) { diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/HeapMemoryTaskStorage.java b/indexing-service/src/main/java/io/druid/indexing/overlord/HeapMemoryTaskStorage.java index 6181a722e1f3..0906fef89a15 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/HeapMemoryTaskStorage.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/HeapMemoryTaskStorage.java @@ -79,7 +79,7 @@ public void insert(Task task, TaskStatus status) throws EntryExistsException status.getId() ); - if(tasks.containsKey(task.getId())) { + if (tasks.containsKey(task.getId())) { throw new EntryExistsException(task.getId()); } @@ -98,7 +98,7 @@ public Optional getTask(String taskid) try { Preconditions.checkNotNull(taskid, "taskid"); - if(tasks.containsKey(taskid)) { + if (tasks.containsKey(taskid)) { return Optional.of(tasks.get(taskid).getTask()); } else { return Optional.absent(); @@ -135,7 +135,7 @@ public Optional getStatus(String taskid) try { Preconditions.checkNotNull(taskid, "taskid"); - if(tasks.containsKey(taskid)) { + if (tasks.containsKey(taskid)) { return Optional.of(tasks.get(taskid).getStatus()); } else { return Optional.absent(); @@ -153,8 +153,8 @@ public List getActiveTasks() try { final ImmutableList.Builder listBuilder = ImmutableList.builder(); - for(final TaskStuff taskStuff : tasks.values()) { - if(taskStuff.getStatus().isRunnable()) { + for (final TaskStuff taskStuff : tasks.values()) { + if (taskStuff.getStatus().isRunnable()) { listBuilder.add(taskStuff.getTask()); } } @@ -182,7 +182,7 @@ public int compare(TaskStuff a, TaskStuff b) } }.reverse(); for (final TaskStuff taskStuff : createdDateDesc.sortedCopy(tasks.values())) { - if(taskStuff.getStatus().isComplete() && taskStuff.getCreatedDate().getMillis() > recent) { + if (taskStuff.getStatus().isComplete() && taskStuff.getCreatedDate().getMillis() > recent) { returns.add(taskStuff.getStatus()); } } diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/MetadataTaskStorage.java b/indexing-service/src/main/java/io/druid/indexing/overlord/MetadataTaskStorage.java index 95cff9a35fb8..72dcd3ec34da 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/MetadataTaskStorage.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/MetadataTaskStorage.java @@ -142,7 +142,7 @@ public void insert(final Task task, final TaskStatus status) throws EntryExistsE ); } catch (Exception e) { - if(e instanceof EntryExistsException) { + if (e instanceof EntryExistsException) { throw (EntryExistsException) e; } else { Throwables.propagate(e); diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/TaskLockbox.java b/indexing-service/src/main/java/io/druid/indexing/overlord/TaskLockbox.java index 304d3d4105d6..599e3a039918 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/TaskLockbox.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/TaskLockbox.java @@ -151,7 +151,7 @@ public int compare(Pair left, Pair right) final TaskLock taskLock = taskLockPosse.getTaskLock(); if (savedTaskLock.getVersion().equals(taskLock.getVersion())) { - taskLockCount ++; + taskLockCount++; log.info( "Reacquired lock on interval[%s] version[%s] for task: %s", savedTaskLock.getInterval(), @@ -159,7 +159,7 @@ public int compare(Pair left, Pair right) task.getId() ); } else { - taskLockCount ++; + taskLockCount++; log.info( "Could not reacquire lock on interval[%s] version[%s] (got version[%s] instead) for task: %s", savedTaskLock.getInterval(), @@ -269,7 +269,7 @@ private Optional tryLock(final Task task, final Interval interval, fin giant.lock(); try { - if(!activeTasks.contains(task.getId())){ + if (!activeTasks.contains(task.getId())) { throw new ISE("Unable to grant lock to inactive Task [%s]", task.getId()); } Preconditions.checkArgument(interval.toDurationMillis() > 0, "interval empty"); @@ -428,9 +428,9 @@ public void unlock(final Task task, final Interval interval) // So we can alert if activeTasks try to release stuff they don't have boolean removed = false; - if(dsRunning != null) { + if (dsRunning != null) { final TaskLockPosse taskLockPosse = dsRunning.get(interval); - if(taskLockPosse != null) { + if (taskLockPosse != null) { final TaskLock taskLock = taskLockPosse.getTaskLock(); // Remove task from live list @@ -514,7 +514,7 @@ private List findLockPossesForTask(final Task task) // Scan through all locks for this datasource final NavigableMap dsRunning = running.get(task.getDataSource()); - if(dsRunning == null) { + if (dsRunning == null) { searchSpace = ImmutableList.of(); } else { searchSpace = dsRunning.values(); diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/TaskQueue.java b/indexing-service/src/main/java/io/druid/indexing/overlord/TaskQueue.java index 0de0b3cba1a0..a360f5c677bf 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/TaskQueue.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/TaskQueue.java @@ -522,13 +522,13 @@ private void syncFromStorage() try { if (active) { - final Map newTasks = toTaskIDMap(taskStorage.getActiveTasks()); + final Map newTasks = toTaskIDMap(taskStorage.getActiveTasks()); final int tasksSynced = newTasks.size(); - final Map oldTasks = toTaskIDMap(tasks); + final Map oldTasks = toTaskIDMap(tasks); // Calculate differences on IDs instead of Task Objects. Set commonIds = Sets.newHashSet(Sets.intersection(newTasks.keySet(), oldTasks.keySet())); - for(String taskID : commonIds){ + for (String taskID : commonIds) { newTasks.remove(taskID); oldTasks.remove(taskID); } @@ -536,12 +536,12 @@ private void syncFromStorage() Collection removedTasks = oldTasks.values(); // Clean up removed Tasks - for(Task task : removedTasks){ + for (Task task : removedTasks) { removeTaskInternal(task); } // Add newly Added tasks to the queue - for(Task task : addedTasks){ + for (Task task : addedTasks) { addTaskInternal(task); } @@ -565,10 +565,10 @@ private void syncFromStorage() } } - private static Map toTaskIDMap(List taskList) + private static Map toTaskIDMap(List taskList) { - Map rv = Maps.newHashMap(); - for(Task task : taskList){ + Map rv = Maps.newHashMap(); + for (Task task : taskList) { rv.put(task.getId(), task); } return rv; diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/helpers/TaskLogAutoCleanerConfig.java b/indexing-service/src/main/java/io/druid/indexing/overlord/helpers/TaskLogAutoCleanerConfig.java index 856e076cf8dc..b8e8a492f3ba 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/helpers/TaskLogAutoCleanerConfig.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/helpers/TaskLogAutoCleanerConfig.java @@ -54,8 +54,8 @@ public TaskLogAutoCleanerConfig( } this.enabled = enabled; - this.initialDelay = initialDelay == null ? 60000 + new Random().nextInt(4*60000) : initialDelay.longValue(); - this.delay = delay == null ? 6*60*60*1000 : delay.longValue(); + this.initialDelay = initialDelay == null ? 60000 + new Random().nextInt(4 * 60000) : initialDelay.longValue(); + this.delay = delay == null ? 6 * 60 * 60 * 1000 : delay.longValue(); this.durationToRetain = durationToRetain == null ? Long.MAX_VALUE : durationToRetain.longValue(); Preconditions.checkArgument(this.initialDelay > 0, "initialDelay must be > 0."); diff --git a/indexing-service/src/test/java/io/druid/indexing/common/RetryPolicyFactoryTest.java b/indexing-service/src/test/java/io/druid/indexing/common/RetryPolicyFactoryTest.java index 48aa62397429..159b073ac68e 100644 --- a/indexing-service/src/test/java/io/druid/indexing/common/RetryPolicyFactoryTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/common/RetryPolicyFactoryTest.java @@ -35,7 +35,7 @@ public void testMakeRetryPolicy() .setMaxRetryCount(1); RetryPolicyFactory retryPolicyFactory = new RetryPolicyFactory(config); RetryPolicy retryPolicy = retryPolicyFactory.makeRetryPolicy(); - Assert.assertEquals(new Duration("PT1S"),retryPolicy.getAndIncrementRetryDelay()); + Assert.assertEquals(new Duration("PT1S"), retryPolicy.getAndIncrementRetryDelay()); Assert.assertTrue(retryPolicy.hasExceededRetryThreshold()); } } diff --git a/indexing-service/src/test/java/io/druid/indexing/common/TaskToolboxTest.java b/indexing-service/src/test/java/io/druid/indexing/common/TaskToolboxTest.java index 192ddec89fa1..5430938f96c6 100644 --- a/indexing-service/src/test/java/io/druid/indexing/common/TaskToolboxTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/common/TaskToolboxTest.java @@ -35,7 +35,6 @@ import io.druid.segment.loading.DataSegmentKiller; import io.druid.segment.loading.DataSegmentMover; import io.druid.segment.loading.DataSegmentPusher; -import io.druid.segment.loading.SegmentLoaderConfig; import io.druid.segment.loading.SegmentLoaderLocalCacheManager; import io.druid.segment.loading.SegmentLoadingException; import io.druid.segment.realtime.plumber.SegmentHandoffNotifierFactory; @@ -118,46 +117,48 @@ public void setUp() throws IOException @Test public void testGetDataSegmentArchiver() { - Assert.assertEquals(mockDataSegmentArchiver,taskToolbox.build(task).getDataSegmentArchiver()); + Assert.assertEquals(mockDataSegmentArchiver, taskToolbox.build(task).getDataSegmentArchiver()); } @Test public void testGetSegmentAnnouncer() { - Assert.assertEquals(mockSegmentAnnouncer,taskToolbox.build(task).getSegmentAnnouncer()); + Assert.assertEquals(mockSegmentAnnouncer, taskToolbox.build(task).getSegmentAnnouncer()); } @Test public void testGetQueryRunnerFactoryConglomerate() { - Assert.assertEquals(mockQueryRunnerFactoryConglomerate,taskToolbox.build(task).getQueryRunnerFactoryConglomerate()); + Assert.assertEquals(mockQueryRunnerFactoryConglomerate, taskToolbox.build(task).getQueryRunnerFactoryConglomerate()); } @Test public void testGetQueryExecutorService() { - Assert.assertEquals(mockQueryExecutorService,taskToolbox.build(task).getQueryExecutorService()); + Assert.assertEquals(mockQueryExecutorService, taskToolbox.build(task).getQueryExecutorService()); } @Test public void testGetMonitorScheduler() { - Assert.assertEquals(mockMonitorScheduler,taskToolbox.build(task).getMonitorScheduler()); + Assert.assertEquals(mockMonitorScheduler, taskToolbox.build(task).getMonitorScheduler()); } @Test public void testGetObjectMapper() { - Assert.assertEquals(ObjectMapper,taskToolbox.build(task).getObjectMapper()); + Assert.assertEquals(ObjectMapper, taskToolbox.build(task).getObjectMapper()); } @Test public void testFetchSegments() throws SegmentLoadingException, IOException { File expectedFile = temporaryFolder.newFile(); - EasyMock.expect(mockSegmentLoaderLocalCacheManager.getSegmentFiles((DataSegment)EasyMock.anyObject())) + EasyMock + .expect(mockSegmentLoaderLocalCacheManager.getSegmentFiles(EasyMock.anyObject())) .andReturn(expectedFile).anyTimes(); - EasyMock.expect(mockSegmentLoaderLocalCacheManager.withConfig((SegmentLoaderConfig)EasyMock.anyObject())) + EasyMock + .expect(mockSegmentLoaderLocalCacheManager.withConfig(EasyMock.anyObject())) .andReturn(mockSegmentLoaderLocalCacheManager).anyTimes(); EasyMock.replay(mockSegmentLoaderLocalCacheManager); DataSegment dataSegment = DataSegment.builder().dataSource("source").interval(new Interval("2012-01-01/P1D")).version("1").size(1).build(); @@ -171,7 +172,7 @@ public void testFetchSegments() throws SegmentLoadingException, IOException @Test public void testGetEmitter() { - Assert.assertEquals(mockEmitter,taskToolbox.build(task).getEmitter()); + Assert.assertEquals(mockEmitter, taskToolbox.build(task).getEmitter()); } @Test diff --git a/indexing-service/src/test/java/io/druid/indexing/common/task/MergeTaskBaseTest.java b/indexing-service/src/test/java/io/druid/indexing/common/task/MergeTaskBaseTest.java index ea2b63e5c73d..bb3f982d8fdc 100644 --- a/indexing-service/src/test/java/io/druid/indexing/common/task/MergeTaskBaseTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/common/task/MergeTaskBaseTest.java @@ -74,12 +74,15 @@ public void testInterval() @Test public void testID() { - final String desiredPrefix = "merge_foo_" + Hashing.sha1().hashString( - "2012-01-03T00:00:00.000Z_2012-01-05T00:00:00.000Z_V1_0" - + "_2012-01-04T00:00:00.000Z_2012-01-06T00:00:00.000Z_V1_0" - + "_2012-01-05T00:00:00.000Z_2012-01-07T00:00:00.000Z_V1_0" - , Charsets.UTF_8 - ).toString() + "_"; + final String desiredPrefix = + "merge_foo_" + + Hashing.sha1().hashString( + "2012-01-03T00:00:00.000Z_2012-01-05T00:00:00.000Z_V1_0" + + "_2012-01-04T00:00:00.000Z_2012-01-06T00:00:00.000Z_V1_0" + + "_2012-01-05T00:00:00.000Z_2012-01-07T00:00:00.000Z_V1_0", + Charsets.UTF_8 + ).toString() + + "_"; Assert.assertEquals( desiredPrefix, testMergeTaskBase.getId().substring(0, desiredPrefix.length()) diff --git a/indexing-service/src/test/java/io/druid/indexing/common/tasklogs/FileTaskLogsTest.java b/indexing-service/src/test/java/io/druid/indexing/common/tasklogs/FileTaskLogsTest.java index 1d90a58ff754..066f01d05ae4 100644 --- a/indexing-service/src/test/java/io/druid/indexing/common/tasklogs/FileTaskLogsTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/common/tasklogs/FileTaskLogsTest.java @@ -104,7 +104,7 @@ public void testKill() throws Exception //is necessary to separate 2 file creations by a timestamp that would result in only one //of them getting deleted Thread.sleep(1500); - long time = (System.currentTimeMillis()/1000)*1000; + long time = (System.currentTimeMillis() / 1000) * 1000; Assert.assertTrue(new File(logDir, "log1.log").lastModified() < time); Files.write("log2content", logFile, Charsets.UTF_8); diff --git a/indexing-service/src/test/java/io/druid/indexing/overlord/TaskLockboxTest.java b/indexing-service/src/test/java/io/druid/indexing/overlord/TaskLockboxTest.java index f58b6af5d319..224000e1bdc7 100644 --- a/indexing-service/src/test/java/io/druid/indexing/overlord/TaskLockboxTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/overlord/TaskLockboxTest.java @@ -82,7 +82,7 @@ public void setup() EasyMock.expect(serverConfig.getMaxIdleTime()).andReturn(new Period(100)).anyTimes(); EasyMock.replay(serverConfig); - ServiceEmitter emitter = EasyMock.createMock(ServiceEmitter.class); + ServiceEmitter emitter = EasyMock.createMock(ServiceEmitter.class); EmittingLogger.registerEmitter(emitter); EasyMock.replay(emitter); @@ -242,7 +242,7 @@ public String getType() } @Override - public String getGroupId() + public String getGroupId() { return "someGroupId"; } diff --git a/indexing-service/src/test/java/io/druid/indexing/overlord/helpers/TaskLogAutoCleanerConfigTest.java b/indexing-service/src/test/java/io/druid/indexing/overlord/helpers/TaskLogAutoCleanerConfigTest.java index 2f5d5f71f650..23b4455e8888 100644 --- a/indexing-service/src/test/java/io/druid/indexing/overlord/helpers/TaskLogAutoCleanerConfigTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/overlord/helpers/TaskLogAutoCleanerConfigTest.java @@ -73,7 +73,7 @@ public void testSerdeWithDefaults() throws Exception Assert.assertFalse(config.isEnabled()); Assert.assertTrue(config.getInitialDelay() >= 60000 && config.getInitialDelay() <= 300000); - Assert.assertEquals(6*60*60*1000, config.getDelay()); + Assert.assertEquals(6 * 60 * 60 * 1000, config.getDelay()); Assert.assertEquals(Long.MAX_VALUE, config.getDurationToRetain()); } } diff --git a/indexing-service/src/test/java/io/druid/indexing/overlord/http/OverlordRedirectInfoTest.java b/indexing-service/src/test/java/io/druid/indexing/overlord/http/OverlordRedirectInfoTest.java index e74dc2d80995..61a63c156b87 100644 --- a/indexing-service/src/test/java/io/druid/indexing/overlord/http/OverlordRedirectInfoTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/overlord/http/OverlordRedirectInfoTest.java @@ -70,7 +70,7 @@ public void testGetRedirectURLNull() { EasyMock.expect(taskMaster.getCurrentLeader()).andReturn(null).anyTimes(); EasyMock.replay(taskMaster); - URL url = redirectInfo.getRedirectURL("http","query", "/request"); + URL url = redirectInfo.getRedirectURL("http", "query", "/request"); Assert.assertNull(url); EasyMock.verify(taskMaster); } diff --git a/indexing-service/src/test/java/io/druid/indexing/overlord/setup/EqualDistributionWorkerSelectStrategyTest.java b/indexing-service/src/test/java/io/druid/indexing/overlord/setup/EqualDistributionWorkerSelectStrategyTest.java index a22c4b09595d..fad4d5ec9901 100644 --- a/indexing-service/src/test/java/io/druid/indexing/overlord/setup/EqualDistributionWorkerSelectStrategyTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/overlord/setup/EqualDistributionWorkerSelectStrategyTest.java @@ -79,14 +79,14 @@ public void testFindWorkerForTaskWhenSameCurrCapacityUsed() throws Exception ImmutableMap.of( "lhost", new ImmutableWorkerInfo( - new Worker("http","lhost", "lhost", 5, "v1"), 5, + new Worker("http", "lhost", "lhost", 5, "v1"), 5, Sets.newHashSet(), Sets.newHashSet(), DateTime.now() ), "localhost", new ImmutableWorkerInfo( - new Worker("http","localhost", "localhost", 10, "v1"), 5, + new Worker("http", "localhost", "localhost", 10, "v1"), 5, Sets.newHashSet(), Sets.newHashSet(), DateTime.now() @@ -116,14 +116,14 @@ public void testOneDisableWorkerDifferentUsedCapacity() throws Exception ImmutableMap.of( "lhost", new ImmutableWorkerInfo( - new Worker("http","disableHost", "disableHost", 10, DISABLED_VERSION), 2, + new Worker("http", "disableHost", "disableHost", 10, DISABLED_VERSION), 2, Sets.newHashSet(), Sets.newHashSet(), DateTime.now() ), "localhost", new ImmutableWorkerInfo( - new Worker("http","enableHost", "enableHost", 10, "v1"), 5, + new Worker("http", "enableHost", "enableHost", 10, "v1"), 5, Sets.newHashSet(), Sets.newHashSet(), DateTime.now() @@ -153,14 +153,14 @@ public void testOneDisableWorkerSameUsedCapacity() throws Exception ImmutableMap.of( "lhost", new ImmutableWorkerInfo( - new Worker("http","disableHost", "disableHost", 10, DISABLED_VERSION), 5, + new Worker("http", "disableHost", "disableHost", 10, DISABLED_VERSION), 5, Sets.newHashSet(), Sets.newHashSet(), DateTime.now() ), "localhost", new ImmutableWorkerInfo( - new Worker("http","enableHost", "enableHost", 10, "v1"), 5, + new Worker("http", "enableHost", "enableHost", 10, "v1"), 5, Sets.newHashSet(), Sets.newHashSet(), DateTime.now() diff --git a/indexing-service/src/test/java/io/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategyTest.java b/indexing-service/src/test/java/io/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategyTest.java index 88509876c3d4..35d1ab1bfddf 100644 --- a/indexing-service/src/test/java/io/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategyTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategyTest.java @@ -49,7 +49,7 @@ public class JavaScriptWorkerSelectStrategyTest + "batch_workers.add(\"10.0.0.2\");\n" + "workers = zkWorkers.keySet().toArray();\n" + "var sortedWorkers = new Array()\n;" - + "for(var i = 0; i < workers.length; i++){\n" + + "for (var i = 0; i < workers.length; i++) {\n" + " sortedWorkers[i] = workers[i];\n" + "}\n" + "Array.prototype.sort.call(sortedWorkers,function(a, b){return zkWorkers.get(b).getCurrCapacityUsed() - zkWorkers.get(a).getCurrCapacityUsed();});\n" @@ -57,11 +57,11 @@ public class JavaScriptWorkerSelectStrategyTest + "for (var i = 0; i < sortedWorkers.length; i++) {\n" + " var worker = sortedWorkers[i];\n" + " var zkWorker = zkWorkers.get(worker);\n" - + " if(zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)){\n" - + " if(task.getType() == 'index_hadoop' && batch_workers.contains(worker)){\n" + + " if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) {\n" + + " if (task.getType() == 'index_hadoop' && batch_workers.contains(worker)) {\n" + " return worker;\n" + " } else {\n" - + " if(task.getType() != 'index_hadoop' && !batch_workers.contains(worker)){\n" + + " if (task.getType() != 'index_hadoop' && !batch_workers.contains(worker)) {\n" + " return worker;\n" + " }\n" + " }\n" diff --git a/indexing-service/src/test/java/io/druid/indexing/test/TestServerView.java b/indexing-service/src/test/java/io/druid/indexing/test/TestServerView.java index 3a5af4805634..1d68061b4feb 100644 --- a/indexing-service/src/test/java/io/druid/indexing/test/TestServerView.java +++ b/indexing-service/src/test/java/io/druid/indexing/test/TestServerView.java @@ -60,7 +60,7 @@ public ServerView.CallbackAction segmentAdded( ) { for (final Map.Entry>, Executor>> entry : callbacks.entrySet()) { - if (entry.getValue().lhs.apply(Pair.of(server,segment))) { + if (entry.getValue().lhs.apply(Pair.of(server, segment))) { entry.getValue().rhs.execute( new Runnable() { diff --git a/indexing-service/src/test/java/io/druid/indexing/worker/WorkerTaskMonitorTest.java b/indexing-service/src/test/java/io/druid/indexing/worker/WorkerTaskMonitorTest.java index 0beab6ba7065..ef4bdba34737 100644 --- a/indexing-service/src/test/java/io/druid/indexing/worker/WorkerTaskMonitorTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/worker/WorkerTaskMonitorTest.java @@ -179,8 +179,8 @@ public List getLocations() { return Lists.newArrayList(); } - } - , jsonMapper + }, + jsonMapper ) ), jsonMapper, diff --git a/indexing-service/src/test/java/io/druid/indexing/worker/http/WorkerResourceTest.java b/indexing-service/src/test/java/io/druid/indexing/worker/http/WorkerResourceTest.java index 6db3da26eb9a..44e83fc8d529 100644 --- a/indexing-service/src/test/java/io/druid/indexing/worker/http/WorkerResourceTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/worker/http/WorkerResourceTest.java @@ -87,7 +87,7 @@ public String getBase() { return basePath; } - },null,null,null,null,null), + }, null, null, null, null, null), new RemoteTaskRunnerConfig(), cf, worker diff --git a/indexing-service/src/test/java/io/druid/server/initialization/IndexerZkConfigTest.java b/indexing-service/src/test/java/io/druid/server/initialization/IndexerZkConfigTest.java index 08b267797fb3..df45c1b99e09 100644 --- a/indexing-service/src/test/java/io/druid/server/initialization/IndexerZkConfigTest.java +++ b/indexing-service/src/test/java/io/druid/server/initialization/IndexerZkConfigTest.java @@ -214,9 +214,9 @@ public void testIndexerBaseOverride() // Rewind value before we potentially fail - if(priorValue == null){ + if (priorValue == null) { System.clearProperty(indexerPropertyKey); - }else { + } else { System.setProperty(indexerPropertyKey, priorValue); } diff --git a/integration-tests/src/main/java/io/druid/testing/utils/LoggerListener.java b/integration-tests/src/main/java/io/druid/testing/utils/LoggerListener.java index 02ba2f33560c..77ea6d063d96 100644 --- a/integration-tests/src/main/java/io/druid/testing/utils/LoggerListener.java +++ b/integration-tests/src/main/java/io/druid/testing/utils/LoggerListener.java @@ -49,7 +49,7 @@ public void onTestSuccess(ITestResult tr) @Override public void onTestStart(ITestResult tr) { - LOG.info ("[%s] -- TEST START", tr.getName() ); + LOG.info ("[%s] -- TEST START", tr.getName()); } } diff --git a/integration-tests/src/test/java/io/druid/tests/indexer/AbstractIndexerTest.java b/integration-tests/src/test/java/io/druid/tests/indexer/AbstractIndexerTest.java index c74c46e733de..cb6a2f435db8 100644 --- a/integration-tests/src/test/java/io/druid/tests/indexer/AbstractIndexerTest.java +++ b/integration-tests/src/test/java/io/druid/tests/indexer/AbstractIndexerTest.java @@ -63,7 +63,7 @@ protected void unloadAndKillData(final String dataSource) throws Exception // to the 2nd date in the last string Collections.sort (intervals); String first = intervals.get(0).split("/")[0]; - String last = intervals.get(intervals.size() -1).split("/")[1]; + String last = intervals.get(intervals.size() - 1).split("/")[1]; unloadAndKillData (dataSource, first, last); } diff --git a/java-util/src/main/java/io/druid/java/util/common/CompressionUtils.java b/java-util/src/main/java/io/druid/java/util/common/CompressionUtils.java index a031ed06891f..08614ff8d759 100644 --- a/java-util/src/main/java/io/druid/java/util/common/CompressionUtils.java +++ b/java-util/src/main/java/io/druid/java/util/common/CompressionUtils.java @@ -324,7 +324,7 @@ public int available() throws IOException public static long gunzip(InputStream in, OutputStream out) throws IOException { try (GZIPInputStream gzipInputStream = gzipInputStream(in)) { - final long result = ByteStreams.copy(gzipInputStream, out); + final long result = ByteStreams.copy(gzipInputStream, out); out.flush(); return result; } diff --git a/java-util/src/main/java/io/druid/java/util/common/StringUtils.java b/java-util/src/main/java/io/druid/java/util/common/StringUtils.java index 4022cfa23e83..78088963ad33 100644 --- a/java-util/src/main/java/io/druid/java/util/common/StringUtils.java +++ b/java-util/src/main/java/io/druid/java/util/common/StringUtils.java @@ -115,7 +115,7 @@ public static String format(String message, Object... formatArgs) */ public static String nonStrictFormat(String message, Object... formatArgs) { - if(formatArgs == null || formatArgs.length == 0) { + if (formatArgs == null || formatArgs.length == 0) { return message; } try { diff --git a/java-util/src/main/java/io/druid/java/util/common/collect/Utils.java b/java-util/src/main/java/io/druid/java/util/common/collect/Utils.java index aae7b8813622..0a741858bd3e 100644 --- a/java-util/src/main/java/io/druid/java/util/common/collect/Utils.java +++ b/java-util/src/main/java/io/druid/java/util/common/collect/Utils.java @@ -46,7 +46,7 @@ public static Map zipMapPartial(K[] keys, V[] values) Map retVal = new LinkedHashMap<>(); - for(int i = 0; i < values.length; ++i) { + for (int i = 0; i < values.length; ++i) { retVal.put(keys[i], values[i]); } @@ -91,7 +91,7 @@ public static Map zipMapPartial(Iterable keys, Iterable value while (keysIter.hasNext()) { final K key = keysIter.next(); - if(valsIter.hasNext()) { + if (valsIter.hasNext()) { retVal.put(key, valsIter.next()); } else { break; diff --git a/java-util/src/main/java/io/druid/java/util/common/concurrent/ScheduledExecutors.java b/java-util/src/main/java/io/druid/java/util/common/concurrent/ScheduledExecutors.java index d636d320bdc7..cce2fa49067f 100644 --- a/java-util/src/main/java/io/druid/java/util/common/concurrent/ScheduledExecutors.java +++ b/java-util/src/main/java/io/druid/java/util/common/concurrent/ScheduledExecutors.java @@ -175,7 +175,7 @@ public void run() log.debug("Running %s (period %s)", callable, rate); prevSignal = callable.call(); } - catch(Throwable e) { + catch (Throwable e) { log.error(e, "Uncaught exception."); } } diff --git a/java-util/src/main/java/io/druid/java/util/common/guava/DroppingIterator.java b/java-util/src/main/java/io/druid/java/util/common/guava/DroppingIterator.java index e65b72fe584d..747fec10c724 100644 --- a/java-util/src/main/java/io/druid/java/util/common/guava/DroppingIterator.java +++ b/java-util/src/main/java/io/druid/java/util/common/guava/DroppingIterator.java @@ -41,7 +41,7 @@ public DroppingIterator( @Override public boolean hasNext() { - if (! dropped) { + if (!dropped) { for (int i = 0; i < numToDrop; ++i) { delegate.next(); } @@ -54,7 +54,7 @@ public boolean hasNext() @Override public T next() { - if (! dropped) { + if (!dropped) { for (int i = 0; i < numToDrop; ++i) { delegate.next(); } diff --git a/java-util/src/main/java/io/druid/java/util/common/guava/MergeIterator.java b/java-util/src/main/java/io/druid/java/util/common/guava/MergeIterator.java index f6a563e1057e..ada5577b6840 100644 --- a/java-util/src/main/java/io/druid/java/util/common/guava/MergeIterator.java +++ b/java-util/src/main/java/io/druid/java/util/common/guava/MergeIterator.java @@ -63,13 +63,13 @@ public int compare(PeekingIterator lhs, PeekingIterator rhs) @Override public boolean hasNext() { - return ! pQueue.isEmpty(); + return !pQueue.isEmpty(); } @Override public T next() { - if (! hasNext()) { + if (!hasNext()) { throw new NoSuchElementException(); } diff --git a/java-util/src/main/java/io/druid/java/util/common/guava/nary/SortedMergeIterable.java b/java-util/src/main/java/io/druid/java/util/common/guava/nary/SortedMergeIterable.java index 7ea2613e542d..7c6810c9e5e2 100644 --- a/java-util/src/main/java/io/druid/java/util/common/guava/nary/SortedMergeIterable.java +++ b/java-util/src/main/java/io/druid/java/util/common/guava/nary/SortedMergeIterable.java @@ -58,6 +58,6 @@ public SortedMergeIterable( @Override public Iterator iterator() { - return SortedMergeIterator.create(lhs.iterator(), rhs.iterator(), comparator, fn); + return SortedMergeIterator.create(lhs.iterator(), rhs.iterator(), comparator, fn); } } diff --git a/java-util/src/main/java/io/druid/java/util/common/guava/nary/SortedMergeIterator.java b/java-util/src/main/java/io/druid/java/util/common/guava/nary/SortedMergeIterator.java index 3eedf0684b01..2c6c4b9b7706 100644 --- a/java-util/src/main/java/io/druid/java/util/common/guava/nary/SortedMergeIterator.java +++ b/java-util/src/main/java/io/druid/java/util/common/guava/nary/SortedMergeIterator.java @@ -74,14 +74,14 @@ public boolean hasNext() @Override public OutType next() { - if (! hasNext()) { + if (!hasNext()) { throw new NoSuchElementException(); } - if (! lhs.hasNext()) { + if (!lhs.hasNext()) { return fn.apply(null, rhs.next()); } - if (! rhs.hasNext()) { + if (!rhs.hasNext()) { return fn.apply(lhs.next(), null); } diff --git a/java-util/src/main/java/io/druid/java/util/common/parsers/ToLowerCaseParser.java b/java-util/src/main/java/io/druid/java/util/common/parsers/ToLowerCaseParser.java index 37c283599577..6363e7d7d18c 100644 --- a/java-util/src/main/java/io/druid/java/util/common/parsers/ToLowerCaseParser.java +++ b/java-util/src/main/java/io/druid/java/util/common/parsers/ToLowerCaseParser.java @@ -44,7 +44,7 @@ public Map parse(String input) for (Map.Entry entry : line.entrySet()) { String k = StringUtils.toLowerCase(entry.getKey()); - if(retVal.containsKey(k)) { + if (retVal.containsKey(k)) { // Duplicate key, case-insensitively throw new ParseException("Unparseable row. Duplicate key found : [%s]", k); } diff --git a/java-util/src/test/java/io/druid/java/util/common/GranularityTest.java b/java-util/src/test/java/io/druid/java/util/common/GranularityTest.java index 7df964711157..f801215106fb 100644 --- a/java-util/src/test/java/io/druid/java/util/common/GranularityTest.java +++ b/java-util/src/test/java/io/druid/java/util/common/GranularityTest.java @@ -312,7 +312,7 @@ private void checkToDate(Granularity granularity, Granularity.Formatter formatte granularity.toDate(pd.path, formatter) ); - if(formatter.equals(Granularity.Formatter.DEFAULT)) { + if (formatter.equals(Granularity.Formatter.DEFAULT)) { Assert.assertEquals( StringUtils.format( "[%s] Expected toDate(%s) to return the same as toDate(%s, DEFAULT)", @@ -324,7 +324,7 @@ private void checkToDate(Granularity granularity, Granularity.Formatter formatte ); } - if(pd.date != null) { + if (pd.date != null) { // check if formatter is readable by toDate Assert.assertEquals( StringUtils.format( @@ -356,7 +356,8 @@ private void checkToDate(Granularity granularity, Granularity.Formatter formatte formatter, pd.exception, pd.path - ), flag + ), + flag ); } } @@ -367,11 +368,11 @@ public void testBucket() { DateTime dt = new DateTime("2011-02-03T04:05:06.100"); - Assert.assertEquals(new Interval("2011-01-01/2012-01-01"), YEAR.bucket(dt)); - Assert.assertEquals(new Interval("2011-02-01/2011-03-01"), MONTH.bucket(dt)); - Assert.assertEquals(new Interval("2011-01-31/2011-02-07"), WEEK.bucket(dt)); - Assert.assertEquals(new Interval("2011-02-03/2011-02-04"), DAY.bucket(dt)); - Assert.assertEquals(new Interval("2011-02-03T04/2011-02-03T05"), HOUR.bucket(dt)); + Assert.assertEquals(new Interval("2011-01-01/2012-01-01"), YEAR.bucket(dt)); + Assert.assertEquals(new Interval("2011-02-01/2011-03-01"), MONTH.bucket(dt)); + Assert.assertEquals(new Interval("2011-01-31/2011-02-07"), WEEK.bucket(dt)); + Assert.assertEquals(new Interval("2011-02-03/2011-02-04"), DAY.bucket(dt)); + Assert.assertEquals(new Interval("2011-02-03T04/2011-02-03T05"), HOUR.bucket(dt)); Assert.assertEquals(new Interval("2011-02-03T04:05:00/2011-02-03T04:06:00"), MINUTE.bucket(dt)); Assert.assertEquals(new Interval("2011-02-03T04:05:06/2011-02-03T04:05:07"), SECOND.bucket(dt)); diff --git a/java-util/src/test/java/io/druid/java/util/common/StreamUtilsTest.java b/java-util/src/test/java/io/druid/java/util/common/StreamUtilsTest.java index 627c3cc4542b..f648f5b0e1ad 100644 --- a/java-util/src/test/java/io/druid/java/util/common/StreamUtilsTest.java +++ b/java-util/src/test/java/io/druid/java/util/common/StreamUtilsTest.java @@ -82,7 +82,7 @@ public void flush() throws IOException 10 ) ); - Assert.assertEquals(4, outputFlushes.get());// 2 closes and 2 manual flushes + Assert.assertEquals(4, outputFlushes.get()); // 2 closes and 2 manual flushes Assert.assertArrayEquals(bytes, byteArrayOutputStream.toByteArray()); } } diff --git a/java-util/src/test/java/io/druid/java/util/common/guava/ConcatSequenceTest.java b/java-util/src/test/java/io/druid/java/util/common/guava/ConcatSequenceTest.java index bf2eb3761568..88212d7bc2bd 100644 --- a/java-util/src/test/java/io/druid/java/util/common/guava/ConcatSequenceTest.java +++ b/java-util/src/test/java/io/druid/java/util/common/guava/ConcatSequenceTest.java @@ -226,7 +226,7 @@ public Iterator iterator() public boolean hasNext() { boolean result = baseIter.hasNext(); - if(!result) { + if (!result) { lastSeqFullyRead.set(true); } return result; @@ -269,13 +269,13 @@ public Integer accumulate(Integer accumulated, Integer in) ); List result = new ArrayList<>(); - while(!yielder.isDone()) { + while (!yielder.isDone()) { result.add(yielder.get()); yielder = yielder.next(null); } yielder.close(); - Assert.assertEquals(ImmutableList.of(1,2,3,4,5,6), result); + Assert.assertEquals(ImmutableList.of(1, 2, 3, 4, 5, 6), result); } @SuppressWarnings("unchecked") diff --git a/java-util/src/test/java/io/druid/java/util/common/parsers/FlatTextFormatParserTest.java b/java-util/src/test/java/io/druid/java/util/common/parsers/FlatTextFormatParserTest.java index a3264e300208..29a410814986 100644 --- a/java-util/src/test/java/io/druid/java/util/common/parsers/FlatTextFormatParserTest.java +++ b/java-util/src/test/java/io/druid/java/util/common/parsers/FlatTextFormatParserTest.java @@ -247,7 +247,7 @@ public Parser get(FlatTextFormat format, String header) } } - private static String concat(FlatTextFormat format, String ... values) + private static String concat(FlatTextFormat format, String... values) { return Arrays.stream(values).collect(Collectors.joining(format.getDefaultDelimiter())); } diff --git a/java-util/src/test/java/io/druid/java/util/common/parsers/JSONPathParserTest.java b/java-util/src/test/java/io/druid/java/util/common/parsers/JSONPathParserTest.java index 671cf83acc3d..7ccf405d8133 100644 --- a/java-util/src/test/java/io/druid/java/util/common/parsers/JSONPathParserTest.java +++ b/java-util/src/test/java/io/druid/java/util/common/parsers/JSONPathParserTest.java @@ -118,11 +118,11 @@ public void testNestingWithFieldDiscovery() Assert.assertEquals("2999", jsonMap.get("timestamp")); Assert.assertEquals("Hello world!", jsonMap.get("foo.bar1")); - List testListConvert = (List)jsonMap.get("testListConvert"); + List testListConvert = (List) jsonMap.get("testListConvert"); Assert.assertEquals(1.23456789E21, testListConvert.get(0)); Assert.assertEquals("foo?", testListConvert.get(1)); - List testListConvert2 = (List)jsonMap.get("testListConvert2"); + List testListConvert2 = (List) jsonMap.get("testListConvert2"); Assert.assertEquals(1.23456789E21, testListConvert2.get(0)); Assert.assertEquals("foo?", testListConvert2.get(1)); Assert.assertEquals(1.23456789E21, ((List) testListConvert2.get(2)).get(0)); diff --git a/processing/src/main/java/io/druid/jackson/DefaultObjectMapper.java b/processing/src/main/java/io/druid/jackson/DefaultObjectMapper.java index 517427d9cfd4..8e69e404c3ba 100644 --- a/processing/src/main/java/io/druid/jackson/DefaultObjectMapper.java +++ b/processing/src/main/java/io/druid/jackson/DefaultObjectMapper.java @@ -32,7 +32,7 @@ public class DefaultObjectMapper extends ObjectMapper { public DefaultObjectMapper() { - this((JsonFactory)null); + this((JsonFactory) null); } public DefaultObjectMapper(DefaultObjectMapper mapper) diff --git a/processing/src/main/java/io/druid/jackson/SegmentsModule.java b/processing/src/main/java/io/druid/jackson/SegmentsModule.java index 00a9f8c2ab7b..27cf76405154 100644 --- a/processing/src/main/java/io/druid/jackson/SegmentsModule.java +++ b/processing/src/main/java/io/druid/jackson/SegmentsModule.java @@ -36,9 +36,9 @@ public SegmentsModule() setMixInAnnotation(ShardSpec.class, ShardSpecMixin.class); } - @JsonTypeInfo(use= JsonTypeInfo.Id.NAME, property="type") + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @JsonSubTypes({ - @JsonSubTypes.Type(name="none", value=NoneShardSpec.class), + @JsonSubTypes.Type(name = "none", value = NoneShardSpec.class), }) public static interface ShardSpecMixin {} diff --git a/processing/src/main/java/io/druid/jackson/StringComparatorModule.java b/processing/src/main/java/io/druid/jackson/StringComparatorModule.java index ae66db2d7f3e..2ac67bc765b0 100644 --- a/processing/src/main/java/io/druid/jackson/StringComparatorModule.java +++ b/processing/src/main/java/io/druid/jackson/StringComparatorModule.java @@ -40,6 +40,6 @@ public StringComparatorModule() ); } - @JsonTypeInfo(use= JsonTypeInfo.Id.NAME, property = "type", defaultImpl = StringComparator.class) + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = StringComparator.class) public static interface StringComparatorMixin {} } diff --git a/processing/src/main/java/io/druid/query/IntervalChunkingQueryRunnerDecorator.java b/processing/src/main/java/io/druid/query/IntervalChunkingQueryRunnerDecorator.java index a8ec5006d055..9a2df39a3650 100644 --- a/processing/src/main/java/io/druid/query/IntervalChunkingQueryRunnerDecorator.java +++ b/processing/src/main/java/io/druid/query/IntervalChunkingQueryRunnerDecorator.java @@ -42,7 +42,7 @@ public IntervalChunkingQueryRunnerDecorator(@Processing ExecutorService executor public QueryRunner decorate(QueryRunner delegate, QueryToolChest> toolChest) { - return new IntervalChunkingQueryRunner(delegate, (QueryToolChest>)toolChest, + return new IntervalChunkingQueryRunner(delegate, (QueryToolChest>) toolChest, executor, queryWatcher, emitter); } } diff --git a/processing/src/main/java/io/druid/query/ResultMergeQueryRunner.java b/processing/src/main/java/io/druid/query/ResultMergeQueryRunner.java index e160cbf75b59..04c6e550dd74 100644 --- a/processing/src/main/java/io/druid/query/ResultMergeQueryRunner.java +++ b/processing/src/main/java/io/druid/query/ResultMergeQueryRunner.java @@ -46,5 +46,5 @@ public Sequence doRun(QueryRunner baseRunner, QueryPlus queryPlus, Map< protected abstract Ordering makeOrdering(Query query); - protected abstract BinaryFn createMergeFn(Query query); + protected abstract BinaryFn createMergeFn(Query query); } diff --git a/processing/src/main/java/io/druid/query/aggregation/FloatMinBufferAggregator.java b/processing/src/main/java/io/druid/query/aggregation/FloatMinBufferAggregator.java index 3d7651a11090..8df36e8556c7 100644 --- a/processing/src/main/java/io/druid/query/aggregation/FloatMinBufferAggregator.java +++ b/processing/src/main/java/io/druid/query/aggregation/FloatMinBufferAggregator.java @@ -40,7 +40,7 @@ public void init(ByteBuffer buf, int position) } @Override - public void putFirst(ByteBuffer buf, int position,float value) + public void putFirst(ByteBuffer buf, int position, float value) { if (!Float.isNaN(value)) { buf.putFloat(position, value); diff --git a/processing/src/main/java/io/druid/query/aggregation/Histogram.java b/processing/src/main/java/io/druid/query/aggregation/Histogram.java index c2b74bc6bdf2..8fa7188e75e9 100644 --- a/processing/src/main/java/io/druid/query/aggregation/Histogram.java +++ b/processing/src/main/java/io/druid/query/aggregation/Histogram.java @@ -31,7 +31,7 @@ public class Histogram { public float[] breaks; - public long[] bins; + public long[] bins; public transient long count; public float min; public float max; @@ -41,8 +41,8 @@ public Histogram(float[] breaks) Preconditions.checkArgument(breaks != null, "Histogram breaks must not be null"); this.breaks = breaks; - this.bins = new long[this.breaks.length + 1]; - this.count = 0; + this.bins = new long[this.breaks.length + 1]; + this.count = 0; this.min = Float.POSITIVE_INFINITY; this.max = Float.NEGATIVE_INFINITY; } @@ -50,20 +50,20 @@ public Histogram(float[] breaks) public Histogram(float[] breaks, long[] bins, float min, float max) { this.breaks = breaks; - this.bins = bins; + this.bins = bins; this.min = min; this.max = max; - for(long k : bins) { + for (long k : bins) { this.count += k; } } public void offer(float d) { - if(d > max) { + if (d > max) { max = d; } - if(d < min) { + if (d < min) { min = d; } @@ -178,7 +178,7 @@ public static Histogram fromBytes(ByteBuffer buf) { int n = buf.getInt(); float[] breaks = new float[n]; - long[] bins = new long[n + 1]; + long[] bins = new long[n + 1]; for (int i = 0; i < breaks.length; ++i) { breaks[i] = buf.getFloat(); diff --git a/processing/src/main/java/io/druid/query/aggregation/HistogramBufferAggregator.java b/processing/src/main/java/io/druid/query/aggregation/HistogramBufferAggregator.java index 9ae050084824..6d99990a56b0 100644 --- a/processing/src/main/java/io/druid/query/aggregation/HistogramBufferAggregator.java +++ b/processing/src/main/java/io/druid/query/aggregation/HistogramBufferAggregator.java @@ -37,7 +37,7 @@ public class HistogramBufferAggregator implements BufferAggregator public HistogramBufferAggregator(FloatColumnSelector selector, float[] breaks) { this.selector = selector; - this.breaks = breaks; + this.breaks = breaks; this.minOffset = Longs.BYTES * (breaks.length + 1); this.maxOffset = this.minOffset + Floats.BYTES; } @@ -61,10 +61,10 @@ public void aggregate(ByteBuffer buf, int position) final int minPos = position + minOffset; final int maxPos = position + maxOffset; - if(value < buf.getFloat(minPos)) { + if (value < buf.getFloat(minPos)) { buf.putFloat(minPos, value); } - if(value > buf.getFloat(maxPos)) { + if (value > buf.getFloat(maxPos)) { buf.putFloat(maxPos, value); } diff --git a/processing/src/main/java/io/druid/query/aggregation/HistogramVisual.java b/processing/src/main/java/io/druid/query/aggregation/HistogramVisual.java index 0f7cf5949726..aa6261b15f7a 100644 --- a/processing/src/main/java/io/druid/query/aggregation/HistogramVisual.java +++ b/processing/src/main/java/io/druid/query/aggregation/HistogramVisual.java @@ -62,13 +62,13 @@ public HistogramVisual( this.breaks = new double[breaks.length]; this.counts = new double[counts.length]; this.quantiles = new double[quantiles.length]; - for(int i = 0; i < breaks.length; ++i) { + for (int i = 0; i < breaks.length; ++i) { this.breaks[i] = breaks[i]; } - for(int i = 0; i < counts.length; ++i) { + for (int i = 0; i < counts.length; ++i) { this.counts[i] = counts[i]; } - for(int i = 0; i < quantiles.length; ++i) { + for (int i = 0; i < quantiles.length; ++i) { this.quantiles[i] = quantiles[i]; } } diff --git a/processing/src/main/java/io/druid/query/aggregation/cardinality/types/CardinalityAggregatorColumnSelectorStrategyFactory.java b/processing/src/main/java/io/druid/query/aggregation/cardinality/types/CardinalityAggregatorColumnSelectorStrategyFactory.java index 0a0d6d222c4f..17b629c46609 100644 --- a/processing/src/main/java/io/druid/query/aggregation/cardinality/types/CardinalityAggregatorColumnSelectorStrategyFactory.java +++ b/processing/src/main/java/io/druid/query/aggregation/cardinality/types/CardinalityAggregatorColumnSelectorStrategyFactory.java @@ -34,7 +34,7 @@ public CardinalityAggregatorColumnSelectorStrategy makeColumnSelectorStrategy( ) { ValueType type = capabilities.getType(); - switch(type) { + switch (type) { case STRING: return new StringCardinalityAggregatorColumnSelectorStrategy(); case LONG: diff --git a/processing/src/main/java/io/druid/query/aggregation/last/FloatLastAggregatorFactory.java b/processing/src/main/java/io/druid/query/aggregation/last/FloatLastAggregatorFactory.java index dd5b6d9c6200..6f2d55423dd2 100644 --- a/processing/src/main/java/io/druid/query/aggregation/last/FloatLastAggregatorFactory.java +++ b/processing/src/main/java/io/druid/query/aggregation/last/FloatLastAggregatorFactory.java @@ -199,7 +199,7 @@ public byte[] getCacheKey() return ByteBuffer.allocate(2 + fieldNameBytes.length) .put(AggregatorUtil.FLOAT_LAST_CACHE_TYPE_ID) .put(fieldNameBytes) - .put((byte)0xff) + .put((byte) 0xff) .array(); } diff --git a/processing/src/main/java/io/druid/query/extraction/MapLookupExtractor.java b/processing/src/main/java/io/druid/query/extraction/MapLookupExtractor.java index fb11c346ae5b..b818bd8cd50c 100644 --- a/processing/src/main/java/io/druid/query/extraction/MapLookupExtractor.java +++ b/processing/src/main/java/io/druid/query/extraction/MapLookupExtractor.java @@ -100,11 +100,11 @@ public byte[] getCacheKey() if (!Strings.isNullOrEmpty(key)) { outputStream.write(StringUtils.toUtf8(key)); } - outputStream.write((byte)0xFF); + outputStream.write((byte) 0xFF); if (!Strings.isNullOrEmpty(val)) { outputStream.write(StringUtils.toUtf8(val)); } - outputStream.write((byte)0xFF); + outputStream.write((byte) 0xFF); } return outputStream.toByteArray(); } diff --git a/processing/src/main/java/io/druid/query/filter/DimFilter.java b/processing/src/main/java/io/druid/query/filter/DimFilter.java index f3b5130fb3fd..e925a2cf731c 100644 --- a/processing/src/main/java/io/druid/query/filter/DimFilter.java +++ b/processing/src/main/java/io/druid/query/filter/DimFilter.java @@ -26,23 +26,23 @@ /** */ -@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, property="type") -@JsonSubTypes(value={ - @JsonSubTypes.Type(name="and", value=AndDimFilter.class), - @JsonSubTypes.Type(name="or", value=OrDimFilter.class), - @JsonSubTypes.Type(name="not", value=NotDimFilter.class), - @JsonSubTypes.Type(name="selector", value=SelectorDimFilter.class), - @JsonSubTypes.Type(name="columnComparison", value=ColumnComparisonDimFilter.class), - @JsonSubTypes.Type(name="extraction", value=ExtractionDimFilter.class), - @JsonSubTypes.Type(name="regex", value=RegexDimFilter.class), - @JsonSubTypes.Type(name="search", value=SearchQueryDimFilter.class), - @JsonSubTypes.Type(name="javascript", value=JavaScriptDimFilter.class), - @JsonSubTypes.Type(name="spatial", value=SpatialDimFilter.class), - @JsonSubTypes.Type(name="in", value=InDimFilter.class), - @JsonSubTypes.Type(name="bound", value=BoundDimFilter.class), - @JsonSubTypes.Type(name="interval", value=IntervalDimFilter.class), - @JsonSubTypes.Type(name="like", value=LikeDimFilter.class), - @JsonSubTypes.Type(name="expression", value=ExpressionDimFilter.class) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") +@JsonSubTypes(value = { + @JsonSubTypes.Type(name = "and", value = AndDimFilter.class), + @JsonSubTypes.Type(name = "or", value = OrDimFilter.class), + @JsonSubTypes.Type(name = "not", value = NotDimFilter.class), + @JsonSubTypes.Type(name = "selector", value = SelectorDimFilter.class), + @JsonSubTypes.Type(name = "columnComparison", value = ColumnComparisonDimFilter.class), + @JsonSubTypes.Type(name = "extraction", value = ExtractionDimFilter.class), + @JsonSubTypes.Type(name = "regex", value = RegexDimFilter.class), + @JsonSubTypes.Type(name = "search", value = SearchQueryDimFilter.class), + @JsonSubTypes.Type(name = "javascript", value = JavaScriptDimFilter.class), + @JsonSubTypes.Type(name = "spatial", value = SpatialDimFilter.class), + @JsonSubTypes.Type(name = "in", value = InDimFilter.class), + @JsonSubTypes.Type(name = "bound", value = BoundDimFilter.class), + @JsonSubTypes.Type(name = "interval", value = IntervalDimFilter.class), + @JsonSubTypes.Type(name = "like", value = LikeDimFilter.class), + @JsonSubTypes.Type(name = "expression", value = ExpressionDimFilter.class) }) public interface DimFilter extends Cacheable { diff --git a/processing/src/main/java/io/druid/query/filter/DimFilterUtils.java b/processing/src/main/java/io/druid/query/filter/DimFilterUtils.java index 338920ac490a..42ee9eeba77a 100644 --- a/processing/src/main/java/io/druid/query/filter/DimFilterUtils.java +++ b/processing/src/main/java/io/druid/query/filter/DimFilterUtils.java @@ -126,7 +126,7 @@ public static Set filterShards(DimFilter dimFilter, Iterable input, Fu for (Map.Entry> entry : domain.entrySet()) { String dimension = entry.getKey(); Optional> optFilterRangeSet = dimensionRangeCache - .computeIfAbsent(dimension, d-> Optional.fromNullable(dimFilter.getDimensionRangeSet(d))); + .computeIfAbsent(dimension, d -> Optional.fromNullable(dimFilter.getDimensionRangeSet(d))); if (optFilterRangeSet.isPresent() && optFilterRangeSet.get().subRangeSet(entry.getValue()).isEmpty()) { include = false; } diff --git a/processing/src/main/java/io/druid/query/filter/DoubleValueMatcherColumnSelectorStrategy.java b/processing/src/main/java/io/druid/query/filter/DoubleValueMatcherColumnSelectorStrategy.java index 1478dfc3dc90..a5bbc78437e2 100644 --- a/processing/src/main/java/io/druid/query/filter/DoubleValueMatcherColumnSelectorStrategy.java +++ b/processing/src/main/java/io/druid/query/filter/DoubleValueMatcherColumnSelectorStrategy.java @@ -83,7 +83,7 @@ public ValueGetter makeValueGetter(final DoubleColumnSelector selector) @Override public String[] get() { - return new String[]{ Double.toString(selector.get()) }; + return new String[]{Double.toString(selector.get())}; } }; } diff --git a/processing/src/main/java/io/druid/query/filter/FloatValueMatcherColumnSelectorStrategy.java b/processing/src/main/java/io/druid/query/filter/FloatValueMatcherColumnSelectorStrategy.java index b209f1b65345..afdecd1c4c3e 100644 --- a/processing/src/main/java/io/druid/query/filter/FloatValueMatcherColumnSelectorStrategy.java +++ b/processing/src/main/java/io/druid/query/filter/FloatValueMatcherColumnSelectorStrategy.java @@ -82,7 +82,7 @@ public ValueGetter makeValueGetter(final FloatColumnSelector selector) @Override public String[] get() { - return new String[]{ Float.toString(selector.get()) }; + return new String[]{Float.toString(selector.get())}; } }; } diff --git a/processing/src/main/java/io/druid/query/filter/LongValueMatcherColumnSelectorStrategy.java b/processing/src/main/java/io/druid/query/filter/LongValueMatcherColumnSelectorStrategy.java index 3995d9e0ae76..4374f3013744 100644 --- a/processing/src/main/java/io/druid/query/filter/LongValueMatcherColumnSelectorStrategy.java +++ b/processing/src/main/java/io/druid/query/filter/LongValueMatcherColumnSelectorStrategy.java @@ -81,7 +81,7 @@ public ValueGetter makeValueGetter(final LongColumnSelector selector) @Override public String[] get() { - return new String[]{ Long.toString(selector.get()) }; + return new String[]{Long.toString(selector.get())}; } }; } diff --git a/processing/src/main/java/io/druid/query/filter/StringValueMatcherColumnSelectorStrategy.java b/processing/src/main/java/io/druid/query/filter/StringValueMatcherColumnSelectorStrategy.java index 294a9379ef98..e380b1162ee3 100644 --- a/processing/src/main/java/io/druid/query/filter/StringValueMatcherColumnSelectorStrategy.java +++ b/processing/src/main/java/io/druid/query/filter/StringValueMatcherColumnSelectorStrategy.java @@ -27,7 +27,7 @@ public class StringValueMatcherColumnSelectorStrategy implements ValueMatcherColumnSelectorStrategy { - private static final String[] NULL_VALUE = new String[]{ null }; + private static final String[] NULL_VALUE = new String[]{null}; private static final ValueGetter NULL_VALUE_GETTER = new ValueGetter() { @Override diff --git a/processing/src/main/java/io/druid/query/groupby/epinephelinae/GroupByQueryEngineV2.java b/processing/src/main/java/io/druid/query/groupby/epinephelinae/GroupByQueryEngineV2.java index 417e7d47b1e1..660871d18280 100644 --- a/processing/src/main/java/io/druid/query/groupby/epinephelinae/GroupByQueryEngineV2.java +++ b/processing/src/main/java/io/druid/query/groupby/epinephelinae/GroupByQueryEngineV2.java @@ -239,7 +239,7 @@ public GroupByColumnSelectorStrategy makeColumnSelectorStrategy( ) { ValueType type = capabilities.getType(); - switch(type) { + switch (type) { case STRING: DimensionSelector dimSelector = (DimensionSelector) selector; if (dimSelector.getValueCardinality() >= 0) { diff --git a/processing/src/main/java/io/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java b/processing/src/main/java/io/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java index 95e1b345f15e..4fb958a3f60a 100644 --- a/processing/src/main/java/io/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java +++ b/processing/src/main/java/io/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java @@ -483,7 +483,7 @@ public InputRawSupplierColumnSelectorStrategy makeColumnSelectorStrategy( ) { ValueType type = capabilities.getType(); - switch(type) { + switch (type) { case STRING: return new StringInputRawSupplierColumnSelectorStrategy(); case LONG: @@ -1141,7 +1141,7 @@ public int compare(ByteBuffer lhsBuffer, ByteBuffer rhsBuffer, int lhsPosition, return timeCompare; } - int cmp = compareDimsInBuffersForNullFudgeTimestampForPushDown( + int cmp = compareDimsInBuffersForNullFudgeTimestampForPushDown( adjustedSerdeHelpers, needsReverses, fieldCount, diff --git a/processing/src/main/java/io/druid/query/lookup/LookupReferencesManager.java b/processing/src/main/java/io/druid/query/lookup/LookupReferencesManager.java index 5592f7bf9357..1485fe725cae 100644 --- a/processing/src/main/java/io/druid/query/lookup/LookupReferencesManager.java +++ b/processing/src/main/java/io/druid/query/lookup/LookupReferencesManager.java @@ -332,7 +332,7 @@ private void loadSnapshotAndInitStateRef() private LookupUpdateState atomicallyUpdateStateRef(Function fn) { - while(true) { + while (true) { LookupUpdateState old = stateRef.get(); LookupUpdateState newState = fn.apply(old); if (stateRef.compareAndSet(old, newState)) { diff --git a/processing/src/main/java/io/druid/query/lookup/LookupSnapshotTaker.java b/processing/src/main/java/io/druid/query/lookup/LookupSnapshotTaker.java index 2c72e7cecbd2..6f65e14ddd13 100644 --- a/processing/src/main/java/io/druid/query/lookup/LookupSnapshotTaker.java +++ b/processing/src/main/java/io/druid/query/lookup/LookupSnapshotTaker.java @@ -51,7 +51,7 @@ public LookupSnapshotTaker( { this.objectMapper = jsonMapper; Preconditions.checkArgument(!Strings.isNullOrEmpty(persistDirectory), "can not work without specifying persistDirectory"); - this.persistDirectory = new File(persistDirectory); + this.persistDirectory = new File(persistDirectory); if (!this.persistDirectory.exists()) { Preconditions.checkArgument(this.persistDirectory.mkdirs(), "Oups was not able to create persist directory"); } @@ -68,7 +68,7 @@ public synchronized List pullExistingSnapshot() if (!persistFile.isFile()) { LOGGER.warn("could not find any snapshot file under working directory [%s]", persistDirectory); return Collections.emptyList(); - } else if( persistFile.length() == 0){ + } else if (persistFile.length() == 0) { LOGGER.warn("found empty file no lookups to load from [%s]", persistFile.getAbsolutePath()); return Collections.emptyList(); } diff --git a/processing/src/main/java/io/druid/query/metadata/metadata/ColumnIncluderator.java b/processing/src/main/java/io/druid/query/metadata/metadata/ColumnIncluderator.java index 407d8b5268a1..7fbc95d13d15 100644 --- a/processing/src/main/java/io/druid/query/metadata/metadata/ColumnIncluderator.java +++ b/processing/src/main/java/io/druid/query/metadata/metadata/ColumnIncluderator.java @@ -26,9 +26,9 @@ */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @JsonSubTypes(value = { - @JsonSubTypes.Type(name = "none", value= NoneColumnIncluderator.class), - @JsonSubTypes.Type(name = "all", value= AllColumnIncluderator.class), - @JsonSubTypes.Type(name = "list", value= ListColumnIncluderator.class) + @JsonSubTypes.Type(name = "none", value = NoneColumnIncluderator.class), + @JsonSubTypes.Type(name = "all", value = AllColumnIncluderator.class), + @JsonSubTypes.Type(name = "list", value = ListColumnIncluderator.class) }) public interface ColumnIncluderator { diff --git a/processing/src/main/java/io/druid/query/metadata/metadata/SegmentMetadataQuery.java b/processing/src/main/java/io/druid/query/metadata/metadata/SegmentMetadataQuery.java index 31f8d111d04e..9f0c1d7e970d 100644 --- a/processing/src/main/java/io/druid/query/metadata/metadata/SegmentMetadataQuery.java +++ b/processing/src/main/java/io/druid/query/metadata/metadata/SegmentMetadataQuery.java @@ -52,7 +52,7 @@ public class SegmentMetadataQuery extends BaseQuery * Prepend 0xFF before the analysisTypes as a separator to avoid * any potential confusion with string values. */ - public static final byte[] ANALYSIS_TYPES_CACHE_PREFIX = new byte[] { (byte) 0xFF }; + public static final byte[] ANALYSIS_TYPES_CACHE_PREFIX = new byte[] {(byte) 0xFF}; public enum AnalysisType { @@ -80,7 +80,7 @@ public static AnalysisType fromString(String name) public byte[] getCacheKey() { - return new byte[] { (byte) this.ordinal() }; + return new byte[] {(byte) this.ordinal()}; } } diff --git a/processing/src/main/java/io/druid/query/ordering/StringComparators.java b/processing/src/main/java/io/druid/query/ordering/StringComparators.java index 441521bf3c8a..0610de06fd98 100644 --- a/processing/src/main/java/io/druid/query/ordering/StringComparators.java +++ b/processing/src/main/java/io/druid/query/ordering/StringComparators.java @@ -103,7 +103,7 @@ public static class AlphanumericComparator extends StringComparator @Override public int compare(String str1, String str2) { - int[] pos = { 0, 0 }; + int[] pos = {0, 0}; if (str1 == null) { if (str2 == null) { diff --git a/processing/src/main/java/io/druid/query/search/SearchQueryQueryToolChest.java b/processing/src/main/java/io/druid/query/search/SearchQueryQueryToolChest.java index 7bf012932021..ec932823fc0b 100644 --- a/processing/src/main/java/io/druid/query/search/SearchQueryQueryToolChest.java +++ b/processing/src/main/java/io/druid/query/search/SearchQueryQueryToolChest.java @@ -194,8 +194,7 @@ public byte[] computeCacheKey(SearchQuery query) .put(granularityBytes) .put(filterBytes) .put(querySpecBytes) - .put(sortSpecBytes) - ; + .put(sortSpecBytes); for (byte[] bytes : dimensionsBytes) { queryCacheKey.put(bytes); @@ -293,11 +292,11 @@ public SearchHit apply(@Nullable Object input) String val = null; Integer cnt = null; if (input instanceof Map) { - dim = outputNameMap.get((String)((Map) input).get("dimension")); + dim = outputNameMap.get((String) ((Map) input).get("dimension")); val = (String) ((Map) input).get("value"); cnt = (Integer) ((Map) input).get("count"); } else if (input instanceof SearchHit) { - SearchHit cached = (SearchHit)input; + SearchHit cached = (SearchHit) input; dim = outputNameMap.get(cached.getDimension()); val = cached.getValue(); cnt = cached.getCount(); @@ -309,8 +308,7 @@ public SearchHit apply(@Nullable Object input) } ) ) - ) - ; + ); } }; } @@ -349,7 +347,9 @@ public Sequence> run( } return runner.run(queryPlus, responseContext); } - } , this), + }, + this + ), config ); } diff --git a/processing/src/main/java/io/druid/query/select/SelectQueryEngine.java b/processing/src/main/java/io/druid/query/select/SelectQueryEngine.java index b651b4362d08..96fa0fd6fb64 100644 --- a/processing/src/main/java/io/druid/query/select/SelectQueryEngine.java +++ b/processing/src/main/java/io/druid/query/select/SelectQueryEngine.java @@ -75,7 +75,7 @@ public SelectColumnSelectorStrategy makeColumnSelectorStrategy( ) { ValueType type = capabilities.getType(); - switch(type) { + switch (type) { case STRING: return new StringSelectColumnSelectorStrategy(); case LONG: diff --git a/processing/src/main/java/io/druid/query/spec/QuerySegmentSpec.java b/processing/src/main/java/io/druid/query/spec/QuerySegmentSpec.java index 6bc26dc41120..136c44753857 100644 --- a/processing/src/main/java/io/druid/query/spec/QuerySegmentSpec.java +++ b/processing/src/main/java/io/druid/query/spec/QuerySegmentSpec.java @@ -30,10 +30,10 @@ /** */ -@JsonTypeInfo(use= JsonTypeInfo.Id.NAME, property="type", defaultImpl = LegacySegmentSpec.class) -@JsonSubTypes(value={ - @JsonSubTypes.Type(name="intervals", value=MultipleIntervalSegmentSpec.class), - @JsonSubTypes.Type(name="segments", value=MultipleSpecificSegmentSpec.class) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = LegacySegmentSpec.class) +@JsonSubTypes(value = { + @JsonSubTypes.Type(name = "intervals", value = MultipleIntervalSegmentSpec.class), + @JsonSubTypes.Type(name = "segments", value = MultipleSpecificSegmentSpec.class) }) public interface QuerySegmentSpec { diff --git a/processing/src/main/java/io/druid/query/timeboundary/TimeBoundaryQueryQueryToolChest.java b/processing/src/main/java/io/druid/query/timeboundary/TimeBoundaryQueryQueryToolChest.java index 8c7abc576d29..c53c05ebcc29 100644 --- a/processing/src/main/java/io/druid/query/timeboundary/TimeBoundaryQueryQueryToolChest.java +++ b/processing/src/main/java/io/druid/query/timeboundary/TimeBoundaryQueryQueryToolChest.java @@ -197,7 +197,7 @@ public Result apply(Object input) List result = (List) input; return new Result<>( - new DateTime(((Number)result.get(0)).longValue()), + new DateTime(((Number) result.get(0)).longValue()), new TimeBoundaryResultValue(result.get(1)) ); } diff --git a/processing/src/main/java/io/druid/query/topn/PooledTopNAlgorithm.java b/processing/src/main/java/io/druid/query/topn/PooledTopNAlgorithm.java index 2605480fdcee..24521b892a1e 100644 --- a/processing/src/main/java/io/druid/query/topn/PooledTopNAlgorithm.java +++ b/processing/src/main/java/io/druid/query/topn/PooledTopNAlgorithm.java @@ -458,7 +458,7 @@ private static long scanAndAggregateDefault( final int dimSize = dimValues.size(); final int dimExtra = dimSize % AGG_UNROLL_COUNT; - switch(dimExtra){ + switch (dimExtra) { case 7: currentPosition = aggregateDimValue( positions, @@ -675,7 +675,7 @@ private static int aggregateDimValue( } final int position = positions[dimIndex]; - switch(aggExtra) { + switch (aggExtra) { case 7: theAggregators[6].aggregate(resultsBuf, position + aggregatorOffsets[6]); // fall through @@ -699,13 +699,13 @@ private static int aggregateDimValue( } for (int j = aggExtra; j < aggSize; j += AGG_UNROLL_COUNT) { theAggregators[j].aggregate(resultsBuf, position + aggregatorOffsets[j]); - theAggregators[j+1].aggregate(resultsBuf, position + aggregatorOffsets[j+1]); - theAggregators[j+2].aggregate(resultsBuf, position + aggregatorOffsets[j+2]); - theAggregators[j+3].aggregate(resultsBuf, position + aggregatorOffsets[j+3]); - theAggregators[j+4].aggregate(resultsBuf, position + aggregatorOffsets[j+4]); - theAggregators[j+5].aggregate(resultsBuf, position + aggregatorOffsets[j+5]); - theAggregators[j+6].aggregate(resultsBuf, position + aggregatorOffsets[j+6]); - theAggregators[j+7].aggregate(resultsBuf, position + aggregatorOffsets[j+7]); + theAggregators[j + 1].aggregate(resultsBuf, position + aggregatorOffsets[j + 1]); + theAggregators[j + 2].aggregate(resultsBuf, position + aggregatorOffsets[j + 2]); + theAggregators[j + 3].aggregate(resultsBuf, position + aggregatorOffsets[j + 3]); + theAggregators[j + 4].aggregate(resultsBuf, position + aggregatorOffsets[j + 4]); + theAggregators[j + 5].aggregate(resultsBuf, position + aggregatorOffsets[j + 5]); + theAggregators[j + 6].aggregate(resultsBuf, position + aggregatorOffsets[j + 6]); + theAggregators[j + 7].aggregate(resultsBuf, position + aggregatorOffsets[j + 7]); } return currentPosition; } diff --git a/processing/src/main/java/io/druid/query/topn/TopNQueryQueryToolChest.java b/processing/src/main/java/io/druid/query/topn/TopNQueryQueryToolChest.java index f18e5806c162..b4bd6ff814de 100644 --- a/processing/src/main/java/io/druid/query/topn/TopNQueryQueryToolChest.java +++ b/processing/src/main/java/io/druid/query/topn/TopNQueryQueryToolChest.java @@ -444,8 +444,8 @@ public Sequence> run( return runner.run(queryPlus.withQuery(delegateTopNQuery), responseContext); } } - } - , this + }, + this ); } diff --git a/processing/src/main/java/io/druid/query/topn/types/TopNColumnSelectorStrategyFactory.java b/processing/src/main/java/io/druid/query/topn/types/TopNColumnSelectorStrategyFactory.java index 06e41c281a90..1d252f6a5759 100644 --- a/processing/src/main/java/io/druid/query/topn/types/TopNColumnSelectorStrategyFactory.java +++ b/processing/src/main/java/io/druid/query/topn/types/TopNColumnSelectorStrategyFactory.java @@ -33,7 +33,7 @@ public TopNColumnSelectorStrategy makeColumnSelectorStrategy( ) { ValueType type = capabilities.getType(); - switch(type) { + switch (type) { case STRING: return new StringTopNColumnSelectorStrategy(); case LONG: diff --git a/processing/src/main/java/io/druid/segment/ColumnSelector.java b/processing/src/main/java/io/druid/segment/ColumnSelector.java index dbc37355a88c..7ac9c198f03f 100644 --- a/processing/src/main/java/io/druid/segment/ColumnSelector.java +++ b/processing/src/main/java/io/druid/segment/ColumnSelector.java @@ -17,7 +17,9 @@ * under the License. */ -package io.druid.segment;import io.druid.segment.column.Column; +package io.druid.segment; + +import io.druid.segment.column.Column; import io.druid.segment.data.Indexed; /** diff --git a/processing/src/main/java/io/druid/segment/Cursor.java b/processing/src/main/java/io/druid/segment/Cursor.java index 0af9f4a9710a..85b367231c52 100644 --- a/processing/src/main/java/io/druid/segment/Cursor.java +++ b/processing/src/main/java/io/druid/segment/Cursor.java @@ -17,7 +17,9 @@ * under the License. */ -package io.druid.segment;import org.joda.time.DateTime; +package io.druid.segment; + +import org.joda.time.DateTime; /** */ diff --git a/processing/src/main/java/io/druid/segment/DimensionHandlerUtils.java b/processing/src/main/java/io/druid/segment/DimensionHandlerUtils.java index 6567c16b0229..aee86578411d 100644 --- a/processing/src/main/java/io/druid/segment/DimensionHandlerUtils.java +++ b/processing/src/main/java/io/druid/segment/DimensionHandlerUtils.java @@ -282,7 +282,7 @@ public static Double convertObjectToDouble(@Nullable Object valObj) return ((Number) valObj).doubleValue(); } else if (valObj instanceof String) { Double doubleValue = Doubles.tryParse((String) valObj); - return doubleValue == null ? ZERO_DOUBLE : doubleValue; + return doubleValue == null ? ZERO_DOUBLE : doubleValue; } else { throw new ParseException("Unknown type[%s]", valObj.getClass()); } diff --git a/processing/src/main/java/io/druid/segment/IndexSpec.java b/processing/src/main/java/io/druid/segment/IndexSpec.java index cbdb51e55255..67ea64d2ac36 100644 --- a/processing/src/main/java/io/druid/segment/IndexSpec.java +++ b/processing/src/main/java/io/druid/segment/IndexSpec.java @@ -106,7 +106,7 @@ public IndexSpec( "Unknown long encoding type[%s]", longEncoding); this.bitmapSerdeFactory = bitmapSerdeFactory != null ? bitmapSerdeFactory : new ConciseBitmapSerdeFactory(); - this.dimensionCompression = dimensionCompression == null ?DEFAULT_DIMENSION_COMPRESSION : dimensionCompression; + this.dimensionCompression = dimensionCompression == null ? DEFAULT_DIMENSION_COMPRESSION : dimensionCompression; this.metricCompression = metricCompression == null ? DEFAULT_METRIC_COMPRESSION : metricCompression; this.longEncoding = longEncoding == null ? DEFAULT_LONG_ENCODING : longEncoding; } diff --git a/processing/src/main/java/io/druid/segment/Metadata.java b/processing/src/main/java/io/druid/segment/Metadata.java index 3163569c0970..3ac724e8f0c5 100644 --- a/processing/src/main/java/io/druid/segment/Metadata.java +++ b/processing/src/main/java/io/druid/segment/Metadata.java @@ -173,7 +173,7 @@ public static Metadata merge( } } - if(!foundSomeMetadata) { + if (!foundSomeMetadata) { return null; } diff --git a/processing/src/main/java/io/druid/segment/QueryableIndexIndexableAdapter.java b/processing/src/main/java/io/druid/segment/QueryableIndexIndexableAdapter.java index 3c81b1e7495f..951929faf8dc 100644 --- a/processing/src/main/java/io/druid/segment/QueryableIndexIndexableAdapter.java +++ b/processing/src/main/java/io/druid/segment/QueryableIndexIndexableAdapter.java @@ -331,7 +331,7 @@ public String getMetricType(String metric) case DOUBLE: return "double"; case COMPLEX: { - try (ComplexColumn complexColumn = column.getComplexColumn() ) { + try (ComplexColumn complexColumn = column.getComplexColumn()) { return complexColumn.getTypeName(); } } diff --git a/processing/src/main/java/io/druid/segment/column/ColumnBuilder.java b/processing/src/main/java/io/druid/segment/column/ColumnBuilder.java index c5e52ae84e97..5e2141cd3b93 100644 --- a/processing/src/main/java/io/druid/segment/column/ColumnBuilder.java +++ b/processing/src/main/java/io/druid/segment/column/ColumnBuilder.java @@ -108,8 +108,7 @@ public Column build() .setHasBitmapIndexes(bitmapIndex != null) .setHasSpatialIndexes(spatialIndex != null) .setRunLengthEncoded(runLengthColumn != null) - .setHasMultipleValues(hasMultipleValues) - , + .setHasMultipleValues(hasMultipleValues), dictionaryEncodedColumn, runLengthColumn, genericColumn, diff --git a/processing/src/main/java/io/druid/segment/column/SimpleDictionaryEncodedColumn.java b/processing/src/main/java/io/druid/segment/column/SimpleDictionaryEncodedColumn.java index 754282cc2856..576dddc339b1 100644 --- a/processing/src/main/java/io/druid/segment/column/SimpleDictionaryEncodedColumn.java +++ b/processing/src/main/java/io/druid/segment/column/SimpleDictionaryEncodedColumn.java @@ -287,10 +287,10 @@ public void close() throws IOException { CloseQuietly.close(cachedLookups); - if(column != null) { + if (column != null) { column.close(); } - if(multiValueColumn != null) { + if (multiValueColumn != null) { multiValueColumn.close(); } } diff --git a/processing/src/main/java/io/druid/segment/data/CachingIndexed.java b/processing/src/main/java/io/druid/segment/data/CachingIndexed.java index 3f8e68fa780f..46cce2ff00ef 100644 --- a/processing/src/main/java/io/druid/segment/data/CachingIndexed.java +++ b/processing/src/main/java/io/druid/segment/data/CachingIndexed.java @@ -51,7 +51,7 @@ public CachingIndexed(GenericIndexed delegate, final int lookupCacheSize) { this.delegate = delegate.singleThreaded(); - if(lookupCacheSize > 0) { + if (lookupCacheSize > 0) { log.debug("Allocating column cache of max size[%d]", lookupCacheSize); cachedValues = new SizedLRUMap<>(INITIAL_CACHE_CAPACITY, lookupCacheSize); } else { diff --git a/processing/src/main/java/io/druid/segment/data/CompressedIntsIndexedSupplier.java b/processing/src/main/java/io/druid/segment/data/CompressedIntsIndexedSupplier.java index 0a4842ffbda2..970927f0d557 100644 --- a/processing/src/main/java/io/druid/segment/data/CompressedIntsIndexedSupplier.java +++ b/processing/src/main/java/io/druid/segment/data/CompressedIntsIndexedSupplier.java @@ -75,7 +75,7 @@ public IndexedInts get() final int div = Integer.numberOfTrailingZeros(sizePer); final int rem = sizePer - 1; final boolean powerOf2 = sizePer == (1 << div); - if(powerOf2) { + if (powerOf2) { return new CompressedIndexedInts() { @Override @@ -224,7 +224,10 @@ public void remove() } public static CompressedIntsIndexedSupplier fromList( - final List list , final int chunkFactor, final ByteOrder byteOrder, CompressedObjectStrategy.CompressionStrategy compression + final List list, + final int chunkFactor, + final ByteOrder byteOrder, + CompressedObjectStrategy.CompressionStrategy compression ) { Preconditions.checkArgument( @@ -259,7 +262,7 @@ public ResourceHolder next() retVal.limit(list.size() - position); } final List ints = list.subList(position, position + retVal.remaining()); - for(int value : ints) { + for (int value : ints) { retVal.put(value); } retVal.rewind(); diff --git a/processing/src/main/java/io/druid/segment/data/CompressionFactory.java b/processing/src/main/java/io/druid/segment/data/CompressionFactory.java index aa024bb0b183..4a0fc224c124 100644 --- a/processing/src/main/java/io/druid/segment/data/CompressionFactory.java +++ b/processing/src/main/java/io/druid/segment/data/CompressionFactory.java @@ -296,12 +296,12 @@ public static LongSupplierSerializer getLongSerializer( { if (encodingStrategy == LongEncodingStrategy.AUTO) { return new IntermediateLongSupplierSerializer(ioPeon, filenameBase, order, compressionStrategy); - } else if (encodingStrategy == LongEncodingStrategy.LONGS){ + } else if (encodingStrategy == LongEncodingStrategy.LONGS) { if (compressionStrategy == CompressedObjectStrategy.CompressionStrategy.NONE) { return new EntireLayoutLongSupplierSerializer( ioPeon, filenameBase, order, new LongsLongEncodingWriter(order) ); - } else{ + } else { return new BlockLayoutLongSupplierSerializer( ioPeon, filenameBase, order, new LongsLongEncodingWriter(order), compressionStrategy ); @@ -338,7 +338,7 @@ public static FloatSupplierSerializer getFloatSerializer( return new EntireLayoutFloatSupplierSerializer( ioPeon, filenameBase, order ); - } else{ + } else { return new BlockLayoutFloatSupplierSerializer( ioPeon, filenameBase, order, compressionStrategy ); diff --git a/processing/src/main/java/io/druid/segment/data/IndexedIterable.java b/processing/src/main/java/io/druid/segment/data/IndexedIterable.java index 15353f22f6a0..2f6ad2bd3b3a 100644 --- a/processing/src/main/java/io/druid/segment/data/IndexedIterable.java +++ b/processing/src/main/java/io/druid/segment/data/IndexedIterable.java @@ -56,7 +56,7 @@ public boolean hasNext() @Override public T next() { - if (! hasNext()) { + if (!hasNext()) { throw new NoSuchElementException(); } return indexed.get(currIndex++); diff --git a/processing/src/main/java/io/druid/segment/data/IntersectingOffset.java b/processing/src/main/java/io/druid/segment/data/IntersectingOffset.java index e38b197fb8dd..a284db4345b8 100644 --- a/processing/src/main/java/io/druid/segment/data/IntersectingOffset.java +++ b/processing/src/main/java/io/druid/segment/data/IntersectingOffset.java @@ -63,7 +63,7 @@ private void findIntersection() while (lhsOffset != rhsOffset) { while (lhsOffset < rhsOffset) { lhs.increment(); - if (! lhs.withinBounds()) { + if (!lhs.withinBounds()) { return; } @@ -72,7 +72,7 @@ private void findIntersection() while (rhsOffset < lhsOffset) { rhs.increment(); - if (! rhs.withinBounds()) { + if (!rhs.withinBounds()) { return; } diff --git a/processing/src/main/java/io/druid/segment/data/UnioningOffset.java b/processing/src/main/java/io/druid/segment/data/UnioningOffset.java index 00b97719204e..61572b0a64e3 100644 --- a/processing/src/main/java/io/druid/segment/data/UnioningOffset.java +++ b/processing/src/main/java/io/druid/segment/data/UnioningOffset.java @@ -125,7 +125,7 @@ public Offset clone() Offset[] newOffsets = new Offset[2]; int[] newOffsetValues = new int[2]; - for(int i = 0; i < newOffsets.length; ++i) { + for (int i = 0; i < newOffsets.length; ++i) { newOffsets[i] = offsets[i] == null ? null : offsets[i].clone(); newOffsetValues[i] = this.offsetVals[i]; } diff --git a/processing/src/main/java/io/druid/segment/filter/BoundFilter.java b/processing/src/main/java/io/druid/segment/filter/BoundFilter.java index 8c4f804c3c2f..c9fc4262a1ee 100644 --- a/processing/src/main/java/io/druid/segment/filter/BoundFilter.java +++ b/processing/src/main/java/io/druid/segment/filter/BoundFilter.java @@ -252,8 +252,7 @@ private boolean doesMatch(String input) || (boundDimFilter.getLower().isEmpty() && !boundDimFilter.isLowerStrict())) // lower bound allows null && (!boundDimFilter.hasUpperBound() || !boundDimFilter.getUpper().isEmpty() - || !boundDimFilter.isUpperStrict()) // upper bound allows null - ; + || !boundDimFilter.isUpperStrict()); // upper bound allows null } int lowerComparing = 1; int upperComparing = 1; diff --git a/processing/src/main/java/io/druid/segment/filter/OrFilter.java b/processing/src/main/java/io/druid/segment/filter/OrFilter.java index a078680a3747..9a7777b4cf7f 100644 --- a/processing/src/main/java/io/druid/segment/filter/OrFilter.java +++ b/processing/src/main/java/io/druid/segment/filter/OrFilter.java @@ -149,7 +149,7 @@ public List getFilters() public boolean supportsBitmapIndex(BitmapIndexSelector selector) { for (Filter filter : filters) { - if(!filter.supportsBitmapIndex(selector)) { + if (!filter.supportsBitmapIndex(selector)) { return false; } } @@ -162,7 +162,7 @@ public boolean supportsSelectivityEstimation( ) { for (Filter filter : filters) { - if(!filter.supportsSelectivityEstimation(columnSelector, indexSelector)) { + if (!filter.supportsSelectivityEstimation(columnSelector, indexSelector)) { return false; } } diff --git a/processing/src/main/java/io/druid/segment/incremental/IncrementalIndexAdapter.java b/processing/src/main/java/io/druid/segment/incremental/IncrementalIndexAdapter.java index caefaf7ce26f..067d9fa06f69 100644 --- a/processing/src/main/java/io/druid/segment/incremental/IncrementalIndexAdapter.java +++ b/processing/src/main/java/io/druid/segment/incremental/IncrementalIndexAdapter.java @@ -64,7 +64,7 @@ public DimensionAccessor(IncrementalIndex.DimensionDesc dimensionDesc) { this.dimensionDesc = dimensionDesc; this.indexer = dimensionDesc.getIndexer(); - if(dimensionDesc.getCapabilities().hasBitmapIndexes()) { + if (dimensionDesc.getCapabilities().hasBitmapIndexes()) { this.invertedIndexes = new MutableBitmap[indexer.getCardinality() + 1]; } else { this.invertedIndexes = null; @@ -110,7 +110,7 @@ public IncrementalIndexAdapter( } final ColumnCapabilities capabilities = dimension.getCapabilities(); - if(capabilities.hasBitmapIndexes()) { + if (capabilities.hasBitmapIndexes()) { final MutableBitmap[] bitmapIndexes = accessor.invertedIndexes; final DimensionIndexer indexer = accessor.indexer; indexer.fillBitmapsFromUnsortedEncodedKeyComponent(dims[dimIndex], rowNum, bitmapIndexes, bitmapFactory); diff --git a/processing/src/main/java/io/druid/segment/incremental/OffheapIncrementalIndex.java b/processing/src/main/java/io/druid/segment/incremental/OffheapIncrementalIndex.java index 2c017d8c2604..4bfa587a12f3 100644 --- a/processing/src/main/java/io/druid/segment/incremental/OffheapIncrementalIndex.java +++ b/processing/src/main/java/io/druid/segment/incremental/OffheapIncrementalIndex.java @@ -126,7 +126,7 @@ protected BufferAggregator[] initAggs( if (i == 0) { aggOffsetInBuffer[i] = 0; } else { - aggOffsetInBuffer[i] = aggOffsetInBuffer[i-1] + metrics[i-1].getMaxIntermediateSize(); + aggOffsetInBuffer[i] = aggOffsetInBuffer[i - 1] + metrics[i - 1].getMaxIntermediateSize(); } } diff --git a/processing/src/main/java/io/druid/segment/serde/DoubleGenericColumnPartSerde.java b/processing/src/main/java/io/druid/segment/serde/DoubleGenericColumnPartSerde.java index df34dfee3b09..f6f78e202830 100644 --- a/processing/src/main/java/io/druid/segment/serde/DoubleGenericColumnPartSerde.java +++ b/processing/src/main/java/io/druid/segment/serde/DoubleGenericColumnPartSerde.java @@ -34,7 +34,7 @@ public class DoubleGenericColumnPartSerde implements ColumnPartSerde { private final ByteOrder byteOrder; - private Serializer serialize; + private Serializer serialize; @JsonCreator public static DoubleGenericColumnPartSerde getDoubleGenericColumnPartSerde( diff --git a/processing/src/test/java/io/druid/guice/ExtensionsConfigTest.java b/processing/src/test/java/io/druid/guice/ExtensionsConfigTest.java index 35ab551f6055..61f6c860b2da 100644 --- a/processing/src/test/java/io/druid/guice/ExtensionsConfigTest.java +++ b/processing/src/test/java/io/druid/guice/ExtensionsConfigTest.java @@ -101,7 +101,7 @@ public void testLoadList() throws Exception ); Assert.assertEquals( - ImmutableList.of("b","a","c","d"), + ImmutableList.of("b", "a", "c", "d"), new ArrayList<>(config.getLoadList()) ); } diff --git a/processing/src/test/java/io/druid/guice/SegmentMetadataQueryConfigTest.java b/processing/src/test/java/io/druid/guice/SegmentMetadataQueryConfigTest.java index 68212d8f7081..780c3c544be2 100644 --- a/processing/src/test/java/io/druid/guice/SegmentMetadataQueryConfigTest.java +++ b/processing/src/test/java/io/druid/guice/SegmentMetadataQueryConfigTest.java @@ -74,7 +74,7 @@ public ObjectMapper jsonMapper() sb.append('['); while (it.hasNext()) { SegmentMetadataQuery.AnalysisType e = it.next(); - sb.append("\""+e+"\""); + sb.append("\"" + e + "\""); if (it.hasNext()) { sb.append(',').append(' '); } diff --git a/processing/src/test/java/io/druid/query/RetryQueryRunnerTest.java b/processing/src/test/java/io/druid/query/RetryQueryRunnerTest.java index f9862ab7d09b..62c7b69cbff6 100644 --- a/processing/src/test/java/io/druid/query/RetryQueryRunnerTest.java +++ b/processing/src/test/java/io/druid/query/RetryQueryRunnerTest.java @@ -349,7 +349,7 @@ public Sequence> run( ); } else if ((int) context.get("count") == 1) { // this is first retry - Assert.assertTrue("Should retry with 2 missing segments", ((MultipleSpecificSegmentSpec)((BaseQuery)query).getQuerySegmentSpec()).getDescriptors().size() == 2); + Assert.assertTrue("Should retry with 2 missing segments", ((MultipleSpecificSegmentSpec) ((BaseQuery) query).getQuerySegmentSpec()).getDescriptors().size() == 2); // assume only left 1 missing at first retry ((List) context.get(Result.MISSING_SEGMENTS_KEY)).add( new SegmentDescriptor( @@ -372,7 +372,7 @@ public Sequence> run( ); } else { // this is second retry - Assert.assertTrue("Should retry with 1 missing segments", ((MultipleSpecificSegmentSpec)((BaseQuery)query).getQuerySegmentSpec()).getDescriptors().size() == 1); + Assert.assertTrue("Should retry with 1 missing segments", ((MultipleSpecificSegmentSpec) ((BaseQuery) query).getQuerySegmentSpec()).getDescriptors().size() == 1); // assume no more missing at second retry context.put("count", 3); return Sequences.simple( diff --git a/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java b/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java index cca5a62ae10e..fe89aafa0713 100644 --- a/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java +++ b/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java @@ -127,7 +127,7 @@ private AggregationTestHelper( this.factory = factory; this.tempFolder = tempFolder; - for(Module mod : jsonModulesToRegister) { + for (Module mod : jsonModulesToRegister) { mapper.registerModule(mod); } } @@ -280,7 +280,7 @@ public static final AggregationTestHelper createTopNQueryAggregationTestHelper( @Override public ByteBuffer get() { - return ByteBuffer.allocate(10*1024*1024); + return ByteBuffer.allocate(10 * 1024 * 1024); } } ), @@ -608,7 +608,7 @@ private List readQueryResultArrayFromString(String str) throws Exception ObjectCodec objectCodec = jp.getCodec(); - while(jp.nextToken() != JsonToken.END_ARRAY) { + while (jp.nextToken() != JsonToken.END_ARRAY) { result.add(objectCodec.readValue(jp, toolChest.getResultTypeReference())); } return result; diff --git a/processing/src/test/java/io/druid/query/aggregation/DoubleMaxAggregationTest.java b/processing/src/test/java/io/druid/query/aggregation/DoubleMaxAggregationTest.java index 2e77b5e83062..ec602d483e1d 100644 --- a/processing/src/test/java/io/druid/query/aggregation/DoubleMaxAggregationTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/DoubleMaxAggregationTest.java @@ -65,7 +65,7 @@ public void testDoubleMaxAggregator() aggregate(selector, agg); Assert.assertEquals(values[2], ((Double) agg.get()).doubleValue(), 0.0001); - Assert.assertEquals((long)values[2], agg.getLong()); + Assert.assertEquals((long) values[2], agg.getLong()); Assert.assertEquals(values[2], agg.getFloat(), 0.0001); agg.reset(); diff --git a/processing/src/test/java/io/druid/query/aggregation/DoubleMinAggregationTest.java b/processing/src/test/java/io/druid/query/aggregation/DoubleMinAggregationTest.java index 820cff234343..bd4479736f96 100644 --- a/processing/src/test/java/io/druid/query/aggregation/DoubleMinAggregationTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/DoubleMinAggregationTest.java @@ -65,7 +65,7 @@ public void testDoubleMinAggregator() aggregate(selector, agg); Assert.assertEquals(values[2], ((Double) agg.get()).doubleValue(), 0.0001); - Assert.assertEquals((long)values[2], agg.getLong()); + Assert.assertEquals((long) values[2], agg.getLong()); Assert.assertEquals(values[2], agg.getFloat(), 0.0001); agg.reset(); diff --git a/processing/src/test/java/io/druid/query/aggregation/FilteredAggregatorTest.java b/processing/src/test/java/io/druid/query/aggregation/FilteredAggregatorTest.java index e2639fc19138..2d58d7087329 100644 --- a/processing/src/test/java/io/druid/query/aggregation/FilteredAggregatorTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/FilteredAggregatorTest.java @@ -248,12 +248,12 @@ public ColumnCapabilities getColumnCapabilities(String columnName) }; } - private void assertValues(FilteredAggregator agg,TestFloatColumnSelector selector, double... expectedVals) + private void assertValues(FilteredAggregator agg, TestFloatColumnSelector selector, double... expectedVals) { Assert.assertEquals(0.0d, agg.get()); Assert.assertEquals(0.0d, agg.get()); Assert.assertEquals(0.0d, agg.get()); - for(double expectedVal : expectedVals){ + for (double expectedVal : expectedVals) { aggregate(selector, agg); Assert.assertEquals(expectedVal, agg.get()); Assert.assertEquals(expectedVal, agg.get()); diff --git a/processing/src/test/java/io/druid/query/aggregation/HistogramAggregatorTest.java b/processing/src/test/java/io/druid/query/aggregation/HistogramAggregatorTest.java index 526e5ad04e51..0bf070c21e1d 100644 --- a/processing/src/test/java/io/druid/query/aggregation/HistogramAggregatorTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/HistogramAggregatorTest.java @@ -63,9 +63,9 @@ public void testAggregate() throws Exception HistogramAggregator agg = new HistogramAggregator(selector, breaks); - Assert.assertArrayEquals(new long[]{0,0,0,0,0,0}, ((Histogram)agg.get()).bins); - Assert.assertArrayEquals(new long[]{0,0,0,0,0,0}, ((Histogram)agg.get()).bins); - Assert.assertArrayEquals(new long[]{0,0,0,0,0,0}, ((Histogram)agg.get()).bins); + Assert.assertArrayEquals(new long[]{0, 0, 0, 0, 0, 0}, ((Histogram) agg.get()).bins); + Assert.assertArrayEquals(new long[]{0, 0, 0, 0, 0, 0}, ((Histogram) agg.get()).bins); + Assert.assertArrayEquals(new long[]{0, 0, 0, 0, 0, 0}, ((Histogram) agg.get()).bins); aggregate(selector, agg); Assert.assertArrayEquals(new long[]{0, 0, 0, 0, 1, 0}, ((Histogram) agg.get()).bins); Assert.assertArrayEquals(new long[]{0, 0, 0, 0, 1, 0}, ((Histogram) agg.get()).bins); @@ -91,7 +91,7 @@ public void testAggregate() throws Exception aggregate(selector, agg); Assert.assertArrayEquals(new long[]{0, 3, 2, 3, 1, 1}, ((Histogram) agg.get()).bins); aggregate(selector, agg); - Assert.assertArrayEquals(new long[]{1,3,2,3,1,1}, ((Histogram)agg.get()).bins); + Assert.assertArrayEquals(new long[]{1, 3, 2, 3, 1, 1}, ((Histogram) agg.get()).bins); } private void aggregateBuffer(TestFloatColumnSelector selector, BufferAggregator agg, ByteBuffer buf, int position) @@ -162,6 +162,6 @@ public void testBufferAggregate() throws Exception Assert.assertArrayEquals(new long[]{0, 3, 2, 3, 1, 1}, ((Histogram) agg.get(buf, position)).bins); aggregateBuffer(selector, agg, buf, position); - Assert.assertArrayEquals(new long[]{1,3,2,3,1,1}, ((Histogram)agg.get(buf, position)).bins); + Assert.assertArrayEquals(new long[]{1, 3, 2, 3, 1, 1}, ((Histogram) agg.get(buf, position)).bins); } } diff --git a/processing/src/test/java/io/druid/query/aggregation/HistogramTest.java b/processing/src/test/java/io/druid/query/aggregation/HistogramTest.java index ee30db6450f3..4d0a6d2d31ea 100644 --- a/processing/src/test/java/io/druid/query/aggregation/HistogramTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/HistogramTest.java @@ -36,10 +36,10 @@ public void testOffer() final float[] values = {0.55f, 0.27f, -0.3f, -.1f, -0.8f, -.7f, -.5f, 0.25f, 0.1f, 2f, -3f}; final float[] breaks = {-1f, -0.5f, 0.0f, 0.5f, 1f}; - Histogram hExpected = new Histogram(breaks, new long[]{1,3,2,3,1,1}, -3f, 2f); + Histogram hExpected = new Histogram(breaks, new long[]{1, 3, 2, 3, 1, 1}, -3f, 2f); Histogram h = new Histogram(breaks); - for(float v : values) { + for (float v : values) { h.offer(v); } @@ -56,10 +56,10 @@ public void testOfferOnlyNegative() final float[] values = {-0.3f, -.1f, -0.8f, -.7f, -.5f, -3f}; final float[] breaks = {-1f, -0.5f, 0.0f, 0.5f, 1f}; - Histogram hExpected = new Histogram(breaks, new long[]{1,3,2,0,0,0}, -3f, -0.1f); + Histogram hExpected = new Histogram(breaks, new long[]{1, 3, 2, 0, 0, 0}, -3f, -0.1f); Histogram h = new Histogram(breaks); - for(float v : values) { + for (float v : values) { h.offer(v); } @@ -70,7 +70,7 @@ public void testOfferOnlyNegative() public void testToFromBytes() { float[] breaks = {-1f, -0.5f, 0.0f, 0.5f, 1f}; - long [] bins = { 23, 123, 4, 56, 7, 493210}; + long[] bins = {23, 123, 4, 56, 7, 493210}; Histogram h = new Histogram(breaks, bins, -1f, 1f); Assert.assertEquals(Histogram.fromBytes(h.toBytes()), h); @@ -80,21 +80,21 @@ public void testToFromBytes() public void testAsVisual() throws Exception { float[] breaks = {-1f, -0.5f, 0.0f, 0.5f, 1f}; - long [] bins = { 23, 123, 4, 56, 7, 493210}; + long[] bins = {23, 123, 4, 56, 7, 493210}; Histogram h = new Histogram(breaks, bins, -1f, 1f); Double[] visualBreaks = {-1.0, -0.5, 0.0, 0.5, 1.0}; - Double[] visualCounts = { 123., 4., 56., 7. }; + Double[] visualCounts = {123., 4., 56., 7.}; ObjectMapper objectMapper = TestHelper.getJsonMapper(); String json = objectMapper.writeValueAsString(h.asVisual()); - Map expectedObj = Maps.newLinkedHashMap(); + Map expectedObj = Maps.newLinkedHashMap(); expectedObj.put("breaks", Arrays.asList(visualBreaks)); expectedObj.put("counts", Arrays.asList(visualCounts)); expectedObj.put("quantiles", Arrays.asList(new Double[]{-1.0, 1.0})); - Map obj = (Map)objectMapper.readValue(json, Object.class); + Map obj = (Map) objectMapper.readValue(json, Object.class); Assert.assertEquals(expectedObj, obj); } } diff --git a/processing/src/test/java/io/druid/query/aggregation/JavaScriptAggregatorBenchmark.java b/processing/src/test/java/io/druid/query/aggregation/JavaScriptAggregatorBenchmark.java index c81589be7df0..26e0db1b6c18 100644 --- a/processing/src/test/java/io/druid/query/aggregation/JavaScriptAggregatorBenchmark.java +++ b/processing/src/test/java/io/druid/query/aggregation/JavaScriptAggregatorBenchmark.java @@ -67,7 +67,7 @@ protected void setUp() throws Exception public double timeJavaScriptDoubleSum(int reps) { double val = 0; - for(int i = 0; i < reps; ++i) { + for (int i = 0; i < reps; ++i) { aggregate(selector, jsAggregator); } return val; @@ -76,7 +76,7 @@ public double timeJavaScriptDoubleSum(int reps) public double timeNativeDoubleSum(int reps) { double val = 0; - for(int i = 0; i < reps; ++i) { + for (int i = 0; i < reps; ++i) { aggregate(selector, doubleAgg); } return val; diff --git a/processing/src/test/java/io/druid/query/aggregation/JavaScriptAggregatorTest.java b/processing/src/test/java/io/druid/query/aggregation/JavaScriptAggregatorTest.java index 9fb8ea58376a..e920ab0f7828 100644 --- a/processing/src/test/java/io/druid/query/aggregation/JavaScriptAggregatorTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/JavaScriptAggregatorTest.java @@ -319,7 +319,7 @@ public static void main(String... args) throws Exception /* memory usage test List aggs = Lists.newLinkedList(); - for(int i = 0; i < 100000; ++i) { + for (int i = 0; i < 100000; ++i) { JavaScriptAggregator a = new JavaScriptAggregator( "billy", Lists.asList(selector, new FloatColumnSelector[]{}), @@ -329,7 +329,7 @@ public static void main(String... args) throws Exception a.aggregate(); a.aggregate(); a.aggregate(); - if(i % 1000 == 0) System.out.println(StringUtils.format("Query object %d", i)); + if (i % 1000 == 0) System.out.println(StringUtils.format("Query object %d", i)); } */ diff --git a/processing/src/test/java/io/druid/query/aggregation/LongMaxAggregationTest.java b/processing/src/test/java/io/druid/query/aggregation/LongMaxAggregationTest.java index ff2f195ca5b3..25cd857e294f 100644 --- a/processing/src/test/java/io/druid/query/aggregation/LongMaxAggregationTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/LongMaxAggregationTest.java @@ -57,7 +57,7 @@ public void setup() @Test public void testLongMaxAggregator() { - LongMaxAggregator agg = (LongMaxAggregator)longMaxAggFactory.factorize(colSelectorFactory); + LongMaxAggregator agg = (LongMaxAggregator) longMaxAggFactory.factorize(colSelectorFactory); aggregate(selector, agg); aggregate(selector, agg); @@ -75,7 +75,7 @@ public void testLongMaxAggregator() @Test public void testLongMaxBufferAggregator() { - LongMaxBufferAggregator agg = (LongMaxBufferAggregator)longMaxAggFactory.factorizeBuffered(colSelectorFactory); + LongMaxBufferAggregator agg = (LongMaxBufferAggregator) longMaxAggFactory.factorizeBuffered(colSelectorFactory); ByteBuffer buffer = ByteBuffer.wrap(new byte[Longs.BYTES]); agg.init(buffer, 0); @@ -87,7 +87,7 @@ public void testLongMaxBufferAggregator() Assert.assertEquals(values[2], ((Long) agg.get(buffer, 0)).longValue()); Assert.assertEquals(values[2], agg.getLong(buffer, 0)); - Assert.assertEquals((float)values[2], agg.getFloat(buffer, 0), 0.0001); + Assert.assertEquals((float) values[2], agg.getFloat(buffer, 0), 0.0001); } @Test diff --git a/processing/src/test/java/io/druid/query/aggregation/LongMinAggregationTest.java b/processing/src/test/java/io/druid/query/aggregation/LongMinAggregationTest.java index 9314b2655f01..73357564c42b 100644 --- a/processing/src/test/java/io/druid/query/aggregation/LongMinAggregationTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/LongMinAggregationTest.java @@ -57,7 +57,7 @@ public void setup() @Test public void testLongMinAggregator() { - LongMinAggregator agg = (LongMinAggregator)longMinAggFactory.factorize(colSelectorFactory); + LongMinAggregator agg = (LongMinAggregator) longMinAggFactory.factorize(colSelectorFactory); aggregate(selector, agg); aggregate(selector, agg); @@ -75,7 +75,7 @@ public void testLongMinAggregator() @Test public void testLongMinBufferAggregator() { - LongMinBufferAggregator agg = (LongMinBufferAggregator)longMinAggFactory.factorizeBuffered(colSelectorFactory); + LongMinBufferAggregator agg = (LongMinBufferAggregator) longMinAggFactory.factorizeBuffered(colSelectorFactory); ByteBuffer buffer = ByteBuffer.wrap(new byte[Longs.BYTES]); agg.init(buffer, 0); @@ -87,7 +87,7 @@ public void testLongMinBufferAggregator() Assert.assertEquals(values[2], ((Long) agg.get(buffer, 0)).longValue()); Assert.assertEquals(values[2], agg.getLong(buffer, 0)); - Assert.assertEquals((float)values[2], agg.getFloat(buffer, 0), 0.0001); + Assert.assertEquals((float) values[2], agg.getFloat(buffer, 0), 0.0001); } @Test diff --git a/processing/src/test/java/io/druid/query/aggregation/first/DoubleFirstAggregationTest.java b/processing/src/test/java/io/druid/query/aggregation/first/DoubleFirstAggregationTest.java index 2c97705dba05..7de0b2a75ec1 100644 --- a/processing/src/test/java/io/druid/query/aggregation/first/DoubleFirstAggregationTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/first/DoubleFirstAggregationTest.java @@ -130,7 +130,7 @@ public void testDoubleFirstCombiningAggregator() aggregate(agg); Pair result = (Pair) agg.get(); - Pair expected = (Pair)pairs[2]; + Pair expected = (Pair) pairs[2]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs, 0.0001); @@ -156,7 +156,7 @@ public void testDoubleFirstCombiningBufferAggregator() aggregate(agg, buffer, 0); Pair result = (Pair) agg.get(buffer, 0); - Pair expected = (Pair)pairs[2]; + Pair expected = (Pair) pairs[2]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs, 0.0001); diff --git a/processing/src/test/java/io/druid/query/aggregation/first/FloatFirstAggregationTest.java b/processing/src/test/java/io/druid/query/aggregation/first/FloatFirstAggregationTest.java index 16637615316f..d5775797dda7 100644 --- a/processing/src/test/java/io/druid/query/aggregation/first/FloatFirstAggregationTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/first/FloatFirstAggregationTest.java @@ -130,7 +130,7 @@ public void testDoubleFirstCombiningAggregator() aggregate(agg); Pair result = (Pair) agg.get(); - Pair expected = (Pair)pairs[2]; + Pair expected = (Pair) pairs[2]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs, 0.0001); @@ -156,7 +156,7 @@ public void testDoubleFirstCombiningBufferAggregator() aggregate(agg, buffer, 0); Pair result = (Pair) agg.get(buffer, 0); - Pair expected = (Pair)pairs[2]; + Pair expected = (Pair) pairs[2]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs, 0.0001); diff --git a/processing/src/test/java/io/druid/query/aggregation/first/LongFirstAggregationTest.java b/processing/src/test/java/io/druid/query/aggregation/first/LongFirstAggregationTest.java index 7ec005884251..f9e3be856ddc 100644 --- a/processing/src/test/java/io/druid/query/aggregation/first/LongFirstAggregationTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/first/LongFirstAggregationTest.java @@ -129,7 +129,7 @@ public void testLongFirstCombiningAggregator() aggregate(agg); Pair result = (Pair) agg.get(); - Pair expected = (Pair)pairs[0]; + Pair expected = (Pair) pairs[0]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs); @@ -155,7 +155,7 @@ public void testLongFirstCombiningBufferAggregator() aggregate(agg, buffer, 0); Pair result = (Pair) agg.get(buffer, 0); - Pair expected = (Pair)pairs[0]; + Pair expected = (Pair) pairs[0]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs); diff --git a/processing/src/test/java/io/druid/query/aggregation/last/DoubleLastAggregationTest.java b/processing/src/test/java/io/druid/query/aggregation/last/DoubleLastAggregationTest.java index 126cc76ee073..0202449eac40 100644 --- a/processing/src/test/java/io/druid/query/aggregation/last/DoubleLastAggregationTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/last/DoubleLastAggregationTest.java @@ -130,7 +130,7 @@ public void testDoubleLastCombiningAggregator() aggregate(agg); Pair result = (Pair) agg.get(); - Pair expected = (Pair)pairs[2]; + Pair expected = (Pair) pairs[2]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs, 0.0001); @@ -156,7 +156,7 @@ public void testDoubleLastCombiningBufferAggregator() aggregate(agg, buffer, 0); Pair result = (Pair) agg.get(buffer, 0); - Pair expected = (Pair)pairs[2]; + Pair expected = (Pair) pairs[2]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs, 0.0001); diff --git a/processing/src/test/java/io/druid/query/aggregation/last/FloatLastAggregationTest.java b/processing/src/test/java/io/druid/query/aggregation/last/FloatLastAggregationTest.java index b7c74c7eec97..480e7b583239 100644 --- a/processing/src/test/java/io/druid/query/aggregation/last/FloatLastAggregationTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/last/FloatLastAggregationTest.java @@ -130,7 +130,7 @@ public void testDoubleLastCombiningAggregator() aggregate(agg); Pair result = (Pair) agg.get(); - Pair expected = (Pair)pairs[2]; + Pair expected = (Pair) pairs[2]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs, 0.0001); @@ -156,7 +156,7 @@ public void testDoubleLastCombiningBufferAggregator() aggregate(agg, buffer, 0); Pair result = (Pair) agg.get(buffer, 0); - Pair expected = (Pair)pairs[2]; + Pair expected = (Pair) pairs[2]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs, 0.0001); diff --git a/processing/src/test/java/io/druid/query/aggregation/last/LongLastAggregationTest.java b/processing/src/test/java/io/druid/query/aggregation/last/LongLastAggregationTest.java index 7353d7a5054f..8b530df3f0ff 100644 --- a/processing/src/test/java/io/druid/query/aggregation/last/LongLastAggregationTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/last/LongLastAggregationTest.java @@ -129,7 +129,7 @@ public void testLongLastCombiningAggregator() aggregate(agg); Pair result = (Pair) agg.get(); - Pair expected = (Pair)pairs[2]; + Pair expected = (Pair) pairs[2]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs); @@ -155,7 +155,7 @@ public void testLongLastCombiningBufferAggregator() aggregate(agg, buffer, 0); Pair result = (Pair) agg.get(buffer, 0); - Pair expected = (Pair)pairs[2]; + Pair expected = (Pair) pairs[2]; Assert.assertEquals(expected.lhs, result.lhs); Assert.assertEquals(expected.rhs, result.rhs); diff --git a/processing/src/test/java/io/druid/query/aggregation/post/FinalizingFieldAccessPostAggregatorTest.java b/processing/src/test/java/io/druid/query/aggregation/post/FinalizingFieldAccessPostAggregatorTest.java index d6309f40c545..d7d7c6643586 100644 --- a/processing/src/test/java/io/druid/query/aggregation/post/FinalizingFieldAccessPostAggregatorTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/post/FinalizingFieldAccessPostAggregatorTest.java @@ -140,10 +140,10 @@ public void testComparatorsWithFinalizing() throws Exception ); List computedValues = Lists.newArrayList(); - computedValues.add(postAgg.compute(ImmutableMap.of(aggName, (Object)"test_val1"))); - computedValues.add(postAgg.compute(ImmutableMap.of(aggName, (Object)"test_val2"))); - computedValues.add(postAgg.compute(ImmutableMap.of(aggName, (Object)"test_val3"))); - computedValues.add(postAgg.compute(ImmutableMap.of(aggName, (Object)"test_val4"))); + computedValues.add(postAgg.compute(ImmutableMap.of(aggName, "test_val1"))); + computedValues.add(postAgg.compute(ImmutableMap.of(aggName, "test_val2"))); + computedValues.add(postAgg.compute(ImmutableMap.of(aggName, "test_val3"))); + computedValues.add(postAgg.compute(ImmutableMap.of(aggName, "test_val4"))); Collections.sort(computedValues, postAgg.getComparator()); Assert.assertArrayEquals(new Object[]{3L, 10L, 21L, null}, computedValues.toArray(new Object[]{})); @@ -165,11 +165,11 @@ public void testComparatorsWithFinalizingAndComparatorNull() throws Exception List computedValues = Lists.newArrayList(); Map forNull = Maps.newHashMap(); - forNull.put("joe", (Object)null); // guava does not allow the value to be null. - computedValues.add(postAgg.compute(ImmutableMap.of("joe", (Object)"test_val1"))); - computedValues.add(postAgg.compute(ImmutableMap.of("joe", (Object)"test_val2"))); + forNull.put("joe", null); // guava does not allow the value to be null. + computedValues.add(postAgg.compute(ImmutableMap.of("joe", "test_val1"))); + computedValues.add(postAgg.compute(ImmutableMap.of("joe", "test_val2"))); computedValues.add(postAgg.compute(forNull)); - computedValues.add(postAgg.compute(ImmutableMap.of("joe", (Object)"test_val4"))); + computedValues.add(postAgg.compute(ImmutableMap.of("joe", "test_val4"))); Collections.sort(computedValues, postAgg.getComparator()); Assert.assertArrayEquals(new Object[]{null, "test_val1", "test_val2", "test_val4"}, computedValues.toArray(new Object[]{})); diff --git a/processing/src/test/java/io/druid/query/datasourcemetadata/DataSourceMetadataQueryTest.java b/processing/src/test/java/io/druid/query/datasourcemetadata/DataSourceMetadataQueryTest.java index 50f43754e5de..15f539b439d4 100644 --- a/processing/src/test/java/io/druid/query/datasourcemetadata/DataSourceMetadataQueryTest.java +++ b/processing/src/test/java/io/druid/query/datasourcemetadata/DataSourceMetadataQueryTest.java @@ -220,7 +220,7 @@ public Interval getInterval() ); for (int i = 0; i < segments.size(); i++) { - Assert.assertEquals(expected.get(i).getInterval(),segments.get(i).getInterval()); + Assert.assertEquals(expected.get(i).getInterval(), segments.get(i).getInterval()); } } diff --git a/processing/src/test/java/io/druid/query/extraction/JavaScriptExtractionFnTest.java b/processing/src/test/java/io/druid/query/extraction/JavaScriptExtractionFnTest.java index 9c4ae14b4d15..b2bfad510c0b 100644 --- a/processing/src/test/java/io/druid/query/extraction/JavaScriptExtractionFnTest.java +++ b/processing/src/test/java/io/druid/query/extraction/JavaScriptExtractionFnTest.java @@ -78,7 +78,7 @@ public void testTimeExample() throws Exception { String utcHour = "function(t) {\nreturn 'Second ' + Math.floor((t % 60000) / 1000);\n}"; final long millis = new DateTime("2015-01-02T13:00:59.999Z").getMillis(); - Assert.assertEquals("Second 59" , new JavaScriptExtractionFn(utcHour, false, JavaScriptConfig.getEnabledInstance()).apply(millis)); + Assert.assertEquals("Second 59", new JavaScriptExtractionFn(utcHour, false, JavaScriptConfig.getEnabledInstance()).apply(millis)); } @Test @@ -98,12 +98,12 @@ public void testFloats() throws Exception @Test public void testCastingAndNull() { - String function = "function(x) {\n x = Number(x);\n if(isNaN(x)) return null;\n return Math.floor(x / 5) * 5;\n}"; + String function = "function(x) {\n x = Number(x);\n if (isNaN(x)) return null;\n return Math.floor(x / 5) * 5;\n}"; ExtractionFn extractionFn = new JavaScriptExtractionFn(function, false, JavaScriptConfig.getEnabledInstance()); Iterator it = Iterators.forArray("0", "5", "5", "10", null); - for(String str : Lists.newArrayList("1", "5", "6", "10", "CA")) { + for (String str : Lists.newArrayList("1", "5", "6", "10", "CA")) { String res = extractionFn.apply(str); String expected = it.next(); Assert.assertEquals(expected, res); @@ -337,7 +337,7 @@ public void testJavaScriptPorterStemmer() Iterator inputs = Iterators.forArray("introducing", "exploratory", "analytics", "on", "large", "datasets"); Iterator it = Iterators.forArray("introduc", "exploratori", "analyt", "on", "larg", "dataset"); - while(inputs.hasNext()) { + while (inputs.hasNext()) { String res = extractionFn.apply(inputs.next()); Assert.assertEquals(it.next(), res); } diff --git a/processing/src/test/java/io/druid/query/extraction/LowerExtractionFnTest.java b/processing/src/test/java/io/druid/query/extraction/LowerExtractionFnTest.java index 2375d3998a96..1a7727adbaf1 100644 --- a/processing/src/test/java/io/druid/query/extraction/LowerExtractionFnTest.java +++ b/processing/src/test/java/io/druid/query/extraction/LowerExtractionFnTest.java @@ -31,9 +31,9 @@ public class LowerExtractionFnTest public void testApply() { Assert.assertEquals("lower 1 string", extractionFn.apply("lOwER 1 String")); - Assert.assertEquals(null, extractionFn.apply("")); + Assert.assertEquals(null, extractionFn.apply("")); Assert.assertEquals(null, extractionFn.apply(null)); - Assert.assertEquals(null, extractionFn.apply((Object)null)); + Assert.assertEquals(null, extractionFn.apply((Object) null)); Assert.assertEquals("1", extractionFn.apply(1)); } diff --git a/processing/src/test/java/io/druid/query/extraction/MapLookupExtractorTest.java b/processing/src/test/java/io/druid/query/extraction/MapLookupExtractorTest.java index 507bdcc08652..6c661859a404 100644 --- a/processing/src/test/java/io/druid/query/extraction/MapLookupExtractorTest.java +++ b/processing/src/test/java/io/druid/query/extraction/MapLookupExtractorTest.java @@ -31,7 +31,7 @@ public class MapLookupExtractorTest { - private final Map lookupMap = ImmutableMap.of("foo", "bar", "null", "", "empty String", "", "","empty_string"); + private final Map lookupMap = ImmutableMap.of("foo", "bar", "null", "", "empty String", "", "", "empty_string"); private final MapLookupExtractor fn = new MapLookupExtractor(lookupMap, false); @Test diff --git a/processing/src/test/java/io/druid/query/extraction/SubstringDimExtractionFnTest.java b/processing/src/test/java/io/druid/query/extraction/SubstringDimExtractionFnTest.java index 40f1d0c578fb..094019c27f1c 100644 --- a/processing/src/test/java/io/druid/query/extraction/SubstringDimExtractionFnTest.java +++ b/processing/src/test/java/io/druid/query/extraction/SubstringDimExtractionFnTest.java @@ -44,13 +44,13 @@ public void testSubstrings() @Test (expected = IllegalArgumentException.class) public void testZeroLength() { - ExtractionFn extractionFnNoLength = new SubstringDimExtractionFn(1,0); + ExtractionFn extractionFnNoLength = new SubstringDimExtractionFn(1, 0); } @Test public void testNoLength() { - ExtractionFn extractionFnNoLength = new SubstringDimExtractionFn(1,null); + ExtractionFn extractionFnNoLength = new SubstringDimExtractionFn(1, null); // 0 length substring returns remainder Assert.assertEquals("abcdef", extractionFnNoLength.apply("/abcdef")); @@ -62,9 +62,9 @@ public void testNoLength() @Test public void testGetCacheKey() { - ExtractionFn extractionFn1 = new SubstringDimExtractionFn(2,4); - ExtractionFn extractionFn2 = new SubstringDimExtractionFn(2,4); - ExtractionFn extractionFn3 = new SubstringDimExtractionFn(1,4); + ExtractionFn extractionFn1 = new SubstringDimExtractionFn(2, 4); + ExtractionFn extractionFn2 = new SubstringDimExtractionFn(2, 4); + ExtractionFn extractionFn3 = new SubstringDimExtractionFn(1, 4); Assert.assertArrayEquals(extractionFn1.getCacheKey(), extractionFn2.getCacheKey()); @@ -74,9 +74,9 @@ public void testGetCacheKey() @Test public void testHashCode() { - ExtractionFn extractionFn1 = new SubstringDimExtractionFn(2,4); - ExtractionFn extractionFn2 = new SubstringDimExtractionFn(2,4); - ExtractionFn extractionFn3 = new SubstringDimExtractionFn(1,4); + ExtractionFn extractionFn1 = new SubstringDimExtractionFn(2, 4); + ExtractionFn extractionFn2 = new SubstringDimExtractionFn(2, 4); + ExtractionFn extractionFn3 = new SubstringDimExtractionFn(1, 4); Assert.assertEquals(extractionFn1.hashCode(), extractionFn2.hashCode()); @@ -86,7 +86,7 @@ public void testHashCode() @Test public void testNullAndEmpty() { - ExtractionFn extractionFn = new SubstringDimExtractionFn(2,4); + ExtractionFn extractionFn = new SubstringDimExtractionFn(2, 4); // no match, map empty input value to null Assert.assertEquals(null, extractionFn.apply("")); // null value, returns null diff --git a/processing/src/test/java/io/druid/query/extraction/TimeFormatExtractionFnTest.java b/processing/src/test/java/io/druid/query/extraction/TimeFormatExtractionFnTest.java index 0ed454071e19..2a608b6923c3 100644 --- a/processing/src/test/java/io/druid/query/extraction/TimeFormatExtractionFnTest.java +++ b/processing/src/test/java/io/druid/query/extraction/TimeFormatExtractionFnTest.java @@ -46,12 +46,12 @@ public class TimeFormatExtractionFnTest public void testDayOfWeekExtraction() throws Exception { TimeFormatExtractionFn fn = new TimeFormatExtractionFn("EEEE", null, null, null, false); - Assert.assertEquals("Thursday", fn.apply(timestamps[0])); - Assert.assertEquals("Friday", fn.apply(timestamps[1])); - Assert.assertEquals("Tuesday", fn.apply(timestamps[2])); + Assert.assertEquals("Thursday", fn.apply(timestamps[0])); + Assert.assertEquals("Friday", fn.apply(timestamps[1])); + Assert.assertEquals("Tuesday", fn.apply(timestamps[2])); Assert.assertEquals("Wednesday", fn.apply(timestamps[3])); - Assert.assertEquals("Saturday", fn.apply(timestamps[4])); - Assert.assertEquals("Monday", fn.apply(timestamps[5])); + Assert.assertEquals("Saturday", fn.apply(timestamps[4])); + Assert.assertEquals("Monday", fn.apply(timestamps[5])); testSerde(fn, "EEEE", null, null, Granularities.NONE); } @@ -60,12 +60,12 @@ public void testDayOfWeekExtraction() throws Exception public void testLocalizedExtraction() throws Exception { TimeFormatExtractionFn fn = new TimeFormatExtractionFn("EEEE", null, "is", null, false); - Assert.assertEquals("fimmtudagur", fn.apply(timestamps[0])); - Assert.assertEquals("föstudagur", fn.apply(timestamps[1])); - Assert.assertEquals("þriðjudagur", fn.apply(timestamps[2])); + Assert.assertEquals("fimmtudagur", fn.apply(timestamps[0])); + Assert.assertEquals("föstudagur", fn.apply(timestamps[1])); + Assert.assertEquals("þriðjudagur", fn.apply(timestamps[2])); Assert.assertEquals("miðvikudagur", fn.apply(timestamps[3])); - Assert.assertEquals("laugardagur", fn.apply(timestamps[4])); - Assert.assertEquals("mánudagur", fn.apply(timestamps[5])); + Assert.assertEquals("laugardagur", fn.apply(timestamps[4])); + Assert.assertEquals("mánudagur", fn.apply(timestamps[5])); testSerde(fn, "EEEE", null, "is", Granularities.NONE); } @@ -94,12 +94,12 @@ public void testTimeZoneExtraction() throws Exception null, false ); - Assert.assertEquals("In Berlin ist es schon Freitag", fn.apply(timestamps[0])); - Assert.assertEquals("In Berlin ist es schon Samstag", fn.apply(timestamps[1])); - Assert.assertEquals("In Berlin ist es schon Mittwoch", fn.apply(timestamps[2])); + Assert.assertEquals("In Berlin ist es schon Freitag", fn.apply(timestamps[0])); + Assert.assertEquals("In Berlin ist es schon Samstag", fn.apply(timestamps[1])); + Assert.assertEquals("In Berlin ist es schon Mittwoch", fn.apply(timestamps[2])); Assert.assertEquals("In Berlin ist es schon Donnerstag", fn.apply(timestamps[3])); - Assert.assertEquals("In Berlin ist es schon Sonntag", fn.apply(timestamps[4])); - Assert.assertEquals("In Berlin ist es schon Dienstag", fn.apply(timestamps[5])); + Assert.assertEquals("In Berlin ist es schon Sonntag", fn.apply(timestamps[4])); + Assert.assertEquals("In Berlin ist es schon Dienstag", fn.apply(timestamps[5])); testSerde(fn, "'In Berlin ist es schon 'EEEE", DateTimeZone.forID("Europe/Berlin"), "de", Granularities.NONE); } diff --git a/processing/src/test/java/io/druid/query/extraction/UpperExtractionFnTest.java b/processing/src/test/java/io/druid/query/extraction/UpperExtractionFnTest.java index 3fddae7ea465..1d038c0674ac 100644 --- a/processing/src/test/java/io/druid/query/extraction/UpperExtractionFnTest.java +++ b/processing/src/test/java/io/druid/query/extraction/UpperExtractionFnTest.java @@ -31,9 +31,9 @@ public class UpperExtractionFnTest public void testApply() { Assert.assertEquals("UPPER", extractionFn.apply("uPpeR")); - Assert.assertEquals(null, extractionFn.apply("")); + Assert.assertEquals(null, extractionFn.apply("")); Assert.assertEquals(null, extractionFn.apply(null)); - Assert.assertEquals(null, extractionFn.apply((Object)null)); + Assert.assertEquals(null, extractionFn.apply((Object) null)); Assert.assertEquals("1", extractionFn.apply(1)); } diff --git a/processing/src/test/java/io/druid/query/filter/BoundDimFilterTest.java b/processing/src/test/java/io/druid/query/filter/BoundDimFilterTest.java index b9e3cef41d28..11bc006f7af8 100644 --- a/processing/src/test/java/io/druid/query/filter/BoundDimFilterTest.java +++ b/processing/src/test/java/io/druid/query/filter/BoundDimFilterTest.java @@ -63,7 +63,7 @@ public class BoundDimFilterTest private static final ExtractionFn extractionFn = new RegexDimExtractionFn(".*", false, null); @Parameterized.Parameters - public static Iterable constructorFeeder() + public static Iterable constructorFeeder() { return ImmutableList.of( diff --git a/processing/src/test/java/io/druid/query/groupby/GroupByQueryRunnerTest.java b/processing/src/test/java/io/druid/query/groupby/GroupByQueryRunnerTest.java index 0a1d327a5a00..67db5bb781b6 100644 --- a/processing/src/test/java/io/druid/query/groupby/GroupByQueryRunnerTest.java +++ b/processing/src/test/java/io/druid/query/groupby/GroupByQueryRunnerTest.java @@ -431,23 +431,23 @@ public void testGroupBy() List expectedResults = Arrays.asList( GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "automotive", "rows", 1L, "idx", 135L, "idxFloat", 135.88510131835938f, "idxDouble", 135.88510131835938d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "business", "rows", 1L, "idx", 118L,"idxFloat", 118.57034, "idxDouble", 118.57034), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "entertainment", "rows", 1L, "idx", 158L,"idxFloat", 158.747224, "idxDouble", 158.747224), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "health", "rows", 1L, "idx", 120L,"idxFloat", 120.134704, "idxDouble", 120.134704), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "mezzanine", "rows", 3L, "idx", 2870L,"idxFloat", 2871.8866900000003f, "idxDouble", 2871.8866900000003d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "news", "rows", 1L, "idx", 121L,"idxFloat", 121.58358f, "idxDouble", 121.58358d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "premium", "rows", 3L, "idx", 2900L,"idxFloat", 2900.798647f, "idxDouble", 2900.798647d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "technology", "rows", 1L, "idx", 78L,"idxFloat", 78.622547f, "idxDouble", 78.622547d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "travel", "rows", 1L, "idx", 119L,"idxFloat", 119.922742f, "idxDouble", 119.922742d), - - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "automotive", "rows", 1L, "idx", 147L,"idxFloat", 147.42593f, "idxDouble", 147.42593d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "business", "rows", 1L, "idx", 112L,"idxFloat", 112.987027f, "idxDouble", 112.987027d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "entertainment", "rows", 1L, "idx", 166L,"idxFloat", 166.016049f, "idxDouble", 166.016049d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "health", "rows", 1L, "idx", 113L,"idxFloat", 113.446008f, "idxDouble", 113.446008d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "mezzanine", "rows", 3L, "idx", 2447L,"idxFloat", 2448.830613f, "idxDouble", 2448.830613d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "news", "rows", 1L, "idx", 114L,"idxFloat", 114.290141f, "idxDouble", 114.290141d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "premium", "rows", 3L, "idx", 2505L,"idxFloat", 2506.415148f, "idxDouble", 2506.415148d), - GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "technology", "rows", 1L, "idx", 97L,"idxFloat", 97.387433f, "idxDouble", 97.387433d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "business", "rows", 1L, "idx", 118L, "idxFloat", 118.57034, "idxDouble", 118.57034), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "entertainment", "rows", 1L, "idx", 158L, "idxFloat", 158.747224, "idxDouble", 158.747224), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "health", "rows", 1L, "idx", 120L, "idxFloat", 120.134704, "idxDouble", 120.134704), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "mezzanine", "rows", 3L, "idx", 2870L, "idxFloat", 2871.8866900000003f, "idxDouble", 2871.8866900000003d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "news", "rows", 1L, "idx", 121L, "idxFloat", 121.58358f, "idxDouble", 121.58358d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "premium", "rows", 3L, "idx", 2900L, "idxFloat", 2900.798647f, "idxDouble", 2900.798647d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "technology", "rows", 1L, "idx", 78L, "idxFloat", 78.622547f, "idxDouble", 78.622547d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "travel", "rows", 1L, "idx", 119L, "idxFloat", 119.922742f, "idxDouble", 119.922742d), + + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "automotive", "rows", 1L, "idx", 147L, "idxFloat", 147.42593f, "idxDouble", 147.42593d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "business", "rows", 1L, "idx", 112L, "idxFloat", 112.987027f, "idxDouble", 112.987027d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "entertainment", "rows", 1L, "idx", 166L, "idxFloat", 166.016049f, "idxDouble", 166.016049d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "health", "rows", 1L, "idx", 113L, "idxFloat", 113.446008f, "idxDouble", 113.446008d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "mezzanine", "rows", 3L, "idx", 2447L, "idxFloat", 2448.830613f, "idxDouble", 2448.830613d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "news", "rows", 1L, "idx", 114L, "idxFloat", 114.290141f, "idxDouble", 114.290141d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "premium", "rows", 3L, "idx", 2505L, "idxFloat", 2506.415148f, "idxDouble", 2506.415148d), + GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "technology", "rows", 1L, "idx", 97L, "idxFloat", 97.387433f, "idxDouble", 97.387433d), GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "travel", "rows", 1L, "idx", 126L, "idxFloat", 126.411364f, "idxDouble", 126.411364d) ); @@ -5504,7 +5504,7 @@ public void testSubqueryWithOuterTimeFilter() .build(); final DimFilter fridayFilter = new SelectorDimFilter(Column.TIME_COLUMN_NAME, "Friday", new TimeFormatExtractionFn("EEEE", null, null, null, false)); - final DimFilter firstDaysFilter = new InDimFilter(Column.TIME_COLUMN_NAME, ImmutableList.of("1", "2", "3"), new TimeFormatExtractionFn("d", null, null, null, false)); + final DimFilter firstDaysFilter = new InDimFilter(Column.TIME_COLUMN_NAME, ImmutableList.of("1", "2", "3"), new TimeFormatExtractionFn("d", null, null, null, false)); final GroupByQuery query = GroupByQuery .builder() .setDataSource(subquery) diff --git a/processing/src/test/java/io/druid/query/groupby/GroupByTimeseriesQueryRunnerTest.java b/processing/src/test/java/io/druid/query/groupby/GroupByTimeseriesQueryRunnerTest.java index eb36f966f1ea..4c7097fd4e29 100644 --- a/processing/src/test/java/io/druid/query/groupby/GroupByTimeseriesQueryRunnerTest.java +++ b/processing/src/test/java/io/druid/query/groupby/GroupByTimeseriesQueryRunnerTest.java @@ -58,7 +58,7 @@ public class GroupByTimeseriesQueryRunnerTest extends TimeseriesQueryRunnerTest { @SuppressWarnings("unchecked") - @Parameterized.Parameters(name="{0}") + @Parameterized.Parameters(name = "{0}") public static Iterable constructorFeeder() throws IOException { GroupByQueryConfig config = new GroupByQueryConfig(); diff --git a/processing/src/test/java/io/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeapTest.java b/processing/src/test/java/io/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeapTest.java index 4c4440c150f7..1fd4facf5c0b 100644 --- a/processing/src/test/java/io/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeapTest.java +++ b/processing/src/test/java/io/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeapTest.java @@ -54,7 +54,7 @@ public void testSimple() 5, 42, 47, 44, 1, 49, 99 ); - for (int i = 0; i < values.size(); i++){ + for (int i = 0; i < values.size(); i++) { heap.addOffset(values.get(i)); } @@ -93,7 +93,7 @@ public void testRandom() ByteBuffer myBuffer = ByteBuffer.allocate(1000000); ByteBufferMinMaxOffsetHeap heap = new ByteBufferMinMaxOffsetHeap(myBuffer, limit, Ordering.natural(), null); - for (int i = 0; i < values.size(); i++){ + for (int i = 0; i < values.size(); i++) { int droppedOffset = heap.addOffset(values.get(i)); Assert.assertTrue(heap.isIntact()); @@ -126,7 +126,7 @@ public void testRandom() List actual = Lists.newArrayList(); int initialHeapSize = heap.getHeapSize(); - for (int i = 0; i < initialHeapSize; i++){ + for (int i = 0; i < initialHeapSize; i++) { int min = heap.removeMin(); actual.add(min); } @@ -150,7 +150,7 @@ public void testRandom2() ByteBuffer myBuffer = ByteBuffer.allocate(1000000); ByteBufferMinMaxOffsetHeap heap = new ByteBufferMinMaxOffsetHeap(myBuffer, limit, Ordering.natural(), null); - for (int i = 0; i < values.size(); i++){ + for (int i = 0; i < values.size(); i++) { int droppedOffset = heap.addOffset(values.get(i)); Assert.assertTrue(heap.isIntact()); @@ -183,7 +183,7 @@ public void testRandom2() List actual = Lists.newArrayList(); int initialHeapSize = heap.getHeapSize(); - for (int i = 0; i < initialHeapSize; i++){ + for (int i = 0; i < initialHeapSize; i++) { int min = heap.removeMin(); actual.add(min); } @@ -204,7 +204,7 @@ public void testRemove() ByteBuffer myBuffer = ByteBuffer.allocate(1000000); ByteBufferMinMaxOffsetHeap heap = new ByteBufferMinMaxOffsetHeap(myBuffer, limit, Ordering.natural(), null); - for (int i = 0; i < values.size(); i++){ + for (int i = 0; i < values.size(); i++) { heap.addOffset(values.get(i)); Assert.assertTrue(heap.isIntact()); } @@ -217,7 +217,7 @@ public void testRemove() values.rem(12); List actual = Lists.newArrayList(); - for (int i = 0; i < values.size(); i++){ + for (int i = 0; i < values.size(); i++) { int min = heap.removeMin(); actual.add(min); } @@ -238,7 +238,7 @@ public void testRemove2() ByteBuffer myBuffer = ByteBuffer.allocate(1000000); ByteBufferMinMaxOffsetHeap heap = new ByteBufferMinMaxOffsetHeap(myBuffer, limit, Ordering.natural(), null); - for (int i = 0; i < values.size(); i++){ + for (int i = 0; i < values.size(); i++) { heap.addOffset(values.get(i)); } Assert.assertTrue(heap.isIntact()); @@ -251,7 +251,7 @@ public void testRemove2() Assert.assertTrue(heap.isIntact()); List actual = Lists.newArrayList(); - for (int i = 0; i < values.size(); i++){ + for (int i = 0; i < values.size(); i++) { int min = heap.removeMin(); actual.add(min); } diff --git a/processing/src/test/java/io/druid/query/groupby/having/HavingSpecTest.java b/processing/src/test/java/io/druid/query/groupby/having/HavingSpecTest.java index 762651ad9c30..4ef1aee63c7f 100644 --- a/processing/src/test/java/io/druid/query/groupby/having/HavingSpecTest.java +++ b/processing/src/test/java/io/druid/query/groupby/having/HavingSpecTest.java @@ -40,7 +40,7 @@ public class HavingSpecTest { - private static final Row ROW = new MapBasedInputRow(0, new ArrayList(), ImmutableMap.of("metric", (Object)Float.valueOf(10))); + private static final Row ROW = new MapBasedInputRow(0, new ArrayList<>(), ImmutableMap.of("metric", Float.valueOf(10))); @Test public void testHavingClauseSerde() throws Exception @@ -85,7 +85,7 @@ public void testHavingClauseSerde() throws Exception ); ObjectMapper mapper = new DefaultObjectMapper(); - assertEquals(andHavingSpec, mapper.convertValue(payloadMap, AndHavingSpec.class)); + assertEquals(andHavingSpec, mapper.convertValue(payloadMap, AndHavingSpec.class)); } @Test(expected = IllegalArgumentException.class) @@ -180,7 +180,7 @@ public void testAndHavingSpecShouldSupportShortcutEvaluation() { AtomicInteger counter = new AtomicInteger(0); AndHavingSpec spec = new AndHavingSpec(ImmutableList.of( - (HavingSpec)new CountingHavingSpec(counter, true), + (HavingSpec) new CountingHavingSpec(counter, true), new CountingHavingSpec(counter, false), new CountingHavingSpec(counter, true), new CountingHavingSpec(counter, false) @@ -196,7 +196,7 @@ public void testAndHavingSpec() { AtomicInteger counter = new AtomicInteger(0); AndHavingSpec spec = new AndHavingSpec(ImmutableList.of( - (HavingSpec)new CountingHavingSpec(counter, true), + (HavingSpec) new CountingHavingSpec(counter, true), new CountingHavingSpec(counter, true), new CountingHavingSpec(counter, true), new CountingHavingSpec(counter, true) @@ -208,7 +208,7 @@ public void testAndHavingSpec() counter.set(0); spec = new AndHavingSpec(ImmutableList.of( - (HavingSpec)new CountingHavingSpec(counter, false), + (HavingSpec) new CountingHavingSpec(counter, false), new CountingHavingSpec(counter, true), new CountingHavingSpec(counter, true), new CountingHavingSpec(counter, true) @@ -224,7 +224,7 @@ public void testOrHavingSpecSupportsShortcutEvaluation() { AtomicInteger counter = new AtomicInteger(0); OrHavingSpec spec = new OrHavingSpec(ImmutableList.of( - (HavingSpec)new CountingHavingSpec(counter, true), + (HavingSpec) new CountingHavingSpec(counter, true), new CountingHavingSpec(counter, true), new CountingHavingSpec(counter, true), new CountingHavingSpec(counter, false) @@ -240,7 +240,7 @@ public void testOrHavingSpec() { AtomicInteger counter = new AtomicInteger(0); OrHavingSpec spec = new OrHavingSpec(ImmutableList.of( - (HavingSpec)new CountingHavingSpec(counter, false), + (HavingSpec) new CountingHavingSpec(counter, false), new CountingHavingSpec(counter, false), new CountingHavingSpec(counter, false), new CountingHavingSpec(counter, false) @@ -252,7 +252,7 @@ public void testOrHavingSpec() counter.set(0); spec = new OrHavingSpec(ImmutableList.of( - (HavingSpec)new CountingHavingSpec(counter, false), + (HavingSpec) new CountingHavingSpec(counter, false), new CountingHavingSpec(counter, false), new CountingHavingSpec(counter, false), new CountingHavingSpec(counter, true) diff --git a/processing/src/test/java/io/druid/query/groupby/orderby/DefaultLimitSpecTest.java b/processing/src/test/java/io/druid/query/groupby/orderby/DefaultLimitSpecTest.java index b20e55a43a7c..03cdcd9cfae5 100644 --- a/processing/src/test/java/io/druid/query/groupby/orderby/DefaultLimitSpecTest.java +++ b/processing/src/test/java/io/druid/query/groupby/orderby/DefaultLimitSpecTest.java @@ -253,8 +253,8 @@ public void testBuildWithExplicitOrder() ) ); Assert.assertEquals( - (List)ImmutableList.of(testRowsList.get(2), testRowsList.get(0)), - (List)Sequences.toList(limitFn.apply(testRowsSequence), new ArrayList()) + (List) ImmutableList.of(testRowsList.get(2), testRowsList.get(0)), + (List) Sequences.toList(limitFn.apply(testRowsSequence), new ArrayList()) ); // makes same result @@ -264,8 +264,8 @@ public void testBuildWithExplicitOrder() ImmutableList.of(new ExpressionPostAggregator("k1", "1 + 1", null, TestExprMacroTable.INSTANCE)) ); Assert.assertEquals( - (List)ImmutableList.of(testRowsList.get(2), testRowsList.get(0)), - (List)Sequences.toList(limitFn.apply(testRowsSequence), new ArrayList()) + (List) ImmutableList.of(testRowsList.get(2), testRowsList.get(0)), + (List) Sequences.toList(limitFn.apply(testRowsSequence), new ArrayList()) ); } diff --git a/processing/src/test/java/io/druid/query/groupby/orderby/TopNSequenceTest.java b/processing/src/test/java/io/druid/query/groupby/orderby/TopNSequenceTest.java index 49d23ca4e58c..143deb9028f0 100644 --- a/processing/src/test/java/io/druid/query/groupby/orderby/TopNSequenceTest.java +++ b/processing/src/test/java/io/druid/query/groupby/orderby/TopNSequenceTest.java @@ -56,26 +56,26 @@ public class TopNSequenceTest public static Collection makeTestData() { Object[][] data = new Object[][] { - { ASC, RAW_ASC, RAW_ASC.size() - 2}, - { ASC, RAW_ASC, RAW_ASC.size()}, - { ASC, RAW_ASC, RAW_ASC.size() + 2}, - { ASC, RAW_ASC, 0}, - { ASC, SINGLE, 0}, - { ASC, SINGLE, 1}, - { ASC, SINGLE, 2}, - { ASC, SINGLE, 3}, - { ASC, EMPTY, 0}, - { ASC, EMPTY, 1}, - { DESC, RAW_DESC, RAW_DESC.size() - 2}, - { DESC, RAW_DESC, RAW_DESC.size()}, - { DESC, RAW_DESC, RAW_DESC.size() + 2}, - { DESC, RAW_DESC, 0}, - { DESC, RAW_DESC, 0}, - { DESC, SINGLE, 1}, - { DESC, SINGLE, 2}, - { DESC, SINGLE, 3}, - { DESC, EMPTY, 0}, - { DESC, EMPTY, 1}, + {ASC, RAW_ASC, RAW_ASC.size() - 2}, + {ASC, RAW_ASC, RAW_ASC.size()}, + {ASC, RAW_ASC, RAW_ASC.size() + 2}, + {ASC, RAW_ASC, 0}, + {ASC, SINGLE, 0}, + {ASC, SINGLE, 1}, + {ASC, SINGLE, 2}, + {ASC, SINGLE, 3}, + {ASC, EMPTY, 0}, + {ASC, EMPTY, 1}, + {DESC, RAW_DESC, RAW_DESC.size() - 2}, + {DESC, RAW_DESC, RAW_DESC.size()}, + {DESC, RAW_DESC, RAW_DESC.size() + 2}, + {DESC, RAW_DESC, 0}, + {DESC, RAW_DESC, 0}, + {DESC, SINGLE, 1}, + {DESC, SINGLE, 2}, + {DESC, SINGLE, 3}, + {DESC, EMPTY, 0}, + {DESC, EMPTY, 1}, }; return Arrays.asList(data); diff --git a/processing/src/test/java/io/druid/query/ordering/StringComparatorsTest.java b/processing/src/test/java/io/druid/query/ordering/StringComparatorsTest.java index 0c6bc49ba4aa..750e26b96e22 100644 --- a/processing/src/test/java/io/druid/query/ordering/StringComparatorsTest.java +++ b/processing/src/test/java/io/druid/query/ordering/StringComparatorsTest.java @@ -150,12 +150,13 @@ public void testLexicographicComparatorSerdeTest() throws IOException String jsonSpec = jsonMapper.writeValueAsString(StringComparators.LEXICOGRAPHIC); Assert.assertEquals(expectJsonSpec, jsonSpec); - Assert.assertEquals(StringComparators.LEXICOGRAPHIC - , jsonMapper.readValue(expectJsonSpec, StringComparator.class)); + Assert.assertEquals(StringComparators.LEXICOGRAPHIC, jsonMapper.readValue(expectJsonSpec, StringComparator.class)); String makeFromJsonSpec = "\"lexicographic\""; - Assert.assertEquals(StringComparators.LEXICOGRAPHIC - , jsonMapper.readValue(makeFromJsonSpec, StringComparator.class)); + Assert.assertEquals( + StringComparators.LEXICOGRAPHIC, + jsonMapper.readValue(makeFromJsonSpec, StringComparator.class) + ); } @Test @@ -166,12 +167,10 @@ public void testAlphanumericComparatorSerdeTest() throws IOException String jsonSpec = jsonMapper.writeValueAsString(StringComparators.ALPHANUMERIC); Assert.assertEquals(expectJsonSpec, jsonSpec); - Assert.assertEquals(StringComparators.ALPHANUMERIC - , jsonMapper.readValue(expectJsonSpec, StringComparator.class)); + Assert.assertEquals(StringComparators.ALPHANUMERIC, jsonMapper.readValue(expectJsonSpec, StringComparator.class)); String makeFromJsonSpec = "\"alphanumeric\""; - Assert.assertEquals(StringComparators.ALPHANUMERIC - , jsonMapper.readValue(makeFromJsonSpec, StringComparator.class)); + Assert.assertEquals(StringComparators.ALPHANUMERIC, jsonMapper.readValue(makeFromJsonSpec, StringComparator.class)); } @Test @@ -182,12 +181,10 @@ public void testStrlenComparatorSerdeTest() throws IOException String jsonSpec = jsonMapper.writeValueAsString(StringComparators.STRLEN); Assert.assertEquals(expectJsonSpec, jsonSpec); - Assert.assertEquals(StringComparators.STRLEN - , jsonMapper.readValue(expectJsonSpec, StringComparator.class)); + Assert.assertEquals(StringComparators.STRLEN, jsonMapper.readValue(expectJsonSpec, StringComparator.class)); String makeFromJsonSpec = "\"strlen\""; - Assert.assertEquals(StringComparators.STRLEN - , jsonMapper.readValue(makeFromJsonSpec, StringComparator.class)); + Assert.assertEquals(StringComparators.STRLEN, jsonMapper.readValue(makeFromJsonSpec, StringComparator.class)); } @Test @@ -198,15 +195,12 @@ public void testNumericComparatorSerdeTest() throws IOException String jsonSpec = jsonMapper.writeValueAsString(StringComparators.NUMERIC); Assert.assertEquals(expectJsonSpec, jsonSpec); - Assert.assertEquals(StringComparators.NUMERIC - , jsonMapper.readValue(expectJsonSpec, StringComparator.class)); + Assert.assertEquals(StringComparators.NUMERIC, jsonMapper.readValue(expectJsonSpec, StringComparator.class)); String makeFromJsonSpec = "\"numeric\""; - Assert.assertEquals(StringComparators.NUMERIC - , jsonMapper.readValue(makeFromJsonSpec, StringComparator.class)); + Assert.assertEquals(StringComparators.NUMERIC, jsonMapper.readValue(makeFromJsonSpec, StringComparator.class)); makeFromJsonSpec = "\"NuMeRiC\""; - Assert.assertEquals(StringComparators.NUMERIC - , jsonMapper.readValue(makeFromJsonSpec, StringComparator.class)); + Assert.assertEquals(StringComparators.NUMERIC, jsonMapper.readValue(makeFromJsonSpec, StringComparator.class)); } } diff --git a/processing/src/test/java/io/druid/query/select/SelectQueryRunnerTest.java b/processing/src/test/java/io/druid/query/select/SelectQueryRunnerTest.java index 02f9b2499f86..4c6a4622261f 100644 --- a/processing/src/test/java/io/druid/query/select/SelectQueryRunnerTest.java +++ b/processing/src/test/java/io/druid/query/select/SelectQueryRunnerTest.java @@ -572,7 +572,7 @@ public void testSelectWithFilterLookupExtractionFn() { Map extractionMap = new HashMap<>(); - extractionMap.put("total_market","replaced"); + extractionMap.put("total_market", "replaced"); MapLookupExtractor mapLookupExtractor = new MapLookupExtractor(extractionMap, false); LookupExtractionFn lookupExtractionFn = new LookupExtractionFn(mapLookupExtractor, false, null, true, true); SelectQuery query = newTestQuery() @@ -588,8 +588,9 @@ public void testSelectWithFilterLookupExtractionFn() Lists.>newArrayList() ); Iterable> resultsOptimize = Sequences.toList( - toolChest.postMergeQueryDecoration(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner))). - run(query, Maps.newHashMap()), Lists.>newArrayList() + toolChest + .postMergeQueryDecoration(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner))) + .run(query, Maps.newHashMap()), Lists.>newArrayList() ); final List>> events = toEvents( diff --git a/processing/src/test/java/io/druid/query/timeboundary/TimeBoundaryQueryRunnerTest.java b/processing/src/test/java/io/druid/query/timeboundary/TimeBoundaryQueryRunnerTest.java index 1cc0829d45ce..bffcb69c19b6 100644 --- a/processing/src/test/java/io/druid/query/timeboundary/TimeBoundaryQueryRunnerTest.java +++ b/processing/src/test/java/io/druid/query/timeboundary/TimeBoundaryQueryRunnerTest.java @@ -62,7 +62,7 @@ @RunWith(Parameterized.class) public class TimeBoundaryQueryRunnerTest { - @Parameterized.Parameters(name="{0}") + @Parameterized.Parameters(name = "{0}") public static Iterable constructorFeeder() throws IOException { return QueryRunnerTestHelper.transformToConstructionFeeder( @@ -173,7 +173,7 @@ public void testFilteredTimeBoundaryQuery() throws IOException .filters("quality", "automotive") .build(); Assert.assertTrue(timeBoundaryQuery.hasFilters()); - HashMap context = new HashMap(); + HashMap context = new HashMap(); Iterable> results = Sequences.toList( customRunner.run(timeBoundaryQuery, context), Lists.>newArrayList() @@ -199,7 +199,7 @@ public void testFilteredTimeBoundaryQueryNoMatches() throws IOException .filters("quality", "foobar") // foobar dimension does not exist .build(); Assert.assertTrue(timeBoundaryQuery.hasFilters()); - HashMap context = new HashMap(); + HashMap context = new HashMap(); Iterable> results = Sequences.toList( customRunner.run(timeBoundaryQuery, context), Lists.>newArrayList() @@ -216,7 +216,7 @@ public void testTimeBoundary() .dataSource("testing") .build(); Assert.assertFalse(timeBoundaryQuery.hasFilters()); - HashMap context = new HashMap(); + HashMap context = new HashMap(); Iterable> results = Sequences.toList( runner.run(timeBoundaryQuery, context), Lists.>newArrayList() diff --git a/processing/src/test/java/io/druid/query/timeseries/TimeSeriesUnionQueryRunnerTest.java b/processing/src/test/java/io/druid/query/timeseries/TimeSeriesUnionQueryRunnerTest.java index b69072cd543b..69f4f635582f 100644 --- a/processing/src/test/java/io/druid/query/timeseries/TimeSeriesUnionQueryRunnerTest.java +++ b/processing/src/test/java/io/druid/query/timeseries/TimeSeriesUnionQueryRunnerTest.java @@ -61,7 +61,7 @@ public TimeSeriesUnionQueryRunnerTest( this.descending = descending; } - @Parameterized.Parameters(name="{0}:descending={1}") + @Parameterized.Parameters(name = "{0}:descending={1}") public static Iterable constructorFeeder() throws IOException { return QueryRunnerTestHelper.cartesian( diff --git a/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerBonusTest.java b/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerBonusTest.java index aba6b33fa6f0..a4f86fb516ee 100644 --- a/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerBonusTest.java +++ b/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerBonusTest.java @@ -136,7 +136,7 @@ private List> runTimeseriesCount(IncrementalIndex ) .descending(descending) .build(); - HashMap context = new HashMap(); + HashMap context = new HashMap(); return Sequences.toList( runner.run(query, context), Lists.>newArrayList() diff --git a/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java b/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java index 23da3a38416d..a2bf79fd1670 100644 --- a/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java +++ b/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java @@ -82,7 +82,7 @@ public class TimeseriesQueryRunnerTest public static final Map CONTEXT = ImmutableMap.of(); - @Parameterized.Parameters(name="{0}:descending={1}") + @Parameterized.Parameters(name = "{0}:descending={1}") public static Iterable constructorFeeder() throws IOException { return QueryRunnerTestHelper.cartesian( @@ -214,7 +214,7 @@ public void testFullOnTimeseries() result.toString(), Doubles.tryParse(expectedIndex[count]).doubleValue(), value.getDoubleMetric("index").doubleValue(), - value.getDoubleMetric("index").doubleValue() * 1e-6 + value.getDoubleMetric("index").doubleValue() * 1e-6 ); Assert.assertEquals( result.toString(), @@ -2519,7 +2519,7 @@ public void testTimeseriesWithBoundFilter1() public void testTimeSeriesWithSelectionFilterLookupExtractionFn() { Map extractionMap = new HashMap<>(); - extractionMap.put("spot","upfront"); + extractionMap.put("spot", "upfront"); MapLookupExtractor mapLookupExtractor = new MapLookupExtractor(extractionMap, false); LookupExtractionFn lookupExtractionFn = new LookupExtractionFn(mapLookupExtractor, true, null, true, true); diff --git a/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryTest.java b/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryTest.java index 27c7f6231bd0..fd11b249e9d5 100644 --- a/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryTest.java +++ b/processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryTest.java @@ -38,7 +38,7 @@ public class TimeseriesQueryTest { private static final ObjectMapper jsonMapper = TestHelper.getJsonMapper(); - @Parameterized.Parameters(name="descending={0}") + @Parameterized.Parameters(name = "descending={0}") public static Iterable constructorFeeder() throws IOException { return QueryRunnerTestHelper.cartesian(Arrays.asList(false, true)); diff --git a/processing/src/test/java/io/druid/query/topn/TopNQueryRunnerTest.java b/processing/src/test/java/io/druid/query/topn/TopNQueryRunnerTest.java index 62c523a7fb7c..ba30867c4a95 100644 --- a/processing/src/test/java/io/druid/query/topn/TopNQueryRunnerTest.java +++ b/processing/src/test/java/io/druid/query/topn/TopNQueryRunnerTest.java @@ -115,7 +115,7 @@ @RunWith(Parameterized.class) public class TopNQueryRunnerTest { - @Parameterized.Parameters(name="{0}") + @Parameterized.Parameters(name = "{0}") public static Iterable constructorFeeder() throws IOException { List>> retVal = queryRunners(); @@ -3516,8 +3516,8 @@ public void testTopNQueryCardinalityAggregatorWithExtractionFn() .threshold(10) .intervals(QueryRunnerTestHelper.firstToThird) .aggregators(duplicateAggregators( - new CardinalityAggregatorFactory("numVals", aggregatorDimensionSpecs,false), - new CardinalityAggregatorFactory("numVals1",aggregatorDimensionSpecs,false) + new CardinalityAggregatorFactory("numVals", aggregatorDimensionSpecs, false), + new CardinalityAggregatorFactory("numVals1", aggregatorDimensionSpecs, false) )) .build(); @@ -4216,7 +4216,7 @@ private Sequence> runWithPreMergeAndMerge(TopNQuery quer public void testTopNWithExtractionFilterNoExistingValue() { Map extractionMap = new HashMap<>(); - extractionMap.put("","NULL"); + extractionMap.put("", "NULL"); MapLookupExtractor mapLookupExtractor = new MapLookupExtractor(extractionMap, false); LookupExtractionFn lookupExtractionFn = new LookupExtractionFn(mapLookupExtractor, false, null, true, true); diff --git a/processing/src/test/java/io/druid/query/topn/TopNUnionQueryTest.java b/processing/src/test/java/io/druid/query/topn/TopNUnionQueryTest.java index a9ebfa0c46c2..c4f3b00e6951 100644 --- a/processing/src/test/java/io/druid/query/topn/TopNUnionQueryTest.java +++ b/processing/src/test/java/io/druid/query/topn/TopNUnionQueryTest.java @@ -57,7 +57,7 @@ public TopNUnionQueryTest( this.runner = runner; } - @Parameterized.Parameters(name="{0}") + @Parameterized.Parameters(name = "{0}") public static Iterable constructorFeeder() throws IOException { return QueryRunnerTestHelper.cartesian( @@ -179,7 +179,7 @@ public void testTopNUnionQuery() ) ) ); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } diff --git a/processing/src/test/java/io/druid/segment/AppendTest.java b/processing/src/test/java/io/druid/segment/AppendTest.java index dbd72079d766..f814d494dd9e 100644 --- a/processing/src/test/java/io/druid/segment/AppendTest.java +++ b/processing/src/test/java/io/druid/segment/AppendTest.java @@ -181,7 +181,7 @@ public void testTimeBoundary() .dataSource(dataSource) .build(); QueryRunner runner = TestQueryRunners.makeTimeBoundaryQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -206,7 +206,7 @@ public void testTimeBoundary2() .dataSource(dataSource) .build(); QueryRunner runner = TestQueryRunners.makeTimeBoundaryQueryRunner(segment2); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -231,7 +231,7 @@ public void testTimeSeries() TimeseriesQuery query = makeTimeseriesQuery(); QueryRunner runner = TestQueryRunners.makeTimeSeriesQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -256,7 +256,7 @@ public void testTimeSeries2() TimeseriesQuery query = makeTimeseriesQuery(); QueryRunner runner = TestQueryRunners.makeTimeSeriesQueryRunner(segment2); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -281,7 +281,7 @@ public void testFilteredTimeSeries() TimeseriesQuery query = makeFilteredTimeseriesQuery(); QueryRunner runner = TestQueryRunners.makeTimeSeriesQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -306,7 +306,7 @@ public void testFilteredTimeSeries2() TimeseriesQuery query = makeFilteredTimeseriesQuery(); QueryRunner runner = TestQueryRunners.makeTimeSeriesQueryRunner(segment2); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -352,7 +352,7 @@ public void testTopNSeries() TopNQuery query = makeTopNQuery(); QueryRunner runner = TestQueryRunners.makeTopNQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -398,7 +398,7 @@ public void testTopNSeries2() TopNQuery query = makeTopNQuery(); QueryRunner runner = TestQueryRunners.makeTopNQueryRunner(segment2); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -426,7 +426,7 @@ public void testFilteredTopNSeries() TopNQuery query = makeFilteredTopNQuery(); QueryRunner runner = TestQueryRunners.makeTopNQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -444,7 +444,7 @@ public void testFilteredTopNSeries2() TopNQuery query = makeFilteredTopNQuery(); QueryRunner runner = TestQueryRunners.makeTopNQueryRunner(segment2); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -467,7 +467,7 @@ public void testSearch() SearchQuery query = makeSearchQuery(); QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -489,7 +489,7 @@ public void testSearchWithOverlap() SearchQuery query = makeSearchQuery(); QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment2); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -510,7 +510,7 @@ public void testFilteredSearch() SearchQuery query = makeFilteredSearchQuery(); QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -532,7 +532,7 @@ public void testFilteredSearch2() SearchQuery query = makeFilteredSearchQuery(); QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment2); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -574,7 +574,7 @@ public void testRowFiltering() .postAggregators(Arrays.asList(addRowsIndexConstant)) .build(); QueryRunner runner = TestQueryRunners.makeTimeSeriesQueryRunner(segment3); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } diff --git a/processing/src/test/java/io/druid/segment/IndexMergerTestBase.java b/processing/src/test/java/io/druid/segment/IndexMergerTestBase.java index 0313116efb1f..c6142afb3bbd 100644 --- a/processing/src/test/java/io/druid/segment/IndexMergerTestBase.java +++ b/processing/src/test/java/io/druid/segment/IndexMergerTestBase.java @@ -2158,7 +2158,7 @@ public void testPersistNullColumnSkipping() throws Exception SmooshedFileMapper sfm = closer.closeLater(SmooshedFileMapper.load(tempDir)); List expectedFilenames = Arrays.asList("A", "__time", "d1", "index.drd", "metadata.drd"); - List actualFilenames = new ArrayList<>(sfm.getInternalFilenames()); + List actualFilenames = new ArrayList<>(sfm.getInternalFilenames()); Collections.sort(expectedFilenames); Collections.sort(actualFilenames); Assert.assertEquals(expectedFilenames, actualFilenames); diff --git a/processing/src/test/java/io/druid/segment/SchemalessTestFullTest.java b/processing/src/test/java/io/druid/segment/SchemalessTestFullTest.java index a24b0eb92b29..608966f37ddb 100644 --- a/processing/src/test/java/io/druid/segment/SchemalessTestFullTest.java +++ b/processing/src/test/java/io/druid/segment/SchemalessTestFullTest.java @@ -1144,10 +1144,7 @@ public void testMultiDimensionalValues() ); runTests( - new QueryableIndexSegment( - null, SchemalessIndexTest.getMergedIncrementalIndex(new int[]{6, 7, 8}) - ) - , + new QueryableIndexSegment(null, SchemalessIndexTest.getMergedIncrementalIndex(new int[]{6, 7, 8})), expectedTimeseriesResults, expectedFilteredTimeSeriesResults, expectedTopNResults, diff --git a/processing/src/test/java/io/druid/segment/SchemalessTestSimpleTest.java b/processing/src/test/java/io/druid/segment/SchemalessTestSimpleTest.java index 9f9507421292..f6e8c3377b2b 100644 --- a/processing/src/test/java/io/druid/segment/SchemalessTestSimpleTest.java +++ b/processing/src/test/java/io/druid/segment/SchemalessTestSimpleTest.java @@ -166,7 +166,7 @@ public void testFullOnTimeseries() ) ); QueryRunner runner = TestQueryRunners.makeTimeSeriesQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -240,7 +240,7 @@ public void testFullOnTopN() ); QueryRunner runner = TestQueryRunners.makeTopNQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -269,7 +269,7 @@ public void testFullOnSearch() ); QueryRunner runner = TestQueryRunners.makeSearchQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } @@ -295,7 +295,7 @@ public void testTimeBoundary() ); QueryRunner runner = TestQueryRunners.makeTimeBoundaryQueryRunner(segment); - HashMap context = new HashMap(); + HashMap context = new HashMap(); TestHelper.assertExpectedResults(expectedResults, runner.run(query, context)); } } diff --git a/processing/src/test/java/io/druid/segment/TestIndex.java b/processing/src/test/java/io/druid/segment/TestIndex.java index fa5e851df379..c59c89f8f5ce 100644 --- a/processing/src/test/java/io/druid/segment/TestIndex.java +++ b/processing/src/test/java/io/druid/segment/TestIndex.java @@ -308,8 +308,8 @@ public static IncrementalIndex loadIncrementalIndex( Arrays.asList(COLUMNS), false, 0 - ) - , "utf8" + ), + "utf8" ); return loadIncrementalIndex(retVal, source, parser); } diff --git a/processing/src/test/java/io/druid/segment/data/BenchmarkIndexibleWrites.java b/processing/src/test/java/io/druid/segment/data/BenchmarkIndexibleWrites.java index 73d542ab2b7f..d780bcc460f8 100644 --- a/processing/src/test/java/io/druid/segment/data/BenchmarkIndexibleWrites.java +++ b/processing/src/test/java/io/druid/segment/data/BenchmarkIndexibleWrites.java @@ -164,7 +164,7 @@ private void ensureCapacity(int capacity) // Any task who sees a resizeCount which changes between the start and stop of their critical section // should also try again resizeCount.incrementAndGet(); - reference.set(Arrays.copyOf(reference.get(), reference.get().length<<1)); + reference.set(Arrays.copyOf(reference.get(), reference.get().length << 1)); resizeCount.incrementAndGet(); } } @@ -172,8 +172,8 @@ private void ensureCapacity(int capacity) } private final ConcurrentIndexible concurrentIndexible; - private final Integer concurrentThreads = 1<<2; - private final Integer totalIndexSize = 1<<20; + private final Integer concurrentThreads = 1 << 2; + private final Integer totalIndexSize = 1 << 20; @BenchmarkOptions(warmupRounds = 100, benchmarkRounds = 100, clock = Clock.REAL_TIME, callgc = true) @Ignore @Test @@ -219,7 +219,7 @@ public void run() } Futures.allAsList(futures).get(); Assert.assertTrue(StringUtils.format("Index too small %d, expected %d across %d loops", index.get(), totalIndexSize, loops), index.get() >= totalIndexSize); - for(int i = 0; i < index.get(); ++i){ + for (int i = 0; i < index.get(); ++i) { Assert.assertEquals(i, concurrentIndexible.get(i).intValue()); } concurrentIndexible.clear(); @@ -272,7 +272,7 @@ public void run() throw Throwables.propagate(e); } final Random rndGen = new Random(); - while(!done.get()){ + while (!done.get()) { Integer idx = rndGen.nextInt(queryableIndex.get() + 1); Assert.assertEquals(idx, concurrentIndexible.get(idx)); } @@ -298,7 +298,7 @@ public void run() executorService.shutdown(); Assert.assertTrue(StringUtils.format("Index too small %d, expected %d across %d loops", index.get(), totalIndexSize, loops), index.get() >= totalIndexSize); - for(int i = 0; i < index.get(); ++i){ + for (int i = 0; i < index.get(); ++i) { Assert.assertEquals(i, concurrentIndexible.get(i).intValue()); } concurrentIndexible.clear(); diff --git a/processing/src/test/java/io/druid/segment/data/BitmapSerdeFactoryTest.java b/processing/src/test/java/io/druid/segment/data/BitmapSerdeFactoryTest.java index adc26d703318..a3de4f534ef1 100644 --- a/processing/src/test/java/io/druid/segment/data/BitmapSerdeFactoryTest.java +++ b/processing/src/test/java/io/druid/segment/data/BitmapSerdeFactoryTest.java @@ -45,14 +45,14 @@ public void testDeserialization() throws Exception ObjectMapper mapper = new DefaultObjectMapper(); final BitmapSerdeFactory roaringFactory = mapper.readValue("{\"type\":\"roaring\"}", BitmapSerdeFactory.class); Assert.assertTrue(roaringFactory instanceof RoaringBitmapSerdeFactory); - Assert.assertTrue(((RoaringBitmapSerdeFactory)roaringFactory).getCompressRunOnSerialization()); + Assert.assertTrue(((RoaringBitmapSerdeFactory) roaringFactory).getCompressRunOnSerialization()); final BitmapSerdeFactory compressingRoaringFactory = mapper.readValue( "{\"type\":\"roaring\", \"compressRunOnSerialization\":false}", BitmapSerdeFactory.class ); Assert.assertTrue(compressingRoaringFactory instanceof RoaringBitmapSerdeFactory); - Assert.assertFalse(((RoaringBitmapSerdeFactory)compressingRoaringFactory).getCompressRunOnSerialization()); + Assert.assertFalse(((RoaringBitmapSerdeFactory) compressingRoaringFactory).getCompressRunOnSerialization()); Assert.assertTrue(mapper.readValue("{\"type\":\"concise\"}", BitmapSerdeFactory.class) instanceof ConciseBitmapSerdeFactory); Assert.assertTrue(mapper.readValue("{\"type\":\"BitmapSerde$SomeRandomClass\"}", BitmapSerdeFactory.class) instanceof ConciseBitmapSerdeFactory); diff --git a/processing/src/test/java/io/druid/segment/data/CompressedVSizeIntsIndexedSupplierTest.java b/processing/src/test/java/io/druid/segment/data/CompressedVSizeIntsIndexedSupplierTest.java index 976c34d0460c..d33d7e48383b 100644 --- a/processing/src/test/java/io/druid/segment/data/CompressedVSizeIntsIndexedSupplierTest.java +++ b/processing/src/test/java/io/druid/segment/data/CompressedVSizeIntsIndexedSupplierTest.java @@ -83,7 +83,7 @@ public Object[] apply(List input) ); } - private static final int[] MAX_VALUES = new int[] { 0xFF, 0xFFFF, 0xFFFFFF, 0x0FFFFFFF }; + private static final int[] MAX_VALUES = new int[] {0xFF, 0xFFFF, 0xFFFFFF, 0x0FFFFFFF}; public CompressedVSizeIntsIndexedSupplierTest(CompressedObjectStrategy.CompressionStrategy compressionStrategy, ByteOrder byteOrder) { @@ -157,7 +157,7 @@ private void setupLargeChunks(final int chunkSize, final int totalSize, final in { vals = new int[totalSize]; Random rand = new Random(0); - for(int i = 0; i < vals.length; ++i) { + for (int i = 0; i < vals.length; ++i) { // VSizeIndexed only allows positive values vals[i] = rand.nextInt(maxValue); } @@ -208,7 +208,7 @@ public void testLargeChunks() throws Exception @Test public void testChunkTooBig() throws Exception { - for(int maxValue : MAX_VALUES) { + for (int maxValue : MAX_VALUES) { final int maxChunkSize = CompressedVSizeIntsIndexedSupplier.maxIntsInBufferForValue(maxValue); try { setupLargeChunks(maxChunkSize + 1, 10 * (maxChunkSize + 1), maxValue); diff --git a/processing/src/test/java/io/druid/segment/filter/ColumnComparisonFilterTest.java b/processing/src/test/java/io/druid/segment/filter/ColumnComparisonFilterTest.java index e55ec45224a9..9b14dac1fab5 100644 --- a/processing/src/test/java/io/druid/segment/filter/ColumnComparisonFilterTest.java +++ b/processing/src/test/java/io/druid/segment/filter/ColumnComparisonFilterTest.java @@ -100,15 +100,15 @@ public void testColumnsWithoutNulls() assertFilterMatches(new ColumnComparisonDimFilter(ImmutableList.of( DefaultDimensionSpec.of("dim0"), DefaultDimensionSpec.of("dim1") - )), ImmutableList.of("2","5","8")); + )), ImmutableList.of("2", "5", "8")); assertFilterMatches(new ColumnComparisonDimFilter(ImmutableList.of( DefaultDimensionSpec.of("dim0"), DefaultDimensionSpec.of("dim2") - )), ImmutableList.of("3","4","5")); + )), ImmutableList.of("3", "4", "5")); assertFilterMatches(new ColumnComparisonDimFilter(ImmutableList.of( DefaultDimensionSpec.of("dim1"), DefaultDimensionSpec.of("dim2") - )), ImmutableList.of("5","9")); + )), ImmutableList.of("5", "9")); assertFilterMatches(new ColumnComparisonDimFilter(ImmutableList.of( DefaultDimensionSpec.of("dim0"), DefaultDimensionSpec.of("dim1"), @@ -122,7 +122,7 @@ public void testMissingColumnNotSpecifiedInDimensionList() assertFilterMatches(new ColumnComparisonDimFilter(ImmutableList.of( DefaultDimensionSpec.of("dim6"), DefaultDimensionSpec.of("dim7") - )), ImmutableList.of("0","1","2","3","4","5","6","7","8","9")); + )), ImmutableList.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")); assertFilterMatches(new ColumnComparisonDimFilter(ImmutableList.of( DefaultDimensionSpec.of("dim1"), DefaultDimensionSpec.of("dim6") @@ -130,7 +130,7 @@ public void testMissingColumnNotSpecifiedInDimensionList() assertFilterMatches(new ColumnComparisonDimFilter(ImmutableList.of( DefaultDimensionSpec.of("dim2"), DefaultDimensionSpec.of("dim6") - )), ImmutableList.of("1","2","6","7","8")); + )), ImmutableList.of("1", "2", "6", "7", "8")); } @Test @@ -145,6 +145,6 @@ public void testSelectorWithLookupExtractionFn() assertFilterMatches(new ColumnComparisonDimFilter(ImmutableList.of( new ExtractionDimensionSpec("dim0", "dim0", lookupFn), new ExtractionDimensionSpec("dim1", "dim1", lookupFn) - )), ImmutableList.of("2","5","7","8")); + )), ImmutableList.of("2", "5", "7", "8")); } } diff --git a/processing/src/test/java/io/druid/segment/filter/InFilterTest.java b/processing/src/test/java/io/druid/segment/filter/InFilterTest.java index 98d942ba6008..54a136569deb 100644 --- a/processing/src/test/java/io/druid/segment/filter/InFilterTest.java +++ b/processing/src/test/java/io/druid/segment/filter/InFilterTest.java @@ -145,7 +145,7 @@ public void testMultiValueStringColumn() ); assertFilterMatches( - toInFilter("dim2", "", (String)null), + toInFilter("dim2", "", (String) null), ImmutableList.of("b", "c", "f") ); @@ -176,7 +176,7 @@ public void testMultiValueStringColumn() public void testMissingColumn() { assertFilterMatches( - toInFilter("dim3", null, (String)null), + toInFilter("dim3", null, (String) null), ImmutableList.of("a", "b", "c", "d", "e", "f") ); diff --git a/processing/src/test/java/io/druid/segment/filter/RegexFilterTest.java b/processing/src/test/java/io/druid/segment/filter/RegexFilterTest.java index 25e4363fdd58..5b177928c86c 100644 --- a/processing/src/test/java/io/druid/segment/filter/RegexFilterTest.java +++ b/processing/src/test/java/io/druid/segment/filter/RegexFilterTest.java @@ -145,13 +145,13 @@ public void testRegexWithExtractionFn() assertFilterMatches(new RegexDimFilter("dim1", ".*ANYMORE", changeNullFn), ImmutableList.of("0")); assertFilterMatches(new RegexDimFilter("dim1", "ab.*", changeNullFn), ImmutableList.of("4", "5")); - assertFilterMatches(new RegexDimFilter("dim2", ".*ANYMORE", changeNullFn), ImmutableList.of("1", "2", "5")); - assertFilterMatches(new RegexDimFilter("dim2", "a.*", changeNullFn), ImmutableList.of("0", "3")); + assertFilterMatches(new RegexDimFilter("dim2", ".*ANYMORE", changeNullFn), ImmutableList.of("1", "2", "5")); + assertFilterMatches(new RegexDimFilter("dim2", "a.*", changeNullFn), ImmutableList.of("0", "3")); - assertFilterMatches(new RegexDimFilter("dim3", ".*ANYMORE", changeNullFn), ImmutableList.of("0", "1", "2", "3", "4", "5")); - assertFilterMatches(new RegexDimFilter("dim3", "a.*", changeNullFn), ImmutableList.of()); + assertFilterMatches(new RegexDimFilter("dim3", ".*ANYMORE", changeNullFn), ImmutableList.of("0", "1", "2", "3", "4", "5")); + assertFilterMatches(new RegexDimFilter("dim3", "a.*", changeNullFn), ImmutableList.of()); - assertFilterMatches(new RegexDimFilter("dim4", ".*ANYMORE", changeNullFn), ImmutableList.of("0", "1", "2", "3", "4", "5")); - assertFilterMatches(new RegexDimFilter("dim4", "a.*", changeNullFn), ImmutableList.of()); + assertFilterMatches(new RegexDimFilter("dim4", ".*ANYMORE", changeNullFn), ImmutableList.of("0", "1", "2", "3", "4", "5")); + assertFilterMatches(new RegexDimFilter("dim4", "a.*", changeNullFn), ImmutableList.of()); } } diff --git a/processing/src/test/java/io/druid/segment/filter/SearchQueryFilterTest.java b/processing/src/test/java/io/druid/segment/filter/SearchQueryFilterTest.java index 763995eb5f41..d3c24c5f6aad 100644 --- a/processing/src/test/java/io/druid/segment/filter/SearchQueryFilterTest.java +++ b/processing/src/test/java/io/druid/segment/filter/SearchQueryFilterTest.java @@ -154,13 +154,13 @@ public void testSearchQueryWithExtractionFn() assertFilterMatches(new SearchQueryDimFilter("dim1", specForValue("ANYMORE"), changeNullFn), ImmutableList.of("0")); assertFilterMatches(new SearchQueryDimFilter("dim1", specForValue("ab"), changeNullFn), ImmutableList.of("4", "5")); - assertFilterMatches(new SearchQueryDimFilter("dim2", specForValue("ANYMORE"), changeNullFn), ImmutableList.of("1", "2", "5")); - assertFilterMatches(new SearchQueryDimFilter("dim2", specForValue("a"), changeNullFn), ImmutableList.of("0", "3")); + assertFilterMatches(new SearchQueryDimFilter("dim2", specForValue("ANYMORE"), changeNullFn), ImmutableList.of("1", "2", "5")); + assertFilterMatches(new SearchQueryDimFilter("dim2", specForValue("a"), changeNullFn), ImmutableList.of("0", "3")); - assertFilterMatches(new SearchQueryDimFilter("dim3", specForValue("ANYMORE"), changeNullFn), ImmutableList.of("0", "1", "2", "3", "4", "5")); - assertFilterMatches(new SearchQueryDimFilter("dim3", specForValue("a"), changeNullFn), ImmutableList.of()); + assertFilterMatches(new SearchQueryDimFilter("dim3", specForValue("ANYMORE"), changeNullFn), ImmutableList.of("0", "1", "2", "3", "4", "5")); + assertFilterMatches(new SearchQueryDimFilter("dim3", specForValue("a"), changeNullFn), ImmutableList.of()); - assertFilterMatches(new SearchQueryDimFilter("dim4", specForValue("ANYMORE"), changeNullFn), ImmutableList.of("0", "1", "2", "3", "4", "5")); - assertFilterMatches(new SearchQueryDimFilter("dim4", specForValue("a"), changeNullFn), ImmutableList.of()); + assertFilterMatches(new SearchQueryDimFilter("dim4", specForValue("ANYMORE"), changeNullFn), ImmutableList.of("0", "1", "2", "3", "4", "5")); + assertFilterMatches(new SearchQueryDimFilter("dim4", specForValue("a"), changeNullFn), ImmutableList.of()); } } diff --git a/processing/src/test/java/io/druid/segment/filter/TimeFilteringTest.java b/processing/src/test/java/io/druid/segment/filter/TimeFilteringTest.java index 4c11bbac7983..aa0a2d7e6a37 100644 --- a/processing/src/test/java/io/druid/segment/filter/TimeFilteringTest.java +++ b/processing/src/test/java/io/druid/segment/filter/TimeFilteringTest.java @@ -134,7 +134,7 @@ public void testTimeFilterAsLong() // cross the hashing threshold to test hashset implementation, filter on even values List infilterValues = new ArrayList<>(InDimFilter.NUMERIC_HASHING_THRESHOLD * 2); for (int i = 0; i < InDimFilter.NUMERIC_HASHING_THRESHOLD * 2; i++) { - infilterValues.add(String.valueOf(i*2)); + infilterValues.add(String.valueOf(i * 2)); } assertFilterMatches( new InDimFilter(Column.TIME_COLUMN_NAME, infilterValues, null), diff --git a/server/src/main/java/io/druid/client/HttpServerInventoryView.java b/server/src/main/java/io/druid/client/HttpServerInventoryView.java index 7f4d4f60e204..03390f982eaa 100644 --- a/server/src/main/java/io/druid/client/HttpServerInventoryView.java +++ b/server/src/main/java/io/druid/client/HttpServerInventoryView.java @@ -482,7 +482,7 @@ void awaitInitialization() DruidServerHolder updatedHolder(DruidServer server) { synchronized (lock) { - return new DruidServerHolder(server.addDataSegments(druidServer), counter) ; + return new DruidServerHolder(server.addDataSegments(druidServer), counter); } } diff --git a/server/src/main/java/io/druid/client/cache/ByteCountingLRUMap.java b/server/src/main/java/io/druid/client/cache/ByteCountingLRUMap.java index b9a287e11fa8..fb4f072abcd3 100644 --- a/server/src/main/java/io/druid/client/cache/ByteCountingLRUMap.java +++ b/server/src/main/java/io/druid/client/cache/ByteCountingLRUMap.java @@ -115,8 +115,8 @@ public byte[] put(ByteBuffer key, byte[] value) public byte[] remove(Object key) { byte[] value = super.remove(key); - if(value != null) { - long delta = -((ByteBuffer)key).remaining() - value.length; + if (value != null) { + long delta = -((ByteBuffer) key).remaining() - value.length; numBytes.addAndGet(delta); } return value; diff --git a/server/src/main/java/io/druid/client/cache/HybridCache.java b/server/src/main/java/io/druid/client/cache/HybridCache.java index d7ca846bea8c..ce9ff9c3c5cd 100644 --- a/server/src/main/java/io/druid/client/cache/HybridCache.java +++ b/server/src/main/java/io/druid/client/cache/HybridCache.java @@ -47,7 +47,7 @@ public byte[] get(NamedKey key) byte[] res = level1.get(key); if (res == null) { res = level2.get(key); - if(res != null) { + if (res != null) { level1.put(key, res); hitCount.incrementAndGet(); return res; @@ -78,7 +78,7 @@ public Map getBulk(Iterable keys) if (!remaining.isEmpty()) { Map res2 = level2.getBulk(remaining); - for(Map.Entry entry : res2.entrySet()) { + for (Map.Entry entry : res2.entrySet()) { level1.put(entry.getKey(), entry.getValue()); } diff --git a/server/src/main/java/io/druid/client/cache/LZ4Transcoder.java b/server/src/main/java/io/druid/client/cache/LZ4Transcoder.java index e7547faad934..607be0940211 100644 --- a/server/src/main/java/io/druid/client/cache/LZ4Transcoder.java +++ b/server/src/main/java/io/druid/client/cache/LZ4Transcoder.java @@ -66,7 +66,7 @@ protected byte[] compress(byte[] in) protected byte[] decompress(byte[] in) { byte[] out = null; - if(in != null) { + if (in != null) { LZ4FastDecompressor decompressor = lz4Factory.fastDecompressor(); int size = ByteBuffer.wrap(in).getInt(); diff --git a/server/src/main/java/io/druid/client/cache/MemcacheClientPool.java b/server/src/main/java/io/druid/client/cache/MemcacheClientPool.java index 440d9557c106..3dca8c42cfec 100644 --- a/server/src/main/java/io/druid/client/cache/MemcacheClientPool.java +++ b/server/src/main/java/io/druid/client/cache/MemcacheClientPool.java @@ -64,7 +64,7 @@ public static long leakedClients() CountingHolder[] connections = new CountingHolder[capacity]; // eagerly instantiate all items in the pool - for(int i = 0; i < capacity; ++i) { + for (int i = 0; i < capacity; ++i) { connections[i] = new CountingHolder(generator.get()); } // Assign the final field after filling the array to ensure visibility of elements diff --git a/server/src/main/java/io/druid/client/cache/MemcachedCache.java b/server/src/main/java/io/druid/client/cache/MemcachedCache.java index e0196b6db4ac..7cd6e10223d6 100644 --- a/server/src/main/java/io/druid/client/cache/MemcachedCache.java +++ b/server/src/main/java/io/druid/client/cache/MemcachedCache.java @@ -600,8 +600,7 @@ public void close(String namespace) MemcachedClientIF.MAX_KEY_LENGTH - 40 // length of namespace hash - 40 // length of key hash - - 2 // length of separators - ; + - 2; // length of separators private static String computeKeyHash(String memcachedPrefix, NamedKey key) { diff --git a/server/src/main/java/io/druid/curator/discovery/ServerDiscoverySelector.java b/server/src/main/java/io/druid/curator/discovery/ServerDiscoverySelector.java index 51ac2dfd16d7..eb356271a271 100644 --- a/server/src/main/java/io/druid/curator/discovery/ServerDiscoverySelector.java +++ b/server/src/main/java/io/druid/curator/discovery/ServerDiscoverySelector.java @@ -54,7 +54,7 @@ public ServerDiscoverySelector(ServiceProvider serviceProvider) public Server apply(final ServiceInstance instance) { Preconditions.checkState( - instance.getPort() >= 0 || instance.getSslPort() >= 0, + instance.getPort() >= 0 || instance.getSslPort() >= 0, "WTH?! Both port and sslPort not set" ); final int port = instance.getSslPort() >= 0 ? instance.getSslPort() : instance.getPort(); diff --git a/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java b/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java index eab70c20bd67..5b66d6917a12 100644 --- a/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java +++ b/server/src/main/java/io/druid/curator/inventory/CuratorInventoryManager.java @@ -231,7 +231,7 @@ public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) th final ChildData child = event.getData(); byte[] data = getZkDataForNode(child.getPath()); - if(data == null) { + if (data == null) { log.info("Ignoring event: Type - %s , Path - %s , Version - %s", event.getType(), child.getPath(), diff --git a/server/src/main/java/io/druid/initialization/Log4jShutterDownerModule.java b/server/src/main/java/io/druid/initialization/Log4jShutterDownerModule.java index 1588f1d1268f..bc21ce7de6fb 100644 --- a/server/src/main/java/io/druid/initialization/Log4jShutterDownerModule.java +++ b/server/src/main/java/io/druid/initialization/Log4jShutterDownerModule.java @@ -48,7 +48,7 @@ public void configure(Binder binder) try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if(loader == null) { + if (loader == null) { loader = getClass().getClassLoader(); } // Reflection to try and allow non Log4j2 stuff to run. This acts as a gateway to stop errors in the next few lines diff --git a/server/src/main/java/io/druid/metadata/SQLMetadataStorageActionHandlerFactory.java b/server/src/main/java/io/druid/metadata/SQLMetadataStorageActionHandlerFactory.java index 50037a5f7ef1..b4298de2ccc9 100644 --- a/server/src/main/java/io/druid/metadata/SQLMetadataStorageActionHandlerFactory.java +++ b/server/src/main/java/io/druid/metadata/SQLMetadataStorageActionHandlerFactory.java @@ -41,9 +41,9 @@ public SQLMetadataStorageActionHandlerFactory( } @Override - public MetadataStorageActionHandler create( + public MetadataStorageActionHandler create( final String entryType, - MetadataStorageActionHandlerTypes payloadTypes + MetadataStorageActionHandlerTypes payloadTypes ) { return new SQLMetadataStorageActionHandler<>( diff --git a/server/src/main/java/io/druid/segment/indexing/DataSchema.java b/server/src/main/java/io/druid/segment/indexing/DataSchema.java index 2b111213fff9..eb5f88a52dc2 100644 --- a/server/src/main/java/io/druid/segment/indexing/DataSchema.java +++ b/server/src/main/java/io/druid/segment/indexing/DataSchema.java @@ -103,7 +103,7 @@ public Map getParserMap() @JsonIgnore public InputRowParser getParser() { - if(parser == null) { + if (parser == null) { log.warn("No parser has been specified"); return null; } diff --git a/server/src/main/java/io/druid/segment/realtime/firehose/WikipediaIrcDecoder.java b/server/src/main/java/io/druid/segment/realtime/firehose/WikipediaIrcDecoder.java index e4e3fb19b1ca..132f669725c4 100644 --- a/server/src/main/java/io/druid/segment/realtime/firehose/WikipediaIrcDecoder.java +++ b/server/src/main/java/io/druid/segment/realtime/firehose/WikipediaIrcDecoder.java @@ -110,9 +110,9 @@ private DatabaseReader openDefaultGeoIpDb() return openDefaultGeoIpDb(geoDb); } catch (RuntimeException e) { - log.warn(e.getMessage()+" Attempting to re-download.", e); + log.warn(e.getMessage() + " Attempting to re-download.", e); if (geoDb.exists() && !geoDb.delete()) { - throw new RuntimeException("Could not delete geo db file ["+ geoDb.getAbsolutePath() +"]."); + throw new RuntimeException("Could not delete geo db file [" + geoDb.getAbsolutePath() + "]."); } // local download may be corrupt, will retry once. return openDefaultGeoIpDb(geoDb); @@ -133,7 +133,7 @@ private DatabaseReader openGeoIpDb(File geoDb) return reader; } catch (IOException e) { - throw new RuntimeException("Could not open geo db at ["+ geoDb.getAbsolutePath() +"].", e); + throw new RuntimeException("Could not open geo db at [" + geoDb.getAbsolutePath() + "].", e); } } @@ -156,7 +156,7 @@ private void downloadGeoLiteDbToFile(File geoDb) ); if (!tmpFile.renameTo(geoDb)) { - throw new RuntimeException("Unable to move geo file to ["+geoDb.getAbsolutePath()+"]!"); + throw new RuntimeException("Unable to move geo file to [" + geoDb.getAbsolutePath() + "]!"); } } catch (IOException e) { diff --git a/server/src/main/java/io/druid/server/coordination/DataSegmentChangeRequest.java b/server/src/main/java/io/druid/server/coordination/DataSegmentChangeRequest.java index 9f8150cbea76..56aa26f091e4 100644 --- a/server/src/main/java/io/druid/server/coordination/DataSegmentChangeRequest.java +++ b/server/src/main/java/io/druid/server/coordination/DataSegmentChangeRequest.java @@ -24,11 +24,11 @@ /** */ -@JsonTypeInfo(use= JsonTypeInfo.Id.NAME, property="action") -@JsonSubTypes(value={ - @JsonSubTypes.Type(name="load", value=SegmentChangeRequestLoad.class), - @JsonSubTypes.Type(name="drop", value=SegmentChangeRequestDrop.class), - @JsonSubTypes.Type(name="noop", value=SegmentChangeRequestNoop.class) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "action") +@JsonSubTypes(value = { + @JsonSubTypes.Type(name = "load", value = SegmentChangeRequestLoad.class), + @JsonSubTypes.Type(name = "drop", value = SegmentChangeRequestDrop.class), + @JsonSubTypes.Type(name = "noop", value = SegmentChangeRequestNoop.class) }) public interface DataSegmentChangeRequest { diff --git a/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestHistory.java b/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestHistory.java index 85472c71b761..83ebefddfe5c 100644 --- a/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestHistory.java +++ b/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestHistory.java @@ -341,7 +341,7 @@ E get(int index) { Preconditions.checkArgument(index >= 0 && index < size, "invalid index"); - int bufferIndex = (start-size+index) % buffer.length; + int bufferIndex = (start - size + index) % buffer.length; if (bufferIndex < 0) { bufferIndex += buffer.length; } diff --git a/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestsSnapshot.java b/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestsSnapshot.java index 893e04e474ce..9672c5265cfe 100644 --- a/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestsSnapshot.java +++ b/server/src/main/java/io/druid/server/coordination/SegmentChangeRequestsSnapshot.java @@ -37,7 +37,7 @@ public class SegmentChangeRequestsSnapshot private final String resetCause; //segments requests delta since counter, if resetCounter if false - private final SegmentChangeRequestHistory.Counter counter; + private final SegmentChangeRequestHistory.Counter counter; private final List requests; @JsonCreator diff --git a/server/src/main/java/io/druid/server/coordination/ZkCoordinator.java b/server/src/main/java/io/druid/server/coordination/ZkCoordinator.java index 6286e516b611..4ae8887694eb 100644 --- a/server/src/main/java/io/druid/server/coordination/ZkCoordinator.java +++ b/server/src/main/java/io/druid/server/coordination/ZkCoordinator.java @@ -350,7 +350,7 @@ public void addSegment(DataSegment segment, DataSegmentChangeCallback callback) log.info("Loading segment %s", segment.getIdentifier()); /* The lock below is used to prevent a race condition when the scheduled runnable in removeSegment() starts, - and if(segmentsToDelete.remove(segment)) returns true, in which case historical will start deleting segment + and if (segmentsToDelete.remove(segment)) returns true, in which case historical will start deleting segment files. At that point, it's possible that right after the "if" check, addSegment() is called and actually loads the segment, which makes dropping segment and downloading segment happen at the same time. */ diff --git a/server/src/main/java/io/druid/server/coordination/broker/DruidBroker.java b/server/src/main/java/io/druid/server/coordination/broker/DruidBroker.java index 3a75b0a66589..2c7c9f84e0ed 100644 --- a/server/src/main/java/io/druid/server/coordination/broker/DruidBroker.java +++ b/server/src/main/java/io/druid/server/coordination/broker/DruidBroker.java @@ -72,7 +72,7 @@ public ServerView.CallbackAction segmentViewInitialized() public void start() { synchronized (self) { - if(started) { + if (started) { return; } started = true; diff --git a/server/src/main/java/io/druid/server/coordinator/BalancerStrategyFactory.java b/server/src/main/java/io/druid/server/coordinator/BalancerStrategyFactory.java index 4cf46d95e7d5..011b63f59088 100644 --- a/server/src/main/java/io/druid/server/coordinator/BalancerStrategyFactory.java +++ b/server/src/main/java/io/druid/server/coordinator/BalancerStrategyFactory.java @@ -26,7 +26,7 @@ @JsonSubTypes(value = { @JsonSubTypes.Type(name = "diskNormalized", value = DiskNormalizedCostBalancerStrategyFactory.class), @JsonSubTypes.Type(name = "cost", value = CostBalancerStrategyFactory.class), - @JsonSubTypes.Type(name = "random", value = RandomBalancerStrategyFactory.class), + @JsonSubTypes.Type(name = "random", value = RandomBalancerStrategyFactory.class), }) public interface BalancerStrategyFactory { diff --git a/server/src/main/java/io/druid/server/coordinator/DiskNormalizedCostBalancerStrategy.java b/server/src/main/java/io/druid/server/coordinator/DiskNormalizedCostBalancerStrategy.java index b003c145e3ab..4b7ba2da696d 100644 --- a/server/src/main/java/io/druid/server/coordinator/DiskNormalizedCostBalancerStrategy.java +++ b/server/src/main/java/io/druid/server/coordinator/DiskNormalizedCostBalancerStrategy.java @@ -40,19 +40,19 @@ protected double computeCost( { double cost = super.computeCost(proposalSegment, server, includeCurrentServer); - if(cost == Double.POSITIVE_INFINITY){ + if (cost == Double.POSITIVE_INFINITY) { return cost; } int nSegments = 1; - if(server.getServer().getSegments().size() > 0) { + if (server.getServer().getSegments().size() > 0) { nSegments = server.getServer().getSegments().size(); } - double normalizedCost = cost/nSegments; + double normalizedCost = cost / nSegments; double usageRatio = (double) server.getSizeUsed() / (double) server.getServer().getMaxSize(); - return normalizedCost*usageRatio; + return normalizedCost * usageRatio; } } diff --git a/server/src/main/java/io/druid/server/coordinator/DruidCoordinator.java b/server/src/main/java/io/druid/server/coordinator/DruidCoordinator.java index 3d41517204ee..9e9630626064 100644 --- a/server/src/main/java/io/druid/server/coordinator/DruidCoordinator.java +++ b/server/src/main/java/io/druid/server/coordinator/DruidCoordinator.java @@ -740,7 +740,7 @@ public void run() log.makeAlert(e, "Caught exception, ignoring so that schedule keeps going.").emit(); } finally { - if (balancerExec != null){ + if (balancerExec != null) { balancerExec.shutdownNow(); } } diff --git a/server/src/main/java/io/druid/server/coordinator/DruidCoordinatorRuntimeParams.java b/server/src/main/java/io/druid/server/coordinator/DruidCoordinatorRuntimeParams.java index 89887e780243..54afd9d71482 100644 --- a/server/src/main/java/io/druid/server/coordinator/DruidCoordinatorRuntimeParams.java +++ b/server/src/main/java/io/druid/server/coordinator/DruidCoordinatorRuntimeParams.java @@ -254,7 +254,7 @@ public static class Builder this.coordinatorDynamicConfig = coordinatorDynamicConfig; this.stats = stats; this.balancerReferenceTimestamp = balancerReferenceTimestamp; - this.balancerStrategy=balancerStrategy; + this.balancerStrategy = balancerStrategy; } public DruidCoordinatorRuntimeParams build() @@ -350,7 +350,7 @@ public Builder withBalancerReferenceTimestamp(DateTime balancerReferenceTimestam public Builder withBalancerStrategy(BalancerStrategy balancerStrategy) { - this.balancerStrategy=balancerStrategy; + this.balancerStrategy = balancerStrategy; return this; } } diff --git a/server/src/main/java/io/druid/server/coordinator/LoadQueuePeon.java b/server/src/main/java/io/druid/server/coordinator/LoadQueuePeon.java index 59c452395974..f689fe6e2745 100644 --- a/server/src/main/java/io/druid/server/coordinator/LoadQueuePeon.java +++ b/server/src/main/java/io/druid/server/coordinator/LoadQueuePeon.java @@ -206,7 +206,7 @@ private void processSegmentChangeRequest() try { if (currentlyProcessing == null) { - if(!stopped) { + if (!stopped) { log.makeAlert("Crazy race condition! server[%s]", basePath) .emit(); } diff --git a/server/src/main/java/io/druid/server/http/LookupCoordinatorResource.java b/server/src/main/java/io/druid/server/http/LookupCoordinatorResource.java index 112d85cd9b7b..10da6deacde8 100644 --- a/server/src/main/java/io/druid/server/http/LookupCoordinatorResource.java +++ b/server/src/main/java/io/druid/server/http/LookupCoordinatorResource.java @@ -497,7 +497,7 @@ public Response getAllNodesStatus( for (HostAndPort node : nodes) { LookupsState lookupsState = lookupsStateOnHosts.get(node); if (lookupsState == null) { - tierNodesStatus.put(node, new LookupsState<>(null,null,null)); + tierNodesStatus.put(node, new LookupsState<>(null, null, null)); } else { tierNodesStatus.put(node, lookupsState); } @@ -529,7 +529,7 @@ public Response getNodesStatusInTier( for (HostAndPort node : nodes) { LookupsState lookupsState = lookupsStateOnHosts.get(node); if (lookupsState == null) { - tierNodesStatus.put(node, new LookupsState<>(null,null,null)); + tierNodesStatus.put(node, new LookupsState<>(null, null, null)); } else { tierNodesStatus.put(node, lookupsState); } diff --git a/server/src/main/java/io/druid/server/http/security/DatasourceResourceFilter.java b/server/src/main/java/io/druid/server/http/security/DatasourceResourceFilter.java index 073214ba3935..2f2b2152b427 100644 --- a/server/src/main/java/io/druid/server/http/security/DatasourceResourceFilter.java +++ b/server/src/main/java/io/druid/server/http/security/DatasourceResourceFilter.java @@ -102,7 +102,7 @@ public boolean isApplicable(String requestPath) "druid/v2/datasources/" ); for (String path : applicablePaths) { - if(requestPath.startsWith(path) && !requestPath.equals(path)) { + if (requestPath.startsWith(path) && !requestPath.equals(path)) { return true; } } diff --git a/server/src/main/java/io/druid/server/http/security/RulesResourceFilter.java b/server/src/main/java/io/druid/server/http/security/RulesResourceFilter.java index 1f73bd3b9849..15ca22188112 100644 --- a/server/src/main/java/io/druid/server/http/security/RulesResourceFilter.java +++ b/server/src/main/java/io/druid/server/http/security/RulesResourceFilter.java @@ -98,7 +98,7 @@ public boolean isApplicable(String requestPath) { List applicablePaths = ImmutableList.of("druid/coordinator/v1/rules/"); for (String path : applicablePaths) { - if(requestPath.startsWith(path) && !requestPath.equals(path)) { + if (requestPath.startsWith(path) && !requestPath.equals(path)) { return true; } } diff --git a/server/src/main/java/io/druid/server/initialization/ZkPathsConfig.java b/server/src/main/java/io/druid/server/initialization/ZkPathsConfig.java index eb8e8c5380f6..96e3532eb86d 100644 --- a/server/src/main/java/io/druid/server/initialization/ZkPathsConfig.java +++ b/server/src/main/java/io/druid/server/initialization/ZkPathsConfig.java @@ -67,7 +67,7 @@ public String getAnnouncementsPath() @Deprecated public String getServedSegmentsPath() { - return (null == servedSegmentsPath) ? defaultPath("servedSegments") : servedSegmentsPath; + return (null == servedSegmentsPath) ? defaultPath("servedSegments") : servedSegmentsPath; } public String getLiveSegmentsPath() @@ -77,17 +77,17 @@ public String getLiveSegmentsPath() public String getCoordinatorPath() { - return (null == coordinatorPath) ? defaultPath("coordinator") : coordinatorPath; + return (null == coordinatorPath) ? defaultPath("coordinator") : coordinatorPath; } public String getLoadQueuePath() { - return (null == loadQueuePath) ? defaultPath("loadQueue") : loadQueuePath; + return (null == loadQueuePath) ? defaultPath("loadQueue") : loadQueuePath; } public String getConnectorPath() { - return (null == connectorPath) ? defaultPath("connector") : connectorPath; + return (null == connectorPath) ? defaultPath("connector") : connectorPath; } public String defaultPath(final String subPath) diff --git a/server/src/main/java/io/druid/server/initialization/jetty/JettyServerInitUtils.java b/server/src/main/java/io/druid/server/initialization/jetty/JettyServerInitUtils.java index 367c58a466df..0adc8c625b38 100644 --- a/server/src/main/java/io/druid/server/initialization/jetty/JettyServerInitUtils.java +++ b/server/src/main/java/io/druid/server/initialization/jetty/JettyServerInitUtils.java @@ -66,7 +66,7 @@ public static void addExtensionFilters(ServletContextHandler handler, Injector i throw new ISE("Filter[%s] for path[%s] didn't have a Filter!?", servletFilterHolder, servletFilterHolder.getPath()); } - if(servletFilterHolder.getInitParameters() != null) { + if (servletFilterHolder.getInitParameters() != null) { holder.setInitParameters(servletFilterHolder.getInitParameters()); } diff --git a/server/src/main/java/io/druid/server/initialization/jetty/ServletFilterHolder.java b/server/src/main/java/io/druid/server/initialization/jetty/ServletFilterHolder.java index 6a22f2303e3b..d40a9bfba540 100644 --- a/server/src/main/java/io/druid/server/initialization/jetty/ServletFilterHolder.java +++ b/server/src/main/java/io/druid/server/initialization/jetty/ServletFilterHolder.java @@ -62,7 +62,7 @@ public interface ServletFilterHolder * @return a map containing all the Filter initialization * parameters */ - public Map getInitParameters(); + public Map getInitParameters(); /** * The path that this Filter should apply to diff --git a/server/src/main/java/io/druid/server/log/EmittingRequestLogger.java b/server/src/main/java/io/druid/server/log/EmittingRequestLogger.java index 334c4e15ec83..c8afc63c61b8 100644 --- a/server/src/main/java/io/druid/server/log/EmittingRequestLogger.java +++ b/server/src/main/java/io/druid/server/log/EmittingRequestLogger.java @@ -66,7 +66,7 @@ private static class RequestLogEvent implements Event @Override // override JsonValue serialization, instead use annotations // to include type information for polymorphic Query objects - @JsonValue(value=false) + @JsonValue(value = false) public Map toMap() { return ImmutableMap.of(); diff --git a/server/src/main/java/io/druid/server/lookup/cache/LookupCoordinatorManager.java b/server/src/main/java/io/druid/server/lookup/cache/LookupCoordinatorManager.java index 22221e6b73c2..d0e6d363b70e 100644 --- a/server/src/main/java/io/druid/server/lookup/cache/LookupCoordinatorManager.java +++ b/server/src/main/java/io/druid/server/lookup/cache/LookupCoordinatorManager.java @@ -194,7 +194,7 @@ public boolean updateLookups(final Map> priorSpec = getKnownLookups(); if (priorSpec == null && !updateSpec.isEmpty()) { // To prevent accidentally erasing configs if we haven't updated our cache of the values @@ -250,7 +250,7 @@ public boolean deleteLookup(final String tier, final String lookup, AuditInfo au { Preconditions.checkState(lifecycleLock.awaitStarted(5, TimeUnit.SECONDS), "not started"); - synchronized(this) { + synchronized (this) { final Map> priorSpec = getKnownLookups(); if (priorSpec == null) { LOG.warn("Requested delete lookup [%s]/[%s]. But no lookups exist!", tier, lookup); @@ -340,7 +340,7 @@ public LookupExtractorFactoryMapContainer getLookup(final String tier, final Str // coordinator becomes leader and drops leadership in quick succession. public void start() { - synchronized(lifecycleLock) { + synchronized (lifecycleLock) { if (!lifecycleLock.canStart()) { throw new ISE("LookupCoordinatorManager can't start."); } @@ -564,8 +564,7 @@ void lookupManagementLoop() allFuture.get(lookupCoordinatorManagerConfig.getAllHostTimeout().getMillis(), TimeUnit.MILLISECONDS) .stream() .filter(Objects::nonNull) - .forEach(stateBuilder::put) - ; + .forEach(stateBuilder::put); knownOldState.set(stateBuilder.build()); } catch (InterruptedException ex) { @@ -818,7 +817,7 @@ public LookupsState getLookupStateForNode( ); return response; } - catch(IOException ex) { + catch (IOException ex) { throw new IOE(ex, "Failed to parser GET lookups response from [%s]. response [%s].", url, result); } } else { diff --git a/server/src/main/java/io/druid/server/router/JavaScriptTieredBrokerSelectorStrategy.java b/server/src/main/java/io/druid/server/router/JavaScriptTieredBrokerSelectorStrategy.java index fb2d4ea7e35b..8e4dd8c5ba18 100644 --- a/server/src/main/java/io/druid/server/router/JavaScriptTieredBrokerSelectorStrategy.java +++ b/server/src/main/java/io/druid/server/router/JavaScriptTieredBrokerSelectorStrategy.java @@ -58,13 +58,13 @@ public JavaScriptTieredBrokerSelectorStrategy( final ScriptEngine engine = new ScriptEngineManager().getEngineByName("javascript"); try { - ((Compilable)engine).compile("var apply = " + fn).eval(); + ((Compilable) engine).compile("var apply = " + fn).eval(); } catch (ScriptException e) { throw new RuntimeException(e); } this.function = fn; - this.fnSelector = ((Invocable)engine).getInterface(SelectorFunction.class); + this.fnSelector = ((Invocable) engine).getInterface(SelectorFunction.class); } @Override diff --git a/server/src/test/java/io/druid/client/CachingClusteredClientTest.java b/server/src/test/java/io/druid/client/CachingClusteredClientTest.java index ed502cda90a1..9fb01f7cfdff 100644 --- a/server/src/test/java/io/druid/client/CachingClusteredClientTest.java +++ b/server/src/test/java/io/druid/client/CachingClusteredClientTest.java @@ -1947,7 +1947,7 @@ public void testQueryCachingWithFilter( @Override public Sequence answer() throws Throwable { - return toFilteredQueryableTimeseriesResults((TimeseriesQuery)capture.getValue().getQuery(), segmentIds, queryIntervals, results); + return toFilteredQueryableTimeseriesResults((TimeseriesQuery) capture.getValue().getQuery(), segmentIds, queryIntervals, results); } }) .times(0, 1); @@ -1958,7 +1958,7 @@ public Sequence answer() throws Throwable final Iterable> expected = new ArrayList<>(); for (int intervalNo = 0; intervalNo < i + 1; intervalNo++) { - Iterables.addAll((List)expected, filteredExpected.get(intervalNo)); + Iterables.addAll((List) expected, filteredExpected.get(intervalNo)); } runWithMocks( @@ -2002,7 +2002,7 @@ private Sequence> toFilteredQueryableTimeseriesRes List>> results ) { - MultipleSpecificSegmentSpec spec = (MultipleSpecificSegmentSpec)query.getQuerySegmentSpec(); + MultipleSpecificSegmentSpec spec = (MultipleSpecificSegmentSpec) query.getQuerySegmentSpec(); List> ret = Lists.newArrayList(); for (SegmentDescriptor descriptor : spec.getDescriptors()) { String id = StringUtils.format("%s_%s", queryIntervals.indexOf(descriptor.getInterval()), descriptor.getPartitionNumber()); @@ -2279,9 +2279,9 @@ private List> populateTimeline( start = String.valueOf(j); } if (j + 1 < numChunks) { - end = String.valueOf(j+1); + end = String.valueOf(j + 1); } - shardSpec = new SingleDimensionShardSpec("dim"+k, start, end, j); + shardSpec = new SingleDimensionShardSpec("dim" + k, start, end, j); } EasyMock.expect(mockSegment.getShardSpec()) .andReturn(shardSpec) diff --git a/server/src/test/java/io/druid/client/DirectDruidClientTest.java b/server/src/test/java/io/druid/client/DirectDruidClientTest.java index d6e5db2dfbd0..2f0729bba9b1 100644 --- a/server/src/test/java/io/druid/client/DirectDruidClientTest.java +++ b/server/src/test/java/io/druid/client/DirectDruidClientTest.java @@ -316,8 +316,8 @@ public void testQueryInterruptionExceptionLogMessage() throws JsonProcessingExce 0, 0L ); - final ServerSelector serverSelector = new ServerSelector( dataSegment - , + final ServerSelector serverSelector = new ServerSelector( + dataSegment, new HighestPriorityTierSelectorStrategy(new ConnectionCountServerSelectorStrategy()) ); diff --git a/server/src/test/java/io/druid/client/cache/ByteCountingLRUMapTest.java b/server/src/test/java/io/druid/client/cache/ByteCountingLRUMapTest.java index 09709809529c..576916c13fd4 100644 --- a/server/src/test/java/io/druid/client/cache/ByteCountingLRUMapTest.java +++ b/server/src/test/java/io/druid/client/cache/ByteCountingLRUMapTest.java @@ -71,13 +71,13 @@ public void testSanity() throws Exception Iterator it = map.keySet().iterator(); List toRemove = Lists.newLinkedList(); - while(it.hasNext()) { + while (it.hasNext()) { ByteBuffer buf = it.next(); - if(buf.remaining() == 10) { + if (buf.remaining() == 10) { toRemove.add(buf); } } - for(ByteBuffer buf : toRemove) { + for (ByteBuffer buf : toRemove) { map.remove(buf); } assertMapValues(1, 3, 3); diff --git a/server/src/test/java/io/druid/client/cache/BytesBoundedLinkedQueueTest.java b/server/src/test/java/io/druid/client/cache/BytesBoundedLinkedQueueTest.java index d7405abf7b73..646acd870e33 100644 --- a/server/src/test/java/io/druid/client/cache/BytesBoundedLinkedQueueTest.java +++ b/server/src/test/java/io/druid/client/cache/BytesBoundedLinkedQueueTest.java @@ -221,7 +221,7 @@ public Boolean call() public Boolean call() throws InterruptedException { while (!stopTest.get()) { - q.poll(100,TimeUnit.MILLISECONDS); + q.poll(100, TimeUnit.MILLISECONDS); q.offer(new TestObject(2)); } return true; diff --git a/server/src/test/java/io/druid/client/cache/CacheConfigTest.java b/server/src/test/java/io/druid/client/cache/CacheConfigTest.java index 10e9d6ee4c26..096887d81b52 100644 --- a/server/src/test/java/io/druid/client/cache/CacheConfigTest.java +++ b/server/src/test/java/io/druid/client/cache/CacheConfigTest.java @@ -66,7 +66,7 @@ public List getJacksonModules() @Override public void configure(Binder binder) { - JsonConfigProvider.bind(binder,propertyPrefix,CacheConfig.class); + JsonConfigProvider.bind(binder, propertyPrefix, CacheConfig.class); } } diff --git a/server/src/test/java/io/druid/client/cache/CacheDistributionTest.java b/server/src/test/java/io/druid/client/cache/CacheDistributionTest.java index fbd37b537d31..c09287c81f77 100644 --- a/server/src/test/java/io/druid/client/cache/CacheDistributionTest.java +++ b/server/src/test/java/io/druid/client/cache/CacheDistributionTest.java @@ -124,12 +124,12 @@ public int getNodeRepetitions() Map counter = Maps.newHashMap(); long t = 0; - for(int i = 0; i < KEY_COUNT; ++i) { + for (int i = 0; i < KEY_COUNT; ++i) { final String k = DigestUtils.sha1Hex("abc" + i) + ":" + DigestUtils.sha1Hex("xyz" + i); long t0 = System.nanoTime(); MemcachedNode node = locator.getPrimary(k); t += System.nanoTime() - t0; - if(counter.containsKey(node)) { + if (counter.containsKey(node)) { counter.get(node).incrementAndGet(); } else { counter.put(node, new AtomicLong(1)); @@ -139,12 +139,12 @@ public int getNodeRepetitions() long min = Long.MAX_VALUE; long max = 0; System.out.printf(Locale.ENGLISH, "%25s\t%5d\t", hash, reps); - for(AtomicLong count : counter.values()) { + for (AtomicLong count : counter.values()) { System.out.printf(Locale.ENGLISH, "%10d\t", count.get()); min = Math.min(min, count.get()); max = Math.max(max, count.get()); } - System.out.printf(Locale.ENGLISH, "%7.2f\t%5.0f%n", (double) min / (double) max, (double)t / KEY_COUNT); + System.out.printf(Locale.ENGLISH, "%7.2f\t%5.0f%n", (double) min / (double) max, (double) t / KEY_COUNT); } private static MemcachedNode dummyNode(String host, int port) diff --git a/server/src/test/java/io/druid/client/client/BatchServerInventoryViewTest.java b/server/src/test/java/io/druid/client/client/BatchServerInventoryViewTest.java index f28009fecffc..3edd25b372a2 100644 --- a/server/src/test/java/io/druid/client/client/BatchServerInventoryViewTest.java +++ b/server/src/test/java/io/druid/client/client/BatchServerInventoryViewTest.java @@ -203,7 +203,7 @@ public boolean apply(@Nullable Pair input) return input.rhs.getInterval().getStart().isBefore(SEGMENT_INTERVAL_START.plusDays(INITIAL_SEGMENTS)); } } - ){ + ) { @Override protected DruidServer addInnerInventory( DruidServer container, String inventoryKey, Set inventory @@ -472,7 +472,7 @@ public String getBase() List segments = new ArrayList(); try { for (int j = 0; j < INITIAL_SEGMENTS / numThreads; ++j) { - segments.add(makeSegment(INITIAL_SEGMENTS + ii + numThreads * j)); + segments.add(makeSegment(INITIAL_SEGMENTS + ii + numThreads * j)); } latch.countDown(); latch.await(); diff --git a/server/src/test/java/io/druid/client/indexing/ClientAppendQueryTest.java b/server/src/test/java/io/druid/client/indexing/ClientAppendQueryTest.java index c470cfeffe4a..3febded43d6d 100644 --- a/server/src/test/java/io/druid/client/indexing/ClientAppendQueryTest.java +++ b/server/src/test/java/io/druid/client/indexing/ClientAppendQueryTest.java @@ -45,7 +45,7 @@ public void setUp() @Test public void testGetType() { - Assert.assertEquals("append",clientAppendQuery.getType()); + Assert.assertEquals("append", clientAppendQuery.getType()); } @Test diff --git a/server/src/test/java/io/druid/client/indexing/ClientConversionQueryTest.java b/server/src/test/java/io/druid/client/indexing/ClientConversionQueryTest.java index c638e2d0fdd5..bb0a22139e5d 100644 --- a/server/src/test/java/io/druid/client/indexing/ClientConversionQueryTest.java +++ b/server/src/test/java/io/druid/client/indexing/ClientConversionQueryTest.java @@ -60,7 +60,7 @@ public void testGetSegment() { clientConversionQuery = new ClientConversionQuery(DATA_SEGMENT); Assert.assertEquals(DATA_SEGMENT, clientConversionQuery.getSegment()); - clientConversionQuery = new ClientConversionQuery(DATA_SOURCE,INTERVAL); + clientConversionQuery = new ClientConversionQuery(DATA_SOURCE, INTERVAL); Assert.assertNull(clientConversionQuery.getSegment()); } } diff --git a/server/src/test/java/io/druid/client/indexing/ClientMergeQueryTest.java b/server/src/test/java/io/druid/client/indexing/ClientMergeQueryTest.java index fb6b193cb45f..d7791e76553c 100644 --- a/server/src/test/java/io/druid/client/indexing/ClientMergeQueryTest.java +++ b/server/src/test/java/io/druid/client/indexing/ClientMergeQueryTest.java @@ -37,7 +37,7 @@ public class ClientMergeQueryTest null, null, null, 0, 0); private static final List SEGMENT_LIST = Lists.newArrayList(DATA_SEGMENT); private static final List AGGREGATOR_LIST = Lists.newArrayList(); - private static final ClientMergeQuery CLIENT_MERGE_QUERY = new ClientMergeQuery(DATA_SOURCE,SEGMENT_LIST,AGGREGATOR_LIST);; + private static final ClientMergeQuery CLIENT_MERGE_QUERY = new ClientMergeQuery(DATA_SOURCE, SEGMENT_LIST, AGGREGATOR_LIST);; @Test public void testGetType() diff --git a/server/src/test/java/io/druid/guice/DruidProcessingModuleTest.java b/server/src/test/java/io/druid/guice/DruidProcessingModuleTest.java index b3be5cfb161f..d80525ec439a 100644 --- a/server/src/test/java/io/druid/guice/DruidProcessingModuleTest.java +++ b/server/src/test/java/io/druid/guice/DruidProcessingModuleTest.java @@ -26,7 +26,7 @@ public class DruidProcessingModuleTest { - @Test(expected=ProvisionException.class) + @Test(expected = ProvisionException.class) public void testMemoryCheckThrowsException() { DruidProcessingModule module = new DruidProcessingModule(); diff --git a/server/src/test/java/io/druid/initialization/InitializationTest.java b/server/src/test/java/io/druid/initialization/InitializationTest.java index e97b4b0c060f..5dc51b910f25 100644 --- a/server/src/test/java/io/druid/initialization/InitializationTest.java +++ b/server/src/test/java/io/druid/initialization/InitializationTest.java @@ -142,7 +142,7 @@ public void test05MakeInjectorWithModules() throws Exception public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, new ServerConfig()) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, new ServerConfig()) ); } } diff --git a/server/src/test/java/io/druid/segment/loading/LoadSpecTest.java b/server/src/test/java/io/druid/segment/loading/LoadSpecTest.java index 94e750a9f267..a6f96c540f3b 100644 --- a/server/src/test/java/io/druid/segment/loading/LoadSpecTest.java +++ b/server/src/test/java/io/druid/segment/loading/LoadSpecTest.java @@ -81,7 +81,7 @@ public void configure(Binder binder) ) ); mapper = new DefaultObjectMapper(); - mapper.registerModule( new SimpleModule("loadSpecTest").registerSubtypes(LocalLoadSpec.class)); + mapper.registerModule(new SimpleModule("loadSpecTest").registerSubtypes(LocalLoadSpec.class)); mapper.setInjectableValues(new GuiceInjectableValues(injector)); final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector(); diff --git a/server/src/test/java/io/druid/segment/loading/LocalDataSegmentKillerTest.java b/server/src/test/java/io/druid/segment/loading/LocalDataSegmentKillerTest.java index dc950bb2bc62..8240adf2e291 100644 --- a/server/src/test/java/io/druid/segment/loading/LocalDataSegmentKillerTest.java +++ b/server/src/test/java/io/druid/segment/loading/LocalDataSegmentKillerTest.java @@ -41,7 +41,7 @@ public class LocalDataSegmentKillerTest @Test public void testKill() throws Exception { - LocalDataSegmentKiller killer = new LocalDataSegmentKiller(new LocalDataSegmentPusherConfig()); + LocalDataSegmentKiller killer = new LocalDataSegmentKiller(new LocalDataSegmentPusherConfig()); // Create following segments and then delete them in this order and assert directory deletions // /tmp/dataSource/interval1/v1/0/index.zip diff --git a/server/src/test/java/io/druid/segment/realtime/RealtimeManagerTest.java b/server/src/test/java/io/druid/segment/realtime/RealtimeManagerTest.java index bef7d9b24575..49c11be5b079 100644 --- a/server/src/test/java/io/druid/segment/realtime/RealtimeManagerTest.java +++ b/server/src/test/java/io/druid/segment/realtime/RealtimeManagerTest.java @@ -466,7 +466,7 @@ public void testQueryWithInterval() throws IOException, InterruptedException .anyMatch( fireChief -> { final Plumber plumber = fireChief.getPlumber(); - return plumber == null || !((TestPlumber)plumber).isStartedJob(); + return plumber == null || !((TestPlumber) plumber).isStartedJob(); } ) ) { @@ -535,7 +535,7 @@ public void testQueryWithSegmentSpec() throws IOException, InterruptedException .anyMatch( fireChief -> { final Plumber plumber = fireChief.getPlumber(); - return plumber == null || !((TestPlumber)plumber).isStartedJob(); + return plumber == null || !((TestPlumber) plumber).isStartedJob(); } ) ) { @@ -643,7 +643,7 @@ public void testQueryWithMultipleSegmentSpec() throws IOException, InterruptedEx .anyMatch( fireChief -> { final Plumber plumber = fireChief.getPlumber(); - return plumber == null || !((TestPlumber)plumber).isStartedJob(); + return plumber == null || !((TestPlumber) plumber).isStartedJob(); } ) ) { @@ -684,8 +684,7 @@ public void testQueryWithMultipleSegmentSpec() throws IOException, InterruptedEx factory, "druid.sample.numeric.tsv.top", null - ) - , + ), interval_28_29, QueryRunnerTestHelper.makeQueryRunner( factory, diff --git a/server/src/test/java/io/druid/segment/realtime/firehose/EventReceiverFirehoseTest.java b/server/src/test/java/io/druid/segment/realtime/firehose/EventReceiverFirehoseTest.java index 2e9a7d3716d6..4b2b106d8f22 100644 --- a/server/src/test/java/io/druid/segment/realtime/firehose/EventReceiverFirehoseTest.java +++ b/server/src/test/java/io/druid/segment/realtime/firehose/EventReceiverFirehoseTest.java @@ -229,7 +229,7 @@ public void testDuplicateRegistering() throws IOException public void testShutdownWithPrevTime() throws Exception { firehose.shutdown(DateTime.now().minusMinutes(2).toString()); - while (!firehose.isClosed()){ + while (!firehose.isClosed()) { Thread.sleep(50); } } @@ -238,7 +238,7 @@ public void testShutdownWithPrevTime() throws Exception public void testShutdown() throws Exception { firehose.shutdown(DateTime.now().plusMillis(100).toString()); - while (!firehose.isClosed()){ + while (!firehose.isClosed()) { Thread.sleep(50); } } diff --git a/server/src/test/java/io/druid/server/ClientInfoResourceTest.java b/server/src/test/java/io/druid/server/ClientInfoResourceTest.java index ae0988a25865..aacf8a3ac945 100644 --- a/server/src/test/java/io/druid/server/ClientInfoResourceTest.java +++ b/server/src/test/java/io/druid/server/ClientInfoResourceTest.java @@ -82,7 +82,7 @@ public class ClientInfoResourceTest public void setup() { VersionedIntervalTimeline timeline = new VersionedIntervalTimeline<>(Ordering.natural()); - DruidServer server = new DruidServer("name", "host", null, 1234, ServerType.HISTORICAL, "tier", 0); + DruidServer server = new DruidServer("name", "host", null, 1234, ServerType.HISTORICAL, "tier", 0); addSegment(timeline, server, "1960-02-13/1961-02-14", ImmutableList.of("d5"), ImmutableList.of("m5"), "v0"); @@ -258,7 +258,7 @@ public void testGetDatasourceFullWithOvershadowedSegments1() @Test public void testGetDatasourceFullWithOvershadowedSegments2() { - Map actual= resource.getDatasource( + Map actual = resource.getDatasource( dataSource, "2015-02-09T09:00:00.000Z/2015-02-13T23:00:00.000Z", "true" diff --git a/server/src/test/java/io/druid/server/DruidNodeTest.java b/server/src/test/java/io/druid/server/DruidNodeTest.java index 342a29a49e8f..15dd29a74d81 100644 --- a/server/src/test/java/io/druid/server/DruidNodeTest.java +++ b/server/src/test/java/io/druid/server/DruidNodeTest.java @@ -167,42 +167,42 @@ public void testDefaultsAndSanity() throws Exception plainTextField.setBoolean(serverConfig, false); tlsField.setBoolean(serverConfig, true); - node = new DruidNode("test",null, null, 123, serverConfig); + node = new DruidNode("test", null, null, 123, serverConfig); Assert.assertEquals(DruidNode.getDefaultHost(), node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals(123, node.getTlsPort()); plainTextField.setBoolean(serverConfig, false); tlsField.setBoolean(serverConfig, true); - node = new DruidNode("test",null, -1, 123, serverConfig); + node = new DruidNode("test", null, -1, 123, serverConfig); Assert.assertEquals(DruidNode.getDefaultHost(), node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals(123, node.getTlsPort()); plainTextField.setBoolean(serverConfig, false); tlsField.setBoolean(serverConfig, true); - node = new DruidNode("test","host", -1, 123, serverConfig); + node = new DruidNode("test", "host", -1, 123, serverConfig); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals(123, node.getTlsPort()); plainTextField.setBoolean(serverConfig, true); tlsField.setBoolean(serverConfig, false); - node = new DruidNode("test","host", -1, 123, serverConfig); + node = new DruidNode("test", "host", -1, 123, serverConfig); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals(-1, node.getTlsPort()); plainTextField.setBoolean(serverConfig, true); tlsField.setBoolean(serverConfig, false); - node = new DruidNode("test","host:123", 123, null, serverConfig); + node = new DruidNode("test", "host:123", 123, null, serverConfig); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(-1, node.getTlsPort()); plainTextField.setBoolean(serverConfig, true); tlsField.setBoolean(serverConfig, false); - node = new DruidNode("test","host:123", null, 123, serverConfig); + node = new DruidNode("test", "host:123", null, 123, serverConfig); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(-1, node.getTlsPort()); diff --git a/server/src/test/java/io/druid/server/StatusResourceTest.java b/server/src/test/java/io/druid/server/StatusResourceTest.java index e4fa99e7f094..fc54bf829a35 100644 --- a/server/src/test/java/io/druid/server/StatusResourceTest.java +++ b/server/src/test/java/io/druid/server/StatusResourceTest.java @@ -38,7 +38,7 @@ public class StatusResourceTest public void testLoadedModules() { - Collection modules = ImmutableList.of((DruidModule)new InitializationTest.TestDruidModule()); + Collection modules = ImmutableList.of((DruidModule) new InitializationTest.TestDruidModule()); List statusResourceModuleList = new StatusResource.Status(modules).getModules(); Assert.assertEquals("Status should have all modules loaded!", modules.size(), statusResourceModuleList.size()); diff --git a/server/src/test/java/io/druid/server/audit/SQLAuditManagerTest.java b/server/src/test/java/io/druid/server/audit/SQLAuditManagerTest.java index 64ac0b8eee55..f0edf6087517 100644 --- a/server/src/test/java/io/druid/server/audit/SQLAuditManagerTest.java +++ b/server/src/test/java/io/druid/server/audit/SQLAuditManagerTest.java @@ -221,13 +221,13 @@ public void testFetchAuditHistoryByTypeWithLimit() throws IOException Assert.assertEquals(entry2, auditEntries.get(1)); } - @Test(expected=IllegalArgumentException.class, timeout = 10_000L) + @Test(expected = IllegalArgumentException.class, timeout = 10_000L) public void testFetchAuditHistoryLimitBelowZero() throws IOException { auditManager.fetchAuditHistory("testType", -1); } - @Test(expected=IllegalArgumentException.class, timeout = 10_000L) + @Test(expected = IllegalArgumentException.class, timeout = 10_000L) public void testFetchAuditHistoryLimitZero() throws IOException { auditManager.fetchAuditHistory("testType", 0); diff --git a/server/src/test/java/io/druid/server/coordination/SegmentChangeRequestHistoryTest.java b/server/src/test/java/io/druid/server/coordination/SegmentChangeRequestHistoryTest.java index a7719b89bd21..1320cc4131e8 100644 --- a/server/src/test/java/io/druid/server/coordination/SegmentChangeRequestHistoryTest.java +++ b/server/src/test/java/io/druid/server/coordination/SegmentChangeRequestHistoryTest.java @@ -208,43 +208,43 @@ public void testCircularBuffer() throws Exception circularBuffer.add(2); Assert.assertEquals(2, circularBuffer.size()); for (int i = 0; i < circularBuffer.size(); i++) { - Assert.assertEquals(i+1, (int) circularBuffer.get(i)); + Assert.assertEquals(i + 1, (int) circularBuffer.get(i)); } circularBuffer.add(3); Assert.assertEquals(3, circularBuffer.size()); for (int i = 0; i < circularBuffer.size(); i++) { - Assert.assertEquals(i+1, (int) circularBuffer.get(i)); + Assert.assertEquals(i + 1, (int) circularBuffer.get(i)); } circularBuffer.add(4); Assert.assertEquals(3, circularBuffer.size()); for (int i = 0; i < circularBuffer.size(); i++) { - Assert.assertEquals(i+2, (int) circularBuffer.get(i)); + Assert.assertEquals(i + 2, (int) circularBuffer.get(i)); } circularBuffer.add(5); Assert.assertEquals(3, circularBuffer.size()); for (int i = 0; i < circularBuffer.size(); i++) { - Assert.assertEquals(i+3, (int) circularBuffer.get(i)); + Assert.assertEquals(i + 3, (int) circularBuffer.get(i)); } circularBuffer.add(6); Assert.assertEquals(3, circularBuffer.size()); for (int i = 0; i < circularBuffer.size(); i++) { - Assert.assertEquals(i+4, (int) circularBuffer.get(i)); + Assert.assertEquals(i + 4, (int) circularBuffer.get(i)); } circularBuffer.add(7); Assert.assertEquals(3, circularBuffer.size()); for (int i = 0; i < circularBuffer.size(); i++) { - Assert.assertEquals(i+5, (int) circularBuffer.get(i)); + Assert.assertEquals(i + 5, (int) circularBuffer.get(i)); } circularBuffer.add(8); Assert.assertEquals(3, circularBuffer.size()); for (int i = 0; i < circularBuffer.size(); i++) { - Assert.assertEquals(i+6, (int) circularBuffer.get(i)); + Assert.assertEquals(i + 6, (int) circularBuffer.get(i)); } } } diff --git a/server/src/test/java/io/druid/server/coordinator/DruidCoordinatorTest.java b/server/src/test/java/io/druid/server/coordinator/DruidCoordinatorTest.java index fa2c7fcfc5ec..ea9639624285 100644 --- a/server/src/test/java/io/druid/server/coordinator/DruidCoordinatorTest.java +++ b/server/src/test/java/io/druid/server/coordinator/DruidCoordinatorTest.java @@ -174,7 +174,7 @@ public String getBase() scheduledExecutorFactory, null, null, - new NoopServiceAnnouncer(){ + new NoopServiceAnnouncer() { @Override public void announce(DruidNode node) { @@ -213,7 +213,7 @@ public void testMoveSegment() throws Exception EasyMock.expect(segment.getDataSource()).andReturn("dummyDataSource"); EasyMock.replay(segment); EasyMock.expect(loadQueuePeon.getLoadQueueSize()).andReturn(new Long(1)); - DruidDataSource druidDataSource= EasyMock.createNiceMock(DruidDataSource.class); + DruidDataSource druidDataSource = EasyMock.createNiceMock(DruidDataSource.class); EasyMock.expect(druidDataSource.getSegment(EasyMock.anyString())).andReturn(segment); EasyMock.replay(druidDataSource); EasyMock.expect(databaseSegmentManager.getInventoryValue(EasyMock.anyString())).andReturn(druidDataSource); @@ -264,7 +264,7 @@ public void testMoveSegment() throws Exception public void testCoordinatorRun() throws Exception { String dataSource = "dataSource1"; - String tier= "hot"; + String tier = "hot"; // Setup MetadataRuleManager Rule foreverLoadRule = new ForeverLoadRule(ImmutableMap.of(tier, 2)); @@ -319,7 +319,7 @@ public void childEvent( CuratorFramework curatorFramework, PathChildrenCacheEvent pathChildrenCacheEvent ) throws Exception { - if(pathChildrenCacheEvent.getType().equals(PathChildrenCacheEvent.Type.CHILD_ADDED)){ + if (pathChildrenCacheEvent.getType().equals(PathChildrenCacheEvent.Type.CHILD_ADDED)) { if (assignSegmentLatch.getCount() > 0) { //Coordinator should try to assign segment to druidServer historical //Simulate historical loading segment diff --git a/server/src/test/java/io/druid/server/coordinator/ServerHolderTest.java b/server/src/test/java/io/druid/server/coordinator/ServerHolderTest.java index aa7bb5c8156f..7f1bc806c65b 100644 --- a/server/src/test/java/io/druid/server/coordinator/ServerHolderTest.java +++ b/server/src/test/java/io/druid/server/coordinator/ServerHolderTest.java @@ -208,7 +208,7 @@ public void testEquals() throws Exception final ServerHolder h4 = new ServerHolder( new ImmutableDruidServer( - new DruidServerMetadata("name1", "host1", null,200L, ServerType.HISTORICAL, "tier2", 0), + new DruidServerMetadata("name1", "host1", null, 200L, ServerType.HISTORICAL, "tier2", 0), 100L, ImmutableMap.of( "src1", diff --git a/server/src/test/java/io/druid/server/coordinator/rules/ForeverLoadRuleTest.java b/server/src/test/java/io/druid/server/coordinator/rules/ForeverLoadRuleTest.java index 720643f6c2e7..5480f0708edc 100644 --- a/server/src/test/java/io/druid/server/coordinator/rules/ForeverLoadRuleTest.java +++ b/server/src/test/java/io/druid/server/coordinator/rules/ForeverLoadRuleTest.java @@ -44,7 +44,7 @@ public void testSerdeNullTieredReplicants() throws Exception ObjectMapper jsonMapper = new DefaultObjectMapper(); Rule reread = jsonMapper.readValue(jsonMapper.writeValueAsString(rule), Rule.class); - Assert.assertEquals(rule.getTieredReplicants(), ((ForeverLoadRule)reread).getTieredReplicants()); + Assert.assertEquals(rule.getTieredReplicants(), ((ForeverLoadRule) reread).getTieredReplicants()); Assert.assertEquals(ImmutableMap.of(DruidServer.DEFAULT_TIER, DruidServer.DEFAULT_NUM_REPLICANTS), rule.getTieredReplicants()); } @@ -56,7 +56,7 @@ public void testMappingNullTieredReplicants() throws Exception + "}"; String expectedJson = " {\n" + " \"tieredReplicants\": {\n" - + " \""+ DruidServer.DEFAULT_TIER +"\": "+ DruidServer.DEFAULT_NUM_REPLICANTS +"\n" + + " \"" + DruidServer.DEFAULT_TIER + "\": " + DruidServer.DEFAULT_NUM_REPLICANTS + "\n" + " },\n" + " \"type\": \"loadForever\"\n" + " }"; @@ -81,7 +81,7 @@ public void testEmptyTieredReplicants() throws Exception public void testEmptyReplicantValue() throws Exception { // Immutable map does not allow null values - Map tieredReplicants= new HashMap<>(); + Map tieredReplicants = new HashMap<>(); tieredReplicants.put("tier", null); ForeverLoadRule rule = new ForeverLoadRule( tieredReplicants diff --git a/server/src/test/java/io/druid/server/coordinator/rules/IntervalLoadRuleTest.java b/server/src/test/java/io/druid/server/coordinator/rules/IntervalLoadRuleTest.java index 4460e32c2392..c3362cebcd2b 100644 --- a/server/src/test/java/io/druid/server/coordinator/rules/IntervalLoadRuleTest.java +++ b/server/src/test/java/io/druid/server/coordinator/rules/IntervalLoadRuleTest.java @@ -69,7 +69,7 @@ public void testMappingNullTieredReplicants() throws Exception String expectedJson = "{\n" + " \"interval\": \"0000-01-01T00:00:00.000-05:50:36/3000-01-01T00:00:00.000-06:00\",\n" + " \"tieredReplicants\": {\n" - + " \""+ DruidServer.DEFAULT_TIER +"\": "+ DruidServer.DEFAULT_NUM_REPLICANTS +"\n" + + " \"" + DruidServer.DEFAULT_TIER + "\": " + DruidServer.DEFAULT_NUM_REPLICANTS + "\n" + " },\n" + " \"type\": \"loadByInterval\"\n" + " }"; diff --git a/server/src/test/java/io/druid/server/coordinator/rules/PeriodLoadRuleTest.java b/server/src/test/java/io/druid/server/coordinator/rules/PeriodLoadRuleTest.java index a487630b7145..688a1711dd81 100644 --- a/server/src/test/java/io/druid/server/coordinator/rules/PeriodLoadRuleTest.java +++ b/server/src/test/java/io/druid/server/coordinator/rules/PeriodLoadRuleTest.java @@ -90,8 +90,8 @@ public void testSerdeNullTieredReplicants() throws Exception ObjectMapper jsonMapper = new DefaultObjectMapper(); Rule reread = jsonMapper.readValue(jsonMapper.writeValueAsString(rule), Rule.class); - Assert.assertEquals(rule.getPeriod(), ((PeriodLoadRule)reread).getPeriod()); - Assert.assertEquals(rule.getTieredReplicants(), ((PeriodLoadRule)reread).getTieredReplicants()); + Assert.assertEquals(rule.getPeriod(), ((PeriodLoadRule) reread).getPeriod()); + Assert.assertEquals(rule.getTieredReplicants(), ((PeriodLoadRule) reread).getTieredReplicants()); Assert.assertEquals(ImmutableMap.of(DruidServer.DEFAULT_TIER, DruidServer.DEFAULT_NUM_REPLICANTS), rule.getTieredReplicants()); } @@ -105,7 +105,7 @@ public void testMappingNullTieredReplicants() throws Exception String expectedJson = "{\n" + " \"period\": \"P1D\",\n" + " \"tieredReplicants\": {\n" - + " \""+ DruidServer.DEFAULT_TIER +"\": "+ DruidServer.DEFAULT_NUM_REPLICANTS +"\n" + + " \"" + DruidServer.DEFAULT_TIER + "\": " + DruidServer.DEFAULT_NUM_REPLICANTS + "\n" + " },\n" + " \"type\": \"loadByPeriod\"\n" + " }"; diff --git a/server/src/test/java/io/druid/server/http/CoordinatorRedirectInfoTest.java b/server/src/test/java/io/druid/server/http/CoordinatorRedirectInfoTest.java index 2bb63c465c7a..145c1af6d7de 100644 --- a/server/src/test/java/io/druid/server/http/CoordinatorRedirectInfoTest.java +++ b/server/src/test/java/io/druid/server/http/CoordinatorRedirectInfoTest.java @@ -68,7 +68,7 @@ public void testGetRedirectURLNull() { EasyMock.expect(druidCoordinator.getCurrentLeader()).andReturn(null).anyTimes(); EasyMock.replay(druidCoordinator); - URL url = coordinatorRedirectInfo.getRedirectURL("http","query", "/request"); + URL url = coordinatorRedirectInfo.getRedirectURL("http", "query", "/request"); Assert.assertNull(url); EasyMock.verify(druidCoordinator); } diff --git a/server/src/test/java/io/druid/server/log/FileRequestLoggerTest.java b/server/src/test/java/io/druid/server/log/FileRequestLoggerTest.java index fded642f0cb8..cfb1d3191385 100644 --- a/server/src/test/java/io/druid/server/log/FileRequestLoggerTest.java +++ b/server/src/test/java/io/druid/server/log/FileRequestLoggerTest.java @@ -54,8 +54,7 @@ public class FileRequestLoggerTest FileRequestLogger fileRequestLogger = new FileRequestLogger(objectMapper, scheduler, logDir); fileRequestLogger.start(); RequestLogLine requestLogLine = EasyMock.createMock(RequestLogLine.class); - EasyMock.expect(requestLogLine.getLine((ObjectMapper) EasyMock.anyObject())). - andReturn(actualLogString).anyTimes(); + EasyMock.expect(requestLogLine.getLine(EasyMock.anyObject())).andReturn(actualLogString).anyTimes(); EasyMock.replay(requestLogLine); fileRequestLogger.log(requestLogLine); File logFile = new File(logDir, dateTime.toString("yyyy-MM-dd'.log'")); diff --git a/server/src/test/java/io/druid/server/lookup/cache/LookupCoordinatorManagerTest.java b/server/src/test/java/io/druid/server/lookup/cache/LookupCoordinatorManagerTest.java index 6a9dde6bd735..958fea55d394 100644 --- a/server/src/test/java/io/druid/server/lookup/cache/LookupCoordinatorManagerTest.java +++ b/server/src/test/java/io/druid/server/lookup/cache/LookupCoordinatorManagerTest.java @@ -996,7 +996,7 @@ public Map> getKnownLook { return ImmutableMap.>of(LOOKUP_TIER, ImmutableMap.of( "foo", lookup, - "bar", new LookupExtractorFactoryMapContainer("v0",ImmutableMap.of()) + "bar", new LookupExtractorFactoryMapContainer("v0", ImmutableMap.of()) )); } }; diff --git a/server/src/test/java/io/druid/server/shard/SingleDimensionShardSpecTest.java b/server/src/test/java/io/druid/server/shard/SingleDimensionShardSpecTest.java index 18d2412de0eb..5efba297c96c 100644 --- a/server/src/test/java/io/druid/server/shard/SingleDimensionShardSpecTest.java +++ b/server/src/test/java/io/druid/server/shard/SingleDimensionShardSpecTest.java @@ -132,7 +132,7 @@ private List>> makeList(Object... arguments) { Preconditions.checkState(arguments.length % 2 == 0); - final ArrayList>> retVal = Lists.newArrayList(); + final ArrayList>> retVal = Lists.newArrayList(); for (int i = 0; i < arguments.length; i += 2) { retVal.add(Pair.of((Boolean) arguments[i], makeMap((String) arguments[i + 1]))); diff --git a/services/src/main/java/io/druid/cli/CliInternalHadoopIndexer.java b/services/src/main/java/io/druid/cli/CliInternalHadoopIndexer.java index f036235d3ef0..376813f3ef6c 100644 --- a/services/src/main/java/io/druid/cli/CliInternalHadoopIndexer.java +++ b/services/src/main/java/io/druid/cli/CliInternalHadoopIndexer.java @@ -139,7 +139,7 @@ public void run() public HadoopDruidIndexerConfig getHadoopDruidIndexerConfig() { - if(config == null) { + if (config == null) { try { if (argumentSpec.startsWith("{")) { config = HadoopDruidIndexerConfig.fromString(argumentSpec); diff --git a/services/src/main/java/io/druid/cli/CoordinatorJettyServerInitializer.java b/services/src/main/java/io/druid/cli/CoordinatorJettyServerInitializer.java index 4ec581918be2..14c5d758023f 100644 --- a/services/src/main/java/io/druid/cli/CoordinatorJettyServerInitializer.java +++ b/services/src/main/java/io/druid/cli/CoordinatorJettyServerInitializer.java @@ -62,7 +62,7 @@ public void initialize(Server server, Injector injector) ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class); root.addServlet(holderPwd, "/"); - if(config.getConsoleStatic() == null) { + if (config.getConsoleStatic() == null) { ResourceCollection staticResources; if (beOverlord) { staticResources = new ResourceCollection( diff --git a/services/src/main/java/io/druid/cli/PullDependencies.java b/services/src/main/java/io/druid/cli/PullDependencies.java index 92decfe5dc42..646512f53040 100644 --- a/services/src/main/java/io/druid/cli/PullDependencies.java +++ b/services/src/main/java/io/druid/cli/PullDependencies.java @@ -440,8 +440,9 @@ public void write(byte[] b, int off, int len) throws IOException { } - } - , false, StringUtils.UTF8_STRING + }, + false, + StringUtils.UTF8_STRING ) ); return new DefaultTeslaAether(