You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2019/01/29 04:26:11 UTC
[incubator-pinot] branch master updated: Auto-reformat all java
source files (#3739)
This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new ce2d9ee Auto-reformat all java source files (#3739)
ce2d9ee is described below
commit ce2d9ee9dc73b2d7273a63a4eede774eb024ea8f
Author: Xiaotian (Jackie) Jiang <17...@users.noreply.github.com>
AuthorDate: Mon Jan 28 20:26:06 2019 -0800
Auto-reformat all java source files (#3739)
Use IntelliJ to reformat all java source files
Manually fix some wrong-placed comments
No code change involved
After this, we can manually go to each file and resolve the checkstyle warnings
To resolve conflict after rebasing on this change:
1. For any conflict, pick the change in your branch
2. Reformat the file using IntelliJ after all conflicts resolved
NOTE: the reformat for enum is not well-supported (behavior is different between Mac and Linux), check before submitting the code
---
.../org/apache/pinotdruidbenchmark/DataMerger.java | 3 +-
.../pinotdruidbenchmark/DruidResponseTime.java | 9 +-
.../pinotdruidbenchmark/PinotResponseTime.java | 6 +-
.../org/apache/pinot/client/BrokerSelector.java | 3 +-
.../java/org/apache/pinot/client/Connection.java | 22 +-
.../org/apache/pinot/client/ConnectionFactory.java | 6 +-
.../apache/pinot/client/DynamicBrokerSelector.java | 12 +-
.../client/JsonAsyncHttpPinotClientTransport.java | 9 +-
.../apache/pinot/client/PinotClientTransport.java | 7 +-
.../java/org/apache/pinot/client/ResultSet.java | 4 +-
.../apache/pinot/client/SimpleBrokerSelector.java | 2 +-
.../java/org/apache/pinot/client/TextTable.java | 2 +-
.../apache/pinot/client/ConnectionFactoryTest.java | 3 +-
.../apache/pinot/client/ResultSetGroupTest.java | 8 +-
.../org/apache/pinot/filesystem/AzurePinotFS.java | 46 +-
.../datalake/store/MockADLFileInputStream.java | 21 +-
.../pinot/filesystem/test/AzurePinotFSTest.java | 13 +-
.../apache/pinot/broker/api/RequestStatistics.java | 4 +-
.../broker/api/resources/PinotBrokerDebug.java | 17 +-
.../api/resources/PinotBrokerHealthCheck.java | 6 +-
.../broker/api/resources/PinotClientRequest.java | 10 +-
.../pinot/broker/broker/AccessControlFactory.java | 6 +-
.../broker/AllowAllAccessControlFactory.java | 1 +
.../pinot/broker/broker/BrokerServerBuilder.java | 10 +-
...okerResourceOnlineOfflineStateModelFactory.java | 8 +-
.../broker/broker/helix/ClusterChangeMediator.java | 12 +-
.../broker/broker/helix/HelixBrokerStarter.java | 88 +-
.../helix/LiveInstancesChangeListenerImpl.java | 10 +-
.../TimeboundaryRefreshMessageHandlerFactory.java | 181 +-
.../apache/pinot/broker/queryquota/HitCounter.java | 2 +-
.../broker/queryquota/TableQueryQuotaManager.java | 13 +-
.../requesthandler/BaseBrokerRequestHandler.java | 16 +-
.../requesthandler/BrokerRequestHandler.java | 3 +-
.../requesthandler/BrokerRequestOptimizer.java | 17 +-
.../ConnectionPoolBrokerRequestHandler.java | 10 +-
...enNestedPredicatesFilterQueryTreeOptimizer.java | 4 +-
...ualitiesToInClauseFilterQueryTreeOptimizer.java | 11 +-
.../broker/requesthandler/OptimizationFlags.java | 3 +-
.../SingleConnectionBrokerRequestHandler.java | 13 +-
.../pinot/broker/routing/CfgBasedRouting.java | 3 +-
.../routing/HelixExternalViewBasedRouting.java | 14 +-
.../apache/pinot/broker/routing/RoutingTable.java | 3 +-
.../broker/routing/RoutingTableBuilderFactory.java | 11 +-
.../pinot/broker/routing/TimeBoundaryService.java | 3 +-
.../BasePartitionAwareRoutingTableBuilder.java | 3 +-
.../DefaultRealtimeRoutingTableBuilder.java | 3 +-
.../LowLevelConsumerRoutingTableBuilder.java | 9 +-
.../builder/LowLevelRoutingTableBuilderUtil.java | 12 +-
.../PartitionAwareRealtimeRoutingTableBuilder.java | 6 +-
.../builder/RoutingTableInstancePruner.java | 4 +-
.../routing/selector/MergedSegmentSelector.java | 8 +-
.../pinot/broker/broker/BrokerTestUtils.java | 3 +-
.../EmptyBrokerOnlineOfflineStateModelFactory.java | 1 -
...EmptySegmentOnlineOfflineStateModelFactory.java | 1 -
.../broker/broker/HelixBrokerStarterTest.java | 117 +-
.../broker/broker/HelixBrokerStarterUtilsTest.java | 4 +-
.../queryquota/TableQueryQuotaManagerTest.java | 152 +-
.../broker/requesthandler/FilterOptimizerTest.java | 26 +-
...tiesToInClauseFilterQueryTreeOptimizerTest.java | 54 +-
.../requesthandler/RangeMergeOptimizerTest.java | 4 +-
.../broker/routing/RandomRoutingTableTest.java | 6 +-
.../pinot/broker/routing/RoutingTableTest.java | 159 +-
.../broker/routing/TimeBoundaryServiceTest.java | 14 +-
.../BalancedRandomRoutingTableBuilderTest.java | 3 +-
.../HighLevelConsumerRoutingTableBuilderTest.java | 3 +-
.../LargeClusterRoutingTableBuilderTest.java | 13 +-
.../LowLevelConsumerRoutingTableBuilderTest.java | 11 +-
...rtitionAwareOfflineRoutingTableBuilderTest.java | 31 +-
...titionAwareRealtimeRoutingTableBuilderTest.java | 30 +-
.../selector/MergedSegmentSelectorTest.java | 25 +-
.../pinot/broker/util/FakePropertyStore.java | 4 +-
.../main/java/org/apache/pinot/common/Utils.java | 3 +-
.../config/AdjustTableNameChildKeyTransformer.java | 29 +-
.../pinot/common/config/ChildKeyTransformer.java | 1 +
.../apache/pinot/common/config/CombinedConfig.java | 14 +-
.../pinot/common/config/CombinedConfigLoader.java | 33 +-
...CombinedConfigSeparatorChildKeyTransformer.java | 20 +-
.../org/apache/pinot/common/config/ConfigDoc.java | 3 +
.../apache/pinot/common/config/Deserializer.java | 53 +-
.../org/apache/pinot/common/config/Duration.java | 3 +-
.../apache/pinot/common/config/IndexingConfig.java | 26 +-
.../common/config/NamedListChildKeyHandler.java | 48 +-
.../apache/pinot/common/config/QuotaConfig.java | 4 +-
.../config/RemapTableTypesChildKeyTransformer.java | 34 +-
.../common/config/ReplicaGroupStrategyConfig.java | 7 +-
.../apache/pinot/common/config/RoutingConfig.java | 4 +-
.../common/config/SegmentPartitionConfig.java | 6 +-
.../SegmentsValidationAndRetentionConfig.java | 22 +-
.../org/apache/pinot/common/config/Serializer.java | 19 +-
.../common/config/SimpleMapChildKeyHandler.java | 3 +-
.../apache/pinot/common/config/TableConfig.java | 25 +-
.../org/apache/pinot/common/config/TagConfig.java | 1 -
.../apache/pinot/common/config/TagNameUtils.java | 1 -
.../pinot/common/config/TagOverrideConfig.java | 4 +-
.../config/TaskConfigMapChildKeyHandler.java | 18 +-
.../org/apache/pinot/common/config/Tenant.java | 7 +-
.../apache/pinot/common/config/TenantConfig.java | 1 +
.../common/config/TypedMapChildKeyHandler.java | 33 +-
.../pinot/common/data/DateTimeFieldSpec.java | 3 +-
.../common/data/DateTimeFormatPatternSpec.java | 5 +-
.../pinot/common/data/DateTimeFormatSpec.java | 19 +-
.../pinot/common/data/DateTimeFormatUnitSpec.java | 34 +-
.../pinot/common/data/DateTimeGranularitySpec.java | 15 +-
.../org/apache/pinot/common/data/FieldSpec.java | 22 +-
.../apache/pinot/common/data/MetricFieldSpec.java | 4 +-
.../java/org/apache/pinot/common/data/Schema.java | 30 +-
.../pinot/common/data/StarTreeIndexSpec.java | 30 +-
.../apache/pinot/common/data/TimeFieldSpec.java | 4 +-
.../pinot/common/data/TimeGranularitySpec.java | 8 +-
.../common/exception/InvalidConfigException.java | 1 -
.../common/exception/TableNotFoundException.java | 1 -
.../pinot/common/lineage/SegmentMergeLineage.java | 9 +-
.../messages/TimeboundaryRefreshMessage.java | 31 +-
.../pinot/common/metadata/ZKMetadataProvider.java | 39 +-
.../metadata/instance/InstanceZKMetadata.java | 6 +-
.../segment/LLCRealtimeSegmentZKMetadata.java | 14 +-
.../metadata/segment/OfflineSegmentZKMetadata.java | 6 +-
.../segment/RealtimeSegmentZKMetadata.java | 8 +-
.../common/metadata/segment/SegmentZKMetadata.java | 23 +-
.../SegmentZKMetadataCustomMapModifier.java | 3 +-
.../pinot/common/metrics/AbstractMetrics.java | 60 +-
.../pinot/common/metrics/AggregatedCounter.java | 6 +-
.../pinot/common/metrics/AggregatedHistogram.java | 4 +-
.../pinot/common/metrics/AggregatedMeter.java | 12 +-
.../common/metrics/AggregatedMetricsRegistry.java | 3 +-
.../apache/pinot/common/metrics/BrokerGauge.java | 9 +-
.../pinot/common/metrics/BrokerQueryPhase.java | 6 +-
.../apache/pinot/common/metrics/BrokerTimer.java | 9 +-
.../pinot/common/metrics/ControllerGauge.java | 39 +-
.../pinot/common/metrics/ControllerMeter.java | 1 -
.../pinot/common/metrics/ControllerTimer.java | 6 +-
.../apache/pinot/common/metrics/LatencyMetric.java | 1 -
.../apache/pinot/common/metrics/MetricsHelper.java | 5 +-
.../apache/pinot/common/metrics/ServerGauge.java | 6 +-
.../pinot/common/metrics/ServerQueryPhase.java | 6 +-
.../apache/pinot/common/metrics/ServerTimer.java | 6 +-
.../pinot/common/metrics/ValidationMetrics.java | 34 +-
.../common/partition/PartitionAssignment.java | 6 +-
.../partition/ReplicaGroupPartitionAssignment.java | 2 +-
.../ReplicaGroupPartitionAssignmentGenerator.java | 3 +-
.../protocols/SegmentCompletionProtocol.java | 78 +-
.../request/transform/TransformExpressionTree.java | 4 +-
.../pinot/common/response/BrokerResponse.java | 3 +-
.../response/broker/BrokerResponseNative.java | 11 +-
.../common/response/broker/GroupByResult.java | 1 -
.../common/restlet/resources/RebalanceResult.java | 1 +
.../common/restlet/resources/TableSegments.java | 1 +
.../org/apache/pinot/common/segment/ReadMode.java | 7 +-
.../common/segment/fetcher/HdfsSegmentFetcher.java | 12 +-
.../common/segment/fetcher/HttpSegmentFetcher.java | 3 +-
.../segment/fetcher/HttpsSegmentFetcher.java | 6 +-
.../segment/fetcher/LocalFileSegmentFetcher.java | 3 +-
.../segment/fetcher/PinotFSSegmentFetcher.java | 3 +-
.../common/segment/fetcher/SegmentFetcher.java | 3 +-
.../segment/fetcher/SegmentFetcherFactory.java | 10 +-
.../common/utils/ClientSSLContextGenerator.java | 12 +-
.../apache/pinot/common/utils/CommonConstants.java | 28 +-
.../org/apache/pinot/common/utils/DataSchema.java | 10 +-
.../org/apache/pinot/common/utils/DataSize.java | 8 +-
.../org/apache/pinot/common/utils/DataTable.java | 3 +-
.../common/utils/FileUploadDownloadClient.java | 95 +-
.../org/apache/pinot/common/utils/FileUtils.java | 6 +-
.../apache/pinot/common/utils/HLCSegmentName.java | 8 +-
.../org/apache/pinot/common/utils/HashUtil.java | 8 +-
.../org/apache/pinot/common/utils/JsonUtils.java | 36 +-
.../pinot/common/utils/KafkaStarterUtils.java | 3 +-
.../apache/pinot/common/utils/LLCSegmentName.java | 8 +-
.../org/apache/pinot/common/utils/LLCUtils.java | 1 +
.../pinot/common/utils/NamedThreadFactory.java | 1 -
.../org/apache/pinot/common/utils/NetUtil.java | 3 +-
.../java/org/apache/pinot/common/utils/Pairs.java | 10 +-
.../pinot/common/utils/PrimitiveArrayUtils.java | 11 +-
.../org/apache/pinot/common/utils/SchemaUtils.java | 13 +-
.../org/apache/pinot/common/utils/SegmentName.java | 9 +-
.../apache/pinot/common/utils/ServiceStatus.java | 25 +-
.../pinot/common/utils/TarGzCompressionUtils.java | 16 +-
.../org/apache/pinot/common/utils/TenantRole.java | 3 +-
.../org/apache/pinot/common/utils/ZkStarter.java | 8 +-
.../pinot/common/utils/helix/HelixHelper.java | 12 +-
.../PinotHelixPropertyStoreZnRecordProvider.java | 3 +-
.../common/utils/request/HavingQueryTree.java | 11 +-
.../pinot/common/utils/retry/BaseRetryPolicy.java | 3 +-
.../pinot/common/utils/retry/RetryPolicy.java | 3 +-
.../pinot/common/utils/time/TimeConverter.java | 10 +-
.../apache/pinot/common/utils/time/TimeUtils.java | 17 +-
.../common/utils/webhdfs/WebHdfsV1Client.java | 27 +-
.../apache/pinot/pql/parsers/AbstractCompiler.java | 2 +
.../org/apache/pinot/pql/parsers/Pql2Compiler.java | 3 +-
.../pinot/pql/parsers/pql2/ast/BaseAstNode.java | 2 +-
.../parsers/pql2/ast/BetweenPredicateAstNode.java | 8 +-
.../parsers/pql2/ast/BooleanOperatorAstNode.java | 5 +-
.../pql2/ast/ComparisonPredicateAstNode.java | 7 +-
.../pinot/pql/parsers/pql2/ast/HavingAstNode.java | 1 -
.../pql/parsers/pql2/ast/IdentifierAstNode.java | 11 +-
.../pinot/pql/parsers/pql2/ast/LimitAstNode.java | 5 +-
.../pql/parsers/pql2/ast/PredicateAstNode.java | 2 +-
.../pql2/ast/RegexpLikePredicateAstNode.java | 6 +-
.../pinot/pql/parsers/pql2/ast/SelectAstNode.java | 8 +-
.../parsers/pql2/ast/StarColumnListAstNode.java | 2 +-
.../pql/parsers/pql2/ast/TableNameAstNode.java | 4 +-
.../org/apache/pinot/startree/hll/HllConfig.java | 15 +-
.../apache/pinot/startree/hll/HllConstants.java | 4 +-
.../apache/pinot/startree/hll/HllSizeUtils.java | 4 +-
.../pinot/common/config/IndexingConfigTest.java | 9 +-
.../pinot/common/config/QuotaConfigTest.java | 21 +-
.../pinot/common/config/TableConfigTest.java | 65 +-
.../pinot/common/config/TagOverrideConfigTest.java | 40 +-
.../org/apache/pinot/common/config/TenantTest.java | 3 +-
.../common/config/TestConfigSerialization.java | 3 +-
.../pinot/common/data/DateTimeFormatSpecTest.java | 292 +--
.../common/data/DateTimeGranularitySpecTest.java | 46 +-
.../apache/pinot/common/data/FieldSpecTest.java | 9 +-
.../org/apache/pinot/common/data/SchemaTest.java | 79 +-
.../pinot/common/http/MultiGetRequestTest.java | 15 +-
.../common/lineage/SegmentMergeLineageTest.java | 18 +-
.../metadata/MetadataEqualsHashCodeTest.java | 12 +-
.../common/metadata/SegmentZKMetadataTest.java | 13 +-
.../pinot/common/metrics/MetricsHelperTest.java | 3 +-
.../common/partition/IdealStateBuilderUtil.java | 6 +-
.../StreamPartitionAssignmentGeneratorTest.java | 3 +-
.../pinot/common/query/gen/AvroQueryGenerator.java | 32 +-
.../transform/TransformExpressionTreeTest.java | 4 +-
.../segment/fetcher/SegmentFetcherFactoryTest.java | 16 +-
.../apache/pinot/common/utils/DataSchemaTest.java | 3 +-
.../apache/pinot/common/utils/DataSizeTest.java | 11 +-
.../common/utils/FileUploadDownloadClientTest.java | 31 +-
.../pinot/common/utils/SegmentNameBuilderTest.java | 27 +-
.../pinot/common/utils/ServiceStatusTest.java | 32 +-
.../common/utils/TarGzCompressionUtilsTest.java | 13 +-
.../org/apache/pinot/common/utils/UtilsTest.java | 26 +-
.../pinot/common/utils/retry/RetryPolicyTest.java | 3 +-
.../apache/pinot/pql/parsers/Pql2CompilerTest.java | 12 +-
.../pinot/request/BrokerResponseNativeTest.java | 9 +-
.../apache/pinot/controller/ControllerConf.java | 39 +-
.../apache/pinot/controller/ControllerStarter.java | 9 +-
.../pinot/controller/api/CallableHttpGet.java | 1 -
.../api/ControllerAdminApiApplication.java | 21 +-
.../api/events/DefaultMetadataEventNotifier.java | 1 +
.../DefaultMetadataEventNotifierFactory.java | 1 -
.../api/events/MetadataEventNotifier.java | 1 +
.../pinot/controller/api/pojos/Instance.java | 8 +-
.../pinot/controller/api/resources/Constants.java | 4 +-
.../api/resources/ControllerResponseFilter.java | 4 +-
.../api/resources/FileUploadPathProvider.java | 6 +-
.../controller/api/resources/HeaderAdder.java | 13 +-
.../resources/LLCSegmentCompletionHandlers.java | 54 +-
.../api/resources/LandingPageHandler.java | 1 +
.../api/resources/PinotControllerHealthCheck.java | 4 +-
.../resources/PinotInstanceRestletResource.java | 44 +-
.../api/resources/PinotSegmentRestletResource.java | 4 +-
.../PinotSegmentUploadRestletResource.java | 41 +-
.../resources/PinotTableConfigRestletResource.java | 87 +-
.../api/resources/PinotTableIndexingConfigs.java | 10 +-
.../api/resources/PinotTableInstances.java | 4 +-
.../api/resources/PinotTableMetadataConfigs.java | 10 +-
.../api/resources/PinotTableRestletResource.java | 25 +-
.../controller/api/resources/PinotTableSchema.java | 8 +-
.../api/resources/PinotTableSegmentConfigs.java | 22 +-
.../api/resources/PinotTableTenantConfigs.java | 10 +-
.../api/resources/PinotTenantRestletResource.java | 105 +-
.../controller/api/resources/PqlQueryResource.java | 12 +-
.../pinot/controller/api/resources/StateType.java | 4 +-
.../pinot/controller/api/resources/TableSize.java | 30 +-
.../pinot/controller/api/resources/TableViews.java | 24 +-
.../resources/WebApplicationExceptionMapper.java | 6 +-
.../controller/api/upload/SegmentValidator.java | 17 +-
.../pinot/controller/api/upload/ZKOperator.java | 31 +-
.../helix/ControllerRequestBuilderUtil.java | 68 +-
.../helix/ControllerRequestURLBuilder.java | 35 +-
.../EmptyBrokerOnlineOfflineStateModelFactory.java | 1 -
...EmptySegmentOnlineOfflineStateModelFactory.java | 4 +-
.../controller/helix/SegmentStatusChecker.java | 14 +-
.../helix/core/PinotHelixResourceManager.java | 135 +-
.../helix/core/PinotTableIdealStateBuilder.java | 12 +-
.../helix/core/SegmentDeletionManager.java | 17 +-
.../controller/helix/core/TableRebalancer.java | 33 +-
.../helix/core/minion/ClusterInfoProvider.java | 8 +-
.../core/minion/PinotHelixTaskResourceManager.java | 23 +-
.../helix/core/minion/PinotTaskManager.java | 8 +-
.../generator/ConvertToRawIndexTaskGenerator.java | 4 +-
.../core/periodictask/ControllerPeriodicTask.java | 5 +-
.../realtime/PinotLLCRealtimeSegmentManager.java | 79 +-
.../core/realtime/PinotRealtimeSegmentManager.java | 54 +-
.../core/realtime/SegmentCompletionManager.java | 159 +-
.../helix/core/realtime/TableConfigCache.java | 9 +-
.../segment/CommittingSegmentDescriptor.java | 3 +-
.../segment/FlushThresholdUpdateManager.java | 4 +-
.../SegmentSizeBasedFlushThresholdUpdater.java | 12 +-
.../rebalance/DefaultRebalanceSegmentStrategy.java | 16 +-
.../core/rebalance/RebalanceSegmentStrategy.java | 6 +-
.../ReplicaGroupRebalanceSegmentStrategy.java | 19 +-
.../core/relocation/RealtimeSegmentRelocator.java | 4 +-
.../helix/core/retention/RetentionManager.java | 13 +-
.../BalanceNumSegmentAssignmentStrategy.java | 8 +-
.../core/sharding/BucketizedSegmentStrategy.java | 8 +-
.../core/sharding/RandomAssignmentStrategy.java | 7 +-
.../ReplicaGroupSegmentAssignmentStrategy.java | 9 +-
.../core/sharding/SegmentAssignmentStrategy.java | 1 -
.../sharding/SegmentAssignmentStrategyEnum.java | 2 +-
.../sharding/SegmentAssignmentStrategyFactory.java | 1 -
.../helix/core/util/HelixSetupUtils.java | 29 +-
.../controller/util/AutoAddInvertedIndex.java | 16 +-
.../pinot/controller/util/TableSizeReader.java | 18 +-
.../BrokerResourceValidationManager.java | 5 +-
.../validation/OfflineSegmentIntervalChecker.java | 4 +-
.../controller/validation/StorageQuotaChecker.java | 44 +-
.../api/resources/AccessControlTest.java | 2 +-
.../api/resources/FileUploadPathProviderTest.java | 10 +-
.../api/resources/PinotFileUploadTest.java | 21 +-
.../PinotInstanceRestletResourceTest.java | 37 +-
.../resources/PinotSchemaRestletResourceTest.java | 3 +-
.../resources/PinotSegmentRestletResourceTest.java | 22 +-
.../resources/PinotTableRestletResourceTest.java | 75 +-
.../resources/PinotTenantRestletResourceTest.java | 30 +-
.../SegmentCompletionProtocolDeserTest.java | 40 +-
.../api/resources/ServerTableSizeReaderTest.java | 6 +-
.../api/resources/TableSizeReaderTest.java | 97 +-
.../controller/api/resources/TableViewsTest.java | 71 +-
.../helix/ControllerInstanceToggleTest.java | 27 +-
.../helix/ControllerPeriodicTaskStarterTest.java | 2 +-
.../controller/helix/ControllerSentinelTestV2.java | 48 +-
.../controller/helix/ControllerTenantTest.java | 57 +-
.../pinot/controller/helix/ControllerTest.java | 30 +-
.../controller/helix/PinotResourceManagerTest.java | 26 +-
.../controller/helix/SegmentStatusCheckerTest.java | 223 +--
.../helix/core/PinotHelixResourceManagerTest.java | 54 +-
.../periodictask/ControllerPeriodicTaskTest.java | 17 +-
.../PinotLLCRealtimeSegmentManagerTest.java | 141 +-
.../helix/core/realtime/SegmentCompletionTest.java | 166 +-
.../segment/FlushThresholdUpdaterTest.java | 98 +-
.../rebalance/DefaultRebalanceStrategyTest.java | 99 +-
.../ReplicaGroupRebalanceStrategyTest.java | 70 +-
.../relocation/RealtimeSegmentRelocatorTest.java | 67 +-
.../helix/core/retention/RetentionManagerTest.java | 45 +-
.../sharding/SegmentAssignmentStrategyTest.java | 120 +-
.../core/util/SegmentDeletionManagerTest.java | 21 +-
.../helix/core/util/TableRebalancerTest.java | 1 +
.../controller/utils/ReplicaGroupTestUtils.java | 14 +-
.../controller/utils/SegmentMetadataMockUtils.java | 1 +
.../validation/StorageQuotaCheckerTest.java | 34 +-
.../validation/ValidationManagerTest.java | 44 +-
.../org/apache/pinot/core/bloom/BloomFilter.java | 6 +-
.../apache/pinot/core/bloom/BloomFilterUtil.java | 4 +-
.../pinot/core/bloom/GuavaOnHeapBloomFilter.java | 14 +-
.../pinot/core/common/BlockDocIdValueSet.java | 1 -
.../pinot/core/common/BlockMultiValIterator.java | 2 -
.../org/apache/pinot/core/common/DataSource.java | 5 +-
.../apache/pinot/core/common/ObjectSerDeUtils.java | 3 +-
.../org/apache/pinot/core/common/Predicate.java | 47 +-
.../core/common/datatable/DataTableBuilder.java | 30 +-
.../core/common/datatable/DataTableFactory.java | 6 +-
.../core/common/datatable/DataTableImplV2.java | 21 +-
.../core/common/predicate/BaseInPredicate.java | 4 +-
.../pinot/core/common/predicate/EqPredicate.java | 4 +-
.../pinot/core/common/predicate/NEqPredicate.java | 4 +-
.../core/common/predicate/RangePredicate.java | 5 +-
.../core/common/predicate/RegexpLikePredicate.java | 9 +-
.../org/apache/pinot/core/data/GenericRow.java | 6 +-
.../data/function/FunctionExpressionEvaluator.java | 9 +-
.../pinot/core/data/function/FunctionInfo.java | 5 +-
.../pinot/core/data/function/FunctionInvoker.java | 13 +-
.../pinot/core/data/function/FunctionRegistry.java | 3 +-
.../core/data/manager/BaseTableDataManager.java | 6 +-
.../core/data/manager/InstanceDataManager.java | 15 +-
.../pinot/core/data/manager/TableDataManager.java | 6 +-
.../manager/offline/OfflineTableDataManager.java | 3 +-
.../realtime/HLRealtimeSegmentDataManager.java | 70 +-
.../realtime/LLRealtimeSegmentDataManager.java | 153 +-
.../manager/realtime/RealtimeTableDataManager.java | 8 +-
.../realtime/SegmentBuildTimeLeaseExtender.java | 15 +-
.../data/partition/PartitionFunctionFactory.java | 4 +-
.../pinot/core/data/readers/AvroRecordReader.java | 15 +-
.../pinot/core/data/readers/CSVRecordReader.java | 12 +-
.../apache/pinot/core/data/readers/FileFormat.java | 7 +-
.../pinot/core/data/readers/JSONRecordReader.java | 12 +-
.../readers/MultiplePinotSegmentRecordReader.java | 6 +-
.../data/readers/PinotSegmentRecordReader.java | 4 +-
.../pinot/core/data/readers/RecordReader.java | 9 +-
.../core/data/readers/RecordReaderFactory.java | 6 +-
.../pinot/core/data/readers/RecordReaderUtils.java | 11 +-
.../core/data/readers/ThriftRecordReader.java | 226 +--
.../data/readers/ThriftRecordReaderConfig.java | 23 +-
.../recordtransformer/CompoundTransformer.java | 4 +-
.../core/data/recordtransformer/PinotDataType.java | 40 +-
.../data/recordtransformer/TimeTransformer.java | 8 +-
.../generator/SegmentGeneratorConfig.java | 11 +-
.../immutable/ImmutableSegmentImpl.java | 4 +-
.../immutable/ImmutableSegmentLoader.java | 14 +-
.../indexsegment/mutable/MutableSegmentImpl.java | 60 +-
.../io/compression/ChunkCompressorFactory.java | 3 +-
.../reader/BaseSingleColumnMultiValueReader.java | 5 +-
.../reader/BaseSingleColumnSingleValueReader.java | 8 +-
.../apache/pinot/core/io/reader/ReaderContext.java | 1 -
.../impl/FixedByteSingleValueMultiColReader.java | 6 +-
.../reader/impl/v1/BaseChunkSingleValueReader.java | 3 +-
.../reader/impl/v1/FixedBitMultiValueReader.java | 3 +-
.../reader/impl/v1/FixedBitSingleValueReader.java | 3 +-
.../core/io/reader/impl/v1/SortedIndexReader.java | 3 +-
.../io/reader/impl/v1/SortedIndexReaderImpl.java | 4 +-
.../BaseSingleColumnMultiValueReaderWriter.java | 3 +-
.../BaseSingleColumnSingleValueReaderWriter.java | 3 +-
.../BaseSingleValueMultiColumnReaderWriter.java | 3 +-
.../RealtimeIndexOffHeapMemoryManager.java | 9 +-
...ixedByteSingleColumnMultiValueReaderWriter.java | 3 +-
...xedByteSingleColumnSingleValueReaderWriter.java | 6 +-
...ixedByteSingleValueMultiColumnReaderWriter.java | 3 +-
.../io/util/DictionaryDelegatingValueReader.java | 3 +-
.../core/io/util/FixedBitIntReaderWriter.java | 7 +-
.../core/io/util/FixedByteValueReaderWriter.java | 3 +-
.../apache/pinot/core/io/util/PinotDataBitSet.java | 11 +-
.../org/apache/pinot/core/io/util/ValueReader.java | 3 +-
.../pinot/core/io/writer/DataFileWriter.java | 1 +
.../io/writer/SingleColumnMultiValueWriter.java | 1 -
.../io/writer/SingleColumnSingleValueWriter.java | 1 -
.../impl/FixedByteSingleValueMultiColWriter.java | 6 +-
.../core/io/writer/impl/MmapMemoryManager.java | 5 +-
.../writer/impl/MutableOffHeapByteArrayStore.java | 6 +-
.../core/io/writer/impl/OffHeapStringStore.java | 6 +-
.../writer/impl/v1/BaseChunkSingleValueWriter.java | 6 +-
.../writer/impl/v1/FixedBitMultiValueWriter.java | 9 +-
.../writer/impl/v1/FixedBitSingleValueWriter.java | 32 +-
.../impl/v1/FixedByteChunkSingleValueWriter.java | 3 +-
.../impl/v1/VarByteChunkSingleValueWriter.java | 6 +-
.../core/metadata/DefaultMetadataExtractor.java | 4 +-
.../pinot/core/metadata/MetadataExtractor.java | 3 +-
.../core/metadata/MetadataExtractorFactory.java | 28 +-
.../pinot/core/minion/BackfillDateTimeColumn.java | 18 +-
.../pinot/core/minion/RawIndexConverter.java | 21 +-
.../apache/pinot/core/minion/SegmentConverter.java | 10 +-
.../apache/pinot/core/minion/SegmentPurger.java | 9 +-
.../minion/rollup/MergeRollupSegmentConverter.java | 36 +-
.../apache/pinot/core/minion/rollup/MergeType.java | 4 +-
.../rollup/aggregate/MaxValueAggregator.java | 1 +
.../core/minion/segment/MapperRecordReader.java | 8 +-
.../core/minion/segment/ReducerRecordReader.java | 3 +-
.../core/operator/CombineGroupByOperator.java | 4 +-
.../pinot/core/operator/CombineOperator.java | 17 +-
.../pinot/core/operator/ExecutionStatistics.java | 11 +-
.../operator/blocks/IntermediateResultsBlock.java | 3 +-
.../operator/dociditerators/AndDocIdIterator.java | 6 +-
.../dociditerators/BitmapDocIdIterator.java | 10 +-
.../dociditerators/IndexBasedDocIdIterator.java | 4 +-
.../RangelessBitmapDocIdIterator.java | 8 +-
.../dociditerators/SVScanDocIdIterator.java | 1 +
.../dociditerators/ScanBasedDocIdIterator.java | 1 +
.../dociditerators/SortedDocIdIterator.java | 4 +-
.../core/operator/docidsets/AndBlockDocIdSet.java | 2 +-
.../docidsets/ScanBasedMultiValueDocIdSet.java | 7 +-
.../docidsets/ScanBasedSingleValueDocIdSet.java | 6 +-
.../core/operator/docidsets/SortedDocIdSet.java | 2 +-
.../core/operator/docidsets/StarTreeDocIdSet.java | 1 +
.../SortedInvertedIndexBasedFilterOperator.java | 4 +-
.../predicate/PredicateEvaluatorProvider.java | 8 +-
.../predicate/RangePredicateEvaluatorFactory.java | 6 +-
.../DateTimeConversionTransformFunction.java | 20 +-
.../function/MultiplicationTransformFunction.java | 3 +-
.../datetime/BaseDateTimeTransformer.java | 33 +-
.../pinot/core/periodictask/BasePeriodicTask.java | 4 +-
.../core/plan/AggregationGroupByPlanNode.java | 5 +-
.../pinot/core/plan/AggregationPlanNode.java | 8 +-
.../apache/pinot/core/plan/CombinePlanNode.java | 11 +-
.../plan/DictionaryBasedAggregationPlanNode.java | 2 +-
.../org/apache/pinot/core/plan/FilterPlanNode.java | 5 +-
.../core/plan/maker/InstancePlanMakerImplV2.java | 4 +-
.../DistinctCountHLLAggregationFunction.java | 6 +-
.../function/customobject/QuantileDigest.java | 8 +-
.../aggregation/groupby/GroupByResultHolder.java | 1 -
.../core/query/config/QueryExecutorConfig.java | 6 +-
.../core/query/config/QueryPlannerConfig.java | 6 +-
.../core/query/config/SegmentPrunerConfig.java | 7 +-
.../query/executor/ServerQueryExecutorV1Impl.java | 7 +-
.../core/query/pruner/AbstractSegmentPruner.java | 4 +-
.../core/query/reduce/BrokerReduceService.java | 32 +-
.../pinot/core/query/reduce/CombineService.java | 5 +-
.../query/reduce/HavingClauseComparisonTree.java | 9 +-
.../query/scheduler/MultiLevelPriorityQueue.java | 36 +-
.../core/query/scheduler/PriorityScheduler.java | 18 +-
.../pinot/core/query/scheduler/QueryScheduler.java | 16 +-
.../query/scheduler/QuerySchedulerFactory.java | 12 +-
.../pinot/core/query/scheduler/SchedulerGroup.java | 1 +
.../query/scheduler/SchedulerPriorityQueue.java | 9 +-
.../query/scheduler/SchedulerQueryContext.java | 10 +-
.../query/scheduler/fcfs/BoundedFCFSScheduler.java | 2 +-
.../resources/BoundedAccountingExecutor.java | 5 +-
.../scheduler/resources/QueryExecutorService.java | 10 +-
.../scheduler/resources/ResourceLimitPolicy.java | 21 +-
.../query/scheduler/resources/ResourceManager.java | 24 +-
.../tokenbucket/TokenPriorityScheduler.java | 3 +-
.../scheduler/tokenbucket/TokenSchedulerGroup.java | 14 +-
.../query/selection/SelectionOperatorUtils.java | 14 +-
.../comparator/CompositeDocIdValComparator.java | 38 +-
.../comparator/DocIdDoubleValComparator.java | 2 +-
.../comparator/DocIdFloatValComparator.java | 2 +-
.../comparator/DocIdIntValComparator.java | 4 +-
.../comparator/DocIdLongValComparator.java | 2 +-
.../DoubleArraySelectionColumnIterator.java | 1 +
.../iterator/DoubleSelectionColumnIterator.java | 1 +
.../FloatArraySelectionColumnIterator.java | 1 +
.../iterator/FloatSelectionColumnIterator.java | 1 +
.../iterator/IntArraySelectionColumnIterator.java | 1 +
.../iterator/IntSelectionColumnIterator.java | 1 +
.../iterator/LongArraySelectionColumnIterator.java | 1 +
.../iterator/LongSelectionColumnIterator.java | 1 +
.../iterator/SelectionColumnIterator.java | 2 +-
.../SelectionMultiValueColumnIterator.java | 1 +
.../StringArraySelectionColumnIterator.java | 1 +
.../iterator/StringSelectionColumnIterator.java | 6 +-
.../org/apache/pinot/core/query/utils/Pair.java | 1 -
.../apache/pinot/core/query/utils/TrieNode.java | 1 -
.../converter/RealtimeSegmentConverter.java | 6 +-
.../RealtimeSegmentSegmentCreationDataSource.java | 3 +-
.../stats/RealtimeSegmentStatsContainer.java | 3 +-
.../core/realtime/impl/RealtimeSegmentConfig.java | 6 +-
.../realtime/impl/RealtimeSegmentStatsHistory.java | 28 +-
.../dictionary/BaseOffHeapMutableDictionary.java | 10 +-
.../dictionary/BaseOnHeapMutableDictionary.java | 3 +-
.../dictionary/BytesOffHeapMutableDictionary.java | 3 +-
.../dictionary/DoubleOffHeapMutableDictionary.java | 3 +-
.../dictionary/FloatOffHeapMutableDictionary.java | 3 +-
.../dictionary/IntOffHeapMutableDictionary.java | 11 +-
.../dictionary/LongOffHeapMutableDictionary.java | 3 +-
.../impl/dictionary/MutableDictionaryFactory.java | 1 -
.../dictionary/StringOffHeapMutableDictionary.java | 7 +-
.../realtime/impl/kafka/ConsumerAndIterator.java | 6 +-
.../impl/kafka/KafkaAvroMessageDecoder.java | 31 +-
.../impl/kafka/KafkaConnectionHandler.java | 12 +-
.../realtime/impl/kafka/KafkaConsumerManager.java | 18 +-
.../impl/kafka/KafkaHighLevelStreamConfig.java | 26 +-
.../impl/kafka/KafkaJSONMessageDecoder.java | 3 +-
.../impl/kafka/KafkaLowLevelStreamConfig.java | 29 +-
.../impl/kafka/KafkaPartitionLevelConsumer.java | 10 +-
.../impl/kafka/KafkaStreamLevelConsumer.java | 19 +-
.../impl/kafka/KafkaStreamMetadataProvider.java | 3 +-
.../pinot/core/realtime/stream/MessageBatch.java | 58 +-
.../pinot/core/realtime/stream/OffsetCriteria.java | 17 +-
.../realtime/stream/PartitionCountFetcher.java | 4 +-
.../realtime/stream/PartitionOffsetFetcher.java | 8 +-
.../pinot/core/realtime/stream/StreamConfig.java | 42 +-
.../realtime/stream/StreamConfigProperties.java | 2 -
.../realtime/stream/StreamConsumerFactory.java | 1 -
.../stream/StreamConsumerFactoryProvider.java | 1 -
.../core/realtime/stream/StreamLevelConsumer.java | 6 +-
.../core/realtime/stream/StreamMessageDecoder.java | 3 +-
.../segment/creator/ColumnIndexCreationInfo.java | 5 +-
.../core/segment/creator/ColumnStatistics.java | 96 +-
.../core/segment/creator/InvertedIndexCreator.java | 3 +-
.../RecordReaderSegmentCreationDataSource.java | 3 +-
.../pinot/core/segment/creator/SegmentCreator.java | 6 +-
.../creator/SegmentIndexCreationDriver.java | 11 +-
.../creator/SegmentPreIndexStatsCollector.java | 10 +-
.../creator/SegmentPreIndexStatsContainer.java | 3 +-
.../creator/impl/SegmentColumnarIndexCreator.java | 27 +-
.../creator/impl/SegmentDictionaryCreator.java | 46 +-
.../impl/SegmentIndexCreationDriverImpl.java | 41 +-
.../creator/impl/bloom/BloomFilterCreator.java | 8 +-
.../fwd/MultiValueUnsortedForwardIndexCreator.java | 6 +-
.../fwd/SingleValueFixedByteRawIndexCreator.java | 3 +-
.../fwd/SingleValueSortedForwardIndexCreator.java | 6 +-
.../SingleValueUnsortedForwardIndexCreator.java | 3 +-
.../fwd/SingleValueVarByteRawIndexCreator.java | 6 +-
.../inv/OffHeapBitmapInvertedIndexCreator.java | 15 +-
.../impl/inv/OnHeapBitmapInvertedIndexCreator.java | 3 +-
.../stats/IntColumnPreIndexStatsCollector.java | 1 -
.../stats/SegmentPreIndexStatsCollectorImpl.java | 24 +-
.../stats/StringColumnPreIndexStatsCollector.java | 1 -
.../segment/index/column/ColumnIndexContainer.java | 2 +-
.../index/column/PhysicalColumnIndexContainer.java | 5 +-
.../index/converter/SegmentFormatConverter.java | 5 +-
.../converter/SegmentV1V2ToV3FormatConverter.java | 37 +-
.../segment/index/loader/IndexLoadingConfig.java | 1 -
.../core/segment/index/loader/LoaderUtils.java | 10 +-
.../segment/index/loader/SegmentPreProcessor.java | 9 +-
.../loader/bloomfilter/BloomFilterHandler.java | 12 +-
.../ColumnMinMaxValueGenerator.java | 29 +-
.../ColumnMinMaxValueGeneratorMode.java | 5 +-
.../defaultcolumn/BaseDefaultColumnHandler.java | 37 +-
.../defaultcolumn/DefaultColumnStatistics.java | 10 +-
.../defaultcolumn/V1DefaultColumnHandler.java | 3 +-
.../defaultcolumn/V3DefaultColumnHandler.java | 3 +-
.../loader/invertedindex/InvertedIndexHandler.java | 6 +-
.../index/readers/BitmapInvertedIndexReader.java | 9 +-
.../segment/index/readers/BloomFilterReader.java | 3 +-
.../core/segment/index/readers/Dictionary.java | 1 -
.../index/readers/ImmutableDictionaryReader.java | 3 +-
.../index/readers/OnHeapDoubleDictionary.java | 4 +-
.../index/readers/OnHeapFloatDictionary.java | 4 +-
.../segment/index/readers/OnHeapIntDictionary.java | 4 +-
.../index/readers/OnHeapLongDictionary.java | 4 +-
.../core/segment/memory/BasePinotLBuffer.java | 6 +-
.../pinot/core/segment/memory/PinotByteBuffer.java | 6 +-
.../pinot/core/segment/memory/PinotDataBuffer.java | 35 +-
.../segment/memory/PinotNativeOrderLBuffer.java | 6 +-
.../segment/memory/PinotNonNativeOrderLBuffer.java | 6 +-
.../segment/name/DefaultSegmentNameGenerator.java | 16 +-
.../name/NormalizedDateSegmentNameGenerator.java | 13 +-
.../core/segment/name/SegmentNameGenerator.java | 3 +-
.../core/segment/store/ColumnIndexDirectory.java | 11 +-
.../pinot/core/segment/store/ColumnIndexType.java | 1 +
.../core/segment/store/FilePerIndexDirectory.java | 16 +-
.../pinot/core/segment/store/IndexEntry.java | 1 +
.../apache/pinot/core/segment/store/IndexKey.java | 1 -
.../pinot/core/segment/store/SegmentDirectory.java | 9 +-
.../segment/store/SegmentLocalFSDirectory.java | 30 +-
.../segment/store/SingleFileIndexDirectory.java | 63 +-
.../virtualcolumn/BaseVirtualColumnProvider.java | 7 +-
.../virtualcolumn/DocIdVirtualColumnProvider.java | 17 +-
.../IntSingleValueDataFileReader.java | 3 +-
.../SingleStringVirtualColumnProvider.java | 17 +-
.../virtualcolumn/VirtualColumnProvider.java | 4 +
.../VirtualColumnProviderFactory.java | 6 +-
.../pinot/core/startree/OffHeapStarTree.java | 18 +-
.../core/startree/OffHeapStarTreeBuilder.java | 77 +-
.../pinot/core/startree/StarTreeBuilder.java | 15 +-
.../pinot/core/startree/StarTreeBuilderUtils.java | 5 +-
.../pinot/core/startree/StarTreeDataTable.java | 3 +-
.../apache/pinot/core/startree/hll/HllUtil.java | 4 +-
.../startree/v2/builder/BaseSingleTreeBuilder.java | 38 +-
.../startree/v2/builder/MultipleTreesBuilder.java | 16 +-
.../v2/builder/OffHeapSingleTreeBuilder.java | 42 +-
.../startree/v2/builder/SingleTreeBuilder.java | 3 +-
.../startree/v2/builder/StarTreeIndexCombiner.java | 9 +-
.../v2/builder/StarTreeV2BuilderConfig.java | 4 +-
.../startree/v2/store/StarTreeIndexContainer.java | 19 +-
.../pinot/core/transport/AsyncQueryResponse.java | 3 +-
.../pinot/core/transport/DataTableHandler.java | 4 +-
.../pinot/core/transport/ServerChannels.java | 16 +-
.../pinot/core/transport/ServerResponse.java | 4 +-
.../java/org/apache/pinot/core/util/AvroUtils.java | 12 +-
.../java/org/apache/pinot/core/util/CrcUtils.java | 6 +-
.../pinot/core/util/FixedIntArrayOffHeapIdMap.java | 3 +-
.../java/org/apache/pinot/core/util/IdMap.java | 2 -
.../java/org/apache/pinot/core/util/SizeUtil.java | 3 +-
.../pinot/core/util/SortedRangeIntersection.java | 1 +
.../pinot/core/util/trace/TraceCallable.java | 6 +-
.../ServerSegmentCompletionProtocolHandler.java | 6 +-
.../apache/pinot/core/common/DataFetcherTest.java | 7 +-
.../core/common/RealtimeNoDictionaryTest.java | 6 +-
.../core/common/datatable/DataTableSerDeTest.java | 13 +-
.../core/common/docidsets/BitmapDocIdSetTest.java | 3 +-
.../core/common/docidsets/SortedDocIdSetTest.java | 5 +-
.../function/FunctionExpressionEvaluatorTest.java | 17 +-
.../data/manager/BaseTableDataManagerTest.java | 16 +-
.../realtime/LLRealtimeSegmentDataManagerTest.java | 187 +-
.../readers/BackfillDateTimeRecordReaderTest.java | 16 +-
.../core/data/readers/CSVRecordReaderTest.java | 12 +-
.../core/data/readers/JSONRecordReaderTest.java | 9 +-
.../MultiplePinotSegmentRecordReaderTest.java | 9 +-
.../data/readers/PinotSegmentRecordReaderTest.java | 12 +-
.../pinot/core/data/readers/RecordReaderTest.java | 6 +-
.../core/data/readers/ThriftRecordReaderTest.java | 12 +-
.../pinot/core/data/readers/ThriftSampleData.java | 2003 ++++++++++----------
.../data/recordtransformer/PinotDataTypeTest.java | 21 +-
.../recordtransformer/RecordTransformerTest.java | 6 +-
.../MutableSegmentImplAggregateMetricsTest.java | 8 +-
.../mutable/MutableSegmentImplTest.java | 8 +-
.../mutable/MutableSegmentImplTestUtils.java | 18 +-
.../pinot/core/io/util/PinotDataBitSetTest.java | 19 +-
.../impl/MmapMemoryManagerFileCleanupTest.java | 3 +-
.../core/io/writer/impl/MmapMemoryManagerTest.java | 9 +-
.../impl/MutableOffHeapByteArrayStoreTest.java | 9 +-
.../io/writer/impl/OffHeapStringStoreTest.java | 9 +-
.../metadata/MetadataExtractorFactoryTest.java | 4 +-
.../minion/MergeRollupSegmentConverterTest.java | 34 +-
.../pinot/core/minion/SegmentConverterTest.java | 58 +-
.../pinot/core/minion/SegmentPurgerTest.java | 9 +-
.../dociditerators/BitmapDocIdIteratorTest.java | 9 +-
.../RealtimeSingleValueIteratorTest.java | 15 +-
.../operator/filter/FilterOperatorUtilsTest.java | 30 +-
.../function/AdditionTransformFunctionTest.java | 16 +-
.../function/BaseTransformFunctionTest.java | 3 +-
.../DateTimeConversionTransformFunctionTest.java | 14 +-
.../function/DivisionTransformFunctionTest.java | 18 +-
.../MultiplicationTransformFunctionTest.java | 14 +-
.../function/SubtractionTransformFunctionTest.java | 18 +-
.../TimeConversionTransformFunctionTest.java | 20 +-
.../function/ValueInTransformFunctionTest.java | 13 +-
.../datetime/DateTimeConverterTest.java | 28 +-
.../periodictask/PeriodicTaskSchedulerTest.java | 6 +-
.../pinot/core/plan/CombinePlanNodeTest.java | 4 +-
...adataAndDictionaryAggregationPlanMakerTest.java | 232 +--
.../NoDictionaryInPredicateEvaluatorTest.java | 15 +-
.../NoDictionaryRangePredicateEvaluatorTest.java | 6 +-
.../scheduler/MultiLevelPriorityQueueTest.java | 28 +-
.../query/scheduler/PrioritySchedulerTest.java | 46 +-
.../query/scheduler/TestSchedulerGroupFactory.java | 1 +
.../resources/BoundedAccountingExecutorTest.java | 3 +-
.../scheduler/resources/ResourceManagerTest.java | 4 +-
.../tokenbucket/TokenSchedulerGroupTest.java | 15 +-
.../impl/RealtimeSegmentStatsHistoryTest.java | 36 +-
.../impl/dictionary/DictionaryPerfRunner.java | 22 +-
.../impl/dictionary/MultiValueDictionaryTest.java | 6 +-
.../impl/dictionary/MutableDictionaryTest.java | 19 +-
.../kafka/AvroRecordToPinotRowGeneratorTest.java | 6 +-
.../impl/kafka/KafkaLowLevelStreamConfigTest.java | 50 +-
.../kafka/KafkaPartitionLevelConsumerTest.java | 78 +-
.../ConsumingSegmentAssignmentStrategyTest.java | 30 +-
.../core/realtime/stream/StreamConfigTest.java | 222 ++-
.../core/segment/index/ColumnMetadataTest.java | 29 +-
.../segment/index/SegmentMetadataImplTest.java | 12 +-
.../SegmentV1V2ToV3FormatConverterTest.java | 6 +-
.../index/creator/BloomFilterCreatorTest.java | 25 +-
.../segment/index/creator/RawIndexCreatorTest.java | 31 +-
.../SegmentGenerationWithBytesTypeTest.java | 22 +-
.../SegmentGenerationWithTimeColumnTest.java | 9 +-
.../core/segment/index/loader/LoaderTest.java | 34 +-
.../index/loader/SegmentPreProcessorTest.java | 30 +-
.../readers/ImmutableDictionaryReaderTest.java | 55 +-
.../core/segment/memory/PinotDataBufferTest.java | 132 +-
.../name/DefaultSegmentNameGeneratorTest.java | 30 +-
.../NormalizedDateSegmentNameGeneratorTest.java | 27 +-
.../store/ColumnIndexDirectoryTestHelper.java | 56 +-
.../segment/store/FilePerIndexDirectoryTest.java | 26 +-
.../segment/store/SegmentDirectoryPathsTest.java | 3 +-
.../segment/store/SegmentLocalFSDirectoryTest.java | 20 +-
.../store/SingleFileIndexDirectoryTest.java | 43 +-
.../pinot/core/startree/BaseStarTreeIndexTest.java | 21 +-
.../core/startree/OffHeapStarTreeBuilderTest.java | 6 +-
.../pinot/core/startree/StarTreeDataTableTest.java | 3 +-
.../startree/StarTreeIndexTestSegmentHelper.java | 6 +-
.../pinot/core/startree/SumStarTreeIndexTest.java | 25 +-
.../pinot/core/startree/TestStarTreeMetadata.java | 7 +-
.../core/startree/hll/HllIndexCreationTest.java | 10 +-
.../core/startree/hll/HllStarTreeIndexTest.java | 33 +-
.../core/startree/hll/HllTypeConversionTest.java | 4 +-
.../OffHeapStarTreeBuilderWithHllFieldTest.java | 15 +-
.../hll/SegmentWithHllIndexCreateHelper.java | 21 +-
.../pinot/core/startree/v2/BaseStarTreeV2Test.java | 26 +-
.../v2/PreAggregatedMinMaxRangeStarTreeV2Test.java | 4 +-
.../apache/pinot/core/transport/DummyServer.java | 14 +-
.../pinot/core/transport/QueryRouterTest.java | 17 +-
.../org/apache/pinot/core/util/CrcUtilsTest.java | 12 +-
.../pinot/core/util/trace/TraceContextTest.java | 9 +-
.../pinot/index/persist/AvroDataPublisherTest.java | 20 +-
.../pinot/index/reader/FileReaderTestUtils.java | 5 +-
.../pinot/index/reader/FixedBitMultiValueTest.java | 57 +-
.../FixedByteWidthRowColDataFileReaderTest.java | 6 +-
.../index/reader/SortedForwardIndexReaderTest.java | 9 +-
.../FixedByteChunkSingleValueReaderWriteTest.java | 24 +-
...ByteSingleColumnMultiValueReaderWriterTest.java | 21 +-
...yteSingleColumnSingleValueReaderWriterTest.java | 15 +-
...ByteSingleValueMultiColumnReaderWriterTest.java | 3 +-
.../VarByteChunkSingleValueReaderWriteTest.java | 9 +-
.../FixedByteWidthRowColDataFileWriterTest.java | 58 +-
.../pinot/queries/BaseMultiValueQueriesTest.java | 22 +-
.../pinot/queries/BaseSingleValueQueriesTest.java | 33 +-
.../apache/pinot/queries/FastHllQueriesTest.java | 55 +-
...nerSegmentAggregationMultiValueQueriesTest.java | 100 +-
...erSegmentAggregationSingleValueQueriesTest.java | 74 +-
...terSegmentAggregationMultiValueQueriesTest.java | 108 +-
...erSegmentAggregationSingleValueQueriesTest.java | 16 +-
.../queries/PercentileTDigestMVQueriesTest.java | 8 +-
.../queries/PercentileTDigestQueriesTest.java | 16 +-
.../DefaultAggregationExecutorTest.java | 6 +-
.../AggregationGroupByTrimmingServiceTest.java | 5 +-
.../DictionaryBasedGroupKeyGeneratorTest.java | 7 +-
.../groupby/NoDictionaryGroupKeyGeneratorTest.java | 24 +-
.../pinot/query/executor/QueryExecutorTest.java | 9 +-
.../query/pruner/ColumnValueSegmentPrunerTest.java | 17 +-
.../selection/SelectionOperatorServiceTest.java | 17 +-
.../converter/RealtimeSegmentConverterTest.java | 9 +-
.../pinot/reduce/HavingClauseComparisonTests.java | 40 +-
.../v1/creator/BitmapInvertedIndexCreatorTest.java | 15 +-
.../v1/creator/BitmapInvertedIndexTest.java | 9 +-
.../pinot/segments/v1/creator/BlocksTest.java | 13 +-
.../segments/v1/creator/DictionariesTest.java | 28 +-
.../v1/creator/FixedIntArrayIdMapTest.java | 5 +-
.../pinot/segments/v1/creator/IntArraysTest.java | 12 +-
.../segments/v1/creator/SegmentTestUtils.java | 12 +-
.../realtime/ControllerLeaderLocatorTest.java | 3 +-
.../test/java/org/apache/pinot/util/TestUtils.java | 12 +-
.../org/apache/pinot/filesystem/LocalPinotFS.java | 39 +-
.../java/org/apache/pinot/filesystem/PinotFS.java | 34 +-
.../apache/pinot/filesystem/PinotFSFactory.java | 3 +-
.../apache/pinot/filesystem/LocalPinotFSTest.java | 22 +-
.../pinot/filesystem/PinotFSFactoryTest.java | 30 +-
.../org/apache/pinot/filesystem/HadoopPinotFS.java | 35 +-
.../pinot/hadoop/PinotHadoopJobLauncher.java | 34 +-
.../org/apache/pinot/hadoop/io/FileHandler.java | 234 +--
.../pinot/hadoop/io/JsonPinotOutputFormat.java | 3 +-
.../apache/pinot/hadoop/io/PinotOutputFormat.java | 336 ++--
.../org/apache/pinot/hadoop/io/PinotRecord.java | 80 +-
.../pinot/hadoop/io/PinotRecordSerialization.java | 32 +-
.../apache/pinot/hadoop/io/PinotRecordWriter.java | 145 +-
.../apache/pinot/hadoop/job/ControllerRestApi.java | 6 +-
.../pinot/hadoop/job/JobConfigConstants.java | 1 -
.../pinot/hadoop/job/SegmentCreationJob.java | 21 +-
.../apache/pinot/hadoop/job/SegmentTarPushJob.java | 14 +-
.../apache/pinot/hadoop/job/SegmentUriPushJob.java | 19 +-
.../mapper/HadoopSegmentCreationMapReduceJob.java | 19 +-
.../apache/pinot/hadoop/utils/PushLocation.java | 2 +-
.../pinot/hadoop/io/PinotOutputFormatTest.java | 264 ++-
...umSegmentAssignmentStrategyIntegrationTest.java | 19 +-
.../tests/BaseClusterIntegrationTest.java | 19 +-
.../tests/BaseClusterIntegrationTestSet.java | 44 +-
.../tests/ChaosMonkeyIntegrationTest.java | 65 +-
.../tests/ClusterIntegrationTestUtils.java | 20 +-
.../pinot/integration/tests/ClusterTest.java | 157 +-
...vertToRawIndexMinionClusterIntegrationTest.java | 21 +-
.../DeleteAPIHybridClusterIntegrationTest.java | 63 +-
...lakyConsumerRealtimeClusterIntegrationTest.java | 9 +-
...mentBuildPushOfflineClusterIntegrationTest.java | 21 +-
.../tests/HybridClusterIntegrationTest.java | 50 +-
...ridClusterIntegrationTestCommandLineRunner.java | 30 +-
.../tests/LLCRealtimeClusterIntegrationTest.java | 9 +-
...onaryAggregationPlanClusterIntegrationTest.java | 23 +-
.../MultiNodesOfflineClusterIntegrationTest.java | 18 +-
.../tests/NewConfigApplyIntegrationTest.java | 40 +-
.../tests/OfflineClusterIntegrationTest.java | 48 +-
.../tests/PinotURIUploadIntegrationTest.java | 46 +-
.../pinot/integration/tests/QueryGenerator.java | 15 +-
.../tests/RealtimeClusterIntegrationTest.java | 32 +-
.../tests/SegmentCompletionIntegrationTests.java | 43 +-
.../tests/SimpleMinionClusterIntegrationTest.java | 9 +-
.../tests/StarTreeClusterIntegrationTest.java | 26 +-
.../tests/StarTreeV2ClusterIntegrationTest.java | 16 +-
.../tests/UploadRefreshDeleteIntegrationTest.java | 37 +-
.../org/apache/pinot/minion/MinionStarter.java | 19 +-
.../BaseMultipleSegmentsConversionExecutor.java | 21 +-
.../BaseSingleSegmentConversionExecutor.java | 18 +-
.../executor/ConvertToRawIndexTaskExecutor.java | 10 +-
.../pinot/minion/executor/PinotTaskExecutor.java | 3 +-
.../pinot/minion/executor/PurgeTaskExecutor.java | 13 +-
.../minion/executor/SegmentConversionUtils.java | 6 +-
.../minion/executor/PurgeTaskExecutorTest.java | 14 +-
.../org/apache/pinot/perf/BenchmarkDictionary.java | 37 +-
.../pinot/perf/BenchmarkDictionaryCreation.java | 34 +-
.../perf/BenchmarkFixedIntArrayOffHeapIdMap.java | 13 +-
.../pinot/perf/BenchmarkOfflineIndexReader.java | 19 +-
.../pinot/perf/BenchmarkOrDocIdIterator.java | 13 +-
.../apache/pinot/perf/BenchmarkQueryEngine.java | 17 +-
.../perf/BenchmarkRealtimeConsumptionSpeed.java | 12 +-
.../pinot/perf/BenchmarkStringDictionary.java | 12 +-
.../org/apache/pinot/perf/DictionaryDumper.java | 3 +-
.../pinot/perf/ForwardIndexWriterBenchmark.java | 15 +-
.../org/apache/pinot/perf/RawIndexBenchmark.java | 12 +-
.../org/apache/pinot/perf/RealtimeStressTest.java | 22 +-
.../pinot/perf/StringDictionaryPerfTest.java | 9 +-
.../server/api/resources/HealthCheckResource.java | 7 +-
.../server/api/resources/SchedulerResource.java | 1 -
.../server/api/resources/TableSizeResource.java | 12 +-
.../pinot/server/api/resources/TablesResource.java | 23 +-
.../pinot/server/conf/NettyServerConfig.java | 3 +-
.../org/apache/pinot/server/conf/ServerConf.java | 3 +-
.../server/request/ScheduledRequestHandler.java | 3 +-
.../apache/pinot/server/starter/ServerBuilder.java | 6 +-
.../server/starter/helix/AdminApiApplication.java | 17 +-
.../helix/DefaultHelixStarterServerConfig.java | 8 +-
.../starter/helix/HelixInstanceDataManager.java | 25 +-
.../helix/HelixInstanceDataManagerConfig.java | 11 +-
.../server/starter/helix/HelixServerStarter.java | 65 +-
.../starter/helix/SegmentFetcherAndLoader.java | 16 +-
.../helix/SegmentMessageHandlerFactory.java | 13 +-
.../SegmentOnlineOfflineStateModelFactory.java | 6 +-
.../server/api/resources/BaseResourceTest.java | 19 +-
.../server/api/resources/TablesResourceTest.java | 26 +-
.../realtime/RealtimeTableDataManagerTest.java | 24 +-
.../request/ScheduledRequestHandlerTest.java | 13 +-
.../apache/pinot/tools/AbstractBaseCommand.java | 7 +-
.../pinot/tools/AutoAddInvertedIndexTool.java | 34 +-
.../apache/pinot/tools/ClusterStateVerifier.java | 10 +-
.../main/java/org/apache/pinot/tools/Command.java | 5 +-
.../org/apache/pinot/tools/HybridQuickstart.java | 4 +-
.../apache/pinot/tools/PinotIdealstateChanger.java | 13 +-
.../apache/pinot/tools/PinotNumReplicaChanger.java | 9 +-
.../apache/pinot/tools/PinotSegmentRebalancer.java | 30 +-
.../org/apache/pinot/tools/PinotToolLauncher.java | 17 +-
.../org/apache/pinot/tools/PinotZKChanger.java | 16 +-
.../java/org/apache/pinot/tools/Quickstart.java | 5 +-
.../org/apache/pinot/tools/RealtimeQuickStart.java | 4 +-
.../org/apache/pinot/tools/SegmentDumpTool.java | 6 +-
.../java/org/apache/pinot/tools/SpeedTest.java | 8 +-
.../apache/pinot/tools/StarTreeIndexViewer.java | 9 +-
.../org/apache/pinot/tools/UpdateSegmentState.java | 13 +-
.../apache/pinot/tools/ValidateTableRetention.java | 10 +-
.../pinot/tools/admin/PinotAdministrator.java | 42 +-
.../org/apache/pinot/tools/admin/PinotBroker.java | 3 +-
.../apache/pinot/tools/admin/PinotController.java | 3 +-
.../org/apache/pinot/tools/admin/PinotServer.java | 3 +-
.../admin/command/AbstractBaseAdminCommand.java | 9 +-
.../tools/admin/command/AddSchemaCommand.java | 3 +-
.../pinot/tools/admin/command/AddTableCommand.java | 21 +-
.../tools/admin/command/AddTenantCommand.java | 28 +-
.../admin/command/ApplyTableConfigCommand.java | 19 +-
.../admin/command/AvroSchemaToPinotSchema.java | 3 +-
.../command/BackfillDateTimeColumnCommand.java | 30 +-
.../admin/command/ChangeNumReplicasCommand.java | 6 +-
.../tools/admin/command/ChangeTableState.java | 36 +-
.../tools/admin/command/CreateSegmentCommand.java | 8 +-
.../tools/admin/command/DeleteClusterCommand.java | 7 +-
.../tools/admin/command/GenerateDataCommand.java | 29 +-
.../tools/admin/command/MoveReplicaGroup.java | 70 +-
.../tools/admin/command/PostQueryCommand.java | 9 +-
.../tools/admin/command/QuickstartRunner.java | 51 +-
.../command/RealtimeProvisioningHelperCommand.java | 16 +-
.../tools/admin/command/RebalanceTableCommand.java | 11 +-
.../admin/command/ShowClusterInfoCommand.java | 14 +-
.../tools/admin/command/StartBrokerCommand.java | 12 +-
.../admin/command/StartControllerCommand.java | 16 +-
.../tools/admin/command/StartKafkaCommand.java | 12 +-
.../tools/admin/command/StartServerCommand.java | 15 +-
.../tools/admin/command/StartZookeeperCommand.java | 19 +-
.../tools/admin/command/StopProcessCommand.java | 9 +-
.../admin/command/StreamAvroIntoKafkaCommand.java | 30 +-
.../tools/admin/command/UploadSegmentCommand.java | 14 +-
.../tools/admin/command/ValidateConfigCommand.java | 9 +-
.../admin/command/VerifyClusterStateCommand.java | 6 +-
.../tools/admin/command/VerifySegmentState.java | 7 +-
.../pinot/tools/backfill/BackfillSegmentUtils.java | 11 +-
.../pinot/tools/data/generator/AvroWriter.java | 9 +-
.../pinot/tools/data/generator/DataGenerator.java | 25 +-
.../tools/data/generator/DataGeneratorSpec.java | 5 +-
.../pinot/tools/data/generator/Generator.java | 1 +
.../tools/data/generator/GeneratorFactory.java | 1 -
.../tools/data/generator/NumberGenerator.java | 1 -
.../tools/data/generator/RangeDoubleGenerator.java | 3 +-
.../tools/data/generator/RangeFloatGenerator.java | 3 +-
.../tools/data/generator/RangeIntGenerator.java | 3 +-
.../tools/data/generator/RangeLongGenerator.java | 3 +-
.../pinot/tools/perf/PerfBenchmarkDriver.java | 41 +-
.../pinot/tools/perf/PerfBenchmarkDriverConf.java | 4 +-
.../pinot/tools/perf/PerfBenchmarkRunner.java | 27 +-
.../org/apache/pinot/tools/perf/QueryRunner.java | 62 +-
.../apache/pinot/tools/perf/ZookeeperLauncher.java | 3 +-
.../tools/query/comparison/ClusterStarter.java | 13 +-
.../tools/query/comparison/QueryComparison.java | 25 +-
.../query/comparison/QueryComparisonConfig.java | 10 +-
.../query/comparison/StarQueryComparison.java | 6 +-
.../query/comparison/StarTreeQueryGenerator.java | 3 +-
.../realtime/provisioning/MemoryEstimator.java | 39 +-
.../apache/pinot/tools/scan/query/Aggregation.java | 8 +-
.../apache/pinot/tools/scan/query/AvgFunction.java | 4 +-
.../pinot/tools/scan/query/CountFunction.java | 1 +
.../tools/scan/query/EqualsPredicateFilter.java | 1 +
.../apache/pinot/tools/scan/query/MinFunction.java | 1 +
.../tools/scan/query/MinMaxRangeFunction.java | 1 +
.../tools/scan/query/NotInPredicateFilter.java | 1 +
.../pinot/tools/scan/query/NotPredicateFilter.java | 3 +-
.../pinot/tools/scan/query/PredicateFilter.java | 3 +-
.../pinot/tools/scan/query/QueryResponse.java | 4 +-
.../apache/pinot/tools/scan/query/ResultTable.java | 9 +-
.../tools/scan/query/ScanBasedQueryProcessor.java | 6 +-
.../tools/scan/query/SegmentQueryProcessor.java | 9 +-
.../apache/pinot/tools/scan/query/SumFunction.java | 1 +
.../org/apache/pinot/tools/scan/query/Utils.java | 1 +
.../converter/ColumnarToStarTreeConverter.java | 6 +-
.../converter/DictionaryToRawIndexConverter.java | 9 +-
.../converter/PinotSegmentConvertCommand.java | 15 +-
.../converter/PinotSegmentToAvroConverter.java | 3 +-
.../converter/PinotSegmentToCsvConverter.java | 3 +-
.../converter/PinotSegmentToJsonConverter.java | 3 +-
.../segment/converter/SegmentMergeCommand.java | 17 +-
.../pinot/tools/streams/AirlineDataStream.java | 10 +-
.../pinot/tools/streams/MeetupRsvpStream.java | 3 +-
.../common/AbstractCompositeListenableFuture.java | 12 +-
.../transport/common/AsyncResponseFuture.java | 18 +-
.../pinot/transport/common/CompositeFuture.java | 30 +-
.../pinot/transport/common/LinkedDequeue.java | 7 +-
.../pinot/transport/common/SelectingFuture.java | 17 +-
.../transport/common/ServerResponseFuture.java | 3 +-
.../pinot/transport/conf/TransportClientConf.java | 7 +-
.../transport/config/ConnectionPoolConfig.java | 18 +-
.../pinot/transport/config/RoutingTableConfig.java | 1 -
.../transport/metrics/AggregatedPoolStats.java | 10 +-
.../transport/metrics/NettyClientMetrics.java | 7 +-
.../transport/metrics/NettyServerMetrics.java | 3 +-
.../apache/pinot/transport/metrics/PoolStats.java | 1 -
.../transport/metrics/TransportServerMetrics.java | 1 -
.../transport/netty/NettyClientConnection.java | 13 +-
.../apache/pinot/transport/netty/NettyServer.java | 20 +-
.../transport/netty/NettyTCPClientConnection.java | 76 +-
.../pinot/transport/netty/NettyTCPServer.java | 13 +-
.../netty/PooledNettyClientResourceManager.java | 7 +-
.../org/apache/pinot/transport/pool/AsyncPool.java | 1 -
.../apache/pinot/transport/pool/AsyncPoolImpl.java | 18 +-
.../pool/AsyncPoolResourceManagerAdapter.java | 6 +-
.../apache/pinot/transport/pool/KeyedPoolImpl.java | 10 +-
.../transport/pool/PooledResourceManager.java | 1 -
.../transport/scattergather/ScatterGatherImpl.java | 3 +-
.../src/test/java/org/apache/pinot/Checkable.java | 3 +-
.../src/test/java/org/apache/pinot/TestUtils.java | 3 +-
.../transport/common/CompositeFutureTest.java | 30 +-
.../pinot/transport/common/ResponseFutureTest.java | 19 +-
.../transport/common/SelectingFutureTest.java | 18 +-
.../pinot/transport/common/ServerInstanceTest.java | 3 +-
.../transport/netty/NettyCloseChannelTest.java | 10 +-
.../NettySingleConnectionIntegrationTest.java | 12 +-
.../transport/perf/ScatterGatherPerfClient.java | 21 +-
.../transport/perf/ScatterGatherPerfServer.java | 26 +-
.../transport/perf/ScatterGatherPerfTester.java | 132 +-
.../pinot/transport/pool/KeyedPoolImplTest.java | 57 +-
.../transport/scattergather/ScatterGatherTest.java | 9 +-
991 files changed, 10554 insertions(+), 10007 deletions(-)
diff --git a/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/DataMerger.java b/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/DataMerger.java
index bce28cf..981b3c6 100644
--- a/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/DataMerger.java
+++ b/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/DataMerger.java
@@ -34,8 +34,7 @@ public class DataMerger {
}
private enum MergeGranularity {
- MONTH,
- YEAR
+ MONTH, YEAR
}
public static void main(String[] args)
diff --git a/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/DruidResponseTime.java b/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/DruidResponseTime.java
index 6650c9e..8c0f2a3 100644
--- a/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/DruidResponseTime.java
+++ b/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/DruidResponseTime.java
@@ -42,7 +42,8 @@ public class DruidResponseTime {
private static final byte[] BYTE_BUFFER = new byte[4096];
private static final char[] CHAR_BUFFER = new char[4096];
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args)
+ throws Exception {
if (args.length != 4 && args.length != 5) {
System.err.println(
"4 or 5 arguments required: QUERY_DIR, RESOURCE_URL, WARM_UP_ROUNDS, TEST_ROUNDS, RESULT_DIR (optional).");
@@ -116,10 +117,8 @@ public class DruidResponseTime {
if (resultDir != null) {
File resultFile = new File(resultDir, queryFile.getName() + ".result");
CloseableHttpResponse httpResponse = httpClient.execute(httpPost);
- try (
- BufferedInputStream bufferedInputStream = new BufferedInputStream(httpResponse.getEntity().getContent());
- BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(resultFile))
- ) {
+ try (BufferedInputStream bufferedInputStream = new BufferedInputStream(httpResponse.getEntity().getContent());
+ BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(resultFile))) {
int length;
while ((length = bufferedInputStream.read(BYTE_BUFFER)) > 0) {
bufferedWriter.write(new String(BYTE_BUFFER, 0, length));
diff --git a/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/PinotResponseTime.java b/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/PinotResponseTime.java
index 353eafc..53bdeb4 100644
--- a/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/PinotResponseTime.java
+++ b/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/PinotResponseTime.java
@@ -108,10 +108,8 @@ public class PinotResponseTime {
if (resultDir != null) {
File resultFile = new File(resultDir, queryFile.getName() + ".result");
CloseableHttpResponse httpResponse = httpClient.execute(httpPost);
- try (
- BufferedInputStream bufferedInputStream = new BufferedInputStream(httpResponse.getEntity().getContent());
- BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(resultFile))
- ) {
+ try (BufferedInputStream bufferedInputStream = new BufferedInputStream(httpResponse.getEntity().getContent());
+ BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(resultFile))) {
int length;
while ((length = bufferedInputStream.read(BYTE_BUFFER)) > 0) {
bufferedWriter.write(new String(BYTE_BUFFER, 0, length));
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/BrokerSelector.java b/pinot-api/src/main/java/org/apache/pinot/client/BrokerSelector.java
index 9b787c2..329a1ca 100644
--- a/pinot-api/src/main/java/org/apache/pinot/client/BrokerSelector.java
+++ b/pinot-api/src/main/java/org/apache/pinot/client/BrokerSelector.java
@@ -24,6 +24,5 @@ public interface BrokerSelector {
* @param table
* @return
*/
- String selectBroker(String table);
-
+ String selectBroker(String table);
}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/Connection.java b/pinot-api/src/main/java/org/apache/pinot/client/Connection.java
index 023cb64..44ee072 100644
--- a/pinot-api/src/main/java/org/apache/pinot/client/Connection.java
+++ b/pinot-api/src/main/java/org/apache/pinot/client/Connection.java
@@ -43,7 +43,7 @@ public class Connection {
_transport = transport;
}
- Connection(BrokerSelector brokerSelector , PinotClientTransport transport) {
+ Connection(BrokerSelector brokerSelector, PinotClientTransport transport) {
_brokerSelector = brokerSelector;
_transport = transport;
}
@@ -64,7 +64,8 @@ public class Connection {
* @return The result of the query
* @throws PinotClientException If an exception occurs while processing the query
*/
- public ResultSetGroup execute(String statement) throws PinotClientException {
+ public ResultSetGroup execute(String statement)
+ throws PinotClientException {
return execute(null, statement);
}
@@ -75,11 +76,12 @@ public class Connection {
* @return The result of the query
* @throws PinotClientException If an exception occurs while processing the query
*/
- public ResultSetGroup execute(String tableName, String statement) throws PinotClientException {
+ public ResultSetGroup execute(String tableName, String statement)
+ throws PinotClientException {
String brokerHostPort = _brokerSelector.selectBroker(tableName);
if (brokerHostPort == null) {
- throw new PinotClientException("Could not find broker to query for table: " +
- (tableName == null ? "null" : tableName));
+ throw new PinotClientException(
+ "Could not find broker to query for table: " + (tableName == null ? "null" : tableName));
}
BrokerResponse response = _transport.executeQuery(brokerHostPort, statement);
if (response.hasExceptions()) {
@@ -95,11 +97,12 @@ public class Connection {
* @return A future containing the result of the query
* @throws PinotClientException If an exception occurs while processing the query
*/
- public Future<ResultSetGroup> executeAsync(String statement) throws PinotClientException {
+ public Future<ResultSetGroup> executeAsync(String statement)
+ throws PinotClientException {
String brokerHostPort = _brokerSelector.selectBroker(null);
if (brokerHostPort == null) {
- throw new PinotClientException("Could not find broker to query for statement: " +
- (statement == null ? "null" : statement));
+ throw new PinotClientException(
+ "Could not find broker to query for statement: " + (statement == null ? "null" : statement));
}
final Future<BrokerResponse> responseFuture = _transport.executeQueryAsync(brokerHostPort, statement);
return new ResultSetGroupFuture(responseFuture);
@@ -137,7 +140,8 @@ public class Connection {
}
@Override
- public ResultSetGroup get() throws InterruptedException, ExecutionException {
+ public ResultSetGroup get()
+ throws InterruptedException, ExecutionException {
try {
return get(1000L, TimeUnit.DAYS);
} catch (TimeoutException e) {
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/ConnectionFactory.java b/pinot-api/src/main/java/org/apache/pinot/client/ConnectionFactory.java
index a6805d9..9992b9f 100644
--- a/pinot-api/src/main/java/org/apache/pinot/client/ConnectionFactory.java
+++ b/pinot-api/src/main/java/org/apache/pinot/client/ConnectionFactory.java
@@ -21,6 +21,7 @@ package org.apache.pinot.client;
import java.util.Arrays;
import java.util.Properties;
+
/**
* Creates connections to Pinot, given various initialization methods.
*/
@@ -52,7 +53,8 @@ public class ConnectionFactory {
* @return A connection that connects to the brokers specified in the properties
*/
public static Connection fromProperties(Properties properties) {
- return new Connection(Arrays.asList(properties.getProperty("brokerList").split(",")), _transportFactory.buildTransport());
+ return new Connection(Arrays.asList(properties.getProperty("brokerList").split(",")),
+ _transportFactory.buildTransport());
}
/**
@@ -63,5 +65,5 @@ public class ConnectionFactory {
*/
public static Connection fromHostList(String... brokers) {
return new Connection(Arrays.asList(brokers), _transportFactory.buildTransport());
- }
+ }
}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/DynamicBrokerSelector.java b/pinot-api/src/main/java/org/apache/pinot/client/DynamicBrokerSelector.java
index e733a42..ca9a0d3 100644
--- a/pinot-api/src/main/java/org/apache/pinot/client/DynamicBrokerSelector.java
+++ b/pinot-api/src/main/java/org/apache/pinot/client/DynamicBrokerSelector.java
@@ -39,8 +39,7 @@ import static org.apache.pinot.client.ExternalViewReader.REALTIME_SUFFIX;
* Maintains a mapping between table name and list of brokers
*/
public class DynamicBrokerSelector implements BrokerSelector, IZkDataListener {
- AtomicReference<Map<String, List<String>>> tableToBrokerListMapRef =
- new AtomicReference<Map<String, List<String>>>();
+ AtomicReference<Map<String, List<String>>> tableToBrokerListMapRef = new AtomicReference<Map<String, List<String>>>();
AtomicReference<List<String>> allBrokerListRef = new AtomicReference<List<String>>();
private final Random _random = new Random();
private ExternalViewReader evReader;
@@ -64,8 +63,9 @@ public class DynamicBrokerSelector implements BrokerSelector, IZkDataListener {
allBrokerListRef.set(new ArrayList<>(brokerSet));
}
+ @Nullable
@Override
- public @Nullable String selectBroker(String table) {
+ public String selectBroker(String table) {
if (table == null) {
List<String> list = allBrokerListRef.get();
if (list != null && !list.isEmpty()) {
@@ -83,12 +83,14 @@ public class DynamicBrokerSelector implements BrokerSelector, IZkDataListener {
}
@Override
- public void handleDataChange(String dataPath, Object data) throws Exception {
+ public void handleDataChange(String dataPath, Object data)
+ throws Exception {
refresh();
}
@Override
- public void handleDataDeleted(String dataPath) throws Exception {
+ public void handleDataDeleted(String dataPath)
+ throws Exception {
refresh();
}
}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java b/pinot-api/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
index 63b13a5..7c99d99 100644
--- a/pinot-api/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
+++ b/pinot-api/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
@@ -41,7 +41,8 @@ class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
AsyncHttpClient _httpClient = new AsyncHttpClient();
@Override
- public BrokerResponse executeQuery(String brokerAddress, String query) throws PinotClientException {
+ public BrokerResponse executeQuery(String brokerAddress, String query)
+ throws PinotClientException {
try {
return executeQueryAsync(brokerAddress, query).get();
} catch (Exception e) {
@@ -92,12 +93,14 @@ class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
}
@Override
- public BrokerResponse get() throws ExecutionException {
+ public BrokerResponse get()
+ throws ExecutionException {
return get(1000L, TimeUnit.DAYS);
}
@Override
- public BrokerResponse get(long timeout, TimeUnit unit) throws ExecutionException {
+ public BrokerResponse get(long timeout, TimeUnit unit)
+ throws ExecutionException {
try {
LOGGER.debug("Sending query {} to {}", _query, _url);
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/PinotClientTransport.java b/pinot-api/src/main/java/org/apache/pinot/client/PinotClientTransport.java
index 9c2dffd..f4168e1 100644
--- a/pinot-api/src/main/java/org/apache/pinot/client/PinotClientTransport.java
+++ b/pinot-api/src/main/java/org/apache/pinot/client/PinotClientTransport.java
@@ -25,6 +25,9 @@ import java.util.concurrent.Future;
* Interface for plugging different client transports.
*/
interface PinotClientTransport {
- BrokerResponse executeQuery(String brokerAddress, String query) throws PinotClientException;
- Future<BrokerResponse> executeQueryAsync(String brokerAddress, String query) throws PinotClientException;
+ BrokerResponse executeQuery(String brokerAddress, String query)
+ throws PinotClientException;
+
+ Future<BrokerResponse> executeQueryAsync(String brokerAddress, String query)
+ throws PinotClientException;
}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/ResultSet.java b/pinot-api/src/main/java/org/apache/pinot/client/ResultSet.java
index 69c4c74..05e1e21 100644
--- a/pinot-api/src/main/java/org/apache/pinot/client/ResultSet.java
+++ b/pinot-api/src/main/java/org/apache/pinot/client/ResultSet.java
@@ -139,10 +139,10 @@ public interface ResultSet {
/**
* Get the group key name for the given key column index. use getGroupKeyLength() to know the number of groupKey
* @param groupKeyColumnIndex
- * @return group key column name
+ * @return group key column name
*/
String getGroupKeyColumnName(int groupKeyColumnIndex);
-
+
/**
* Obtains the group key value for the given row and key column index.
*
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/SimpleBrokerSelector.java b/pinot-api/src/main/java/org/apache/pinot/client/SimpleBrokerSelector.java
index 97a8ddd..d171c31 100644
--- a/pinot-api/src/main/java/org/apache/pinot/client/SimpleBrokerSelector.java
+++ b/pinot-api/src/main/java/org/apache/pinot/client/SimpleBrokerSelector.java
@@ -21,6 +21,7 @@ package org.apache.pinot.client;
import java.util.List;
import java.util.Random;
+
/**
* Picks a broker randomly from list of brokers provided. This assumes that all the provided brokers
* are healthy. There is no health check done on the brokers
@@ -38,5 +39,4 @@ public class SimpleBrokerSelector implements BrokerSelector {
public String selectBroker(String table) {
return _brokerList.get(_random.nextInt(_brokerList.size()));
}
-
}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/TextTable.java b/pinot-api/src/main/java/org/apache/pinot/client/TextTable.java
index bde857d..ce7499b 100644
--- a/pinot-api/src/main/java/org/apache/pinot/client/TextTable.java
+++ b/pinot-api/src/main/java/org/apache/pinot/client/TextTable.java
@@ -21,6 +21,7 @@ package org.apache.pinot.client;
import java.util.LinkedList;
import java.util.List;
+
/**
* Utility class to format tabular data. Useful to display on console for debugging
*/
@@ -119,5 +120,4 @@ public class TextTable {
}
return String.valueOf(buf);
}
-
}
diff --git a/pinot-api/src/test/java/org/apache/pinot/client/ConnectionFactoryTest.java b/pinot-api/src/test/java/org/apache/pinot/client/ConnectionFactoryTest.java
index fecf5cb..81a26bc 100644
--- a/pinot-api/src/test/java/org/apache/pinot/client/ConnectionFactoryTest.java
+++ b/pinot-api/src/test/java/org/apache/pinot/client/ConnectionFactoryTest.java
@@ -23,6 +23,7 @@ import java.util.List;
import org.testng.Assert;
import org.testng.annotations.Test;
+
/**
* Tests for the connection factory
*/
@@ -58,6 +59,7 @@ public class ConnectionFactoryTest {
}
// For testing DynamicBrokerSelector
+
/**
* ConnectionFactoryTest <ZK_URL> <tableName> <query>
* @param args
@@ -73,5 +75,4 @@ public class ConnectionFactoryTest {
ResultSetGroup resultSetGroup = connection.execute(tableName, args[2]);
System.out.println(resultSetGroup);
}
-
}
diff --git a/pinot-api/src/test/java/org/apache/pinot/client/ResultSetGroupTest.java b/pinot-api/src/test/java/org/apache/pinot/client/ResultSetGroupTest.java
index 45842ee..737588d 100644
--- a/pinot-api/src/test/java/org/apache/pinot/client/ResultSetGroupTest.java
+++ b/pinot-api/src/test/java/org/apache/pinot/client/ResultSetGroupTest.java
@@ -55,14 +55,16 @@ public class ResultSetGroupTest {
}
@Test
- public void testDeserializeAggregationResultSet() throws Exception {
+ public void testDeserializeAggregationResultSet()
+ throws Exception {
// Deserialize aggregation result
ResultSetGroup resultSetGroup = getResultSet("aggregation.json");
// Check length and number of result groups
Assert.assertEquals(resultSetGroup.getResultSetCount(), 1, "Result set count mismatch");
ResultSet resultSet = resultSetGroup.getResultSet(0);
- Assert.assertEquals(resultSet.getGroupKeyLength(), 0, "Expected 0 length group key for non-group by aggregation query");
+ Assert.assertEquals(resultSet.getGroupKeyLength(), 0,
+ "Expected 0 length group key for non-group by aggregation query");
Assert.assertEquals(resultSet.getRowCount(), 1, "Result group length mismatch");
// Check that values match and are in the same order
@@ -129,7 +131,7 @@ public class ResultSetGroupTest {
InputStream stream = getClass().getResourceAsStream(_resource);
int lastByte = stream.read();
while (lastByte != -1) {
- builder.append((char)lastByte);
+ builder.append((char) lastByte);
lastByte = stream.read();
}
String jsonText = builder.toString();
diff --git a/pinot-azure-filesystem/src/main/java/org/apache/pinot/filesystem/AzurePinotFS.java b/pinot-azure-filesystem/src/main/java/org/apache/pinot/filesystem/AzurePinotFS.java
index 9a5f9fa..766b2d4 100644
--- a/pinot-azure-filesystem/src/main/java/org/apache/pinot/filesystem/AzurePinotFS.java
+++ b/pinot-azure-filesystem/src/main/java/org/apache/pinot/filesystem/AzurePinotFS.java
@@ -77,29 +77,29 @@ public class AzurePinotFS extends PinotFS {
// The secret key used to authenticate this application
String clientSecret = config.getString(CommonConstants.SegmentOperations.AzureSegmentOperations.CLIENT_SECRET);
- AccessTokenProvider tokenProvider =
- new ClientCredsTokenProvider(authEndpoint, clientId, clientSecret);
+ AccessTokenProvider tokenProvider = new ClientCredsTokenProvider(authEndpoint, clientId, clientSecret);
_adlStoreClient = ADLStoreClient.createClient(account, tokenProvider);
}
@Override
- public boolean mkdir(URI uri) throws IOException {
+ public boolean mkdir(URI uri)
+ throws IOException {
return _adlStoreClient.createDirectory(uri.getPath());
}
@Override
- public boolean delete(URI segmentUri, boolean forceDelete) throws IOException {
+ public boolean delete(URI segmentUri, boolean forceDelete)
+ throws IOException {
// Returns false if directory we want to delete is not empty
- if (isDirectory(segmentUri)
- && listFiles(segmentUri, false).length > 0
- && !forceDelete) {
+ if (isDirectory(segmentUri) && listFiles(segmentUri, false).length > 0 && !forceDelete) {
return false;
}
return _adlStoreClient.deleteRecursive(segmentUri.getPath());
}
@Override
- public boolean move(URI srcUri, URI dstUri, boolean overwrite) throws IOException {
+ public boolean move(URI srcUri, URI dstUri, boolean overwrite)
+ throws IOException {
if (exists(dstUri) && !overwrite) {
return false;
}
@@ -108,7 +108,8 @@ public class AzurePinotFS extends PinotFS {
}
@Override
- public boolean copy(URI srcUri, URI dstUri) throws IOException {
+ public boolean copy(URI srcUri, URI dstUri)
+ throws IOException {
if (exists(dstUri)) {
delete(dstUri, true);
}
@@ -126,26 +127,30 @@ public class AzurePinotFS extends PinotFS {
inputStream.close();
outputStream.close();
} catch (IOException e) {
- LOGGER.error("Exception encountered during copy, input: '{}', output: '{}'.", srcUri.toString(),
- dstUri.toString(), e);
+ LOGGER
+ .error("Exception encountered during copy, input: '{}', output: '{}'.", srcUri.toString(), dstUri.toString(),
+ e);
}
return true;
}
@Override
- public boolean exists(URI fileUri) throws IOException {
+ public boolean exists(URI fileUri)
+ throws IOException {
return _adlStoreClient.checkExists(fileUri.getPath());
}
@Override
- public long length(URI fileUri) throws IOException {
+ public long length(URI fileUri)
+ throws IOException {
// get file metadata
DirectoryEntry ent = _adlStoreClient.getDirectoryEntry(fileUri.getPath());
return ent.length;
}
@Override
- public String[] listFiles(URI fileUri, boolean recursive) throws IOException {
+ public String[] listFiles(URI fileUri, boolean recursive)
+ throws IOException {
DirectoryEntry rootDir = _adlStoreClient.getDirectoryEntry(fileUri.getPath());
if (rootDir == null) {
return EMPTY_ARR;
@@ -168,7 +173,8 @@ public class AzurePinotFS extends PinotFS {
return fullFilePaths.toArray(new String[fullFilePaths.size()]);
}
- private List<DirectoryEntry> listFiles(DirectoryEntry origDirEntry) throws IOException {
+ private List<DirectoryEntry> listFiles(DirectoryEntry origDirEntry)
+ throws IOException {
List<DirectoryEntry> fileList = new ArrayList<>();
if (origDirEntry.type.equals(DirectoryEntryType.DIRECTORY)) {
for (DirectoryEntry directoryEntry : _adlStoreClient.enumerateDirectory(origDirEntry.fullName)) {
@@ -182,7 +188,8 @@ public class AzurePinotFS extends PinotFS {
}
@Override
- public void copyToLocalFile(URI srcUri, File dstFile) throws Exception {
+ public void copyToLocalFile(URI srcUri, File dstFile)
+ throws Exception {
if (dstFile.exists()) {
if (dstFile.isDirectory()) {
FileUtils.deleteDirectory(dstFile);
@@ -198,14 +205,14 @@ public class AzurePinotFS extends PinotFS {
* Set new file permissions on the copied file.
*/
Files.copy(adlStream, dstFilePath);
-
} catch (Exception ex) {
throw ex;
}
}
@Override
- public void copyFromLocalFile(File srcFile, URI dstUri) throws Exception {
+ public void copyFromLocalFile(File srcFile, URI dstUri)
+ throws Exception {
OutputStream stream = _adlStoreClient.createFile(dstUri.getPath(), IfExists.OVERWRITE);
PrintStream out = new PrintStream(stream);
byte[] inputStream = IOUtils.toByteArray(new FileInputStream(srcFile));
@@ -237,7 +244,8 @@ public class AzurePinotFS extends PinotFS {
}
@Override
- public boolean touch(URI uri) throws IOException {
+ public boolean touch(URI uri)
+ throws IOException {
if (!exists(uri)) {
_adlStoreClient.createEmptyFile(uri.getPath());
} else {
diff --git a/pinot-azure-filesystem/src/test/java/com/microsoft/azure/datalake/store/MockADLFileInputStream.java b/pinot-azure-filesystem/src/test/java/com/microsoft/azure/datalake/store/MockADLFileInputStream.java
index 1a7351f..c766d88 100644
--- a/pinot-azure-filesystem/src/test/java/com/microsoft/azure/datalake/store/MockADLFileInputStream.java
+++ b/pinot-azure-filesystem/src/test/java/com/microsoft/azure/datalake/store/MockADLFileInputStream.java
@@ -41,32 +41,38 @@ public final class MockADLFileInputStream extends ADLFileInputStream {
}
@Override
- public int read() throws IOException {
+ public int read()
+ throws IOException {
return _in.read();
}
@Override
- public int read(byte[] b) throws IOException {
+ public int read(byte[] b)
+ throws IOException {
return _in.read(b);
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(byte[] b, int off, int len)
+ throws IOException {
return _in.read(b, off, len);
}
@Override
- public long skip(long n) throws IOException {
+ public long skip(long n)
+ throws IOException {
return _in.skip(n);
}
@Override
- public int available() throws IOException {
+ public int available()
+ throws IOException {
return _in.available();
}
@Override
- public void close() throws IOException {
+ public void close()
+ throws IOException {
_in.close();
}
@@ -76,7 +82,8 @@ public final class MockADLFileInputStream extends ADLFileInputStream {
}
@Override
- public synchronized void reset() throws IOException {
+ public synchronized void reset()
+ throws IOException {
_in.reset();
}
diff --git a/pinot-azure-filesystem/src/test/java/org/apache/pinot/filesystem/test/AzurePinotFSTest.java b/pinot-azure-filesystem/src/test/java/org/apache/pinot/filesystem/test/AzurePinotFSTest.java
index aa742f2..b4d6852 100644
--- a/pinot-azure-filesystem/src/test/java/org/apache/pinot/filesystem/test/AzurePinotFSTest.java
+++ b/pinot-azure-filesystem/src/test/java/org/apache/pinot/filesystem/test/AzurePinotFSTest.java
@@ -44,8 +44,10 @@ public class AzurePinotFSTest {
private File _testFile;
@BeforeMethod
- public void setup() throws IOException {
- _adlLocation = new File(System.getProperty("java.io.tmpdir"), AzurePinotFSTest.class.getSimpleName()).getAbsolutePath();
+ public void setup()
+ throws IOException {
+ _adlLocation =
+ new File(System.getProperty("java.io.tmpdir"), AzurePinotFSTest.class.getSimpleName()).getAbsolutePath();
FileUtils.deleteQuietly(new File(_adlLocation));
Assert.assertTrue(new File(_adlLocation).mkdir(), "Could not make directory" + _adlLocation);
@@ -60,7 +62,8 @@ public class AzurePinotFSTest {
}
@Test
- public void testFS() throws Exception {
+ public void testFS()
+ throws Exception {
ADLStoreClient adlStoreClient = Mockito.mock(ADLStoreClient.class);
Mockito.when(adlStoreClient.checkExists(_adlLocation)).thenReturn(true);
Mockito.when(adlStoreClient.checkExists(_testFile.getPath())).thenReturn(true);
@@ -71,8 +74,8 @@ public class AzurePinotFSTest {
Assert.assertTrue(azurePinotFS.exists(new URI(_adlLocation)));
File file = new File(_adlLocation, "testfile2");
- MockADLFileInputStream adlFileInputStream = new MockADLFileInputStream(
- new ByteArrayInputStream(Files.readAllBytes(Paths.get(testFileURI))));
+ MockADLFileInputStream adlFileInputStream =
+ new MockADLFileInputStream(new ByteArrayInputStream(Files.readAllBytes(Paths.get(testFileURI))));
Mockito.when(adlStoreClient.getReadStream(ArgumentMatchers.anyString())).thenReturn(adlFileInputStream);
azurePinotFS.copyToLocalFile(testFileURI, file);
Assert.assertTrue(file.exists());
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/api/RequestStatistics.java b/pinot-broker/src/main/java/org/apache/pinot/broker/api/RequestStatistics.java
index 2709692..5607cb0 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/api/RequestStatistics.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/api/RequestStatistics.java
@@ -67,9 +67,7 @@ public class RequestStatistics {
private long _reduceTimeMillis;
public enum FanoutType {
- OFFLINE,
- REALTIME,
- HYBRID
+ OFFLINE, REALTIME, HYBRID
}
private FanoutType _fanoutType;
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerDebug.java b/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerDebug.java
index d2e8c3d..c2db05d 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerDebug.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerDebug.java
@@ -59,13 +59,8 @@ public class PinotBrokerDebug {
@Produces(MediaType.APPLICATION_JSON)
@Path("/routingTable/{tableName}")
@ApiOperation(value = "Debugging routing table")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Routing table information of a table"),
- @ApiResponse(code = 500, message = "Internal server error")
- })
- public String debugRoutingTable(
- @ApiParam(value = "Name of the table") @PathParam("tableName") String tableName
- ) {
+ @ApiResponses(value = {@ApiResponse(code = 200, message = "Routing table information of a table"), @ApiResponse(code = 500, message = "Internal server error")})
+ public String debugRoutingTable(@ApiParam(value = "Name of the table") @PathParam("tableName") String tableName) {
try {
return _routingTable.dumpSnapshot(tableName);
} catch (Exception e) {
@@ -79,13 +74,9 @@ public class PinotBrokerDebug {
@Produces(MediaType.APPLICATION_JSON)
@Path("/timeBoundary/{tableName}")
@ApiOperation(value = "Debugging time boundary service")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Time boundary information of a table"),
- @ApiResponse(code = 500, message = "Internal server error")
- })
+ @ApiResponses(value = {@ApiResponse(code = 200, message = "Time boundary information of a table"), @ApiResponse(code = 500, message = "Internal server error")})
public String debugTimeBoundaryService(
- @ApiParam(value = "Name of the table") @PathParam("tableName") String tableName
- ) {
+ @ApiParam(value = "Name of the table") @PathParam("tableName") String tableName) {
try {
String response = "{}";
if (!tableName.isEmpty()) {
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerHealthCheck.java b/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerHealthCheck.java
index dcdafab..7f92090 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerHealthCheck.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerHealthCheck.java
@@ -33,6 +33,7 @@ import org.apache.pinot.broker.broker.BrokerServerBuilder;
import org.apache.pinot.common.metrics.BrokerMeter;
import org.apache.pinot.common.metrics.BrokerMetrics;
+
@Api(tags = "Health")
@Path("/")
public class PinotBrokerHealthCheck {
@@ -47,10 +48,7 @@ public class PinotBrokerHealthCheck {
@Produces(MediaType.TEXT_PLAIN)
@Path("health")
@ApiOperation(value = "Checking broker health")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Broker is healthy"),
- @ApiResponse(code = 503, message = "Broker is disabled")
- })
+ @ApiResponses(value = {@ApiResponse(code = 200, message = "Broker is healthy"), @ApiResponse(code = 503, message = "Broker is disabled")})
public String getBrokerHealth() {
if (brokerServerBuilder != null
&& this.brokerServerBuilder.getCurrentState() == BrokerServerBuilder.State.RUNNING) {
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java b/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java
index 1c24ee9..09c92c6 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java
@@ -63,10 +63,7 @@ public class PinotClientRequest {
@Produces(MediaType.APPLICATION_JSON)
@Path("query")
@ApiOperation(value = "Querying pinot")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Query response"),
- @ApiResponse(code = 500, message = "Internal Server Error")
- })
+ @ApiResponses(value = {@ApiResponse(code = 200, message = "Query response"), @ApiResponse(code = 500, message = "Internal Server Error")})
public String processQueryGet(
// Query param "bql" is for backward compatibility
@ApiParam(value = "Query", required = true) @QueryParam("bql") String query,
@@ -94,10 +91,7 @@ public class PinotClientRequest {
@Produces(MediaType.APPLICATION_JSON)
@Path("query")
@ApiOperation(value = "Querying pinot")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Query response"),
- @ApiResponse(code = 500, message = "Internal Server Error")
- })
+ @ApiResponses(value = {@ApiResponse(code = 200, message = "Query response"), @ApiResponse(code = 500, message = "Internal Server Error")})
public String processQueryPost(String query) {
try {
JsonNode requestJson = JsonUtils.stringToJsonNode(query);
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/AccessControlFactory.java b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/AccessControlFactory.java
index ef00605..046d3b5 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/AccessControlFactory.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/AccessControlFactory.java
@@ -28,9 +28,9 @@ public abstract class AccessControlFactory {
public static final Logger LOGGER = LoggerFactory.getLogger(AccessControlFactory.class);
public static final String ACCESS_CONTROL_CLASS_CONFIG = "class";
- public abstract void init(Configuration confguration);
+ public abstract void init(Configuration confguration);
- public abstract AccessControl create();
+ public abstract AccessControl create();
public static AccessControlFactory loadFactory(Configuration configuration) {
AccessControlFactory accessControlFactory;
@@ -40,7 +40,7 @@ public abstract class AccessControlFactory {
}
try {
LOGGER.info("Instantiating Access control factory class {}", accessControlFactoryClassName);
- accessControlFactory = (AccessControlFactory) Class.forName(accessControlFactoryClassName).newInstance();
+ accessControlFactory = (AccessControlFactory) Class.forName(accessControlFactoryClassName).newInstance();
LOGGER.info("Initializing Access control factory class {}", accessControlFactoryClassName);
accessControlFactory.init(configuration);
return accessControlFactory;
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/AllowAllAccessControlFactory.java b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/AllowAllAccessControlFactory.java
index 4a01bad..b424278 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/AllowAllAccessControlFactory.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/AllowAllAccessControlFactory.java
@@ -26,6 +26,7 @@ import org.apache.pinot.common.request.BrokerRequest;
public class AllowAllAccessControlFactory extends AccessControlFactory {
private final AccessControl _accessControl;
+
public AllowAllAccessControlFactory() {
_accessControl = new AllowAllAccessControl();
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/BrokerServerBuilder.java b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/BrokerServerBuilder.java
index 2224743..dced4b2 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/BrokerServerBuilder.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/BrokerServerBuilder.java
@@ -50,11 +50,7 @@ public class BrokerServerBuilder {
public static final String SINGLE_CONNECTION_REQUEST_HANDLER_TYPE = "singleConnection";
public enum State {
- INIT,
- STARTING,
- RUNNING,
- SHUTTING_DOWN,
- SHUTDOWN
+ INIT, STARTING, RUNNING, SHUTTING_DOWN, SHUTDOWN
}
// Running State Of broker
@@ -112,8 +108,8 @@ public class BrokerServerBuilder {
_state.set(State.STARTING);
_brokerRequestHandler.start();
- _brokerAdminApplication.start(_config.getInt(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT,
- CommonConstants.Helix.DEFAULT_BROKER_QUERY_PORT));
+ _brokerAdminApplication.start(_config
+ .getInt(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT, CommonConstants.Helix.DEFAULT_BROKER_QUERY_PORT));
_state.set(State.RUNNING);
LOGGER.info("Pinot Broker started");
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BrokerResourceOnlineOfflineStateModelFactory.java b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BrokerResourceOnlineOfflineStateModelFactory.java
index a324328..1916d86 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BrokerResourceOnlineOfflineStateModelFactory.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BrokerResourceOnlineOfflineStateModelFactory.java
@@ -92,13 +92,11 @@ public class BrokerResourceOnlineOfflineStateModelFactory extends StateModelFact
List<InstanceConfig> instanceConfigList = helixDataAccessor.getChildValues(keyBuilder.instanceConfigs());
TableConfig tableConfig = ZKMetadataProvider.getTableConfig(_propertyStore, tableName);
- _helixExternalViewBasedRouting.markDataResourceOnline(
- tableConfig,
+ _helixExternalViewBasedRouting.markDataResourceOnline(tableConfig,
HelixHelper.getExternalViewForResource(_helixAdmin, _helixManager.getClusterName(), tableName),
instanceConfigList);
- _tableQueryQuotaManager.initTableQueryQuota(
- tableConfig,
- HelixHelper.getExternalViewForResource(_helixAdmin, _helixManager.getClusterName(), BROKER_RESOURCE_INSTANCE));
+ _tableQueryQuotaManager.initTableQueryQuota(tableConfig, HelixHelper
+ .getExternalViewForResource(_helixAdmin, _helixManager.getClusterName(), BROKER_RESOURCE_INSTANCE));
} catch (Exception e) {
LOGGER.error("Caught exception during OFFLINE -> ONLINE transition", e);
Utils.rethrowException(e);
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/ClusterChangeMediator.java b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/ClusterChangeMediator.java
index ae87a7f..9a8be33 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/ClusterChangeMediator.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/ClusterChangeMediator.java
@@ -48,8 +48,7 @@ public class ClusterChangeMediator implements LiveInstanceChangeListener, Extern
private final TableQueryQuotaManager _tableQueryQuotaManager;
private enum UpdateType {
- EXTERNAL_VIEW,
- INSTANCE_CONFIG
+ EXTERNAL_VIEW, INSTANCE_CONFIG
}
private final LinkedBlockingQueue<Pair<UpdateType, Long>> _clusterChangeQueue = new LinkedBlockingQueue<>(1000);
@@ -57,8 +56,7 @@ public class ClusterChangeMediator implements LiveInstanceChangeListener, Extern
private Thread _deferredClusterUpdater = null;
public ClusterChangeMediator(HelixExternalViewBasedRouting helixExternalViewBasedRouting,
- TableQueryQuotaManager tableQueryQuotaManager,
- final BrokerMetrics brokerMetrics) {
+ TableQueryQuotaManager tableQueryQuotaManager, final BrokerMetrics brokerMetrics) {
_helixExternalViewBasedRouting = helixExternalViewBasedRouting;
_tableQueryQuotaManager = tableQueryQuotaManager;
@@ -132,7 +130,8 @@ public class ClusterChangeMediator implements LiveInstanceChangeListener, Extern
LOGGER.warn("Was interrupted while trying to add external view change to queue", e);
}
} else {
- LOGGER.warn("Deferred cluster updater thread is null or stopped, not deferring external view routing table rebuild");
+ LOGGER.warn(
+ "Deferred cluster updater thread is null or stopped, not deferring external view routing table rebuild");
_helixExternalViewBasedRouting.processExternalViewChange();
_tableQueryQuotaManager.processQueryQuotaChange();
}
@@ -148,7 +147,8 @@ public class ClusterChangeMediator implements LiveInstanceChangeListener, Extern
LOGGER.warn("Was interrupted while trying to add external view change to queue", e);
}
} else {
- LOGGER.warn("Deferred cluster updater thread is null or stopped, not deferring instance config change notification");
+ LOGGER.warn(
+ "Deferred cluster updater thread is null or stopped, not deferring instance config change notification");
_helixExternalViewBasedRouting.processInstanceConfigChange();
}
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/HelixBrokerStarter.java b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/HelixBrokerStarter.java
index 3d75a0b..c446c70 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/HelixBrokerStarter.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/HelixBrokerStarter.java
@@ -78,15 +78,15 @@ public class HelixBrokerStarter {
private static final Logger LOGGER = LoggerFactory.getLogger(HelixBrokerStarter.class);
- private static final String ROUTING_TABLE_PARAMS_SUBSET_KEY =
- "pinot.broker.routing.table";
+ private static final String ROUTING_TABLE_PARAMS_SUBSET_KEY = "pinot.broker.routing.table";
public HelixBrokerStarter(String helixClusterName, String zkServer, Configuration pinotHelixProperties)
throws Exception {
this(null, helixClusterName, zkServer, pinotHelixProperties);
}
- public HelixBrokerStarter(String brokerHost, String helixClusterName, String zkServer, Configuration pinotHelixProperties)
+ public HelixBrokerStarter(String brokerHost, String helixClusterName, String zkServer,
+ Configuration pinotHelixProperties)
throws Exception {
LOGGER.info("Starting Pinot broker");
@@ -98,14 +98,9 @@ public class HelixBrokerStarter {
brokerHost = NetUtil.getHostAddress();
}
- final String brokerId =
- _pinotHelixProperties.getString(
- CommonConstants.Helix.Instance.INSTANCE_ID_KEY,
- CommonConstants.Helix.PREFIX_OF_BROKER_INSTANCE
- + brokerHost
- + "_"
- + _pinotHelixProperties.getInt(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT,
- CommonConstants.Helix.DEFAULT_BROKER_QUERY_PORT));
+ final String brokerId = _pinotHelixProperties.getString(CommonConstants.Helix.Instance.INSTANCE_ID_KEY,
+ CommonConstants.Helix.PREFIX_OF_BROKER_INSTANCE + brokerHost + "_" + _pinotHelixProperties
+ .getInt(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT, CommonConstants.Helix.DEFAULT_BROKER_QUERY_PORT));
_pinotHelixProperties.addProperty(CommonConstants.Broker.CONFIG_OF_BROKER_ID, brokerId);
setupHelixSystemProperties();
@@ -126,7 +121,8 @@ public class HelixBrokerStarter {
_brokerServerBuilder = startBroker(_pinotHelixProperties);
_metricsRegistry = _brokerServerBuilder.getMetricsRegistry();
ClusterChangeMediator clusterChangeMediator =
- new ClusterChangeMediator(_helixExternalViewBasedRouting, _tableQueryQuotaManager, _brokerServerBuilder.getBrokerMetrics());
+ new ClusterChangeMediator(_helixExternalViewBasedRouting, _tableQueryQuotaManager,
+ _brokerServerBuilder.getBrokerMetrics());
_spectatorHelixManager.addExternalViewChangeListener(clusterChangeMediator);
_spectatorHelixManager.addInstanceConfigChangeListener(clusterChangeMediator);
_spectatorHelixManager.addLiveInstanceChangeListener(_liveInstancesListener);
@@ -138,48 +134,44 @@ public class HelixBrokerStarter {
StateModelFactory<?> stateModelFactory =
new BrokerResourceOnlineOfflineStateModelFactory(_spectatorHelixManager, _propertyStore,
_helixExternalViewBasedRouting, _tableQueryQuotaManager);
- stateMachineEngine.registerStateModelFactory(BrokerResourceOnlineOfflineStateModelFactory.getStateModelDef(),
- stateModelFactory);
+ stateMachineEngine
+ .registerStateModelFactory(BrokerResourceOnlineOfflineStateModelFactory.getStateModelDef(), stateModelFactory);
_helixManager.connect();
- _tbiMessageHandler = new TimeboundaryRefreshMessageHandlerFactory
- (_helixExternalViewBasedRouting,
- _pinotHelixProperties.getLong(
- CommonConstants.Broker.CONFIG_OF_BROKER_REFRESH_TIMEBOUNDARY_INFO_SLEEP_INTERVAL,
- CommonConstants.Broker.DEFAULT_BROKER_REFRESH_TIMEBOUNDARY_INFO_SLEEP_INTERVAL_MS));
- _helixManager.getMessagingService().registerMessageHandlerFactory(
- Message.MessageType.USER_DEFINE_MSG.toString(), _tbiMessageHandler);
+ _tbiMessageHandler = new TimeboundaryRefreshMessageHandlerFactory(_helixExternalViewBasedRouting,
+ _pinotHelixProperties.getLong(CommonConstants.Broker.CONFIG_OF_BROKER_REFRESH_TIMEBOUNDARY_INFO_SLEEP_INTERVAL,
+ CommonConstants.Broker.DEFAULT_BROKER_REFRESH_TIMEBOUNDARY_INFO_SLEEP_INTERVAL_MS));
+ _helixManager.getMessagingService()
+ .registerMessageHandlerFactory(Message.MessageType.USER_DEFINE_MSG.toString(), _tbiMessageHandler);
addInstanceTagIfNeeded(helixClusterName, brokerId);
// Register the service status handler
- ServiceStatus.setServiceStatusCallback(
- new ServiceStatus.MultipleCallbackServiceStatusCallback(ImmutableList.of(
- new ServiceStatus.IdealStateAndCurrentStateMatchServiceStatusCallback(_helixManager, helixClusterName, brokerId),
- new ServiceStatus.IdealStateAndExternalViewMatchServiceStatusCallback(_helixManager, helixClusterName, brokerId)
- )));
-
- _brokerServerBuilder.getBrokerMetrics().addCallbackGauge(
- "helix.connected", new Callable<Long>() {
- @Override
- public Long call() throws Exception {
- return _helixManager.isConnected() ? 1L : 0L;
- }
- });
-
- _helixManager.addPreConnectCallback(
- new PreConnectCallback() {
- @Override
- public void onPreConnect() {
- _brokerServerBuilder.getBrokerMetrics()
- .addMeteredGlobalValue(BrokerMeter.HELIX_ZOOKEEPER_RECONNECTS, 1L);
- }
- });
+ ServiceStatus.setServiceStatusCallback(new ServiceStatus.MultipleCallbackServiceStatusCallback(ImmutableList
+ .of(new ServiceStatus.IdealStateAndCurrentStateMatchServiceStatusCallback(_helixManager, helixClusterName,
+ brokerId),
+ new ServiceStatus.IdealStateAndExternalViewMatchServiceStatusCallback(_helixManager, helixClusterName,
+ brokerId))));
+
+ _brokerServerBuilder.getBrokerMetrics().addCallbackGauge("helix.connected", new Callable<Long>() {
+ @Override
+ public Long call()
+ throws Exception {
+ return _helixManager.isConnected() ? 1L : 0L;
+ }
+ });
+
+ _helixManager.addPreConnectCallback(new PreConnectCallback() {
+ @Override
+ public void onPreConnect() {
+ _brokerServerBuilder.getBrokerMetrics().addMeteredGlobalValue(BrokerMeter.HELIX_ZOOKEEPER_RECONNECTS, 1L);
+ }
+ });
}
private void setupHelixSystemProperties() {
final String helixFlappingTimeWindowPropName = "helixmanager.flappingTimeWindow";
- System.setProperty(helixFlappingTimeWindowPropName,
- _pinotHelixProperties.getString(DefaultHelixBrokerConfig.HELIX_FLAPPING_TIME_WINDOW_NAME,
+ System.setProperty(helixFlappingTimeWindowPropName, _pinotHelixProperties
+ .getString(DefaultHelixBrokerConfig.HELIX_FLAPPING_TIME_WINDOW_NAME,
DefaultHelixBrokerConfig.DEFAULT_HELIX_FLAPPING_TIMEIWINDWOW_MS));
}
@@ -265,7 +257,8 @@ public class HelixBrokerStarter {
return _brokerServerBuilder;
}
- public static HelixBrokerStarter startDefault() throws Exception {
+ public static HelixBrokerStarter startDefault()
+ throws Exception {
Configuration configuration = new PropertiesConfiguration();
int port = 5001;
configuration.addProperty(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT, port);
@@ -298,7 +291,8 @@ public class HelixBrokerStarter {
return _metricsRegistry;
}
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args)
+ throws Exception {
startDefault();
}
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/LiveInstancesChangeListenerImpl.java b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/LiveInstancesChangeListenerImpl.java
index 62498b6..5c192ad 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/LiveInstancesChangeListenerImpl.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/LiveInstancesChangeListenerImpl.java
@@ -46,7 +46,8 @@ public class LiveInstancesChangeListenerImpl implements LiveInstanceChangeListen
this.liveInstanceToSessionIdMap = new HashMap<String, String>();
}
- public void init(final KeyedPool<PooledNettyClientResourceManager.PooledClientConnection> connectionPool, final long timeout) {
+ public void init(final KeyedPool<PooledNettyClientResourceManager.PooledClientConnection> connectionPool,
+ final long timeout) {
this.connectionPool = connectionPool;
this.timeout = timeout;
}
@@ -75,15 +76,16 @@ public class LiveInstancesChangeListenerImpl implements LiveInstanceChangeListen
port = Integer.parseInt(namePortStr.split("_")[1]);
} catch (Exception e) {
port = CommonConstants.Helix.DEFAULT_SERVER_NETTY_PORT;
- LOGGER.warn("Port for server instance {} does not appear to be numeric, defaulting to {}.", instanceId, port, e);
+ LOGGER
+ .warn("Port for server instance {} does not appear to be numeric, defaulting to {}.", instanceId, port, e);
}
if (liveInstanceToSessionIdMap.containsKey(instanceId)) {
// sessionId has changed
if (!sessionId.equals(liveInstanceToSessionIdMap.get(instanceId))) {
try {
- LOGGER.info("Instance {} has changed session id {} -> {}, validating connection pool for this instance.", instanceId, sessionId,
- liveInstanceToSessionIdMap.get(instanceId));
+ LOGGER.info("Instance {} has changed session id {} -> {}, validating connection pool for this instance.",
+ instanceId, sessionId, liveInstanceToSessionIdMap.get(instanceId));
ServerInstance ins = ServerInstance.forHostPort(hostName, port);
connectionPool.validatePool(ins, DO_NOT_RECREATE);
liveInstanceToSessionIdMap.put(instanceId, sessionId);
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/TimeboundaryRefreshMessageHandlerFactory.java b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/TimeboundaryRefreshMessageHandlerFactory.java
index 9e3e1cc..68b16c3 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/TimeboundaryRefreshMessageHandlerFactory.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/TimeboundaryRefreshMessageHandlerFactory.java
@@ -30,113 +30,116 @@ import org.apache.pinot.common.messages.TimeboundaryRefreshMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
// Handle the TimeboundaryRefresh message. The Timeboundary refresh requests are handled asynchronously: i.e., they are
// first put into a request map first. The map dedups requests by their tables thus multiple requests for the same
// table only needs to be executed once. A background thread periodically checks the map and performs refreshing for
// all the tables in the map.
public class TimeboundaryRefreshMessageHandlerFactory implements MessageHandlerFactory {
- private static final Logger LOGGER = LoggerFactory.getLogger(TimeboundaryRefreshMessageHandlerFactory.class);
- private final HelixExternalViewBasedRouting _helixExternalViewBasedRouting;
- // A map to store the unique requests (i.e., the table names) to refresh the TimeBoundaryInfo of a pinot table.
- // Ideally a Hashset will suffice but Java util currently does not have Hashset.
- private static ConcurrentHashMap<String, Boolean> _tablesToRefreshmap = new ConcurrentHashMap<>();
- private boolean shuttingDown;
+ private static final Logger LOGGER = LoggerFactory.getLogger(TimeboundaryRefreshMessageHandlerFactory.class);
+ private final HelixExternalViewBasedRouting _helixExternalViewBasedRouting;
+ // A map to store the unique requests (i.e., the table names) to refresh the TimeBoundaryInfo of a pinot table.
+ // Ideally a Hashset will suffice but Java util currently does not have Hashset.
+ private static ConcurrentHashMap<String, Boolean> _tablesToRefreshmap = new ConcurrentHashMap<>();
+ private boolean shuttingDown;
- /**
- *
- * @param helixExternalViewBasedRouting The underlying Routing object to execute TimeboundaryInfo refreshing.
- * @param sleepTimeInMilliseconds The sleep time for the background thread to execute TimeboundaryInfo refreshing.
- */
- public TimeboundaryRefreshMessageHandlerFactory(HelixExternalViewBasedRouting helixExternalViewBasedRouting,
- long sleepTimeInMilliseconds) {
- _helixExternalViewBasedRouting = helixExternalViewBasedRouting;
- // Start a background thread to execute the TimeboundaryInfo update requests.
- Thread tbiUpdateThread = new Thread(new TimeboundaryRefreshMessageExecutor(sleepTimeInMilliseconds));
- tbiUpdateThread.start();
- shuttingDown = false;
- }
+ /**
+ *
+ * @param helixExternalViewBasedRouting The underlying Routing object to execute TimeboundaryInfo refreshing.
+ * @param sleepTimeInMilliseconds The sleep time for the background thread to execute TimeboundaryInfo refreshing.
+ */
+ public TimeboundaryRefreshMessageHandlerFactory(HelixExternalViewBasedRouting helixExternalViewBasedRouting,
+ long sleepTimeInMilliseconds) {
+ _helixExternalViewBasedRouting = helixExternalViewBasedRouting;
+ // Start a background thread to execute the TimeboundaryInfo update requests.
+ Thread tbiUpdateThread = new Thread(new TimeboundaryRefreshMessageExecutor(sleepTimeInMilliseconds));
+ tbiUpdateThread.start();
+ shuttingDown = false;
+ }
- @Override
- public MessageHandler createHandler(Message message, NotificationContext context) {
- String msgSubType = message.getMsgSubType();
- switch (msgSubType) {
- case TimeboundaryRefreshMessage.REFRESH_TIME_BOUNDARY_MSG_SUB_TYPE:
- LOGGER.info("time refresh msg received {} for table {}", message.getPartitionName());
- return new TimeboundaryRefreshMessageHandler(new TimeboundaryRefreshMessage(message), context);
- default:
- throw new UnsupportedOperationException("Unsupported user defined message sub type: " + msgSubType);
- }
+ @Override
+ public MessageHandler createHandler(Message message, NotificationContext context) {
+ String msgSubType = message.getMsgSubType();
+ switch (msgSubType) {
+ case TimeboundaryRefreshMessage.REFRESH_TIME_BOUNDARY_MSG_SUB_TYPE:
+ LOGGER.info("time refresh msg received {} for table {}", message.getPartitionName());
+ return new TimeboundaryRefreshMessageHandler(new TimeboundaryRefreshMessage(message), context);
+ default:
+ throw new UnsupportedOperationException("Unsupported user defined message sub type: " + msgSubType);
}
+ }
- @Override
- public String getMessageType() {
- return Message.MessageType.USER_DEFINE_MSG.toString();
+ @Override
+ public String getMessageType() {
+ return Message.MessageType.USER_DEFINE_MSG.toString();
+ }
+
+ @Override
+ public void reset() {
+ LOGGER.info("Reset called");
+ }
+
+ public void shutdown() {
+ shuttingDown = true;
+ }
+
+ private class TimeboundaryRefreshMessageHandler extends MessageHandler {
+ private final String _tableNameWithType;
+ private final Logger _logger;
+
+ public TimeboundaryRefreshMessageHandler(TimeboundaryRefreshMessage message, NotificationContext context) {
+ super(message, context);
+ // The partition name field stores the table name.
+ _tableNameWithType = message.getPartitionName();
+ _logger = LoggerFactory.getLogger(_tableNameWithType + "-" + TimeboundaryRefreshMessageHandler.class);
}
@Override
- public void reset() {
- LOGGER.info("Reset called");
+ public HelixTaskResult handleMessage() {
+ HelixTaskResult result = new HelixTaskResult();
+ // Put the segment refresh request to a request queue instead of executing immediately. This will reduce the
+ // burst of requests when a large number of segments are updated in a short time span.
+ _tablesToRefreshmap.put(_tableNameWithType, Boolean.TRUE);
+ result.setSuccess(true);
+ return result;
}
- public void shutdown() {
- shuttingDown = true;
+ @Override
+ public void onError(Exception e, ErrorCode errorCode, ErrorType errorType) {
+ _logger.error("onError: {}, {}", errorType, errorCode, e);
}
+ }
- private class TimeboundaryRefreshMessageHandler extends MessageHandler{
- private final String _tableNameWithType;
- private final Logger _logger;
+ private class TimeboundaryRefreshMessageExecutor implements Runnable {
+ private long _sleepTimeInMilliseconds;
+ private final Logger _logger = LoggerFactory.getLogger(TimeboundaryRefreshMessageExecutor.class);
+ ;
-
- public TimeboundaryRefreshMessageHandler(TimeboundaryRefreshMessage message, NotificationContext context) {
- super(message, context);
- // The partition name field stores the table name.
- _tableNameWithType = message.getPartitionName();
- _logger = LoggerFactory.getLogger(_tableNameWithType + "-" + TimeboundaryRefreshMessageHandler.class);
- }
-
- @Override
- public HelixTaskResult handleMessage() {
- HelixTaskResult result = new HelixTaskResult();
- // Put the segment refresh request to a request queue instead of executing immediately. This will reduce the
- // burst of requests when a large number of segments are updated in a short time span.
- _tablesToRefreshmap.put(_tableNameWithType, Boolean.TRUE);
- result.setSuccess(true);
- return result;
- }
-
- @Override
- public void onError(Exception e, ErrorCode errorCode, ErrorType errorType) {
- _logger.error("onError: {}, {}", errorType, errorCode, e);
- }
+ public TimeboundaryRefreshMessageExecutor(long sleepTimeInMilliseconds) {
+ _sleepTimeInMilliseconds = sleepTimeInMilliseconds;
}
- private class TimeboundaryRefreshMessageExecutor implements Runnable {
- private long _sleepTimeInMilliseconds;
- private final Logger _logger = LoggerFactory.getLogger(TimeboundaryRefreshMessageExecutor.class);;
- public TimeboundaryRefreshMessageExecutor(long sleepTimeInMilliseconds) {
- _sleepTimeInMilliseconds = sleepTimeInMilliseconds;
- }
- @Override
- public void run() {
- while(!shuttingDown) {
- try {
- ConcurrentHashMap.KeySetView<String, Boolean> tables = _tablesToRefreshmap.keySet();
- Iterator<String> tableItr = tables.iterator();
- while(tableItr.hasNext()) {
- String table = tableItr.next();
- _logger.info("Update time boundary info for table {} ", table);
- _helixExternalViewBasedRouting.updateTimeBoundary(table);
- // Remove the table name from the underlying hashmap.
- tableItr.remove();
- }
- Thread.sleep(_sleepTimeInMilliseconds);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- // It is OK for us to break out the loop early because the TimeboundInfo refresh is best effort.
- break;
- }
- }
- _logger.info("TimeboundaryRefreshMessageExecutor thread has been shutdown.");
- }
+ @Override
+ public void run() {
+ while (!shuttingDown) {
+ try {
+ ConcurrentHashMap.KeySetView<String, Boolean> tables = _tablesToRefreshmap.keySet();
+ Iterator<String> tableItr = tables.iterator();
+ while (tableItr.hasNext()) {
+ String table = tableItr.next();
+ _logger.info("Update time boundary info for table {} ", table);
+ _helixExternalViewBasedRouting.updateTimeBoundary(table);
+ // Remove the table name from the underlying hashmap.
+ tableItr.remove();
+ }
+ Thread.sleep(_sleepTimeInMilliseconds);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ // It is OK for us to break out the loop early because the TimeboundInfo refresh is best effort.
+ break;
+ }
+ }
+ _logger.info("TimeboundaryRefreshMessageExecutor thread has been shutdown.");
}
+ }
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HitCounter.java b/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HitCounter.java
index ae45398..c5d5b6e 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HitCounter.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HitCounter.java
@@ -51,7 +51,7 @@ public class HitCounter {
@VisibleForTesting
void hit(long timestamp) {
long numTimeUnits = timestamp / _timeBucketWidthMs;
- int index = (int)(numTimeUnits % BUCKET_COUNT);
+ int index = (int) (numTimeUnits % BUCKET_COUNT);
if (_bucketStartTime.get(index) == numTimeUnits) {
_bucketHitCount.incrementAndGet(index);
} else {
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/TableQueryQuotaManager.java b/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/TableQueryQuotaManager.java
index f7d06f6..d37670e 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/TableQueryQuotaManager.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/TableQueryQuotaManager.java
@@ -264,8 +264,8 @@ public class TableQueryQuotaManager {
LOGGER.info("Start processing qps quota change.");
long startTime = System.currentTimeMillis();
- ExternalView currentBrokerResource =
- HelixHelper.getExternalViewForResource(_helixManager.getClusterManagmentTool(), _helixManager.getClusterName(),
+ ExternalView currentBrokerResource = HelixHelper
+ .getExternalViewForResource(_helixManager.getClusterManagmentTool(), _helixManager.getClusterName(),
BROKER_RESOURCE_INSTANCE);
if (currentBrokerResource == null) {
LOGGER.warn("Finish processing qps quota change: external view for broker resource is null!");
@@ -286,8 +286,8 @@ public class TableQueryQuotaManager {
// Get latest quota config for table.
QuotaConfig quotaConfig = getQuotaConfigFromPropertyStore(rawTableName, tableType);
- if (quotaConfig == null || quotaConfig.getMaxQueriesPerSecond() == null
- || !quotaConfig.isMaxQueriesPerSecondValid()) {
+ if (quotaConfig == null || quotaConfig.getMaxQueriesPerSecond() == null || !quotaConfig
+ .isMaxQueriesPerSecondValid()) {
LOGGER.info("No query quota config or the config is invalid for Table {}. Removing its rate limit.",
tableNameWithType);
removeRateLimiter(tableNameWithType);
@@ -323,7 +323,8 @@ public class TableQueryQuotaManager {
}
_lastKnownBrokerResourceVersion.set(currentVersionNumber);
long endTime = System.currentTimeMillis();
- LOGGER.info("Processed query quota change in {}ms, {} out of {} query quota configs rebuilt.",
- (endTime - startTime), numRebuilt, _rateLimiterMap.size());
+ LOGGER
+ .info("Processed query quota change in {}ms, {} out of {} query quota configs rebuilt.", (endTime - startTime),
+ numRebuilt, _rateLimiterMap.size());
}
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
index 1088306..47d478a 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
@@ -150,8 +150,8 @@ public abstract class BaseBrokerRequestHandler implements BrokerRequestHandler {
requestStatistics.setErrorCode(QueryException.ACCESS_DENIED_ERROR_CODE);
return new BrokerResponseNative(QueryException.ACCESS_DENIED_ERROR);
}
- _brokerMetrics.addPhaseTiming(rawTableName, BrokerQueryPhase.AUTHORIZATION,
- System.nanoTime() - compilationEndTimeNs);
+ _brokerMetrics
+ .addPhaseTiming(rawTableName, BrokerQueryPhase.AUTHORIZATION, System.nanoTime() - compilationEndTimeNs);
// Get the tables hit by the request
String offlineTableName = null;
@@ -212,10 +212,7 @@ public abstract class BaseBrokerRequestHandler implements BrokerRequestHandler {
brokerRequest.setEnableTrace(true);
}
if (request.has(DEBUG_OPTIONS)) {
- Map<String, String> debugOptions = Splitter.on(';')
- .omitEmptyStrings()
- .trimResults()
- .withKeyValueSeparator('=')
+ Map<String, String> debugOptions = Splitter.on(';').omitEmptyStrings().trimResults().withKeyValueSeparator('=')
.split(request.get(DEBUG_OPTIONS).asText());
LOGGER.debug("Debug options are set to: {} for request {}: {}", debugOptions, requestId, query);
brokerRequest.setDebugOptions(debugOptions);
@@ -279,8 +276,8 @@ public abstract class BaseBrokerRequestHandler implements BrokerRequestHandler {
processBrokerRequest(requestId, brokerRequest, offlineBrokerRequest, offlineRoutingTable, realtimeBrokerRequest,
realtimeRoutingTable, remainingTimeMs, serverStats, requestStatistics);
long executionEndTimeNs = System.nanoTime();
- _brokerMetrics.addPhaseTiming(rawTableName, BrokerQueryPhase.QUERY_EXECUTION,
- executionEndTimeNs - routingEndTimeNs);
+ _brokerMetrics
+ .addPhaseTiming(rawTableName, BrokerQueryPhase.QUERY_EXECUTION, executionEndTimeNs - routingEndTimeNs);
// Track number of queries with number of groups limit reached
if (brokerResponse.isNumGroupsLimitReached()) {
@@ -427,7 +424,8 @@ public abstract class BaseBrokerRequestHandler implements BrokerRequestHandler {
protected abstract BrokerResponse processBrokerRequest(long requestId, BrokerRequest originalBrokerRequest,
@Nullable BrokerRequest offlineBrokerRequest, @Nullable Map<String, List<String>> offlineRoutingTable,
@Nullable BrokerRequest realtimeBrokerRequest, @Nullable Map<String, List<String>> realtimeRoutingTable,
- long timeoutMs, ServerStats serverStats, RequestStatistics requestStatistics) throws Exception;
+ long timeoutMs, ServerStats serverStats, RequestStatistics requestStatistics)
+ throws Exception;
/**
* Helper class to pass the per server statistics.
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BrokerRequestHandler.java b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BrokerRequestHandler.java
index 1d6ccb1..c0fc868 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BrokerRequestHandler.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BrokerRequestHandler.java
@@ -34,5 +34,6 @@ public interface BrokerRequestHandler {
void shutDown();
BrokerResponse handleRequest(JsonNode request, @Nullable RequesterIdentity requesterIdentity,
- RequestStatistics requestStatistics) throws Exception;
+ RequestStatistics requestStatistics)
+ throws Exception;
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BrokerRequestOptimizer.java b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BrokerRequestOptimizer.java
index 36a1a36..665fafd 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BrokerRequestOptimizer.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BrokerRequestOptimizer.java
@@ -27,11 +27,9 @@ import org.apache.pinot.common.utils.request.RequestUtils;
public class BrokerRequestOptimizer {
- private static final List<? extends FilterQueryTreeOptimizer> FILTER_QUERY_TREE_OPTIMIZERS = Arrays.asList(
- new FlattenNestedPredicatesFilterQueryTreeOptimizer(),
- new MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizer(),
- new RangeMergeOptimizer()
- );
+ private static final List<? extends FilterQueryTreeOptimizer> FILTER_QUERY_TREE_OPTIMIZERS = Arrays
+ .asList(new FlattenNestedPredicatesFilterQueryTreeOptimizer(),
+ new MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizer(), new RangeMergeOptimizer());
/**
* Optimizes the given broker request.
@@ -61,7 +59,8 @@ public class BrokerRequestOptimizer {
return;
}
- filterQueryTree = RequestUtils.buildFilterQuery(q.getId(), brokerRequest.getFilterSubQueryMap().getFilterQueryMap());
+ filterQueryTree =
+ RequestUtils.buildFilterQuery(q.getId(), brokerRequest.getFilterSubQueryMap().getFilterQueryMap());
FilterQueryOptimizerRequest.FilterQueryOptimizerRequestBuilder builder =
new FilterQueryOptimizerRequest.FilterQueryOptimizerRequestBuilder();
@@ -69,14 +68,16 @@ public class BrokerRequestOptimizer {
if (optimizationFlags == null) {
for (FilterQueryTreeOptimizer filterQueryTreeOptimizer : FILTER_QUERY_TREE_OPTIMIZERS) {
filterQueryTree = filterQueryTreeOptimizer.optimize(request);
- request.setFilterQueryTree(filterQueryTree); // Optimizers may return a new tree instead of in-place optimization
+ request
+ .setFilterQueryTree(filterQueryTree); // Optimizers may return a new tree instead of in-place optimization
}
} else {
if (optimizationFlags.isOptimizationEnabled("filterQueryTree")) {
for (FilterQueryTreeOptimizer filterQueryTreeOptimizer : FILTER_QUERY_TREE_OPTIMIZERS) {
if (optimizationFlags.isOptimizationEnabled(filterQueryTreeOptimizer.getOptimizationName())) {
filterQueryTree = filterQueryTreeOptimizer.optimize(request);
- request.setFilterQueryTree(filterQueryTree); // Optimizers may return a new tree instead of in-place optimization
+ request.setFilterQueryTree(
+ filterQueryTree); // Optimizers may return a new tree instead of in-place optimization
}
}
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/ConnectionPoolBrokerRequestHandler.java b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/ConnectionPoolBrokerRequestHandler.java
index e379386..068a137 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/ConnectionPoolBrokerRequestHandler.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/ConnectionPoolBrokerRequestHandler.java
@@ -135,7 +135,8 @@ public class ConnectionPoolBrokerRequestHandler extends BaseBrokerRequestHandler
protected BrokerResponse processBrokerRequest(long requestId, BrokerRequest originalBrokerRequest,
@Nullable BrokerRequest offlineBrokerRequest, @Nullable Map<String, List<String>> offlineRoutingTable,
@Nullable BrokerRequest realtimeBrokerRequest, @Nullable Map<String, List<String>> realtimeRoutingTable,
- long timeoutMs, ServerStats serverStats, RequestStatistics requestStatistics) throws Exception {
+ long timeoutMs, ServerStats serverStats, RequestStatistics requestStatistics)
+ throws Exception {
ScatterGatherStats scatterGatherStats = new ScatterGatherStats();
PhaseTimes phaseTimes = new PhaseTimes();
@@ -227,8 +228,8 @@ public class ConnectionPoolBrokerRequestHandler extends BaseBrokerRequestHandler
if (numServersQueried > numServersResponded) {
_brokerMetrics.addMeteredTableValue(rawTableName, BrokerMeter.BROKER_RESPONSES_WITH_PARTIAL_SERVERS_RESPONDED, 1);
}
- _brokerMetrics.addMeteredQueryValue(originalBrokerRequest, BrokerMeter.TOTAL_SERVER_RESPONSE_SIZE,
- totalServerResponseSize);
+ _brokerMetrics
+ .addMeteredQueryValue(originalBrokerRequest, BrokerMeter.TOTAL_SERVER_RESPONSE_SIZE, totalServerResponseSize);
return brokerResponse;
}
@@ -240,7 +241,8 @@ public class ConnectionPoolBrokerRequestHandler extends BaseBrokerRequestHandler
*/
private CompositeFuture<byte[]> scatterBrokerRequest(long requestId, BrokerRequest brokerRequest,
Map<String, List<String>> routingTable, boolean isOfflineTable, long timeoutMs,
- ScatterGatherStats scatterGatherStats, PhaseTimes phaseTimes) throws InterruptedException {
+ ScatterGatherStats scatterGatherStats, PhaseTimes phaseTimes)
+ throws InterruptedException {
long scatterStartTimeNs = System.nanoTime();
ScatterGatherRequest scatterRequest =
new ScatterGatherRequestImpl(brokerRequest, routingTable, requestId, timeoutMs, _brokerId);
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/FlattenNestedPredicatesFilterQueryTreeOptimizer.java b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/FlattenNestedPredicatesFilterQueryTreeOptimizer.java
index 00eb3cd..e5a268e 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/FlattenNestedPredicatesFilterQueryTreeOptimizer.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/FlattenNestedPredicatesFilterQueryTreeOptimizer.java
@@ -70,8 +70,8 @@ public class FlattenNestedPredicatesFilterQueryTreeOptimizer extends FilterQuery
if (parent == null) {
return;
}
- if (node.getOperator() == parent.getOperator()
- && (node.getOperator() == FilterOperator.OR || node.getOperator() == FilterOperator.AND)) {
+ if (node.getOperator() == parent.getOperator() && (node.getOperator() == FilterOperator.OR
+ || node.getOperator() == FilterOperator.AND)) {
// Move all of 'node's children one level up. If 'node' has no children left, remove it from parent's list.
List<FilterQueryTree> children = node.getChildren();
Iterator<FilterQueryTree> it = children.iterator();
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizer.java b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizer.java
index 286d83f..a3304ff 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizer.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizer.java
@@ -68,7 +68,7 @@ public class MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizer extends Filt
return rebuildFilterPredicate(columnToValues, nonEqualityOperators);
}
}
- } else if (filterQueryTree.getChildren() != null){
+ } else if (filterQueryTree.getChildren() != null) {
// Optimize the child nodes, if any
applyOptimizationToChildNodes(filterQueryTree);
}
@@ -102,7 +102,8 @@ public class MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizer extends Filt
boolean containsDuplicates = false;
for (FilterQueryTree childQueryTree : filterQueryTree.getChildren()) {
- if (childQueryTree.getOperator() == FilterOperator.EQUALITY || childQueryTree.getOperator() == FilterOperator.IN) {
+ if (childQueryTree.getOperator() == FilterOperator.EQUALITY
+ || childQueryTree.getOperator() == FilterOperator.IN) {
List<String> childValues = valueDoubleTabListToElements(childQueryTree.getValue());
if (!columnToValues.containsKey(childQueryTree.getColumn())) {
@@ -112,7 +113,7 @@ public class MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizer extends Filt
containsDuplicates = true;
}
} else {
- Set<String> currentValues = columnToValues.get(childQueryTree.getColumn());
+ Set<String> currentValues = columnToValues.get(childQueryTree.getColumn());
for (String childValue : childValues) {
if (!containsDuplicates && currentValues.contains(childValue)) {
containsDuplicates = true;
@@ -158,8 +159,8 @@ public class MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizer extends Filt
private FilterQueryTree buildFilterQueryTreeForColumnAndValues(Map.Entry<String, Set<String>> columnAndValues) {
// If there's only one value, turn it into an equality, otherwise turn it into an IN clause
if (columnAndValues.getValue().size() == 1) {
- return new FilterQueryTree(columnAndValues.getKey(),
- new ArrayList<>(columnAndValues.getValue()), FilterOperator.EQUALITY, null);
+ return new FilterQueryTree(columnAndValues.getKey(), new ArrayList<>(columnAndValues.getValue()),
+ FilterOperator.EQUALITY, null);
} else {
return new FilterQueryTree(columnAndValues.getKey(), new ArrayList<>(columnAndValues.getValue()),
FilterOperator.IN, null);
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/OptimizationFlags.java b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/OptimizationFlags.java
index f10f0de..a3d8bdf 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/OptimizationFlags.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/OptimizationFlags.java
@@ -65,7 +65,8 @@ public class OptimizationFlags {
* @param brokerRequest The broker request from which to extract the optimization flags
* @return The optimization flags for this request, or null.
*/
- public static @Nullable OptimizationFlags getOptimizationFlags(BrokerRequest brokerRequest) {
+ public static @Nullable
+ OptimizationFlags getOptimizationFlags(BrokerRequest brokerRequest) {
if (brokerRequest == null || brokerRequest.getDebugOptions() == null) {
return null;
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/SingleConnectionBrokerRequestHandler.java b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/SingleConnectionBrokerRequestHandler.java
index 198d4e5..4231e52 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/SingleConnectionBrokerRequestHandler.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/SingleConnectionBrokerRequestHandler.java
@@ -73,17 +73,18 @@ public class SingleConnectionBrokerRequestHandler extends BaseBrokerRequestHandl
protected BrokerResponse processBrokerRequest(long requestId, BrokerRequest originalBrokerRequest,
@Nullable BrokerRequest offlineBrokerRequest, @Nullable Map<String, List<String>> offlineRoutingTable,
@Nullable BrokerRequest realtimeBrokerRequest, @Nullable Map<String, List<String>> realtimeRoutingTable,
- long timeoutMs, ServerStats serverStats, RequestStatistics requestStatistics) throws Exception {
+ long timeoutMs, ServerStats serverStats, RequestStatistics requestStatistics)
+ throws Exception {
assert offlineBrokerRequest != null || realtimeBrokerRequest != null;
String rawTableName = TableNameBuilder.extractRawTableName(originalBrokerRequest.getQuerySource().getTableName());
long scatterGatherStartTimeNs = System.nanoTime();
- AsyncQueryResponse asyncQueryResponse =
- _queryRouter.submitQuery(requestId, rawTableName, offlineBrokerRequest, offlineRoutingTable,
- realtimeBrokerRequest, realtimeRoutingTable, timeoutMs);
+ AsyncQueryResponse asyncQueryResponse = _queryRouter
+ .submitQuery(requestId, rawTableName, offlineBrokerRequest, offlineRoutingTable, realtimeBrokerRequest,
+ realtimeRoutingTable, timeoutMs);
Map<Server, ServerResponse> response = asyncQueryResponse.getResponse();
- _brokerMetrics.addPhaseTiming(rawTableName, BrokerQueryPhase.SCATTER_GATHER,
- System.nanoTime() - scatterGatherStartTimeNs);
+ _brokerMetrics
+ .addPhaseTiming(rawTableName, BrokerQueryPhase.SCATTER_GATHER, System.nanoTime() - scatterGatherStartTimeNs);
// TODO Use scatterGatherStats as serverStats
serverStats.setServerStats(asyncQueryResponse.getStats());
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/CfgBasedRouting.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/CfgBasedRouting.java
index 1856b70..c7c5d01 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/CfgBasedRouting.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/CfgBasedRouting.java
@@ -57,7 +57,8 @@ public class CfgBasedRouting implements RoutingTable {
}
@Override
- public String dumpSnapshot(String tableName) throws Exception {
+ public String dumpSnapshot(String tableName)
+ throws Exception {
return null;
}
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/HelixExternalViewBasedRouting.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/HelixExternalViewBasedRouting.java
index 66ef930..e62a7ef 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/HelixExternalViewBasedRouting.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/HelixExternalViewBasedRouting.java
@@ -86,7 +86,6 @@ public class HelixExternalViewBasedRouting implements RoutingTable {
private RoutingTableBuilderFactory _routingTableBuilderFactory;
private SegmentSelectorProvider _segmentSelectorProvider;
-
public HelixExternalViewBasedRouting(ZkHelixPropertyStore<ZNRecord> propertyStore, HelixManager helixManager,
Configuration configuration) {
_configuration = configuration;
@@ -119,8 +118,8 @@ public class HelixExternalViewBasedRouting implements RoutingTable {
RoutingTableBuilder routingTableBuilder =
_routingTableBuilderFactory.createRoutingTableBuilder(tableConfig, _brokerMetrics);
- LOGGER.info("Initialized routingTableBuilder: {} for table {}", routingTableBuilder.getClass().getName(),
- tableName);
+ LOGGER
+ .info("Initialized routingTableBuilder: {} for table {}", routingTableBuilder.getClass().getName(), tableName);
_routingTableBuilderMap.put(tableName, routingTableBuilder);
// Initialize segment selector
@@ -346,7 +345,7 @@ public class HelixExternalViewBasedRouting implements RoutingTable {
}
public void updateTimeBoundary(String tableName) {
- updateTimeBoundary(tableName,fetchExternalView(tableName));
+ updateTimeBoundary(tableName, fetchExternalView(tableName));
}
protected void updateTimeBoundary(String tableName, ExternalView externalView) {
@@ -359,8 +358,8 @@ public class HelixExternalViewBasedRouting implements RoutingTable {
}
protected ExternalView fetchExternalView(String table) {
- return HelixHelper.getExternalViewForResource(_helixManager.getClusterManagmentTool(),
- _helixManager.getClusterName(), table);
+ return HelixHelper
+ .getExternalViewForResource(_helixManager.getClusterManagmentTool(), _helixManager.getClusterName(), table);
}
private void updateInstanceConfigsMapFromExternalView(Map<String, InstanceConfig> relevantInstanceConfigs,
@@ -574,7 +573,8 @@ public class HelixExternalViewBasedRouting implements RoutingTable {
}
@Override
- public String dumpSnapshot(String tableName) throws Exception {
+ public String dumpSnapshot(String tableName)
+ throws Exception {
ObjectNode ret = JsonUtils.newObjectNode();
ArrayNode routingTableSnapshot = JsonUtils.newArrayNode();
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingTable.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingTable.java
index bcb752b..5cad348 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingTable.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingTable.java
@@ -49,5 +49,6 @@ public interface RoutingTable {
* @param tableName Table name or null for all tables.
* @throws Exception
*/
- String dumpSnapshot(String tableName) throws Exception;
+ String dumpSnapshot(String tableName)
+ throws Exception;
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingTableBuilderFactory.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingTableBuilderFactory.java
index 8f5ffa0..8fb0ccf 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingTableBuilderFactory.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingTableBuilderFactory.java
@@ -50,8 +50,10 @@ public class RoutingTableBuilderFactory {
DefaultOffline,
DefaultRealtime,
BalancedRandom,
- KafkaLowLevel, // This should ideally be LowLevel and HighLevel. But we cannot rename these, else all tables which reference these in the configs will break
- KafkaHighLevel,// We will keep these prefixed with "Kafka", but they are intended to work for any stream
+ // This should ideally be LowLevel and HighLevel. But we cannot rename these, else all tables which reference these
+ // in the configs will break. We will keep these prefixed with "Kafka", but they are intended to work for any stream
+ KafkaLowLevel,
+ KafkaHighLevel,
PartitionAwareOffline,
PartitionAwareRealtime
}
@@ -117,8 +119,9 @@ public class RoutingTableBuilderFactory {
boolean hasReplicaGroupStrategyConfig = (validationConfig != null);
// Check that the table push type is not 'refresh'.
- boolean isNotRefreshPush = (validationConfig.getSegmentPushType() != null) &&
- !validationConfig.getSegmentPushType().equalsIgnoreCase("REFRESH");
+ boolean isNotRefreshPush =
+ (validationConfig.getSegmentPushType() != null) && !validationConfig.getSegmentPushType()
+ .equalsIgnoreCase("REFRESH");
if (isSegmentAssignmentStrategyCorrect && hasReplicaGroupStrategyConfig && isNotRefreshPush) {
builder = new PartitionAwareOfflineRoutingTableBuilder();
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/TimeBoundaryService.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/TimeBoundaryService.java
index 347ab0f..cbe6db1 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/TimeBoundaryService.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/TimeBoundaryService.java
@@ -58,7 +58,8 @@ public interface TimeBoundaryService {
_timeValue = timeValue;
}
- public String toJsonString() throws JsonProcessingException {
+ public String toJsonString()
+ throws JsonProcessingException {
return JsonUtils.objectToPrettyString(this);
}
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/BasePartitionAwareRoutingTableBuilder.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/BasePartitionAwareRoutingTableBuilder.java
index b6ebf50..e8e8434 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/BasePartitionAwareRoutingTableBuilder.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/BasePartitionAwareRoutingTableBuilder.java
@@ -75,7 +75,8 @@ public abstract class BasePartitionAwareRoutingTableBuilder implements RoutingTa
private String _tableName;
@Override
- public void init(Configuration configuration, TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore, BrokerMetrics brokerMetrics) {
+ public void init(Configuration configuration, TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore,
+ BrokerMetrics brokerMetrics) {
_propertyStore = propertyStore;
_tableName = tableConfig.getTableName();
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/DefaultRealtimeRoutingTableBuilder.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/DefaultRealtimeRoutingTableBuilder.java
index e46b3b6..49ffc18 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/DefaultRealtimeRoutingTableBuilder.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/DefaultRealtimeRoutingTableBuilder.java
@@ -44,7 +44,8 @@ public class DefaultRealtimeRoutingTableBuilder implements RoutingTableBuilder {
private boolean _hasLLC;
@Override
- public void init(Configuration configuration, TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore, BrokerMetrics brokerMetrics) {
+ public void init(Configuration configuration, TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore,
+ BrokerMetrics brokerMetrics) {
_realtimeHLCRoutingTableBuilder = new HighLevelConsumerBasedRoutingTableBuilder();
_realtimeLLCRoutingTableBuilder = new LowLevelConsumerRoutingTableBuilder();
_realtimeHLCRoutingTableBuilder.init(configuration, tableConfig, propertyStore, brokerMetrics);
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/LowLevelConsumerRoutingTableBuilder.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/LowLevelConsumerRoutingTableBuilder.java
index e3cf792..f6c40b2 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/LowLevelConsumerRoutingTableBuilder.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/LowLevelConsumerRoutingTableBuilder.java
@@ -88,8 +88,7 @@ public class LowLevelConsumerRoutingTableBuilder extends GeneratorBasedRoutingTa
// 2. Ensure that for each partition, we have at most one Helix partition (Pinot segment) in consuming state
Map<String, SegmentName> allowedSegmentInConsumingStateByPartition =
- LowLevelRoutingTableBuilderUtil.getAllowedConsumingStateSegments(externalView,
- sortedSegmentsByStreamPartition);
+ LowLevelRoutingTableBuilderUtil.getAllowedConsumingStateSegments(externalView, sortedSegmentsByStreamPartition);
// 3. Sort all the segments to be used during assignment in ascending order of replicas
@@ -118,15 +117,13 @@ public class LowLevelConsumerRoutingTableBuilder extends GeneratorBasedRoutingTa
}
// Replicas in ONLINE state are always allowed
- if (state.equalsIgnoreCase(
- CommonConstants.Helix.StateModel.RealtimeSegmentOnlineOfflineStateModel.ONLINE)) {
+ if (state.equalsIgnoreCase(CommonConstants.Helix.StateModel.RealtimeSegmentOnlineOfflineStateModel.ONLINE)) {
validServers.add(instance);
continue;
}
// Replicas in CONSUMING state are only allowed on the last segment
- if (state.equalsIgnoreCase(
- CommonConstants.Helix.StateModel.RealtimeSegmentOnlineOfflineStateModel.CONSUMING)
+ if (state.equalsIgnoreCase(CommonConstants.Helix.StateModel.RealtimeSegmentOnlineOfflineStateModel.CONSUMING)
&& segmentName.equals(validConsumingSegment)) {
validServers.add(instance);
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/LowLevelRoutingTableBuilderUtil.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/LowLevelRoutingTableBuilderUtil.java
index 96e831d..8490397 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/LowLevelRoutingTableBuilderUtil.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/LowLevelRoutingTableBuilderUtil.java
@@ -53,22 +53,22 @@ public class LowLevelRoutingTableBuilderUtil {
// Only keep the segment if all replicas have it in CONSUMING state
for (String externalViewState : helixPartitionState.values()) {
// Ignore ERROR state
- if (externalViewState.equalsIgnoreCase(
- CommonConstants.Helix.StateModel.RealtimeSegmentOnlineOfflineStateModel.ERROR)) {
+ if (externalViewState
+ .equalsIgnoreCase(CommonConstants.Helix.StateModel.RealtimeSegmentOnlineOfflineStateModel.ERROR)) {
continue;
}
// Not all segments are in CONSUMING state, therefore don't consider the last segment assignable to CONSUMING
// replicas
- if (externalViewState.equalsIgnoreCase(
- CommonConstants.Helix.StateModel.RealtimeSegmentOnlineOfflineStateModel.ONLINE)) {
+ if (externalViewState
+ .equalsIgnoreCase(CommonConstants.Helix.StateModel.RealtimeSegmentOnlineOfflineStateModel.ONLINE)) {
allInConsumingState = false;
break;
}
// Otherwise count the replica as being in CONSUMING state
- if (externalViewState.equalsIgnoreCase(
- CommonConstants.Helix.StateModel.RealtimeSegmentOnlineOfflineStateModel.CONSUMING)) {
+ if (externalViewState
+ .equalsIgnoreCase(CommonConstants.Helix.StateModel.RealtimeSegmentOnlineOfflineStateModel.CONSUMING)) {
replicasInConsumingState++;
}
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/PartitionAwareRealtimeRoutingTableBuilder.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/PartitionAwareRealtimeRoutingTableBuilder.java
index 6bd0ebb..f302dc4 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/PartitionAwareRealtimeRoutingTableBuilder.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/PartitionAwareRealtimeRoutingTableBuilder.java
@@ -79,8 +79,7 @@ public class PartitionAwareRealtimeRoutingTableBuilder extends BasePartitionAwar
// Ensure that for each partition, we have at most one Helix partition (Pinot segment) in consuming state
Map<String, SegmentName> allowedSegmentInConsumingStateByPartition =
- LowLevelRoutingTableBuilderUtil.getAllowedConsumingStateSegments(externalView,
- sortedSegmentsByStreamPartition);
+ LowLevelRoutingTableBuilderUtil.getAllowedConsumingStateSegments(externalView, sortedSegmentsByStreamPartition);
RoutingTableInstancePruner instancePruner = new RoutingTableInstancePruner(instanceConfigs);
@@ -88,8 +87,7 @@ public class PartitionAwareRealtimeRoutingTableBuilder extends BasePartitionAwar
Map<String, Map<Integer, String>> segmentToReplicaToServerMap = new HashMap<>();
for (String segmentName : segmentSet) {
int partitionId = getPartitionId(segmentName);
- SegmentName validConsumingSegment =
- allowedSegmentInConsumingStateByPartition.get(Integer.toString(partitionId));
+ SegmentName validConsumingSegment = allowedSegmentInConsumingStateByPartition.get(Integer.toString(partitionId));
Map<Integer, String> replicaToServerMap = new HashMap<>();
int replicaId = 0;
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/RoutingTableInstancePruner.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/RoutingTableInstancePruner.java
index 0f907e0..ada8050 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/RoutingTableInstancePruner.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/builder/RoutingTableInstancePruner.java
@@ -62,8 +62,8 @@ public class RoutingTableInstancePruner {
return true;
}
- if (Boolean.parseBoolean(
- instanceConfig.getRecord().getSimpleField(CommonConstants.Helix.IS_SHUTDOWN_IN_PROGRESS))) {
+ if (Boolean
+ .parseBoolean(instanceConfig.getRecord().getSimpleField(CommonConstants.Helix.IS_SHUTDOWN_IN_PROGRESS))) {
LOGGER.info("Instance '{}' is shutting down", instanceName);
return true;
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/selector/MergedSegmentSelector.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/selector/MergedSegmentSelector.java
index e670288..fa055cc 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/selector/MergedSegmentSelector.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/selector/MergedSegmentSelector.java
@@ -45,8 +45,8 @@ public class MergedSegmentSelector implements SegmentSelector {
@Override
public void computeOnExternalViewChange() {
- SegmentMergeLineage segmentMergeLineage = SegmentMergeLineageAccessHelper.getSegmentMergeLineage(_propertyStore,
- _tableNameWithType);
+ SegmentMergeLineage segmentMergeLineage =
+ SegmentMergeLineageAccessHelper.getSegmentMergeLineage(_propertyStore, _tableNameWithType);
_rootSegmentGroup = segmentMergeLineage.getMergeLineageRootSegmentGroup();
}
@@ -68,13 +68,13 @@ public class MergedSegmentSelector implements SegmentSelector {
if (segmentGroup.getChildrenGroups() == null || segmentGroup.getChildrenGroups().isEmpty()) {
return;
}
- for (SegmentGroup child: segmentGroup.getChildrenGroups()) {
+ for (SegmentGroup child : segmentGroup.getChildrenGroups()) {
removeSegmentsForSegmentGroup(child, selectedSegments);
}
} else {
// If the current group is not picked, we compute the selection recursively for children nodes
selectedSegments.removeAll(segmentsForGroup);
- for (SegmentGroup child: segmentGroup.getChildrenGroups()) {
+ for (SegmentGroup child : segmentGroup.getChildrenGroups()) {
computeSelectionProcessForSegmentGroup(child, selectedSegments, availableSegments);
}
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/broker/BrokerTestUtils.java b/pinot-broker/src/test/java/org/apache/pinot/broker/broker/BrokerTestUtils.java
index ef65e08..f863e56 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/broker/BrokerTestUtils.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/broker/BrokerTestUtils.java
@@ -32,7 +32,8 @@ public class BrokerTestUtils {
return DefaultHelixBrokerConfig.getDefaultBrokerConf();
}
- public static HelixBrokerStarter startBroker(final String clusterName, final String zkStr, final Configuration configuration) {
+ public static HelixBrokerStarter startBroker(final String clusterName, final String zkStr,
+ final Configuration configuration) {
try {
return new HelixBrokerStarter(clusterName, zkStr, configuration);
} catch (Exception e) {
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/broker/EmptyBrokerOnlineOfflineStateModelFactory.java b/pinot-broker/src/test/java/org/apache/pinot/broker/broker/EmptyBrokerOnlineOfflineStateModelFactory.java
index 64b2244..ffecb62 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/broker/EmptyBrokerOnlineOfflineStateModelFactory.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/broker/EmptyBrokerOnlineOfflineStateModelFactory.java
@@ -67,5 +67,4 @@ public class EmptyBrokerOnlineOfflineStateModelFactory extends StateModelFactory
LOGGER.debug("EmptyBrokerOnlineOfflineStateModel.onBecomeDroppedFromOnline() : {}", message);
}
}
-
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/broker/EmptySegmentOnlineOfflineStateModelFactory.java b/pinot-broker/src/test/java/org/apache/pinot/broker/broker/EmptySegmentOnlineOfflineStateModelFactory.java
index f093c74..6920000 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/broker/EmptySegmentOnlineOfflineStateModelFactory.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/broker/EmptySegmentOnlineOfflineStateModelFactory.java
@@ -68,5 +68,4 @@ public class EmptySegmentOnlineOfflineStateModelFactory extends StateModelFactor
LOGGER.debug("EmptySegmentOnlineOfflineStateModel.onBecomeDroppedFromOnline() : {}", message);
}
}
-
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/broker/HelixBrokerStarterTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/broker/HelixBrokerStarterTest.java
index a2ce793..12d0c12 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/broker/HelixBrokerStarterTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/broker/HelixBrokerStarterTest.java
@@ -73,40 +73,42 @@ public class HelixBrokerStarterTest {
private ZkStarter.ZookeeperInstance _zookeeperInstance;
@BeforeTest
- public void setUp() throws Exception {
+ public void setUp()
+ throws Exception {
_zookeeperInstance = ZkStarter.startLocalZkServer();
_zkClient = new ZkClient(ZkStarter.DEFAULT_ZK_STR);
final String instanceId = "localhost_helixController";
_pinotResourceManager =
- new PinotHelixResourceManager(ZkStarter.DEFAULT_ZK_STR, HELIX_CLUSTER_NAME, instanceId, null, 10000L, true, /*isUpdateStateModel=*/false, true);
+ new PinotHelixResourceManager(ZkStarter.DEFAULT_ZK_STR, HELIX_CLUSTER_NAME, instanceId, null, 10000L,
+ true, /*isUpdateStateModel=*/false, true);
_pinotResourceManager.start();
_helixAdmin = _pinotResourceManager.getHelixAdmin();
_pinotHelixBrokerProperties.addProperty(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT, 8943);
- _pinotHelixBrokerProperties.addProperty(
- CommonConstants.Broker.CONFIG_OF_BROKER_REFRESH_TIMEBOUNDARY_INFO_SLEEP_INTERVAL, 100L);
+ _pinotHelixBrokerProperties
+ .addProperty(CommonConstants.Broker.CONFIG_OF_BROKER_REFRESH_TIMEBOUNDARY_INFO_SLEEP_INTERVAL, 100L);
_helixBrokerStarter =
new HelixBrokerStarter(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, _pinotHelixBrokerProperties);
- ControllerRequestBuilderUtil.addFakeBrokerInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME,
- ZkStarter.DEFAULT_ZK_STR, 5, true);
- ControllerRequestBuilderUtil.addFakeDataInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME,
- ZkStarter.DEFAULT_ZK_STR, 1, true);
+ ControllerRequestBuilderUtil
+ .addFakeBrokerInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, 5, true);
+ ControllerRequestBuilderUtil
+ .addFakeDataInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, 1, true);
- while (_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_OFFLINE").size() == 0 ||
- _helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size() == 0) {
+ while (_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_OFFLINE").size() == 0
+ || _helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size() == 0) {
Thread.sleep(100);
}
TableConfig offlineTableConfig =
- new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE)
- .setTableName(RAW_DINING_TABLE_NAME).setTimeColumnName("timeColumn").setTimeType("DAYS").build();
+ new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE).setTableName(RAW_DINING_TABLE_NAME)
+ .setTimeColumnName("timeColumn").setTimeType("DAYS").build();
_pinotResourceManager.addTable(offlineTableConfig);
setupRealtimeTable();
for (int i = 0; i < 5; i++) {
- _pinotResourceManager.addNewSegment(SegmentMetadataMockUtils.mockSegmentMetadata(RAW_DINING_TABLE_NAME),
- "downloadUrl");
+ _pinotResourceManager
+ .addNewSegment(SegmentMetadataMockUtils.mockSegmentMetadata(RAW_DINING_TABLE_NAME), "downloadUrl");
}
Thread.sleep(1000);
@@ -115,28 +117,30 @@ public class HelixBrokerStarterTest {
Assert.assertEquals(externalView.getPartitionSet().size(), 5);
}
- private void setupRealtimeTable() throws IOException {
+ private void setupRealtimeTable()
+ throws IOException {
// Set up the realtime table.
Map<String, String> streamConfigs = new HashMap<>();
streamConfigs.put("streamType", "kafka");
streamConfigs.put("stream.kafka.consumer.type", "highLevel");
streamConfigs.put("stream.kafka.topic.name", "kafkaTopic");
- streamConfigs.put("stream.kafka.decoder.class.name",
- "org.apache.pinot.core.realtime.impl.kafka.KafkaAvroMessageDecoder");
+ streamConfigs
+ .put("stream.kafka.decoder.class.name", "org.apache.pinot.core.realtime.impl.kafka.KafkaAvroMessageDecoder");
streamConfigs.put("stream.kafka.hlc.zk.connect.string", "localhost:1111/zkConnect");
streamConfigs.put("stream.kafka.decoder.prop.schema.registry.rest.url", "http://localhost:2222/schemaRegistry");
- TableConfig realtimeTimeConfig = new TableConfig.Builder(CommonConstants.Helix.TableType.REALTIME)
- .setTableName(RAW_DINING_TABLE_NAME).setTimeColumnName("timeColumn").setTimeType("DAYS").
- setStreamConfigs(streamConfigs).build();
+ TableConfig realtimeTimeConfig =
+ new TableConfig.Builder(CommonConstants.Helix.TableType.REALTIME).setTableName(RAW_DINING_TABLE_NAME)
+ .setTimeColumnName("timeColumn").setTimeType("DAYS").
+ setStreamConfigs(streamConfigs).build();
Schema schema = new Schema();
schema.setSchemaName(RAW_DINING_TABLE_NAME);
_pinotResourceManager.addOrUpdateSchema(schema);
// Fake an PinotLLCRealtimeSegmentManager instance: required for a realtime table creation.
- PinotLLCRealtimeSegmentManager.create(_pinotResourceManager, new ControllerConf(),
- new ControllerMetrics(new MetricsRegistry()));
+ PinotLLCRealtimeSegmentManager
+ .create(_pinotResourceManager, new ControllerConf(), new ControllerMetrics(new MetricsRegistry()));
_pinotResourceManager.addTable(realtimeTimeConfig);
- _helixBrokerStarter.getHelixExternalViewBasedRouting().markDataResourceOnline(realtimeTimeConfig, null,
- new ArrayList<InstanceConfig>());
+ _helixBrokerStarter.getHelixExternalViewBasedRouting()
+ .markDataResourceOnline(realtimeTimeConfig, null, new ArrayList<InstanceConfig>());
}
@AfterTest
@@ -147,7 +151,8 @@ public class HelixBrokerStarterTest {
}
@Test
- public void testResourceAndTagAssignment() throws Exception {
+ public void testResourceAndTagAssignment()
+ throws Exception {
IdealState idealState;
Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size(), 6);
@@ -158,29 +163,30 @@ public class HelixBrokerStarterTest {
_helixAdmin.getResourceExternalView(HELIX_CLUSTER_NAME, CommonConstants.Helix.BROKER_RESOURCE_INSTANCE);
Assert.assertEquals(externalView.getStateMap(DINING_TABLE_NAME).size(), SEGMENT_COUNT);
- HelixExternalViewBasedRouting helixExternalViewBasedRouting = _helixBrokerStarter.getHelixExternalViewBasedRouting();
+ HelixExternalViewBasedRouting helixExternalViewBasedRouting =
+ _helixBrokerStarter.getHelixExternalViewBasedRouting();
Field brokerRoutingTableBuilderMapField;
brokerRoutingTableBuilderMapField = HelixExternalViewBasedRouting.class.getDeclaredField("_routingTableBuilderMap");
brokerRoutingTableBuilderMapField.setAccessible(true);
final Map<String, RoutingTableBuilder> brokerRoutingTableBuilderMap =
- (Map<String, RoutingTableBuilder>)brokerRoutingTableBuilderMapField.get(helixExternalViewBasedRouting);
+ (Map<String, RoutingTableBuilder>) brokerRoutingTableBuilderMapField.get(helixExternalViewBasedRouting);
// Wait up to 30s for routing table to reach the expected size
waitForPredicate(new Callable<Boolean>() {
@Override
- public Boolean call() throws Exception {
+ public Boolean call()
+ throws Exception {
return brokerRoutingTableBuilderMap.size() == 1;
}
}, 30000L);
- Assert.assertEquals(Arrays.toString(brokerRoutingTableBuilderMap.keySet().toArray()), "[dining_OFFLINE, dining_REALTIME]");
+ Assert.assertEquals(Arrays.toString(brokerRoutingTableBuilderMap.keySet().toArray()),
+ "[dining_OFFLINE, dining_REALTIME]");
final String tableName = "coffee";
TableConfig tableConfig = new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE).setTableName(tableName)
- .setBrokerTenant("testBroker")
- .setServerTenant("testServer")
- .build();
+ .setBrokerTenant("testBroker").setServerTenant("testServer").build();
_pinotResourceManager.addTable(tableConfig);
Assert.assertEquals(_helixAdmin.getInstancesInClusterWithTag(HELIX_CLUSTER_NAME, "DefaultTenant_BROKER").size(), 6);
@@ -191,7 +197,8 @@ public class HelixBrokerStarterTest {
// Wait up to 30s for broker external view to reach the expected size
waitForPredicate(new Callable<Boolean>() {
@Override
- public Boolean call() throws Exception {
+ public Boolean call()
+ throws Exception {
return _helixAdmin.getResourceExternalView(HELIX_CLUSTER_NAME, CommonConstants.Helix.BROKER_RESOURCE_INSTANCE)
.getStateMap(COFFEE_TABLE_NAME).size() == SEGMENT_COUNT;
}
@@ -204,7 +211,8 @@ public class HelixBrokerStarterTest {
// Wait up to 30s for routing table to reach the expected size
waitForPredicate(new Callable<Boolean>() {
@Override
- public Boolean call() throws Exception {
+ public Boolean call()
+ throws Exception {
return brokerRoutingTableBuilderMap.size() == 2;
}
}, 30000L);
@@ -217,15 +225,16 @@ public class HelixBrokerStarterTest {
brokerRoutingTableBuilderMap.get(DINING_TABLE_NAME).getRoutingTables().get(0).values().iterator().next().size(),
5);
- _pinotResourceManager.addNewSegment(SegmentMetadataMockUtils.mockSegmentMetadata(RAW_DINING_TABLE_NAME),
- "downloadUrl");
+ _pinotResourceManager
+ .addNewSegment(SegmentMetadataMockUtils.mockSegmentMetadata(RAW_DINING_TABLE_NAME), "downloadUrl");
// Wait up to 30s for external view to reach the expected size
waitForPredicate(new Callable<Boolean>() {
@Override
- public Boolean call() throws Exception {
- return _helixAdmin.getResourceExternalView(HELIX_CLUSTER_NAME, DINING_TABLE_NAME).getPartitionSet().size() ==
- SEGMENT_COUNT;
+ public Boolean call()
+ throws Exception {
+ return _helixAdmin.getResourceExternalView(HELIX_CLUSTER_NAME, DINING_TABLE_NAME).getPartitionSet().size()
+ == SEGMENT_COUNT;
}
}, 30000L);
@@ -238,25 +247,27 @@ public class HelixBrokerStarterTest {
// Wait up to 30s for routing table to reach the expected size
waitForPredicate(new Callable<Boolean>() {
@Override
- public Boolean call() throws Exception {
+ public Boolean call()
+ throws Exception {
Map<String, List<String>> routingTable =
brokerRoutingTableBuilderMap.get(DINING_TABLE_NAME).getRoutingTables().get(0);
return routingTable.values().iterator().next().size() == SEGMENT_COUNT;
}
}, 30000L);
- Assert.assertEquals(brokerRoutingTableBuilderMap.get(DINING_TABLE_NAME).getRoutingTables().get(0)
- .values().iterator().next().size(), SEGMENT_COUNT);
+ Assert.assertEquals(
+ brokerRoutingTableBuilderMap.get(DINING_TABLE_NAME).getRoutingTables().get(0).values().iterator().next().size(),
+ SEGMENT_COUNT);
}
@Test
- public void testTimeBoundaryUpdate() throws Exception {
+ public void testTimeBoundaryUpdate()
+ throws Exception {
// This test verifies that when the segments of an offline table are refreshed, the TimeBoundaryInfo is also updated
// to a newer timestamp.
final long currentTimeBoundary = 10;
- TimeBoundaryService.TimeBoundaryInfo tbi =
- _helixBrokerStarter.getHelixExternalViewBasedRouting().
- getTimeBoundaryService().getTimeBoundaryInfoFor(DINING_TABLE_NAME);
+ TimeBoundaryService.TimeBoundaryInfo tbi = _helixBrokerStarter.getHelixExternalViewBasedRouting().
+ getTimeBoundaryService().getTimeBoundaryInfoFor(DINING_TABLE_NAME);
Assert.assertEquals(tbi.getTimeValue(), Long.toString(currentTimeBoundary));
@@ -265,23 +276,23 @@ public class HelixBrokerStarterTest {
// Refresh all 5 segments.
for (String segment : segmentNames) {
OfflineSegmentZKMetadata offlineSegmentZKMetadata =
- _pinotResourceManager.getOfflineSegmentZKMetadata(RAW_DINING_TABLE_NAME, segment);
+ _pinotResourceManager.getOfflineSegmentZKMetadata(RAW_DINING_TABLE_NAME, segment);
Assert.assertNotNull(offlineSegmentZKMetadata);
_pinotResourceManager.refreshSegment(
- SegmentMetadataMockUtils.mockSegmentMetadataWithEndTimeInfo(RAW_DINING_TABLE_NAME, segment, endTime ++),
- offlineSegmentZKMetadata);
+ SegmentMetadataMockUtils.mockSegmentMetadataWithEndTimeInfo(RAW_DINING_TABLE_NAME, segment, endTime++),
+ offlineSegmentZKMetadata);
}
// Due to the asynchronous nature of the TimeboundaryInfo update and thread scheduling, the updated time boundary
// may not always be the max endtime of segments. We do not expect such exact update either as long as the timestamp
// is updated to some newer value.
waitForPredicate(() -> {
TimeBoundaryService.TimeBoundaryInfo timeBoundaryInfo = _helixBrokerStarter.getHelixExternalViewBasedRouting().
- getTimeBoundaryService().getTimeBoundaryInfoFor(DINING_TABLE_NAME);
+ getTimeBoundaryService().getTimeBoundaryInfoFor(DINING_TABLE_NAME);
return currentTimeBoundary < Long.parseLong(timeBoundaryInfo.getTimeValue());
- }, 5 * _pinotHelixBrokerProperties.getLong(
- CommonConstants.Broker.CONFIG_OF_BROKER_REFRESH_TIMEBOUNDARY_INFO_SLEEP_INTERVAL));
+ }, 5 * _pinotHelixBrokerProperties
+ .getLong(CommonConstants.Broker.CONFIG_OF_BROKER_REFRESH_TIMEBOUNDARY_INFO_SLEEP_INTERVAL));
tbi = _helixBrokerStarter.getHelixExternalViewBasedRouting().
- getTimeBoundaryService().getTimeBoundaryInfoFor(DINING_TABLE_NAME);
+ getTimeBoundaryService().getTimeBoundaryInfoFor(DINING_TABLE_NAME);
Assert.assertTrue(currentTimeBoundary < Long.parseLong(tbi.getTimeValue()));
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/broker/HelixBrokerStarterUtilsTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/broker/HelixBrokerStarterUtilsTest.java
index f974cf7..f080f0e 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/broker/HelixBrokerStarterUtilsTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/broker/HelixBrokerStarterUtilsTest.java
@@ -29,7 +29,8 @@ public class HelixBrokerStarterUtilsTest {
public void testZkParserUtil1() {
String zkServers = "hostname1,hostname2";
String zkAddressForBroker = HelixBrokerStarter.getZkAddressForBroker(zkServers, "helixClusterName");
- String expectedZkAddressForBroker = "hostname1/helixClusterName/PROPERTYSTORE,hostname2/helixClusterName/PROPERTYSTORE";
+ String expectedZkAddressForBroker =
+ "hostname1/helixClusterName/PROPERTYSTORE,hostname2/helixClusterName/PROPERTYSTORE";
Assert.assertEquals(zkAddressForBroker, expectedZkAddressForBroker);
}
@@ -59,5 +60,4 @@ public class HelixBrokerStarterUtilsTest {
"hostname1:2181/chroot1/chroot2/helixClusterName/PROPERTYSTORE,hostname2:2181/chroot1/chroot2/helixClusterName/PROPERTYSTORE";
Assert.assertEquals(zkAddressForBroker, expectedZkAddressForBroker);
}
-
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/TableQueryQuotaManagerTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/TableQueryQuotaManagerTest.java
index 5c60aa8..25210eb 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/TableQueryQuotaManagerTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/TableQueryQuotaManagerTest.java
@@ -54,7 +54,6 @@ public class TableQueryQuotaManagerTest {
private static String REALTIME_TABLE_NAME = RAW_TABLE_NAME + "_REALTIME";
private static final String BROKER_INSTANCE_ID = "broker_instance_1";
-
@BeforeTest
public void beforeTest() {
_zookeeperInstance = ZkStarter.startLocalZkServer();
@@ -67,7 +66,8 @@ public class TableQueryQuotaManagerTest {
}
private HelixManager initHelixManager(String helixClusterName) {
- return new FakeHelixManager(helixClusterName, BROKER_INSTANCE_ID, InstanceType.PARTICIPANT, ZkStarter.DEFAULT_ZK_STR);
+ return new FakeHelixManager(helixClusterName, BROKER_INSTANCE_ID, InstanceType.PARTICIPANT,
+ ZkStarter.DEFAULT_ZK_STR);
}
public class FakeHelixManager extends ZKHelixManager {
@@ -83,8 +83,9 @@ public class TableQueryQuotaManagerTest {
}
void setPropertyStore(String clusterName) {
- _propertyStore = new ZkHelixPropertyStore<>(new ZkBaseDataAccessor<ZNRecord>(_zkclient),
- "/" + clusterName + "/PROPERTYSTORE", null);
+ _propertyStore =
+ new ZkHelixPropertyStore<>(new ZkBaseDataAccessor<ZNRecord>(_zkclient), "/" + clusterName + "/PROPERTYSTORE",
+ null);
}
void closeZkClient() {
@@ -111,7 +112,8 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testOfflineTableNotnullQuota() throws Exception {
+ public void testOfflineTableNotnullQuota()
+ throws Exception {
ExternalView brokerResource = generateBrokerResource(OFFLINE_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
setQps(tableConfig);
@@ -126,7 +128,8 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testOfflineTableWithNullQuotaAndNoRealtimeTableConfig() throws Exception {
+ public void testOfflineTableWithNullQuotaAndNoRealtimeTableConfig()
+ throws Exception {
ExternalView brokerResource = generateBrokerResource(OFFLINE_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
_tableQueryQuotaManager.initTableQueryQuota(tableConfig, brokerResource);
@@ -134,19 +137,16 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testOfflineTableWithNullQuotaButWithRealtimeTableConfigNullQpsConfig() throws Exception {
+ public void testOfflineTableWithNullQuotaButWithRealtimeTableConfigNullQpsConfig()
+ throws Exception {
QuotaConfig quotaConfig = new QuotaConfig();
quotaConfig.setStorage("6G");
- TableConfig realtimeTableConfig = new TableConfig.Builder(TableType.REALTIME)
- .setTableName(RAW_TABLE_NAME)
- .setQuotaConfig(quotaConfig)
- .setRetentionTimeUnit("DAYS")
- .setRetentionTimeValue("1")
- .setSegmentPushType("APPEND")
- .setBrokerTenant("testBroker")
- .setServerTenant("testServer")
- .build();
- ZKMetadataProvider.setRealtimeTableConfig(_testPropertyStore, REALTIME_TABLE_NAME, TableConfig.toZnRecord(realtimeTableConfig));
+ TableConfig realtimeTableConfig =
+ new TableConfig.Builder(TableType.REALTIME).setTableName(RAW_TABLE_NAME).setQuotaConfig(quotaConfig)
+ .setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
+ .setBrokerTenant("testBroker").setServerTenant("testServer").build();
+ ZKMetadataProvider
+ .setRealtimeTableConfig(_testPropertyStore, REALTIME_TABLE_NAME, TableConfig.toZnRecord(realtimeTableConfig));
ExternalView brokerResource = generateBrokerResource(OFFLINE_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
@@ -159,20 +159,17 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testOfflineTableWithNullQuotaButWithRealtimeTableConfigNotNullQpsConfig() throws Exception {
+ public void testOfflineTableWithNullQuotaButWithRealtimeTableConfigNotNullQpsConfig()
+ throws Exception {
QuotaConfig quotaConfig = new QuotaConfig();
quotaConfig.setStorage("6G");
quotaConfig.setMaxQueriesPerSecond("100.00");
- TableConfig realtimeTableConfig = new TableConfig.Builder(TableType.REALTIME)
- .setTableName(RAW_TABLE_NAME)
- .setQuotaConfig(quotaConfig)
- .setRetentionTimeUnit("DAYS")
- .setRetentionTimeValue("1")
- .setSegmentPushType("APPEND")
- .setBrokerTenant("testBroker")
- .setServerTenant("testServer")
- .build();
- ZKMetadataProvider.setRealtimeTableConfig(_testPropertyStore, REALTIME_TABLE_NAME, TableConfig.toZnRecord(realtimeTableConfig));
+ TableConfig realtimeTableConfig =
+ new TableConfig.Builder(TableType.REALTIME).setTableName(RAW_TABLE_NAME).setQuotaConfig(quotaConfig)
+ .setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
+ .setBrokerTenant("testBroker").setServerTenant("testServer").build();
+ ZKMetadataProvider
+ .setRealtimeTableConfig(_testPropertyStore, REALTIME_TABLE_NAME, TableConfig.toZnRecord(realtimeTableConfig));
ExternalView brokerResource = generateBrokerResource(REALTIME_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
@@ -185,7 +182,8 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testBothTableHaveQpsQuotaConfig() throws Exception {
+ public void testBothTableHaveQpsQuotaConfig()
+ throws Exception {
ExternalView brokerResource = generateBrokerResource(OFFLINE_TABLE_NAME);
brokerResource.setState(REALTIME_TABLE_NAME, BROKER_INSTANCE_ID, "ONLINE");
brokerResource.setState(REALTIME_TABLE_NAME, "broker_instance_2", "OFFLINE");
@@ -193,31 +191,23 @@ public class TableQueryQuotaManagerTest {
QuotaConfig quotaConfig = new QuotaConfig();
quotaConfig.setStorage("6G");
quotaConfig.setMaxQueriesPerSecond("100.00");
- TableConfig realtimeTableConfig = new TableConfig.Builder(TableType.REALTIME)
- .setTableName(RAW_TABLE_NAME)
- .setQuotaConfig(quotaConfig)
- .setRetentionTimeUnit("DAYS")
- .setRetentionTimeValue("1")
- .setSegmentPushType("APPEND")
- .setBrokerTenant("testBroker")
- .setServerTenant("testServer")
- .build();
+ TableConfig realtimeTableConfig =
+ new TableConfig.Builder(TableType.REALTIME).setTableName(RAW_TABLE_NAME).setQuotaConfig(quotaConfig)
+ .setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
+ .setBrokerTenant("testBroker").setServerTenant("testServer").build();
QuotaConfig quotaConfig2 = new QuotaConfig();
quotaConfig2.setStorage("6G");
quotaConfig2.setMaxQueriesPerSecond("100.00");
- TableConfig offlineTableConfig = new TableConfig.Builder(TableType.OFFLINE)
- .setTableName(RAW_TABLE_NAME)
- .setQuotaConfig(quotaConfig)
- .setRetentionTimeUnit("DAYS")
- .setRetentionTimeValue("1")
- .setSegmentPushType("APPEND")
- .setBrokerTenant("testBroker")
- .setServerTenant("testServer")
- .build();
-
- ZKMetadataProvider.setRealtimeTableConfig(_testPropertyStore, REALTIME_TABLE_NAME, TableConfig.toZnRecord(realtimeTableConfig));
- ZKMetadataProvider.setOfflineTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME, TableConfig.toZnRecord(offlineTableConfig));
+ TableConfig offlineTableConfig =
+ new TableConfig.Builder(TableType.OFFLINE).setTableName(RAW_TABLE_NAME).setQuotaConfig(quotaConfig)
+ .setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
+ .setBrokerTenant("testBroker").setServerTenant("testServer").build();
+
+ ZKMetadataProvider
+ .setRealtimeTableConfig(_testPropertyStore, REALTIME_TABLE_NAME, TableConfig.toZnRecord(realtimeTableConfig));
+ ZKMetadataProvider
+ .setOfflineTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME, TableConfig.toZnRecord(offlineTableConfig));
// Since each table has 2 online brokers, per broker rate becomes 100.0 / 2 = 50.0
_tableQueryQuotaManager.initTableQueryQuota(offlineTableConfig, brokerResource);
@@ -239,7 +229,8 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testRealtimeTableNotnullQuota() throws Exception {
+ public void testRealtimeTableNotnullQuota()
+ throws Exception {
ExternalView brokerResource = generateBrokerResource(REALTIME_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(REALTIME_TABLE_NAME);
setQps(tableConfig);
@@ -253,7 +244,8 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testRealtimeTableWithNullQuotaAndNoOfflineTableConfig() throws Exception {
+ public void testRealtimeTableWithNullQuotaAndNoOfflineTableConfig()
+ throws Exception {
ExternalView brokerResource = generateBrokerResource(REALTIME_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(REALTIME_TABLE_NAME);
_tableQueryQuotaManager.initTableQueryQuota(tableConfig, brokerResource);
@@ -261,19 +253,16 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testRealtimeTableWithNullQuotaButWithOfflineTableConfigNullQpsConfig() throws Exception {
+ public void testRealtimeTableWithNullQuotaButWithOfflineTableConfigNullQpsConfig()
+ throws Exception {
QuotaConfig quotaConfig = new QuotaConfig();
quotaConfig.setStorage("6G");
- TableConfig offlineTableConfig = new TableConfig.Builder(TableType.OFFLINE)
- .setTableName(RAW_TABLE_NAME)
- .setQuotaConfig(quotaConfig)
- .setRetentionTimeUnit("DAYS")
- .setRetentionTimeValue("1")
- .setSegmentPushType("APPEND")
- .setBrokerTenant("testBroker")
- .setServerTenant("testServer")
- .build();
- ZKMetadataProvider.setOfflineTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME, TableConfig.toZnRecord(offlineTableConfig));
+ TableConfig offlineTableConfig =
+ new TableConfig.Builder(TableType.OFFLINE).setTableName(RAW_TABLE_NAME).setQuotaConfig(quotaConfig)
+ .setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
+ .setBrokerTenant("testBroker").setServerTenant("testServer").build();
+ ZKMetadataProvider
+ .setOfflineTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME, TableConfig.toZnRecord(offlineTableConfig));
ExternalView brokerResource = generateBrokerResource(REALTIME_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(REALTIME_TABLE_NAME);
@@ -282,20 +271,17 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testRealtimeTableWithNullQuotaButWithOfflineTableConfigNotNullQpsConfig() throws Exception {
+ public void testRealtimeTableWithNullQuotaButWithOfflineTableConfigNotNullQpsConfig()
+ throws Exception {
QuotaConfig quotaConfig = new QuotaConfig();
quotaConfig.setStorage("6G");
quotaConfig.setMaxQueriesPerSecond("100.00");
- TableConfig offlineTableConfig = new TableConfig.Builder(TableType.OFFLINE)
- .setTableName(RAW_TABLE_NAME)
- .setQuotaConfig(quotaConfig)
- .setRetentionTimeUnit("DAYS")
- .setRetentionTimeValue("1")
- .setSegmentPushType("APPEND")
- .setBrokerTenant("testBroker")
- .setServerTenant("testServer")
- .build();
- ZKMetadataProvider.setOfflineTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME, TableConfig.toZnRecord(offlineTableConfig));
+ TableConfig offlineTableConfig =
+ new TableConfig.Builder(TableType.OFFLINE).setTableName(RAW_TABLE_NAME).setQuotaConfig(quotaConfig)
+ .setRetentionTimeUnit("DAYS").setRetentionTimeValue("1").setSegmentPushType("APPEND")
+ .setBrokerTenant("testBroker").setServerTenant("testServer").build();
+ ZKMetadataProvider
+ .setOfflineTableConfig(_testPropertyStore, OFFLINE_TABLE_NAME, TableConfig.toZnRecord(offlineTableConfig));
ExternalView brokerResource = generateBrokerResource(OFFLINE_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(REALTIME_TABLE_NAME);
@@ -304,7 +290,8 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testInvalidQpsQuota() throws Exception {
+ public void testInvalidQpsQuota()
+ throws Exception {
ExternalView brokerResource = generateBrokerResource(OFFLINE_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
// Set invalid qps quota
@@ -316,7 +303,8 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testInvalidNegativeQpsQuota() throws Exception {
+ public void testInvalidNegativeQpsQuota()
+ throws Exception {
ExternalView brokerResource = generateBrokerResource(OFFLINE_TABLE_NAME);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
// Set invalid negative qps quota
@@ -328,7 +316,8 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testNoBrokerResource() throws Exception {
+ public void testNoBrokerResource()
+ throws Exception {
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
setQps(tableConfig);
_tableQueryQuotaManager.initTableQueryQuota(tableConfig, null);
@@ -336,7 +325,8 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testNoBrokerServiceOnBrokerResource() throws Exception {
+ public void testNoBrokerServiceOnBrokerResource()
+ throws Exception {
ExternalView brokerResource = new ExternalView(BROKER_RESOURCE_INSTANCE);
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
setQps(tableConfig);
@@ -345,7 +335,8 @@ public class TableQueryQuotaManagerTest {
}
@Test
- public void testNoOnlineBrokerServiceOnBrokerResource() throws Exception {
+ public void testNoOnlineBrokerServiceOnBrokerResource()
+ throws Exception {
ExternalView brokerResource = new ExternalView(BROKER_RESOURCE_INSTANCE);
brokerResource.setState(OFFLINE_TABLE_NAME, "broker_instance_2", "OFFLINE");
TableConfig tableConfig = generateDefaultTableConfig(OFFLINE_TABLE_NAME);
@@ -377,7 +368,8 @@ public class TableQueryQuotaManagerTest {
return brokerResource;
}
- private void runQueries(int numOfTimesToRun, long millis) throws InterruptedException {
+ private void runQueries(int numOfTimesToRun, long millis)
+ throws InterruptedException {
int count = 0;
for (int i = 0; i < numOfTimesToRun; i++) {
Assert.assertTrue(_tableQueryQuotaManager.acquire(RAW_TABLE_NAME));
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/FilterOptimizerTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/FilterOptimizerTest.java
index 3cabb78..7ea5c89 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/FilterOptimizerTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/FilterOptimizerTest.java
@@ -32,7 +32,8 @@ public class FilterOptimizerTest {
// Testing positive cases of flattening the query tree.
@Test
- public void testPositive() throws Exception {
+ public void testPositive()
+ throws Exception {
Pql2Compiler pql2Compiler = new Pql2Compiler();
BrokerRequest req;
@@ -45,7 +46,7 @@ public class FilterOptimizerTest {
tree = RequestUtils.generateFilterQueryTree(_optimizer.optimize(req, timeColumn));
Assert.assertEquals(tree.getChildren().size(), 3);
Assert.assertEquals(tree.getOperator(), FilterOperator.AND);
- for (FilterQueryTree node: tree.getChildren()) {
+ for (FilterQueryTree node : tree.getChildren()) {
Assert.assertNull(node.getChildren());
Assert.assertEquals(node.getOperator(), FilterOperator.EQUALITY);
}
@@ -54,7 +55,7 @@ public class FilterOptimizerTest {
tree = RequestUtils.generateFilterQueryTree(_optimizer.optimize(req, timeColumn));
Assert.assertEquals(tree.getChildren().size(), 4);
Assert.assertEquals(tree.getOperator(), FilterOperator.AND);
- for (FilterQueryTree node: tree.getChildren()) {
+ for (FilterQueryTree node : tree.getChildren()) {
Assert.assertNull(node.getChildren());
Assert.assertEquals(node.getOperator(), FilterOperator.EQUALITY);
}
@@ -63,7 +64,7 @@ public class FilterOptimizerTest {
tree = RequestUtils.generateFilterQueryTree(_optimizer.optimize(req, timeColumn));
Assert.assertEquals(tree.getChildren().size(), 3);
Assert.assertEquals(tree.getOperator(), FilterOperator.OR);
- for (FilterQueryTree node: tree.getChildren()) {
+ for (FilterQueryTree node : tree.getChildren()) {
Assert.assertNull(node.getChildren());
Assert.assertEquals(node.getOperator(), FilterOperator.EQUALITY);
}
@@ -72,7 +73,7 @@ public class FilterOptimizerTest {
tree = RequestUtils.generateFilterQueryTree(_optimizer.optimize(req, timeColumn));
Assert.assertEquals(tree.getChildren().size(), 4);
Assert.assertEquals(tree.getOperator(), FilterOperator.OR);
- for (FilterQueryTree node: tree.getChildren()) {
+ for (FilterQueryTree node : tree.getChildren()) {
Assert.assertNull(node.getChildren());
Assert.assertEquals(node.getOperator(), FilterOperator.EQUALITY);
}
@@ -82,7 +83,7 @@ public class FilterOptimizerTest {
tree = RequestUtils.generateFilterQueryTree(_optimizer.optimize(req, timeColumn));
Assert.assertEquals(tree.getChildren().size(), 5);
Assert.assertEquals(tree.getOperator(), FilterOperator.OR);
- for (FilterQueryTree node: tree.getChildren()) {
+ for (FilterQueryTree node : tree.getChildren()) {
Assert.assertNull(node.getChildren());
Assert.assertEquals(node.getOperator(), FilterOperator.EQUALITY);
}
@@ -94,7 +95,7 @@ public class FilterOptimizerTest {
Assert.assertEquals(tree.getOperator(), FilterOperator.OR);
numLeaves = 0;
numOps = 0;
- for (FilterQueryTree node: tree.getChildren()) {
+ for (FilterQueryTree node : tree.getChildren()) {
if (node.getOperator().equals(FilterOperator.EQUALITY)) {
Assert.assertNull(node.getChildren());
numLeaves++;
@@ -111,11 +112,11 @@ public class FilterOptimizerTest {
String whereClause = constructWhereClause(FilterOperator.OR, maxNodesAtTopLevel + 50);
req = pql2Compiler.compileToBrokerRequest("SELECT * FROM T WHERE " + whereClause);
tree = RequestUtils.generateFilterQueryTree(_optimizer.optimize(req, timeColumn));
- Assert.assertEquals(tree.getChildren().size(), maxNodesAtTopLevel+1);
+ Assert.assertEquals(tree.getChildren().size(), maxNodesAtTopLevel + 1);
Assert.assertEquals(tree.getOperator(), FilterOperator.OR);
numLeaves = 0;
numOps = 0;
- for (FilterQueryTree node: tree.getChildren()) {
+ for (FilterQueryTree node : tree.getChildren()) {
if (node.getOperator().equals(FilterOperator.EQUALITY)) {
Assert.assertNull(node.getChildren());
numLeaves++;
@@ -130,7 +131,8 @@ public class FilterOptimizerTest {
// Tests cases where we should not do any flattening.
@Test
- public void testNegative() throws Exception {
+ public void testNegative()
+ throws Exception {
Pql2Compiler pql2Compiler = new Pql2Compiler();
BrokerRequest req;
FilterQueryTree tree;
@@ -143,7 +145,7 @@ public class FilterOptimizerTest {
Assert.assertEquals(tree.getOperator(), FilterOperator.AND);
numOps = 0;
numLeaves = 0;
- for (FilterQueryTree node: tree.getChildren()) {
+ for (FilterQueryTree node : tree.getChildren()) {
if (node.getOperator().equals(FilterOperator.OR)) {
Assert.assertEquals(2, node.getChildren().size());
numOps++;
@@ -159,7 +161,7 @@ public class FilterOptimizerTest {
if (depth == 1) {
return "(A = " + depth + ")";
} else {
- return "(A" + depth + " = " + depth + " " + operator + " " + constructWhereClause(operator, depth-1) + ")";
+ return "(A" + depth + " = " + depth + " " + operator + " " + constructWhereClause(operator, depth - 1) + ")";
}
}
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizerTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizerTest.java
index 2a1145b..bd401f2 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizerTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizerTest.java
@@ -33,74 +33,54 @@ public class MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizerTest {
@Test
public void testSimpleOrCase() {
// a = 1 OR a = 2 OR a = 3 should be rewritten to a IN (1, 2, 3)
- checkForIdenticalFilterQueryTrees(
- "select * from a where a = 1 OR a = 2 OR a = 3",
- "select * from a where a IN (1, 2, 3)"
- );
+ checkForIdenticalFilterQueryTrees("select * from a where a = 1 OR a = 2 OR a = 3",
+ "select * from a where a IN (1, 2, 3)");
}
@Test
public void testWithOtherClause() {
// a = 1 OR a = 2 OR (a = 3 AND b = 4) -> a IN (1, 2) OR (a = 3 AND b = 4)
- checkForIdenticalFilterQueryTrees(
- "select * from a where a = 1 OR a = 2 OR a = 3 AND b = 4",
- "select * from a where a IN (1, 2) OR (a = 3 AND b = 4)"
- );
+ checkForIdenticalFilterQueryTrees("select * from a where a = 1 OR a = 2 OR a = 3 AND b = 4",
+ "select * from a where a IN (1, 2) OR (a = 3 AND b = 4)");
}
@Test
public void testTwoOrClauses() {
// a = 1 OR a = 2 OR a = 3 OR b = 4 OR b = 5 OR b = 6 -> a IN (1,2,3) OR b IN (4,5,6)
- checkForIdenticalFilterQueryTrees(
- "select * from a where a = 1 OR a = 2 OR a = 3 OR b = 4 OR b = 5 OR b = 6",
- "select * from a where a IN (1,2,3) OR b IN (4,5,6)"
- );
+ checkForIdenticalFilterQueryTrees("select * from a where a = 1 OR a = 2 OR a = 3 OR b = 4 OR b = 5 OR b = 6",
+ "select * from a where a IN (1,2,3) OR b IN (4,5,6)");
}
@Test
public void testMultipleOutOfOrderClauses() {
// a = 1 OR a = 2 OR a = 3 OR b = 4 OR b = 5 OR b = 6 -> a IN (1,2,3) OR b IN (4,5,6)
- checkForIdenticalFilterQueryTrees(
- "select * from a where a = 1 OR b = 4 OR a = 2 OR b = 5 OR a = 3 OR b = 6",
- "select * from a where a IN (1,2,3) OR b IN (4,5,6)"
- );
+ checkForIdenticalFilterQueryTrees("select * from a where a = 1 OR b = 4 OR a = 2 OR b = 5 OR a = 3 OR b = 6",
+ "select * from a where a IN (1,2,3) OR b IN (4,5,6)");
}
@Test
public void testDuplicatesAndPullup() {
// a = 1 OR a = 1 -> a = 1 (equality predicate, not IN clause, eg. a IN (1))
// This should also remove the OR node
- checkForIdenticalFilterQueryTrees(
- "select * from a where a = 1 OR a = 1",
- "select * from a where a = 1"
- );
+ checkForIdenticalFilterQueryTrees("select * from a where a = 1 OR a = 1", "select * from a where a = 1");
// (a = 1 OR a = 1) AND b = 2 -> a = 1 AND b = 2 (no OR node either)
// These are reordered due to an implementation detail
- checkOptimizedFilterQueryTreeForQuery(
- "select * from a where (a = 1 OR a = 1) AND b = 2",
- "AND\n" +
- " b EQUALITY [2]\n" +
- " a EQUALITY [1]"
- );
+ checkOptimizedFilterQueryTreeForQuery("select * from a where (a = 1 OR a = 1) AND b = 2",
+ "AND\n" + " b EQUALITY [2]\n" + " a EQUALITY [1]");
}
@Test
public void testEqualityAndInMerge() {
// a = 1 OR a IN (2,3,4) -> a IN (1,2,3,4)
- checkForIdenticalFilterQueryTrees(
- "select * from a where a = 1 OR a IN (2,3,4,31)",
- "select * from a where a IN (1,2,31,3,4)"
- );
+ checkForIdenticalFilterQueryTrees("select * from a where a = 1 OR a IN (2,3,4,31)",
+ "select * from a where a IN (1,2,31,3,4)");
}
@Test
public void testSingularInClauseDedupeAndCollapse() {
// a IN (1,1) -> a = 1
- checkForIdenticalFilterQueryTrees(
- "select * from a where a IN (1, 1) OR a = 1",
- "select * from a where a = 1"
- );
+ checkForIdenticalFilterQueryTrees("select * from a where a IN (1, 1) OR a = 1", "select * from a where a = 1");
}
private static final Pql2Compiler COMPILER = new Pql2Compiler();
@@ -124,13 +104,15 @@ public class MultipleOrEqualitiesToInClauseFilterQueryTreeOptimizerTest {
private void checkOptimizedFilterQueryTreeForQuery(String query, String optimizedFilterQueryTree) {
String queryFilterTree = stripIds(filterQueryTreeForQuery(query));
- Assert.assertEquals(queryFilterTree, stripIds(optimizedFilterQueryTree), "Optimized filter query trees are different for query " + query);
+ Assert.assertEquals(queryFilterTree, stripIds(optimizedFilterQueryTree),
+ "Optimized filter query trees are different for query " + query);
}
private void checkForIdenticalFilterQueryTrees(String query, String optimizedQuery) {
String queryFilterTree = stripIds(filterQueryTreeForQuery(query));
String optimizedFilterQueryTree = stripIds(filterQueryTreeForQuery(optimizedQuery));
- Assert.assertEquals(queryFilterTree, stripIds(optimizedFilterQueryTree), "Optimized filter query trees are different for query " + query);
+ Assert.assertEquals(queryFilterTree, stripIds(optimizedFilterQueryTree),
+ "Optimized filter query trees are different for query " + query);
}
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/RangeMergeOptimizerTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/RangeMergeOptimizerTest.java
index ddc6717..8b0ffdf 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/RangeMergeOptimizerTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/RangeMergeOptimizerTest.java
@@ -178,7 +178,9 @@ public class RangeMergeOptimizerTest {
compareTrees(actualTree, expectedTree);
// Query with same lower and upper range
- actualTree = buildFilterQueryTree("select * from table where (time >= 10 and time <= 20) and (time between 10 and 20)", true);
+ actualTree =
+ buildFilterQueryTree("select * from table where (time >= 10 and time <= 20) and (time between 10 and 20)",
+ true);
expectedTree = buildFilterQueryTree("select * from table where time between 10 and 20", false);
compareTrees(actualTree, expectedTree);
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/RandomRoutingTableTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/RandomRoutingTableTest.java
index f894191..ac02919 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/RandomRoutingTableTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/RandomRoutingTableTest.java
@@ -45,7 +45,8 @@ public class RandomRoutingTableTest {
private static final int MAX_NUM_SEGMENTS_PER_SERVER = 31;
@Test
- public void testHelixExternalViewBasedRoutingTable() throws Exception {
+ public void testHelixExternalViewBasedRoutingTable()
+ throws Exception {
URL resourceUrl = getClass().getClassLoader().getResource("SampleExternalView.json");
Assert.assertNotNull(resourceUrl);
String fileName = resourceUrl.getFile();
@@ -91,7 +92,8 @@ public class RandomRoutingTableTest {
return instanceConfigs;
}
- private TableConfig generateTableConfig(String tableName) throws Exception {
+ private TableConfig generateTableConfig(String tableName)
+ throws Exception {
TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName);
Builder builder = new TableConfig.Builder(tableType);
builder.setTableName(tableName);
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/RoutingTableTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/RoutingTableTest.java
index 9ee925b..c89b1c2 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/RoutingTableTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/RoutingTableTest.java
@@ -49,7 +49,8 @@ public class RoutingTableTest {
public static final String ALL_PARTITIONS = "ALL";
@Test
- public void testHelixExternalViewBasedRoutingTable() throws Exception {
+ public void testHelixExternalViewBasedRoutingTable()
+ throws Exception {
HelixExternalViewBasedRouting routingTable = new HelixExternalViewBasedRouting(null, null, new BaseConfiguration());
ExternalView externalView = new ExternalView("testResource0_OFFLINE");
@@ -95,16 +96,17 @@ public class RoutingTableTest {
}
}
-
@Test
- public void testTimeBoundaryRegression() throws Exception {
+ public void testTimeBoundaryRegression()
+ throws Exception {
final FakePropertyStore propertyStore = new FakePropertyStore();
final OfflineSegmentZKMetadata offlineSegmentZKMetadata = new OfflineSegmentZKMetadata();
offlineSegmentZKMetadata.setTimeUnit(TimeUnit.DAYS);
offlineSegmentZKMetadata.setEndTime(1234L);
- propertyStore.setContents(ZKMetadataProvider.constructPropertyStorePathForSegment("myTable_OFFLINE",
- "someSegment_0"), offlineSegmentZKMetadata.toZNRecord());
+ propertyStore
+ .setContents(ZKMetadataProvider.constructPropertyStorePathForSegment("myTable_OFFLINE", "someSegment_0"),
+ offlineSegmentZKMetadata.toZNRecord());
final ExternalView offlineExternalView = new ExternalView("myTable_OFFLINE");
offlineExternalView.setState("someSegment_0", "Server_1.2.3.4_1234", "ONLINE");
@@ -113,18 +115,18 @@ public class RoutingTableTest {
HelixExternalViewBasedRouting routingTable =
new HelixExternalViewBasedRouting(propertyStore, null, new BaseConfiguration()) {
- @Override
- protected ExternalView fetchExternalView(String table) {
- return offlineExternalView;
- }
+ @Override
+ protected ExternalView fetchExternalView(String table) {
+ return offlineExternalView;
+ }
- @Override
- protected void updateTimeBoundary(String tableName, ExternalView externalView) {
- if (tableName.equals("myTable_OFFLINE")) {
- timeBoundaryUpdated.setValue(true);
- }
- }
- };
+ @Override
+ protected void updateTimeBoundary(String tableName, ExternalView externalView) {
+ if (tableName.equals("myTable_OFFLINE")) {
+ timeBoundaryUpdated.setValue(true);
+ }
+ }
+ };
routingTable.setBrokerMetrics(new BrokerMetrics(new MetricsRegistry()));
Assert.assertFalse(timeBoundaryUpdated.booleanValue());
@@ -135,7 +137,8 @@ public class RoutingTableTest {
TableConfig myTableRealtimeConfig = generateTableConfig("myTable_REALTIME");
routingTable.markDataResourceOnline(myTableOfflineConfig, offlineExternalView, instanceConfigList);
- routingTable.markDataResourceOnline(myTableRealtimeConfig, new ExternalView("myTable_REALTIME"), new ArrayList<InstanceConfig>());
+ routingTable.markDataResourceOnline(myTableRealtimeConfig, new ExternalView("myTable_REALTIME"),
+ new ArrayList<InstanceConfig>());
Assert.assertTrue(timeBoundaryUpdated.booleanValue());
}
@@ -153,8 +156,9 @@ public class RoutingTableTest {
Assert.assertEquals(Arrays.toString(selectedSegmentArray), expectedSegmentList);
}
- @Test(enabled=false)
- public void testKafkaHighLevelConsumerBasedRoutingTable() throws Exception {
+ @Test(enabled = false)
+ public void testKafkaHighLevelConsumerBasedRoutingTable()
+ throws Exception {
RoutingTableBuilder routingStrategy = new HighLevelConsumerBasedRoutingTableBuilder();
final String group0 = "testResource0_REALTIME_1433316466991_0";
final String group1 = "testResource1_REALTIME_1433316490099_1";
@@ -171,80 +175,77 @@ public class RoutingTableTest {
ExternalView externalView = new ExternalView("testResource0_REALTIME");
// Toss in an llc segment in the mix. Should not affect the results
externalView.setState(llcSegmentName.getSegmentName(), "dataServer_instance_0", "CONSUMING");
- externalView.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "0").getSegmentName(),
- "dataServer_instance_0", "ONLINE");
- externalView.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "1").getSegmentName(),
- "dataServer_instance_1", "ONLINE");
- externalView.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "2").getSegmentName(),
- "dataServer_instance_2", "ONLINE");
- externalView.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "3").getSegmentName(),
- "dataServer_instance_3", "ONLINE");
- externalView.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "4").getSegmentName(),
- "dataServer_instance_4", "ONLINE");
- externalView.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "5").getSegmentName(),
- "dataServer_instance_5", "ONLINE");
+ externalView
+ .setState(new HLCSegmentName(group0, ALL_PARTITIONS, "0").getSegmentName(), "dataServer_instance_0", "ONLINE");
+ externalView
+ .setState(new HLCSegmentName(group0, ALL_PARTITIONS, "1").getSegmentName(), "dataServer_instance_1", "ONLINE");
+ externalView
+ .setState(new HLCSegmentName(group1, ALL_PARTITIONS, "2").getSegmentName(), "dataServer_instance_2", "ONLINE");
+ externalView
+ .setState(new HLCSegmentName(group1, ALL_PARTITIONS, "3").getSegmentName(), "dataServer_instance_3", "ONLINE");
+ externalView
+ .setState(new HLCSegmentName(group2, ALL_PARTITIONS, "4").getSegmentName(), "dataServer_instance_4", "ONLINE");
+ externalView
+ .setState(new HLCSegmentName(group2, ALL_PARTITIONS, "5").getSegmentName(), "dataServer_instance_5", "ONLINE");
routingTable.markDataResourceOnline(generateTableConfig("testResource0_REALTIME"), externalView,
generateInstanceConfigs("dataServer_instance", 0, 5));
ExternalView externalView1 = new ExternalView("testResource1_REALTIME");
- externalView1.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "10").getSegmentName(),
- "dataServer_instance_10", "ONLINE");
- externalView1.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "11").getSegmentName(),
- "dataServer_instance_11", "ONLINE");
- externalView1.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "12").getSegmentName(),
- "dataServer_instance_12", "ONLINE");
+ externalView1.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "10").getSegmentName(), "dataServer_instance_10",
+ "ONLINE");
+ externalView1.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "11").getSegmentName(), "dataServer_instance_11",
+ "ONLINE");
+ externalView1.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "12").getSegmentName(), "dataServer_instance_12",
+ "ONLINE");
routingTable.markDataResourceOnline(generateTableConfig("testResource1_REALTIME"), externalView1,
generateInstanceConfigs("dataServer_instance", 10, 12));
ExternalView externalView2 = new ExternalView("testResource2_REALTIME");
- externalView2.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "20").getSegmentName(),
- "dataServer_instance_20", "ONLINE");
- externalView2.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "21").getSegmentName(),
- "dataServer_instance_21", "ONLINE");
- externalView2.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "22").getSegmentName(),
- "dataServer_instance_22", "ONLINE");
- externalView2.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "23").getSegmentName(),
- "dataServer_instance_23", "ONLINE");
- externalView2.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "24").getSegmentName(),
- "dataServer_instance_24", "ONLINE");
- externalView2.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "25").getSegmentName(),
- "dataServer_instance_25", "ONLINE");
- externalView2.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "26").getSegmentName(),
- "dataServer_instance_26", "ONLINE");
- externalView2.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "27").getSegmentName(),
- "dataServer_instance_27", "ONLINE");
- externalView2.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "28").getSegmentName(),
- "dataServer_instance_28", "ONLINE");
+ externalView2.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "20").getSegmentName(), "dataServer_instance_20",
+ "ONLINE");
+ externalView2.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "21").getSegmentName(), "dataServer_instance_21",
+ "ONLINE");
+ externalView2.setState(new HLCSegmentName(group0, ALL_PARTITIONS, "22").getSegmentName(), "dataServer_instance_22",
+ "ONLINE");
+ externalView2.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "23").getSegmentName(), "dataServer_instance_23",
+ "ONLINE");
+ externalView2.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "24").getSegmentName(), "dataServer_instance_24",
+ "ONLINE");
+ externalView2.setState(new HLCSegmentName(group1, ALL_PARTITIONS, "25").getSegmentName(), "dataServer_instance_25",
+ "ONLINE");
+ externalView2.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "26").getSegmentName(), "dataServer_instance_26",
+ "ONLINE");
+ externalView2.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "27").getSegmentName(), "dataServer_instance_27",
+ "ONLINE");
+ externalView2.setState(new HLCSegmentName(group2, ALL_PARTITIONS, "28").getSegmentName(), "dataServer_instance_28",
+ "ONLINE");
routingTable.markDataResourceOnline(generateTableConfig("testResource2_REALTIME"), externalView2,
generateInstanceConfigs("dataServer_instance", 20, 28));
for (int numRun = 0; numRun < 100; ++numRun) {
- assertResourceRequest(
- routingTable,
- "testResource0_REALTIME",
- new String[] { "[" + new HLCSegmentName(group0, ALL_PARTITIONS, "0").getSegmentName()
- + ", " + new HLCSegmentName(group0, ALL_PARTITIONS, "1").getSegmentName() + "]", "["
- + new HLCSegmentName(group1, ALL_PARTITIONS, "2").getSegmentName()
- + ", "
- + new HLCSegmentName(group1, ALL_PARTITIONS, "3").getSegmentName() + "]", "["
- + new HLCSegmentName(group2, ALL_PARTITIONS, "4").getSegmentName() + ", "
- + new HLCSegmentName(group2, ALL_PARTITIONS, "5").getSegmentName() + "]" }, 2);
+ assertResourceRequest(routingTable, "testResource0_REALTIME", new String[]{
+ "[" + new HLCSegmentName(group0, ALL_PARTITIONS, "0").getSegmentName() + ", " + new HLCSegmentName(group0,
+ ALL_PARTITIONS, "1").getSegmentName() + "]",
+ "[" + new HLCSegmentName(group1, ALL_PARTITIONS, "2").getSegmentName() + ", " + new HLCSegmentName(group1,
+ ALL_PARTITIONS, "3").getSegmentName() + "]",
+ "[" + new HLCSegmentName(group2, ALL_PARTITIONS, "4").getSegmentName() + ", " + new HLCSegmentName(group2,
+ ALL_PARTITIONS, "5").getSegmentName() + "]"}, 2);
}
for (int numRun = 0; numRun < 100; ++numRun) {
- assertResourceRequest(routingTable, "testResource1_REALTIME",
- new String[] { "[" + new HLCSegmentName(group0, ALL_PARTITIONS, "10").getSegmentName()
- + ", " + new HLCSegmentName(group0, ALL_PARTITIONS, "11").getSegmentName() + ", "
- + new HLCSegmentName(group0, ALL_PARTITIONS, "12").getSegmentName() + "]" }, 3);
+ assertResourceRequest(routingTable, "testResource1_REALTIME", new String[]{
+ "[" + new HLCSegmentName(group0, ALL_PARTITIONS, "10").getSegmentName() + ", " + new HLCSegmentName(group0,
+ ALL_PARTITIONS, "11").getSegmentName() + ", " + new HLCSegmentName(group0, ALL_PARTITIONS, "12")
+ .getSegmentName() + "]"}, 3);
}
for (int numRun = 0; numRun < 100; ++numRun) {
- assertResourceRequest(routingTable, "testResource2_REALTIME",
- new String[] { "[" + new HLCSegmentName(group0, ALL_PARTITIONS, "20").getSegmentName()
- + ", " + new HLCSegmentName(group0, ALL_PARTITIONS, "21").getSegmentName() + ", "
- + new HLCSegmentName(group0, ALL_PARTITIONS, "22").getSegmentName() + "]", "["
- + new HLCSegmentName(group1, ALL_PARTITIONS, "23").getSegmentName() + ", "
- + new HLCSegmentName(group1, ALL_PARTITIONS, "24").getSegmentName() + ", "
- + new HLCSegmentName(group1, ALL_PARTITIONS, "25").getSegmentName() + "]", "["
- + new HLCSegmentName(group2, ALL_PARTITIONS, "26").getSegmentName() + ", "
- + new HLCSegmentName(group2, ALL_PARTITIONS, "27").getSegmentName() + ", "
- + new HLCSegmentName(group2, ALL_PARTITIONS, "28").getSegmentName() + "]" }, 3);
+ assertResourceRequest(routingTable, "testResource2_REALTIME", new String[]{
+ "[" + new HLCSegmentName(group0, ALL_PARTITIONS, "20").getSegmentName() + ", " + new HLCSegmentName(group0,
+ ALL_PARTITIONS, "21").getSegmentName() + ", " + new HLCSegmentName(group0, ALL_PARTITIONS, "22")
+ .getSegmentName() + "]",
+ "[" + new HLCSegmentName(group1, ALL_PARTITIONS, "23").getSegmentName() + ", " + new HLCSegmentName(group1,
+ ALL_PARTITIONS, "24").getSegmentName() + ", " + new HLCSegmentName(group1, ALL_PARTITIONS, "25")
+ .getSegmentName() + "]",
+ "[" + new HLCSegmentName(group2, ALL_PARTITIONS, "26").getSegmentName() + ", " + new HLCSegmentName(group2,
+ ALL_PARTITIONS, "27").getSegmentName() + ", " + new HLCSegmentName(group2, ALL_PARTITIONS, "28")
+ .getSegmentName() + "]"}, 3);
}
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/TimeBoundaryServiceTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/TimeBoundaryServiceTest.java
index f808c47..7f4b200 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/TimeBoundaryServiceTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/TimeBoundaryServiceTest.java
@@ -66,7 +66,8 @@ public class TimeBoundaryServiceTest {
}
@Test
- public void testExternalViewBasedTimeBoundaryService() throws Exception {
+ public void testExternalViewBasedTimeBoundaryService()
+ throws Exception {
addingTableToPropertyStore("testResource0");
addingTableToPropertyStore("testResource1");
HelixExternalViewBasedTimeBoundaryService tbs = new HelixExternalViewBasedTimeBoundaryService(_propertyStore);
@@ -120,12 +121,11 @@ public class TimeBoundaryServiceTest {
}
}
- private void addingTableToPropertyStore(String tableName) throws Exception {
+ private void addingTableToPropertyStore(String tableName)
+ throws Exception {
TableConfig tableConfig = new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE).setTableName(tableName)
- .setTimeColumnName("timestamp")
- .setTimeType("DAYS")
- .build();
- ZKMetadataProvider.setOfflineTableConfig(_propertyStore, tableConfig.getTableName(),
- TableConfig.toZnRecord(tableConfig));
+ .setTimeColumnName("timestamp").setTimeType("DAYS").build();
+ ZKMetadataProvider
+ .setOfflineTableConfig(_propertyStore, tableConfig.getTableName(), TableConfig.toZnRecord(tableConfig));
}
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/BalancedRandomRoutingTableBuilderTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/BalancedRandomRoutingTableBuilderTest.java
index 03c2951..cc18fec 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/BalancedRandomRoutingTableBuilderTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/BalancedRandomRoutingTableBuilderTest.java
@@ -66,7 +66,8 @@ public class BalancedRandomRoutingTableBuilderTest {
}
@Test
- public void testDynamicRouting() throws Exception {
+ public void testDynamicRouting()
+ throws Exception {
String tableNameWithType = "testTable_OFFLINE";
BalancedRandomRoutingTableBuilder routingTableBuilder = new BalancedRandomRoutingTableBuilder();
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/HighLevelConsumerRoutingTableBuilderTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/HighLevelConsumerRoutingTableBuilderTest.java
index c2d230c..967be45 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/HighLevelConsumerRoutingTableBuilderTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/HighLevelConsumerRoutingTableBuilderTest.java
@@ -51,8 +51,7 @@ public class HighLevelConsumerRoutingTableBuilderTest {
TableConfig tableConfig = new TableConfig();
tableConfig.setTableName("tableName");
- HighLevelConsumerBasedRoutingTableBuilder routingTableBuilder =
- new HighLevelConsumerBasedRoutingTableBuilder();
+ HighLevelConsumerBasedRoutingTableBuilder routingTableBuilder = new HighLevelConsumerBasedRoutingTableBuilder();
routingTableBuilder.init(new BaseConfiguration(), tableConfig, null, null);
String tableNameWithType = "table_REALTIME";
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/LargeClusterRoutingTableBuilderTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/LargeClusterRoutingTableBuilderTest.java
index 2fb2539..d45b7ef 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/LargeClusterRoutingTableBuilderTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/LargeClusterRoutingTableBuilderTest.java
@@ -84,7 +84,8 @@ public class LargeClusterRoutingTableBuilderTest {
final InstanceConfig shuttingDownInstance = instanceConfigs.get(1);
final String shuttingDownInstanceName = shuttingDownInstance.getInstanceName();
- shuttingDownInstance.getRecord().setSimpleField(CommonConstants.Helix.IS_SHUTDOWN_IN_PROGRESS, Boolean.toString(true));
+ shuttingDownInstance.getRecord()
+ .setSimpleField(CommonConstants.Helix.IS_SHUTDOWN_IN_PROGRESS, Boolean.toString(true));
validateAssertionForOneRoutingTable(new RoutingTableValidator() {
@Override
@@ -183,9 +184,10 @@ public class LargeClusterRoutingTableBuilderTest {
done = true;
} else {
if (iterationCount++ >= maxNumIterations) {
- Assert.fail("At least one server has more than 150% of the load of the least loaded server, minNumberOfSegmentsAssignedPerServer = "
- + minNumberOfSegmentsAssignedPerServer + " maxNumberOfSegmentsAssignedPerServer = "
- + maxNumberOfSegmentsAssignedPerServer);
+ Assert.fail(
+ "At least one server has more than 150% of the load of the least loaded server, minNumberOfSegmentsAssignedPerServer = "
+ + minNumberOfSegmentsAssignedPerServer + " maxNumberOfSegmentsAssignedPerServer = "
+ + maxNumberOfSegmentsAssignedPerServer);
}
}
}
@@ -216,8 +218,7 @@ public class LargeClusterRoutingTableBuilderTest {
return externalView;
}
- private void validateAssertionOverMultipleRoutingTables(RoutingTableValidator routingTableValidator,
- String message) {
+ private void validateAssertionOverMultipleRoutingTables(RoutingTableValidator routingTableValidator, String message) {
if (EXHAUSTIVE) {
for (int instanceCount = 1; instanceCount < 100; instanceCount += 1) {
for (int replicationFactor = 1; replicationFactor < 10; replicationFactor++) {
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/LowLevelConsumerRoutingTableBuilderTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/LowLevelConsumerRoutingTableBuilderTest.java
index f4bc265..92da770 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/LowLevelConsumerRoutingTableBuilderTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/LowLevelConsumerRoutingTableBuilderTest.java
@@ -77,8 +77,8 @@ public class LowLevelConsumerRoutingTableBuilderTest {
int segmentCount = random.nextInt(32); // 0 to 31 segments in partition
segmentNames[partitionId] = new String[segmentCount];
for (int sequenceNumber = 0; sequenceNumber < segmentCount; sequenceNumber++) {
- segmentNames[partitionId][sequenceNumber] = new LLCSegmentName("table", partitionId, sequenceNumber,
- System.currentTimeMillis()).getSegmentName();
+ segmentNames[partitionId][sequenceNumber] =
+ new LLCSegmentName("table", partitionId, sequenceNumber, System.currentTimeMillis()).getSegmentName();
}
totalSegmentCount += segmentCount;
}
@@ -130,8 +130,7 @@ public class LowLevelConsumerRoutingTableBuilderTest {
// Create routing tables
long startTime = System.nanoTime();
- routingTableBuilder.computeOnExternalViewChange(
- "table_REALTIME", externalView, instanceConfigs);
+ routingTableBuilder.computeOnExternalViewChange("table_REALTIME", externalView, instanceConfigs);
List<Map<String, List<String>>> routingTables = routingTableBuilder.getRoutingTables();
@@ -168,7 +167,7 @@ public class LowLevelConsumerRoutingTableBuilderTest {
routingTableBuilder.init(new BaseConfiguration(), tableConfig, null, null);
List<SegmentName> segmentNames = new ArrayList<>();
- for(int i = 0; i < SEGMENT_COUNT; ++i) {
+ for (int i = 0; i < SEGMENT_COUNT; ++i) {
segmentNames.add(new LLCSegmentName("table", 0, i, System.currentTimeMillis()));
}
@@ -214,7 +213,7 @@ public class LowLevelConsumerRoutingTableBuilderTest {
routingTableBuilder.init(new BaseConfiguration(), tableConfig, null, null);
List<SegmentName> segmentNames = new ArrayList<>();
- for(int i = 0; i < SEGMENT_COUNT; ++i) {
+ for (int i = 0; i < SEGMENT_COUNT; ++i) {
segmentNames.add(new LLCSegmentName("table", 0, i, System.currentTimeMillis()));
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/PartitionAwareOfflineRoutingTableBuilderTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/PartitionAwareOfflineRoutingTableBuilderTest.java
index 71e984a..5fe6322 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/PartitionAwareOfflineRoutingTableBuilderTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/PartitionAwareOfflineRoutingTableBuilderTest.java
@@ -60,7 +60,8 @@ public class PartitionAwareOfflineRoutingTableBuilderTest {
private int NUM_SEGMENTS;
@Test
- public void testBrokerSideServerAndSegmentPruning() throws Exception {
+ public void testBrokerSideServerAndSegmentPruning()
+ throws Exception {
int numIterations = 50;
for (int iter = 0; iter < numIterations; iter++) {
@@ -90,9 +91,9 @@ public class PartitionAwareOfflineRoutingTableBuilderTest {
partitionSegmentCount.put(partition, partitionSegmentCount.get(partition) + 1);
SegmentZKMetadata metadata = buildOfflineSegmentZKMetadata(segmentName, partition);
- fakePropertyStore.setContents(
- ZKMetadataProvider.constructPropertyStorePathForSegment(OFFLINE_TABLE_NAME, segmentName),
- metadata.toZNRecord());
+ fakePropertyStore
+ .setContents(ZKMetadataProvider.constructPropertyStorePathForSegment(OFFLINE_TABLE_NAME, segmentName),
+ metadata.toZNRecord());
}
// Update replica group mapping zk metadata
@@ -134,8 +135,7 @@ public class PartitionAwareOfflineRoutingTableBuilderTest {
// Check the broker side server and segment pruning.
for (int queryPartition = 0; queryPartition < 100; queryPartition++) {
String filterQuery = "select count(*) from myTable where " + PARTITION_COLUMN + " = " + queryPartition;
- routingTable =
- routingTableBuilder.getRoutingTable(buildRoutingTableLookupRequest(filterQuery), null);
+ routingTable = routingTableBuilder.getRoutingTable(buildRoutingTableLookupRequest(filterQuery), null);
// Check that the number of servers picked are always equal or less than the number of servers
// in a single replica group.
@@ -155,7 +155,8 @@ public class PartitionAwareOfflineRoutingTableBuilderTest {
}
@Test
- public void testRoutingTableAfterRebalance() throws Exception {
+ public void testRoutingTableAfterRebalance()
+ throws Exception {
NUM_REPLICA = 1;
NUM_PARTITION = 1;
NUM_SERVERS = 1;
@@ -175,9 +176,9 @@ public class PartitionAwareOfflineRoutingTableBuilderTest {
String segmentName = "segment" + i;
int partition = i % NUM_PARTITION;
SegmentZKMetadata metadata = buildOfflineSegmentZKMetadata(segmentName, partition);
- fakePropertyStore.setContents(
- ZKMetadataProvider.constructPropertyStorePathForSegment(OFFLINE_TABLE_NAME, segmentName),
- metadata.toZNRecord());
+ fakePropertyStore
+ .setContents(ZKMetadataProvider.constructPropertyStorePathForSegment(OFFLINE_TABLE_NAME, segmentName),
+ metadata.toZNRecord());
}
// Update replica group mapping zk metadata
@@ -247,7 +248,8 @@ public class PartitionAwareOfflineRoutingTableBuilderTest {
}
private RoutingTableBuilder buildPartitionAwareOfflineRoutingTableBuilder(FakePropertyStore propertyStore,
- TableConfig tableConfig, ExternalView externalView, List<InstanceConfig> instanceConfigs) throws Exception {
+ TableConfig tableConfig, ExternalView externalView, List<InstanceConfig> instanceConfigs)
+ throws Exception {
PartitionAwareOfflineRoutingTableBuilder routingTableBuilder = new PartitionAwareOfflineRoutingTableBuilder();
routingTableBuilder.init(null, tableConfig, propertyStore, null);
routingTableBuilder.computeOnExternalViewChange(OFFLINE_TABLE_NAME, externalView, instanceConfigs);
@@ -287,7 +289,8 @@ public class PartitionAwareOfflineRoutingTableBuilderTest {
return new RoutingTableLookupRequest(COMPILER.compileToBrokerRequest(query));
}
- private TableConfig buildOfflineTableConfig() throws Exception {
+ private TableConfig buildOfflineTableConfig()
+ throws Exception {
// Create the replica group aware assignment strategy config
ReplicaGroupStrategyConfig replicaGroupStrategyConfig = new ReplicaGroupStrategyConfig();
replicaGroupStrategyConfig.setNumInstancesPerPartition(NUM_PARTITION);
@@ -300,9 +303,7 @@ public class PartitionAwareOfflineRoutingTableBuilderTest {
// Create table config
TableConfig tableConfig =
new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE).setTableName(OFFLINE_TABLE_NAME)
- .setNumReplicas(NUM_REPLICA)
- .setSegmentAssignmentStrategy("ReplicaGroupSegmentAssignmentStrategy")
- .build();
+ .setNumReplicas(NUM_REPLICA).setSegmentAssignmentStrategy("ReplicaGroupSegmentAssignmentStrategy").build();
tableConfig.getValidationConfig().setReplicaGroupStrategyConfig(replicaGroupStrategyConfig);
tableConfig.setRoutingConfig(routingConfig);
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/PartitionAwareRealtimeRoutingTableBuilderTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/PartitionAwareRealtimeRoutingTableBuilderTest.java
index c08657f..6274b14 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/PartitionAwareRealtimeRoutingTableBuilderTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/builder/PartitionAwareRealtimeRoutingTableBuilderTest.java
@@ -60,7 +60,8 @@ public class PartitionAwareRealtimeRoutingTableBuilderTest {
private int NUM_SEGMENTS;
@Test
- public void testBrokerSideSegmentPruning() throws Exception {
+ public void testBrokerSideSegmentPruning()
+ throws Exception {
int numIterations = 50;
for (int iter = 0; iter < numIterations; iter++) {
@@ -135,7 +136,8 @@ public class PartitionAwareRealtimeRoutingTableBuilderTest {
}
@Test
- public void testMultipleConsumingSegments() throws Exception {
+ public void testMultipleConsumingSegments()
+ throws Exception {
NUM_PARTITION = 1;
NUM_REPLICA = 1;
NUM_SERVERS = 1;
@@ -200,7 +202,8 @@ public class PartitionAwareRealtimeRoutingTableBuilderTest {
}
@Test
- public void testRoutingAfterRebalance() throws Exception {
+ public void testRoutingAfterRebalance()
+ throws Exception {
NUM_PARTITION = 10;
NUM_REPLICA = 1;
NUM_SERVERS = 1;
@@ -265,7 +268,8 @@ public class PartitionAwareRealtimeRoutingTableBuilderTest {
}
private List<String> updateZkMetadataAndBuildSegmentList(Map<Integer, Integer> partitionSegmentCount,
- FakePropertyStore propertyStore) throws Exception {
+ FakePropertyStore propertyStore)
+ throws Exception {
// Update segment zk metadata.
List<String> segmentList = new ArrayList<>();
int seqId = 0;
@@ -277,9 +281,9 @@ public class PartitionAwareRealtimeRoutingTableBuilderTest {
String segmentName = segment.getSegmentName();
SegmentZKMetadata metadata = buildSegmentZKMetadata(segmentName, partitionId);
- propertyStore.setContents(
- ZKMetadataProvider.constructPropertyStorePathForSegment(REALTIME_TABLE_NAME, segmentName),
- metadata.toZNRecord());
+ propertyStore
+ .setContents(ZKMetadataProvider.constructPropertyStorePathForSegment(REALTIME_TABLE_NAME, segmentName),
+ metadata.toZNRecord());
segmentList.add(segmentName);
if (partitionId % NUM_PARTITION == 0) {
seqId++;
@@ -314,7 +318,8 @@ public class PartitionAwareRealtimeRoutingTableBuilderTest {
}
private ExternalView buildExternalView(String tableName, FakePropertyStore propertyStore,
- Map<Integer, List<String>> partitionToServerMapping, List<String> segmentList) throws Exception {
+ Map<Integer, List<String>> partitionToServerMapping, List<String> segmentList)
+ throws Exception {
// Create External View
ExternalView externalView = new ExternalView(tableName);
@@ -332,7 +337,8 @@ public class PartitionAwareRealtimeRoutingTableBuilderTest {
return new RoutingTableLookupRequest(COMPILER.compileToBrokerRequest(query));
}
- private TableConfig buildRealtimeTableConfig() throws Exception {
+ private TableConfig buildRealtimeTableConfig()
+ throws Exception {
// Create partition config
Map<String, ColumnPartitionConfig> metadataMap = new HashMap<>();
metadataMap.put(PARTITION_COLUMN, new ColumnPartitionConfig(PARTITION_FUNCTION_NAME, NUM_PARTITION));
@@ -344,10 +350,8 @@ public class PartitionAwareRealtimeRoutingTableBuilderTest {
// Create table config
TableConfig tableConfig =
- new TableConfig.Builder(CommonConstants.Helix.TableType.REALTIME)
- .setTableName(REALTIME_TABLE_NAME)
- .setNumReplicas(NUM_REPLICA)
- .build();
+ new TableConfig.Builder(CommonConstants.Helix.TableType.REALTIME).setTableName(REALTIME_TABLE_NAME)
+ .setNumReplicas(NUM_REPLICA).build();
tableConfig.getValidationConfig().setReplicasPerPartition(Integer.toString(NUM_REPLICA));
tableConfig.getIndexingConfig().setSegmentPartitionConfig(partitionConfig);
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/selector/MergedSegmentSelectorTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/selector/MergedSegmentSelectorTest.java
index 3d72344..d988610 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/routing/selector/MergedSegmentSelectorTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/routing/selector/MergedSegmentSelectorTest.java
@@ -37,7 +37,8 @@ public class MergedSegmentSelectorTest {
private static final String TEST_TABLE_NAME = "test_OFFLINE";
@Test
- public void testMergedSegmentSelector() throws Exception {
+ public void testMergedSegmentSelector()
+ throws Exception {
MergedSegmentSelector segmentSelector = new MergedSegmentSelector();
TableConfig tableConfig =
@@ -57,15 +58,14 @@ public class MergedSegmentSelectorTest {
segmentSelector.computeOnExternalViewChange();
// Test the result of segment selection
- testSegmentSelector(segmentSelector,
- new String[]{"segment0", "segment1", "segment2", "segment3"},
+ testSegmentSelector(segmentSelector, new String[]{"segment0", "segment1", "segment2", "segment3"},
new String[]{"segment0", "segment1", "segment2", "segment3"});
// Add G4 (merged_0, merged_1) that was merged from G0, G1, G2
String mergedGroupId = "G4";
List<String> childrenGroups = Arrays.asList(new String[]{"G0", "G1", "G2"});
- segmentMergeLineage.addSegmentGroup(mergedGroupId,
- Arrays.asList(new String[]{"merged0", "merged1"}), childrenGroups);
+ segmentMergeLineage
+ .addSegmentGroup(mergedGroupId, Arrays.asList(new String[]{"merged0", "merged1"}), childrenGroups);
// Update segment merge lineage in the property store and update segment selector
SegmentMergeLineageAccessHelper.writeSegmentMergeLineage(fakePropertyStore, segmentMergeLineage, 0);
@@ -77,16 +77,13 @@ public class MergedSegmentSelectorTest {
new String[]{"merged0", "merged1", "segment3"});
// Test the result of segment selection when the external view does not have one of merged segments
- testSegmentSelector(segmentSelector,
- new String[]{"segment0", "segment1", "segment2", "segment3", "merged0"},
+ testSegmentSelector(segmentSelector, new String[]{"segment0", "segment1", "segment2", "segment3", "merged0"},
new String[]{"segment0", "segment1", "segment2", "segment3"});
// Test the result of segment selection when one of the base segment is missing.
- testSegmentSelector(segmentSelector,
- new String[]{"segment0", "segment2", "segment3", "merged0", "merged1"},
+ testSegmentSelector(segmentSelector, new String[]{"segment0", "segment2", "segment3", "merged0", "merged1"},
new String[]{"merged0", "merged1", "segment3"});
-
// Add G5 (segment4)
segmentMergeLineage.addSegmentGroup("G5", Arrays.asList(new String[]{"segment4"}), null);
@@ -100,8 +97,8 @@ public class MergedSegmentSelectorTest {
new String[]{"merged0", "merged1", "segment3", "segment4"});
// Add G6 (merged3) that is merged from G3 (segment3), G5 (segment4)
- segmentMergeLineage.addSegmentGroup("G6", Arrays.asList(new String[]{"merged2"}),
- Arrays.asList(new String[]{"G3", "G5"}));
+ segmentMergeLineage
+ .addSegmentGroup("G6", Arrays.asList(new String[]{"merged2"}), Arrays.asList(new String[]{"G3", "G5"}));
// Update segment merge lineage in the property store and update segment selector
SegmentMergeLineageAccessHelper.writeSegmentMergeLineage(fakePropertyStore, segmentMergeLineage, 0);
@@ -120,8 +117,8 @@ public class MergedSegmentSelectorTest {
new String[]{"segment0", "segment1", "segment2", "segment3", "segment4"});
// Add G7 (merged4) that is merged from G3, G6
- segmentMergeLineage.addSegmentGroup("G7", Arrays.asList(new String[]{"merged3"}),
- Arrays.asList(new String[]{"G4", "G6"}));
+ segmentMergeLineage
+ .addSegmentGroup("G7", Arrays.asList(new String[]{"merged3"}), Arrays.asList(new String[]{"G4", "G6"}));
// Update segment merge lineage in the property store and update segment selector
SegmentMergeLineageAccessHelper.writeSegmentMergeLineage(fakePropertyStore, segmentMergeLineage, 0);
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/util/FakePropertyStore.java b/pinot-broker/src/test/java/org/apache/pinot/broker/util/FakePropertyStore.java
index 9d68307..fa3e9ca 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/util/FakePropertyStore.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/util/FakePropertyStore.java
@@ -26,6 +26,7 @@ import org.apache.helix.manager.zk.ZkBaseDataAccessor;
import org.apache.helix.store.zk.ZkHelixPropertyStore;
import org.apache.zookeeper.data.Stat;
+
public class FakePropertyStore extends ZkHelixPropertyStore<ZNRecord> {
private Map<String, ZNRecord> _contents = new HashMap<>();
private IZkDataListener _listener = null;
@@ -64,7 +65,8 @@ public class FakePropertyStore extends ZkHelixPropertyStore<ZNRecord> {
}
}
- public void setContents(String path, ZNRecord contents) throws Exception {
+ public void setContents(String path, ZNRecord contents)
+ throws Exception {
_contents.put(path, contents);
if (_listener != null) {
_listener.handleDataChange(path, contents);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/Utils.java b/pinot-common/src/main/java/org/apache/pinot/common/Utils.java
index a126185..313ac62 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/Utils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/Utils.java
@@ -46,7 +46,8 @@ public class Utils {
}
@SuppressWarnings("unchecked")
- private static <T extends Throwable> void rethrowExceptionInner(Throwable exception) throws T {
+ private static <T extends Throwable> void rethrowExceptionInner(Throwable exception)
+ throws T {
throw (T) exception;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/AdjustTableNameChildKeyTransformer.java b/pinot-common/src/main/java/org/apache/pinot/common/config/AdjustTableNameChildKeyTransformer.java
index dc92c57..dd53963 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/AdjustTableNameChildKeyTransformer.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/AdjustTableNameChildKeyTransformer.java
@@ -32,23 +32,19 @@ public class AdjustTableNameChildKeyTransformer implements ChildKeyTransformer {
@Override
public Map<String, ?> apply(Map<String, ?> childKeys, String pathPrefix) {
// Adjust the name to add the table suffix to table.name.realtime/table.name.offline
- List<String> tableTypes = childKeys
- .get("table.types")
- .map(tableTypesListOrString -> {
- if (tableTypesListOrString instanceof String) {
- return List.of((String) tableTypesListOrString);
- } else if (tableTypesListOrString instanceof Collection) {
- return List.ofAll((Collection<String>) tableTypesListOrString);
- } else {
- return List.empty();
- }
- })
- .getOrElse(List.empty())
- .map(Object::toString);
+ List<String> tableTypes = childKeys.get("table.types").map(tableTypesListOrString -> {
+ if (tableTypesListOrString instanceof String) {
+ return List.of((String) tableTypesListOrString);
+ } else if (tableTypesListOrString instanceof Collection) {
+ return List.ofAll((Collection<String>) tableTypesListOrString);
+ } else {
+ return List.empty();
+ }
+ }).getOrElse(List.empty()).map(Object::toString);
String tableName = childKeys.get("table.name").map(Object::toString).getOrElse(
- () -> childKeys.get("table.name.realtime").map(Object::toString).getOrElse(
- () -> childKeys.get("table.name.offline").map(Object::toString).getOrNull()));
+ () -> childKeys.get("table.name.realtime").map(Object::toString)
+ .getOrElse(() -> childKeys.get("table.name.offline").map(Object::toString).getOrNull()));
Map<String, Object> remappedConfig = (Map<String, Object>) childKeys;
@@ -68,8 +64,7 @@ public class AdjustTableNameChildKeyTransformer implements ChildKeyTransformer {
public Map<String, ?> unapply(Map<String, ?> childKeys, String pathPrefix) {
String tableNameWithSuffix = childKeys.filterKeys(key -> key.startsWith("table.name")).head()._2.toString();
- return ((Map<String, Object>) childKeys)
- .filterKeys(key -> !key.startsWith("table.name"))
+ return ((Map<String, Object>) childKeys).filterKeys(key -> !key.startsWith("table.name"))
.put("table.name", TableNameBuilder.extractRawTableName(tableNameWithSuffix));
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/ChildKeyTransformer.java b/pinot-common/src/main/java/org/apache/pinot/common/config/ChildKeyTransformer.java
index d9c000d..3dbe18e 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/ChildKeyTransformer.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/ChildKeyTransformer.java
@@ -28,5 +28,6 @@ import io.vavr.collection.Map;
*/
public interface ChildKeyTransformer {
Map<String, ?> apply(Map<String, ?> childKeys, String pathPrefix);
+
Map<String, ?> unapply(Map<String, ?> childKeys, String pathPrefix);
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfig.java
index 2431f5f..a668b30 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfig.java
@@ -30,11 +30,7 @@ import static org.apache.pinot.common.utils.EqualityUtils.isNullOrNotSameClass;
* Combined configuration object, which contains an offline table configuration, a realtime table configuration, and a
* schema for the table.
*/
-@UseChildKeyTransformers({
- AdjustTableNameChildKeyTransformer.class,
- RemapTableTypesChildKeyTransformer.class,
- CombinedConfigSeparatorChildKeyTransformer.class
-})
+@UseChildKeyTransformers({AdjustTableNameChildKeyTransformer.class, RemapTableTypesChildKeyTransformer.class, CombinedConfigSeparatorChildKeyTransformer.class})
public class CombinedConfig {
@ConfigKey("offline")
private TableConfig _offline;
@@ -80,7 +76,8 @@ public class CombinedConfig {
_schema = schema;
}
- public CombinedConfig() {}
+ public CombinedConfig() {
+ }
@Override
public boolean equals(Object o) {
@@ -94,10 +91,7 @@ public class CombinedConfig {
CombinedConfig that = (CombinedConfig) o;
- return
- isEqual(_offline, that._offline) &&
- isEqual(_realtime, that._realtime) &&
- isEqual(_schema, that._schema);
+ return isEqual(_offline, that._offline) && isEqual(_realtime, that._realtime) && isEqual(_schema, that._schema);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfigLoader.java b/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfigLoader.java
index bfeea39..206127c 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfigLoader.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfigLoader.java
@@ -75,8 +75,7 @@ public class CombinedConfigLoader {
config = processProfileConditionals(config, profiles);
- return HashSet.ofAll(config.entrySet())
- .toMap(entry -> Tuple.of(entry.getKey(), entry.getValue().unwrapped()));
+ return HashSet.ofAll(config.entrySet()).toMap(entry -> Tuple.of(entry.getKey(), entry.getValue().unwrapped()));
}
private static Config processProfileConditionals(Config config, String... profiles) {
@@ -86,17 +85,14 @@ public class CombinedConfigLoader {
HashSet.ofAll(config.entrySet()).toMap(entry -> Tuple.of(entry.getKey(), entry.getValue()));
// Get all profile-specific keys
- Set<String> profileKeys = configMap.keySet()
- .filter(key -> key.contains(PROFILE_SEPARATOR))
- .toSet();
+ Set<String> profileKeys = configMap.keySet().filter(key -> key.contains(PROFILE_SEPARATOR)).toSet();
// Keep profile-specific keys for enabled profiles
- Set<String> enabledProfileKeys = profileKeys
- .filter(key -> {
- int lastUnderscoreIndex = key.lastIndexOf(PROFILE_SEPARATOR);
- String profile = key.substring(lastUnderscoreIndex + PROFILE_SEPARATOR.length(), key.length());
- return enabledProfiles.contains(profile);
- });
+ Set<String> enabledProfileKeys = profileKeys.filter(key -> {
+ int lastUnderscoreIndex = key.lastIndexOf(PROFILE_SEPARATOR);
+ String profile = key.substring(lastUnderscoreIndex + PROFILE_SEPARATOR.length(), key.length());
+ return enabledProfiles.contains(profile);
+ });
// Merge all the enabled keys together
io.vavr.collection.Map<String, ConfigValue> overrideConfigMap = HashMap.empty();
@@ -112,10 +108,10 @@ public class CombinedConfigLoader {
ConfigValue previousOverrideValue = overrideConfigMap.get(destinationKey).get();
ConfigValue newConfigValue = config.getValue(enabledProfileKey);
if (!EqualityUtils.isEqual(previousOverrideValue.unwrapped(), newConfigValue.unwrapped())) {
- throw new RuntimeException("Found conflicting value for key " + destinationKey +
- " due to multiple enabled profiles for this configuration key. Previous override was " +
- previousOverrideValue.unwrapped() + ", new override value is " + newConfigValue.unwrapped() +
- ". Ensure that all enabled profiles for this profile override key have the same resulting value.");
+ throw new RuntimeException("Found conflicting value for key " + destinationKey
+ + " due to multiple enabled profiles for this configuration key. Previous override was "
+ + previousOverrideValue.unwrapped() + ", new override value is " + newConfigValue.unwrapped()
+ + ". Ensure that all enabled profiles for this profile override key have the same resulting value.");
}
}
}
@@ -132,8 +128,8 @@ public class CombinedConfigLoader {
}
static io.vavr.collection.Map<String, ?> loadConfigFromString(String string) {
- Config config = ConfigFactory.parseString(string,
- ConfigParseOptions.defaults().prependIncluder(new ConfigIncluder() {
+ Config config =
+ ConfigFactory.parseString(string, ConfigParseOptions.defaults().prependIncluder(new ConfigIncluder() {
private ConfigIncluder parent = null;
public ConfigObject include(ConfigIncludeContext context, String what) {
@@ -148,8 +144,7 @@ public class CombinedConfigLoader {
config = config.resolve();
- return HashSet.ofAll(config.entrySet())
- .toMap(entry -> Tuple.of(entry.getKey(), entry.getValue().unwrapped()));
+ return HashSet.ofAll(config.entrySet()).toMap(entry -> Tuple.of(entry.getKey(), entry.getValue().unwrapped()));
}
public static CombinedConfig loadCombinedConfig(io.vavr.collection.Map<String, ?> config) {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfigSeparatorChildKeyTransformer.java b/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfigSeparatorChildKeyTransformer.java
index bd3bba6..a3c9376 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfigSeparatorChildKeyTransformer.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/CombinedConfigSeparatorChildKeyTransformer.java
@@ -47,7 +47,7 @@ public class CombinedConfigSeparatorChildKeyTransformer implements ChildKeyTrans
// Move keys around so that they match with the combined config
Map<String, Object> remappedConfig = config.flatMap((k, v) -> {
- if(k.startsWith("table.schema.")) {
+ if (k.startsWith("table.schema.")) {
// Remove realtime/offline suffixes
if (k.endsWith(".realtime")) {
k = k.substring(0, k.length() - ".realtime".length());
@@ -104,13 +104,13 @@ public class CombinedConfigSeparatorChildKeyTransformer implements ChildKeyTrans
// Merge keys realtime/offline key pairs with the same value
// table.foo.realtime + table.foo.offline -> table.foo?
- Set<String> realtimeKeySet = remappedConfig.keySet()
- .filter(key -> key.startsWith("table.") && key.endsWith(".realtime"))
- .map(key -> key.substring(0, key.lastIndexOf(".realtime")));
+ Set<String> realtimeKeySet =
+ remappedConfig.keySet().filter(key -> key.startsWith("table.") && key.endsWith(".realtime"))
+ .map(key -> key.substring(0, key.lastIndexOf(".realtime")));
- Set<String> offlineKeySet = remappedConfig.keySet()
- .filter(key -> key.startsWith("table.") && key.endsWith(".offline"))
- .map(key -> key.substring(0, key.lastIndexOf(".offline")));
+ Set<String> offlineKeySet =
+ remappedConfig.keySet().filter(key -> key.startsWith("table.") && key.endsWith(".offline"))
+ .map(key -> key.substring(0, key.lastIndexOf(".offline")));
Set<String> commonOfflineAndRealtimeKeys = realtimeKeySet.intersect(offlineKeySet);
@@ -122,10 +122,8 @@ public class CombinedConfigSeparatorChildKeyTransformer implements ChildKeyTrans
Object offlineValue = remappedConfig.getOrElse(offlineKey, null);
if (EqualityUtils.isEqual(offlineValue, realtimeValue)) {
- remappedConfig = remappedConfig
- .remove(realtimeKey)
- .remove(offlineKey)
- .put(commonOfflineAndRealtimeKey, offlineValue);
+ remappedConfig =
+ remappedConfig.remove(realtimeKey).remove(offlineKey).put(commonOfflineAndRealtimeKey, offlineValue);
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/ConfigDoc.java b/pinot-common/src/main/java/org/apache/pinot/common/config/ConfigDoc.java
index 12b69ef..800750e 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/ConfigDoc.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/ConfigDoc.java
@@ -28,7 +28,10 @@ import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface ConfigDoc {
String value();
+
String exampleValue() default "";
+
boolean mandatory() default false;
+
int order() default Integer.MAX_VALUE;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/Deserializer.java b/pinot-common/src/main/java/org/apache/pinot/common/config/Deserializer.java
index 94afbf2..93c4d84 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/Deserializer.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/Deserializer.java
@@ -48,8 +48,7 @@ import org.slf4j.LoggerFactory;
public class Deserializer {
private static final Logger LOGGER = LoggerFactory.getLogger(Deserializer.class);
- private static final java.util.Map<Tuple2<Class, Class>, Function<Object, Object>>
- typeConverters = new HashMap<>();
+ private static final java.util.Map<Tuple2<Class, Class>, Function<Object, Object>> typeConverters = new HashMap<>();
private static final java.util.Set<Class> simpleTypes;
@@ -169,13 +168,13 @@ public class Deserializer {
// Mark all types that have a converter as simple types
simpleTypes = new HashSet<>();
- typeConverters
- .keySet()
- .forEach(t2 -> simpleTypes.add(t2._2));
+ typeConverters.keySet().forEach(t2 -> simpleTypes.add(t2._2));
}
- public static <T> T deserialize(Class<T> clazz, Map<String, ?> config, String configPath) throws Exception {
- LOGGER.debug("Deserializing object of class {} at config path {} using config {}", clazz.getName(), configPath, config);
+ public static <T> T deserialize(Class<T> clazz, Map<String, ?> config, String configPath)
+ throws Exception {
+ LOGGER.debug("Deserializing object of class {} at config path {} using config {}", clazz.getName(), configPath,
+ config);
if (config == null) {
LOGGER.debug("Config is null, returning null value");
@@ -264,7 +263,8 @@ public class Deserializer {
String suffix = keyName + ".";
String newPath = configPath + suffix;
LOGGER.debug("Recursively deserializing complex type");
- valueInjected |= coerceValueIntoField(rootObject, declaredField, deserialize(declaredField.getType(), subset(suffix, config), newPath));
+ valueInjected |= coerceValueIntoField(rootObject, declaredField,
+ deserialize(declaredField.getType(), subset(suffix, config), newPath));
}
} else if (isKeylessConfigField) {
if (useChildKeyHandler != null) {
@@ -274,7 +274,8 @@ public class Deserializer {
valueInjected |= coerceValueIntoField(rootObject, declaredField, value);
} else {
// Complex type, recurse without changing the current path
- valueInjected |= coerceValueIntoField(rootObject, declaredField, deserialize(declaredField.getType(), config, configPath));
+ valueInjected |= coerceValueIntoField(rootObject, declaredField,
+ deserialize(declaredField.getType(), config, configPath));
}
} else {
// Skip this field, it is not annotated with @ConfigKey or @ConfigWithoutKey
@@ -305,10 +306,12 @@ public class Deserializer {
}
}
- private static <T> boolean coerceValueIntoField(T parentObject, Field field, Object value) throws
- ReflectiveOperationException {
+ private static <T> boolean coerceValueIntoField(T parentObject, Field field, Object value)
+ throws ReflectiveOperationException {
try {
- if (value == null) return false;
+ if (value == null) {
+ return false;
+ }
Object destinationValue;
Class<?> objectType = value.getClass();
@@ -334,7 +337,8 @@ public class Deserializer {
destinationValue = value;
} else if (Number.class.isAssignableFrom(fieldType) || fieldType.isPrimitive()) { // field instanceof Number
Number numberValue = (Number) value;
- if(Integer.class.isAssignableFrom(fieldType) || int.class.isAssignableFrom(fieldType)) { // field instanceof int/Integer
+ if (Integer.class.isAssignableFrom(fieldType) || int.class
+ .isAssignableFrom(fieldType)) { // field instanceof int/Integer
destinationValue = numberValue.intValue();
} else {
throw new RuntimeException("Unsupported conversion from " + objectType + " -> " + fieldType);
@@ -345,7 +349,8 @@ public class Deserializer {
} else if (value instanceof String) {
String stringValue = (String) value;
try {
- if (Integer.class.isAssignableFrom(fieldType) || int.class.isAssignableFrom(fieldType)) { // field instanceof int/Integer
+ if (Integer.class.isAssignableFrom(fieldType) || int.class
+ .isAssignableFrom(fieldType)) { // field instanceof int/Integer
destinationValue = Integer.parseInt(stringValue);
} else if (Long.class.isAssignableFrom(fieldType)) { // field instanceof long/Long
destinationValue = Long.parseLong(stringValue);
@@ -374,15 +379,16 @@ public class Deserializer {
return true;
}
} catch (Exception e) {
- throw new ReflectiveOperationException("Caught exception while processing field " + field.getName() + " of class " + field.getDeclaringClass(), e);
+ throw new ReflectiveOperationException(
+ "Caught exception while processing field " + field.getName() + " of class " + field.getDeclaringClass(), e);
}
return false;
}
public static <T> T deserializeFromString(Class<T> clazz, String string) {
- Config config = ConfigFactory.parseString(string,
- ConfigParseOptions.defaults().prependIncluder(new ConfigIncluder() {
+ Config config =
+ ConfigFactory.parseString(string, ConfigParseOptions.defaults().prependIncluder(new ConfigIncluder() {
private ConfigIncluder parent = null;
public ConfigObject include(ConfigIncludeContext context, String what) {
@@ -410,7 +416,7 @@ public class Deserializer {
List<Field> fields = List.of(clazz.getDeclaredFields());
// Recursively add all parent fields
- while(clazz.getSuperclass() != null) {
+ while (clazz.getSuperclass() != null) {
clazz = clazz.getSuperclass();
fields = fields.appendAll(Arrays.asList(clazz.getDeclaredFields()));
}
@@ -420,17 +426,12 @@ public class Deserializer {
private static Map<String, ?> subset(String prefix, Map<String, ?> config) {
final int prefixLength = prefix.length();
- return config
- .filter((key, value) -> key.startsWith(prefix))
+ return config.filter((key, value) -> key.startsWith(prefix))
.map((key, value) -> Tuple.of(key.substring(prefixLength), value));
}
public static boolean isSimpleType(Class<?> fieldType) {
- return simpleTypes.contains(fieldType) ||
- fieldType.equals(boolean.class) ||
- fieldType.equals(String.class) ||
- fieldType.equals(TimeUnit.class) ||
- fieldType.isArray() ||
- Enum.class.isAssignableFrom(fieldType);
+ return simpleTypes.contains(fieldType) || fieldType.equals(boolean.class) || fieldType.equals(String.class)
+ || fieldType.equals(TimeUnit.class) || fieldType.isArray() || Enum.class.isAssignableFrom(fieldType);
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/Duration.java b/pinot-common/src/main/java/org/apache/pinot/common/config/Duration.java
index 17f000b..a04d24f 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/Duration.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/Duration.java
@@ -37,7 +37,8 @@ public class Duration {
this.unitCount = unitCount;
}
- public Duration() {}
+ public Duration() {
+ }
public TimeUnit getUnit() {
return unit;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/IndexingConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/IndexingConfig.java
index 657a340..6c0fb65 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/IndexingConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/IndexingConfig.java
@@ -119,7 +119,6 @@ public class IndexingConfig {
_sortedColumn = sortedColumn;
}
-
public List<String> getBloomFilterColumns() {
return _bloomFilterColumns;
}
@@ -268,18 +267,19 @@ public class IndexingConfig {
IndexingConfig that = (IndexingConfig) o;
- return EqualityUtils.isEqual(_autoGeneratedInvertedIndex, that._autoGeneratedInvertedIndex)
- && EqualityUtils.isEqual(_createInvertedIndexDuringSegmentGeneration,
- that._createInvertedIndexDuringSegmentGeneration) && EqualityUtils.isEqual(_invertedIndexColumns,
- that._invertedIndexColumns) && EqualityUtils.isEqual(_sortedColumn, that._sortedColumn)
- && EqualityUtils.isEqual(_loadMode, that._loadMode) && EqualityUtils.isEqual(_streamConfigs,
- that._streamConfigs) && EqualityUtils.isEqual(_segmentFormatVersion, that._segmentFormatVersion)
- && EqualityUtils.isEqual(_columnMinMaxValueGeneratorMode, that._columnMinMaxValueGeneratorMode) && EqualityUtils
- .isEqual(_noDictionaryColumns, that._noDictionaryColumns) && EqualityUtils.isEqual(_noDictionaryConfig,
- that._noDictionaryConfig) && EqualityUtils.isEqual(_onHeapDictionaryColumns, that._onHeapDictionaryColumns)
- && EqualityUtils.isEqual(_starTreeIndexSpec, that._starTreeIndexSpec) && EqualityUtils.isEqual(
- _segmentPartitionConfig, that._segmentPartitionConfig) && EqualityUtils.isEqual(_bloomFilterColumns,
- that._bloomFilterColumns);
+ return EqualityUtils.isEqual(_autoGeneratedInvertedIndex, that._autoGeneratedInvertedIndex) && EqualityUtils
+ .isEqual(_createInvertedIndexDuringSegmentGeneration, that._createInvertedIndexDuringSegmentGeneration)
+ && EqualityUtils.isEqual(_invertedIndexColumns, that._invertedIndexColumns) && EqualityUtils
+ .isEqual(_sortedColumn, that._sortedColumn) && EqualityUtils.isEqual(_loadMode, that._loadMode) && EqualityUtils
+ .isEqual(_streamConfigs, that._streamConfigs) && EqualityUtils
+ .isEqual(_segmentFormatVersion, that._segmentFormatVersion) && EqualityUtils
+ .isEqual(_columnMinMaxValueGeneratorMode, that._columnMinMaxValueGeneratorMode) && EqualityUtils
+ .isEqual(_noDictionaryColumns, that._noDictionaryColumns) && EqualityUtils
+ .isEqual(_noDictionaryConfig, that._noDictionaryConfig) && EqualityUtils
+ .isEqual(_onHeapDictionaryColumns, that._onHeapDictionaryColumns) && EqualityUtils
+ .isEqual(_starTreeIndexSpec, that._starTreeIndexSpec) && EqualityUtils
+ .isEqual(_segmentPartitionConfig, that._segmentPartitionConfig) && EqualityUtils
+ .isEqual(_bloomFilterColumns, that._bloomFilterColumns);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/NamedListChildKeyHandler.java b/pinot-common/src/main/java/org/apache/pinot/common/config/NamedListChildKeyHandler.java
index 0f78dd6..b42d73d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/NamedListChildKeyHandler.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/NamedListChildKeyHandler.java
@@ -38,26 +38,24 @@ public class NamedListChildKeyHandler<T> implements ChildKeyHandler<java.util.Li
@Override
public java.util.List<T> handleChildKeys(Map<String, ?> childKeys, String pathPrefix) {
- Seq<T> valueList = childKeys
- .groupBy(tuple2 -> tuple2._1.split("\\.", 2)[0])
- .flatMap(tuple2 -> {
- String key = tuple2._1;
- Map<String, ?> values = tuple2._2;
+ Seq<T> valueList = childKeys.groupBy(tuple2 -> tuple2._1.split("\\.", 2)[0]).flatMap(tuple2 -> {
+ String key = tuple2._1;
+ Map<String, ?> values = tuple2._2;
- // Drop the prefix
- Map<String, Object> valuesWithoutPrefix = values
- .map((configKey, configValue) -> Tuple.of(configKey.substring(key.length() + 1), configValue));
- valuesWithoutPrefix = valuesWithoutPrefix.put("name", key);
+ // Drop the prefix
+ Map<String, Object> valuesWithoutPrefix =
+ values.map((configKey, configValue) -> Tuple.of(configKey.substring(key.length() + 1), configValue));
+ valuesWithoutPrefix = valuesWithoutPrefix.put("name", key);
- T value;
- try {
- value = Deserializer.deserialize(_type, valuesWithoutPrefix, "");
- return Option.some(value);
- } catch (Exception e) {
- e.printStackTrace();
- return Option.none();
- }
- });
+ T value;
+ try {
+ value = Deserializer.deserialize(_type, valuesWithoutPrefix, "");
+ return Option.some(value);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return Option.none();
+ }
+ });
return valueList.asJava();
}
@@ -68,14 +66,10 @@ public class NamedListChildKeyHandler<T> implements ChildKeyHandler<java.util.Li
return null;
}
- return List.ofAll(values)
- .flatMap(value -> {
- Map<String, ?> serializedValue = Serializer.serialize(value);
- final String name = (String) serializedValue.getOrElse("name", null);
- return serializedValue
- .remove("name")
- .mapKeys(key -> name + "." + key);
- })
- .toMap(Function.identity());
+ return List.ofAll(values).flatMap(value -> {
+ Map<String, ?> serializedValue = Serializer.serialize(value);
+ final String name = (String) serializedValue.getOrElse("name", null);
+ return serializedValue.remove("name").mapKeys(key -> name + "." + key);
+ }).toMap(Function.identity());
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/QuotaConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/QuotaConfig.java
index 32adf5e..bf2394e 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/QuotaConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/QuotaConfig.java
@@ -113,8 +113,8 @@ public class QuotaConfig {
QuotaConfig that = (QuotaConfig) o;
- return EqualityUtils.isEqual(_storage, that._storage) && EqualityUtils.isEqual(
- _maxQueriesPerSecond, that._maxQueriesPerSecond);
+ return EqualityUtils.isEqual(_storage, that._storage) && EqualityUtils
+ .isEqual(_maxQueriesPerSecond, that._maxQueriesPerSecond);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/RemapTableTypesChildKeyTransformer.java b/pinot-common/src/main/java/org/apache/pinot/common/config/RemapTableTypesChildKeyTransformer.java
index add64a9..254e388 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/RemapTableTypesChildKeyTransformer.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/RemapTableTypesChildKeyTransformer.java
@@ -34,22 +34,16 @@ public class RemapTableTypesChildKeyTransformer implements ChildKeyTransformer {
public Map<String, ?> apply(Map<String, ?> config, String keyPrefix) {
// Generate keys for table types based on table.types
// eg. table.types=[offline,realtime] -> table.type.realtime=realtime, table.type.offline=offline
- config = ((Map<String, Object>) config).merge(
- config.get("table.types")
- .map(typeList -> {
- if (typeList instanceof String) {
- return List.of((String) typeList);
- } else if (typeList instanceof Collection){
- return List.ofAll((Collection<String>) typeList);
- } else {
- return List.empty();
- }
- })
- .map(typeList -> typeList
- .map(type -> Tuple.of("table.type." + type.toString().toLowerCase(), type))
- .toMap(Function.identity()))
- .getOrElse(HashMap::empty)
- );
+ config = ((Map<String, Object>) config).merge(config.get("table.types").map(typeList -> {
+ if (typeList instanceof String) {
+ return List.of((String) typeList);
+ } else if (typeList instanceof Collection) {
+ return List.ofAll((Collection<String>) typeList);
+ } else {
+ return List.empty();
+ }
+ }).map(typeList -> typeList.map(type -> Tuple.of("table.type." + type.toString().toLowerCase(), type))
+ .toMap(Function.identity())).getOrElse(HashMap::empty));
config = config.remove("table.types");
@@ -58,14 +52,12 @@ public class RemapTableTypesChildKeyTransformer implements ChildKeyTransformer {
@Override
public Map<String, ?> unapply(Map<String, ?> config, String keyPrefix) {
- Map<String, ?> tableTypeMap = config
- .filterKeys(key -> key.startsWith("table.type."));
+ Map<String, ?> tableTypeMap = config.filterKeys(key -> key.startsWith("table.type."));
java.util.List<String> tableTypes = tableTypeMap.values().map(Object::toString).toSet().toJavaList();
- Map<String, Object> remappedConfig = ((Map<String, Object>) config)
- .removeAll(tableTypeMap.keySet())
- .put("table.types", tableTypes);
+ Map<String, Object> remappedConfig =
+ ((Map<String, Object>) config).removeAll(tableTypeMap.keySet()).put("table.types", tableTypes);
return remappedConfig;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/ReplicaGroupStrategyConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/ReplicaGroupStrategyConfig.java
index 4c6450c..191bc8c 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/ReplicaGroupStrategyConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/ReplicaGroupStrategyConfig.java
@@ -22,6 +22,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.annotation.Nullable;
import org.apache.pinot.common.utils.EqualityUtils;
+
/**
* Class representing configurations related to segment assignment strategy.
*
@@ -92,9 +93,9 @@ public class ReplicaGroupStrategyConfig {
ReplicaGroupStrategyConfig that = (ReplicaGroupStrategyConfig) o;
- return EqualityUtils.isEqual(_numInstancesPerPartition, that._numInstancesPerPartition) &&
- EqualityUtils.isEqual(_mirrorAssignmentAcrossReplicaGroups, that._mirrorAssignmentAcrossReplicaGroups) &&
- EqualityUtils.isEqual(_partitionColumn, that._partitionColumn);
+ return EqualityUtils.isEqual(_numInstancesPerPartition, that._numInstancesPerPartition) && EqualityUtils
+ .isEqual(_mirrorAssignmentAcrossReplicaGroups, that._mirrorAssignmentAcrossReplicaGroups) && EqualityUtils
+ .isEqual(_partitionColumn, that._partitionColumn);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/RoutingConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/RoutingConfig.java
index 66e59e5..e708e53 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/RoutingConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/RoutingConfig.java
@@ -61,8 +61,8 @@ public class RoutingConfig {
RoutingConfig that = (RoutingConfig) o;
- return EqualityUtils.isEqual(_routingTableBuilderName, that._routingTableBuilderName) && EqualityUtils.isEqual(
- _routingTableBuilderOptions, that._routingTableBuilderOptions);
+ return EqualityUtils.isEqual(_routingTableBuilderName, that._routingTableBuilderName) && EqualityUtils
+ .isEqual(_routingTableBuilderOptions, that._routingTableBuilderOptions);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/SegmentPartitionConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/SegmentPartitionConfig.java
index db024ee..f4c6fa8 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/SegmentPartitionConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/SegmentPartitionConfig.java
@@ -95,7 +95,8 @@ public class SegmentPartitionConfig {
* @return Instance of {@link SegmentPartitionConfig} built from the input string.
* @throws IOException
*/
- public static SegmentPartitionConfig fromJsonString(String jsonString) throws IOException {
+ public static SegmentPartitionConfig fromJsonString(String jsonString)
+ throws IOException {
return JsonUtils.stringToObject(jsonString, SegmentPartitionConfig.class);
}
@@ -105,7 +106,8 @@ public class SegmentPartitionConfig {
* @return JSON string equivalent of the object.
* @throws IOException
*/
- public String toJsonString() throws IOException {
+ public String toJsonString()
+ throws IOException {
return JsonUtils.objectToString(this);
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/SegmentsValidationAndRetentionConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/SegmentsValidationAndRetentionConfig.java
index 399b261..27366c4 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/SegmentsValidationAndRetentionConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/SegmentsValidationAndRetentionConfig.java
@@ -220,18 +220,15 @@ public class SegmentsValidationAndRetentionConfig {
SegmentsValidationAndRetentionConfig that = (SegmentsValidationAndRetentionConfig) o;
- return EqualityUtils.isEqual(retentionTimeUnit, that.retentionTimeUnit) &&
- EqualityUtils.isEqual(retentionTimeValue, that.retentionTimeValue) &&
- EqualityUtils.isEqual(segmentPushFrequency, that.segmentPushFrequency) &&
- EqualityUtils.isEqual(segmentPushType, that.segmentPushType) &&
- EqualityUtils.isEqual(replication, that.replication) &&
- EqualityUtils.isEqual(schemaName, that.schemaName) &&
- EqualityUtils.isEqual(timeColumnName, that.timeColumnName) &&
- EqualityUtils.isEqual(timeType, that.timeType) &&
- EqualityUtils.isEqual( segmentAssignmentStrategy, that.segmentAssignmentStrategy) &&
- EqualityUtils.isEqual(replicaGroupStrategyConfig, that.replicaGroupStrategyConfig) &&
- EqualityUtils.isEqual(hllConfig, that.hllConfig) &&
- EqualityUtils.isEqual(replicasPerPartition, that.replicasPerPartition);
+ return EqualityUtils.isEqual(retentionTimeUnit, that.retentionTimeUnit) && EqualityUtils
+ .isEqual(retentionTimeValue, that.retentionTimeValue) && EqualityUtils
+ .isEqual(segmentPushFrequency, that.segmentPushFrequency) && EqualityUtils
+ .isEqual(segmentPushType, that.segmentPushType) && EqualityUtils.isEqual(replication, that.replication)
+ && EqualityUtils.isEqual(schemaName, that.schemaName) && EqualityUtils
+ .isEqual(timeColumnName, that.timeColumnName) && EqualityUtils.isEqual(timeType, that.timeType) && EqualityUtils
+ .isEqual(segmentAssignmentStrategy, that.segmentAssignmentStrategy) && EqualityUtils
+ .isEqual(replicaGroupStrategyConfig, that.replicaGroupStrategyConfig) && EqualityUtils
+ .isEqual(hllConfig, that.hllConfig) && EqualityUtils.isEqual(replicasPerPartition, that.replicasPerPartition);
}
@Override
@@ -250,5 +247,4 @@ public class SegmentsValidationAndRetentionConfig {
result = EqualityUtils.hashCodeOf(result, replicasPerPartition);
return result;
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/Serializer.java b/pinot-common/src/main/java/org/apache/pinot/common/config/Serializer.java
index a95dd08..474f2f9 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/Serializer.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/Serializer.java
@@ -59,14 +59,13 @@ public class Serializer {
public static <T> String serializeToPropertiesString(T object) {
ConfigRenderOptions configRenderOptions =
ConfigRenderOptions.defaults().setJson(false).setOriginComments(false).setFormatted(false);
- return serialize(object)
- .map(keyValueTuple -> keyValueTuple._1 + "=" +
- ConfigValueFactory.fromAnyRef(keyValueTuple._2).render(configRenderOptions))
- .sorted()
- .mkString("\n");
+ return serialize(object).map(
+ keyValueTuple -> keyValueTuple._1 + "=" + ConfigValueFactory.fromAnyRef(keyValueTuple._2)
+ .render(configRenderOptions)).sorted().mkString("\n");
}
- private static <T> Map<String, ?> serialize(T object, Class<? extends T> clazz, String pathContext) throws Exception {
+ private static <T> Map<String, ?> serialize(T object, Class<? extends T> clazz, String pathContext)
+ throws Exception {
if (object == null) {
return HashMap.empty();
}
@@ -155,8 +154,7 @@ public class Serializer {
if (useChildKeyTransformers != null) {
// Reverse the order of the child key transformers
List<Class<? extends ChildKeyTransformer>> reversedChildKeyTransformers =
- List.ofAll(Arrays.asList(useChildKeyTransformers.value()))
- .reverse();
+ List.ofAll(Arrays.asList(useChildKeyTransformers.value())).reverse();
for (Class<? extends ChildKeyTransformer> childKeyTransformerClass : reversedChildKeyTransformers) {
LOGGER.debug("Using child key transformer {} on the root config {}", childKeyTransformerClass, values);
@@ -175,7 +173,7 @@ public class Serializer {
List<Field> fields = List.of(clazz.getDeclaredFields());
// Recursively add all parent fields
- while(clazz.getSuperclass() != null) {
+ while (clazz.getSuperclass() != null) {
clazz = clazz.getSuperclass();
fields = fields.appendAll(Arrays.asList(clazz.getDeclaredFields()));
}
@@ -183,7 +181,8 @@ public class Serializer {
return fields;
}
- private static Map<String, Object> storeSimpleFieldIntoMap(Object object, Class<?> type, String keyName, Map<String, Object> values) {
+ private static Map<String, Object> storeSimpleFieldIntoMap(Object object, Class<?> type, String keyName,
+ Map<String, Object> values) {
// No object to write
if (object == null) {
return values;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/SimpleMapChildKeyHandler.java b/pinot-common/src/main/java/org/apache/pinot/common/config/SimpleMapChildKeyHandler.java
index a0f031b..ef36104 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/SimpleMapChildKeyHandler.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/SimpleMapChildKeyHandler.java
@@ -30,8 +30,7 @@ public class SimpleMapChildKeyHandler implements ChildKeyHandler<java.util.Map<S
public java.util.Map<String, String> handleChildKeys(Map<String, ?> childKeys, String pathPrefix) {
java.util.Map<String, String> returnedMap = new HashMap<>();
- childKeys
- .forEach((key, value) -> returnedMap.put(key, value.toString()));
+ childKeys.forEach((key, value) -> returnedMap.put(key, value.toString()));
if (returnedMap.isEmpty()) {
return null;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/TableConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/TableConfig.java
index 444427d..3779d2c 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/TableConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/TableConfig.java
@@ -110,12 +110,14 @@ public class TableConfig {
return fromJsonString(jsonConfigString);
}
- public static TableConfig fromJsonString(String jsonString) throws IOException {
+ public static TableConfig fromJsonString(String jsonString)
+ throws IOException {
return fromJSONConfig(JsonUtils.stringToJsonNode(jsonString));
}
@Nonnull
- public static TableConfig fromJSONConfig(@Nonnull JsonNode jsonConfig) throws IOException {
+ public static TableConfig fromJSONConfig(@Nonnull JsonNode jsonConfig)
+ throws IOException {
TableType tableType = TableType.valueOf(jsonConfig.get(TABLE_TYPE_KEY).asText().toUpperCase());
String tableName = TableNameBuilder.forType(tableType).tableNameWithType(jsonConfig.get(TABLE_NAME_KEY).asText());
@@ -179,7 +181,8 @@ public class TableConfig {
}
@Nonnull
- public static TableConfig fromZnRecord(@Nonnull ZNRecord znRecord) throws IOException {
+ public static TableConfig fromZnRecord(@Nonnull ZNRecord znRecord)
+ throws IOException {
Map<String, String> simpleFields = znRecord.getSimpleFields();
TableType tableType = TableType.valueOf(simpleFields.get(TABLE_TYPE_KEY).toUpperCase());
String tableName = TableNameBuilder.forType(tableType).tableNameWithType(simpleFields.get(TABLE_NAME_KEY));
@@ -321,7 +324,8 @@ public class TableConfig {
}
@Nonnull
- public String toJSONConfigString() throws IOException {
+ public String toJSONConfigString()
+ throws IOException {
return toJSONConfig(this).toString();
}
@@ -341,14 +345,11 @@ public class TableConfig {
}
if (obj instanceof TableConfig) {
TableConfig that = (TableConfig) obj;
- return EqualityUtils.isEqual(_tableName, that._tableName)
- && EqualityUtils.isEqual(_tableType, that._tableType)
- && EqualityUtils.isEqual(_validationConfig, that._validationConfig)
- && EqualityUtils.isEqual(_tenantConfig, that._tenantConfig)
- && EqualityUtils.isEqual(_indexingConfig, that._indexingConfig)
- && EqualityUtils.isEqual(_customConfig, that._customConfig)
- && EqualityUtils.isEqual(_quotaConfig, that._quotaConfig)
- && EqualityUtils.isEqual(_taskConfig, that._taskConfig)
+ return EqualityUtils.isEqual(_tableName, that._tableName) && EqualityUtils.isEqual(_tableType, that._tableType)
+ && EqualityUtils.isEqual(_validationConfig, that._validationConfig) && EqualityUtils
+ .isEqual(_tenantConfig, that._tenantConfig) && EqualityUtils.isEqual(_indexingConfig, that._indexingConfig)
+ && EqualityUtils.isEqual(_customConfig, that._customConfig) && EqualityUtils
+ .isEqual(_quotaConfig, that._quotaConfig) && EqualityUtils.isEqual(_taskConfig, that._taskConfig)
&& EqualityUtils.isEqual(_routingConfig, that._routingConfig);
}
return false;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/TagConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/TagConfig.java
index 3dba931..857786a 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/TagConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/TagConfig.java
@@ -39,6 +39,5 @@ public class TagConfig {
public String getServerTenantName() {
return _serverTenant;
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/TagNameUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/config/TagNameUtils.java
index 9dd1cb9..0b75d5d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/TagNameUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/TagNameUtils.java
@@ -109,5 +109,4 @@ public class TagNameUtils {
}
return tag;
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/TagOverrideConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/TagOverrideConfig.java
index 0137a3a..011c1b6 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/TagOverrideConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/TagOverrideConfig.java
@@ -85,8 +85,8 @@ public class TagOverrideConfig {
TagOverrideConfig that = (TagOverrideConfig) o;
- return EqualityUtils.isEqual(realtimeConsuming, that.realtimeConsuming) && EqualityUtils.isEqual(realtimeCompleted,
- that.realtimeCompleted);
+ return EqualityUtils.isEqual(realtimeConsuming, that.realtimeConsuming) && EqualityUtils
+ .isEqual(realtimeCompleted, that.realtimeCompleted);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/TaskConfigMapChildKeyHandler.java b/pinot-common/src/main/java/org/apache/pinot/common/config/TaskConfigMapChildKeyHandler.java
index a3a8bbe..35e9aea 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/TaskConfigMapChildKeyHandler.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/TaskConfigMapChildKeyHandler.java
@@ -33,8 +33,7 @@ public class TaskConfigMapChildKeyHandler implements ChildKeyHandler<Map<String,
Map<String, Map<String, String>> returnValue = new java.util.HashMap<>();
// Deserialize task keys for tasks that have no config
- childKeys
- .filter((key, value) -> key.indexOf('.') == -1)
+ childKeys.filter((key, value) -> key.indexOf('.') == -1)
.forEach((key, value) -> returnValue.put(key, new java.util.HashMap<>()));
if (returnValue.isEmpty()) {
@@ -47,14 +46,13 @@ public class TaskConfigMapChildKeyHandler implements ChildKeyHandler<Map<String,
@Override
public io.vavr.collection.Map<String, ?> unhandleChildKeys(Map<String, Map<String, String>> value,
String pathPrefix) {
- HashMap<String, String> retVal = HashMap.ofAll(value)
- .flatMap((taskKey, configs) -> {
- if (!configs.isEmpty()) {
- return HashMap.ofAll(configs).map((configKey, configValue) -> Tuple.of(taskKey + "." + configKey, configValue));
- } else {
- return HashMap.of(taskKey, "");
- }
- });
+ HashMap<String, String> retVal = HashMap.ofAll(value).flatMap((taskKey, configs) -> {
+ if (!configs.isEmpty()) {
+ return HashMap.ofAll(configs).map((configKey, configValue) -> Tuple.of(taskKey + "." + configKey, configValue));
+ } else {
+ return HashMap.of(taskKey, "");
+ }
+ });
return retVal;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/Tenant.java b/pinot-common/src/main/java/org/apache/pinot/common/config/Tenant.java
index 95134de..66386ca 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/Tenant.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/Tenant.java
@@ -84,10 +84,9 @@ public class Tenant {
}
if (obj instanceof Tenant) {
Tenant that = (Tenant) obj;
- return EqualityUtils.isEqual(_numberOfInstances, that._numberOfInstances)
- && EqualityUtils.isEqual(_offlineInstances, that._offlineInstances)
- && EqualityUtils.isEqual(_realtimeInstances, that._realtimeInstances)
- && EqualityUtils.isEqual(_tenantRole, that._tenantRole)
+ return EqualityUtils.isEqual(_numberOfInstances, that._numberOfInstances) && EqualityUtils
+ .isEqual(_offlineInstances, that._offlineInstances) && EqualityUtils
+ .isEqual(_realtimeInstances, that._realtimeInstances) && EqualityUtils.isEqual(_tenantRole, that._tenantRole)
&& EqualityUtils.isEqual(_tenantName, that._tenantName);
}
return false;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/TenantConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/TenantConfig.java
index 3802f47..d9271bb 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/TenantConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/TenantConfig.java
@@ -24,6 +24,7 @@ import org.apache.pinot.common.utils.EqualityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
@JsonIgnoreProperties(ignoreUnknown = true)
public class TenantConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(TenantConfig.class);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/TypedMapChildKeyHandler.java b/pinot-common/src/main/java/org/apache/pinot/common/config/TypedMapChildKeyHandler.java
index 3f94369..6404639 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/TypedMapChildKeyHandler.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/TypedMapChildKeyHandler.java
@@ -37,24 +37,21 @@ public class TypedMapChildKeyHandler<T> implements ChildKeyHandler<java.util.Map
public java.util.Map<String, T> handleChildKeys(Map<String, ?> childKeys, String pathPrefix) {
java.util.Map<String, T> returnedMap = new HashMap<>();
- childKeys
- .groupBy(tuple2 -> tuple2._1.split("\\.", 2)[0])
- .map((key, values) -> {
- // Drop the prefix
- Map<String, ?> valuesWithoutPrefix = values
- .map((configKey, configValue) -> Tuple.of(configKey.substring(key.length() + 1), configValue));
+ childKeys.groupBy(tuple2 -> tuple2._1.split("\\.", 2)[0]).map((key, values) -> {
+ // Drop the prefix
+ Map<String, ?> valuesWithoutPrefix =
+ values.map((configKey, configValue) -> Tuple.of(configKey.substring(key.length() + 1), configValue));
- T value;
- try {
- value = Deserializer.deserialize(_type, valuesWithoutPrefix, "");
- } catch (Exception e) {
- value = null;
- e.printStackTrace();
- }
+ T value;
+ try {
+ value = Deserializer.deserialize(_type, valuesWithoutPrefix, "");
+ } catch (Exception e) {
+ value = null;
+ e.printStackTrace();
+ }
- return Tuple.of(key, value);
- })
- .forEach(returnedMap::put);
+ return Tuple.of(key, value);
+ }).forEach(returnedMap::put);
if (returnedMap.isEmpty()) {
return null;
@@ -69,8 +66,8 @@ public class TypedMapChildKeyHandler<T> implements ChildKeyHandler<java.util.Map
return null;
}
- final io.vavr.collection.HashMap<String, ?> serialized = io.vavr.collection.HashMap.ofAll(value)
- .flatMap((columnName, columnPartitionConfig) -> Serializer.serialize(columnPartitionConfig)
+ final io.vavr.collection.HashMap<String, ?> serialized = io.vavr.collection.HashMap.ofAll(value).flatMap(
+ (columnName, columnPartitionConfig) -> Serializer.serialize(columnPartitionConfig)
.map((key, obj) -> Tuple.of(columnName + "." + key, obj)));
return serialized;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFieldSpec.java b/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFieldSpec.java
index 2dd18cb..a7e67fb 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFieldSpec.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFieldSpec.java
@@ -37,8 +37,7 @@ public final class DateTimeFieldSpec extends FieldSpec {
private String _granularity;
public enum TimeFormat {
- EPOCH,
- SIMPLE_DATE_FORMAT
+ EPOCH, SIMPLE_DATE_FORMAT
}
// Default constructor required by JSON de-serializer. DO NOT REMOVE.
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatPatternSpec.java b/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatPatternSpec.java
index 9fc352b..ca09a48 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatPatternSpec.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatPatternSpec.java
@@ -84,9 +84,8 @@ public class DateTimeFormatPatternSpec {
DateTimeFormatPatternSpec that = (DateTimeFormatPatternSpec) o;
- return EqualityUtils.isEqual(_timeFormat, that._timeFormat) &&
- EqualityUtils.isEqual(_sdfPattern, that._sdfPattern) &&
- EqualityUtils.isEqual(_dateTimeZone, that._dateTimeZone);
+ return EqualityUtils.isEqual(_timeFormat, that._timeFormat) && EqualityUtils.isEqual(_sdfPattern, that._sdfPattern)
+ && EqualityUtils.isEqual(_dateTimeZone, that._dateTimeZone);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatSpec.java b/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatSpec.java
index d8d6221..eac3067 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatSpec.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatSpec.java
@@ -63,10 +63,10 @@ public class DateTimeFormatSpec {
_size = Integer.valueOf(formatTokens[FORMAT_SIZE_POSITION]);
_unitSpec = new DateTimeFormatUnitSpec(formatTokens[FORMAT_UNIT_POSITION]);
if (formatTokens.length == MAX_FORMAT_TOKENS) {
- _patternSpec = new DateTimeFormatPatternSpec(formatTokens[FORMAT_TIMEFORMAT_POSITION],
+ _patternSpec = new DateTimeFormatPatternSpec(formatTokens[FORMAT_TIMEFORMAT_POSITION],
formatTokens[FORMAT_PATTERN_POSITION]);
} else {
- _patternSpec = new DateTimeFormatPatternSpec(formatTokens[FORMAT_TIMEFORMAT_POSITION], null);
+ _patternSpec = new DateTimeFormatPatternSpec(formatTokens[FORMAT_TIMEFORMAT_POSITION], null);
}
}
}
@@ -95,8 +95,7 @@ public class DateTimeFormatSpec {
* @param sdfPattern and tz
* @return
*/
- public DateTimeFormatSpec(int columnSize, String columnUnit, String columnTimeFormat,
- String sdfPattern) {
+ public DateTimeFormatSpec(int columnSize, String columnUnit, String columnTimeFormat, String sdfPattern) {
_format = Joiner.on(COLON_SEPARATOR).join(columnSize, columnUnit, columnTimeFormat, sdfPattern);
isValidFormat(_format);
@@ -214,9 +213,9 @@ public class DateTimeFormatSpec {
Preconditions.checkArgument(formatTokens[FORMAT_TIMEFORMAT_POSITION].equals(TimeFormat.EPOCH.toString()),
TIME_FORMAT_ERROR_STR);
} else {
- Preconditions.checkArgument(
- formatTokens[FORMAT_TIMEFORMAT_POSITION].equals(TimeFormat.SIMPLE_DATE_FORMAT.toString()),
- TIME_FORMAT_ERROR_STR);
+ Preconditions
+ .checkArgument(formatTokens[FORMAT_TIMEFORMAT_POSITION].equals(TimeFormat.SIMPLE_DATE_FORMAT.toString()),
+ TIME_FORMAT_ERROR_STR);
}
return true;
}
@@ -233,10 +232,8 @@ public class DateTimeFormatSpec {
DateTimeFormatSpec that = (DateTimeFormatSpec) o;
- return EqualityUtils.isEqual(_size, that._size) &&
- EqualityUtils.isEqual(_format, that._format) &&
- EqualityUtils.isEqual(_unitSpec, that._unitSpec) &&
- EqualityUtils.isEqual(_patternSpec, that._patternSpec);
+ return EqualityUtils.isEqual(_size, that._size) && EqualityUtils.isEqual(_format, that._format) && EqualityUtils
+ .isEqual(_unitSpec, that._unitSpec) && EqualityUtils.isEqual(_patternSpec, that._patternSpec);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatUnitSpec.java b/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatUnitSpec.java
index f9c50b2..7596867 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatUnitSpec.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeFormatUnitSpec.java
@@ -31,42 +31,57 @@ public class DateTimeFormatUnitSpec {
* Time unit enum with range from MILLISECONDS to YEARS
*/
public enum DateTimeTransformUnit {
+
MILLISECONDS {
@Override
public long fromMillis(long millisSinceEpoch) {
return millisSinceEpoch;
}
- }, SECONDS {
+ },
+
+ SECONDS {
@Override
public long fromMillis(long millisSinceEpoch) {
return TimeUnit.MILLISECONDS.toSeconds(millisSinceEpoch);
}
- }, MINUTES {
+ },
+
+ MINUTES {
@Override
public long fromMillis(long millisSinceEpoch) {
return TimeUnit.MILLISECONDS.toMinutes(millisSinceEpoch);
}
- }, HOURS {
+ },
+
+ HOURS {
@Override
public long fromMillis(long millisSinceEpoch) {
return TimeUnit.MILLISECONDS.toHours(millisSinceEpoch);
}
- }, DAYS {
+ },
+
+ DAYS {
@Override
public long fromMillis(long millisSinceEpoch) {
return TimeUnit.MILLISECONDS.toDays(millisSinceEpoch);
}
- }, WEEKS {
+ },
+
+ WEEKS {
@Override
public long fromMillis(long millisSinceEpoch) {
return DurationFieldType.weeks().getField(ISOChronology.getInstanceUTC()).getDifference(millisSinceEpoch, 0L);
}
- }, MONTHS {
+ },
+
+ MONTHS {
@Override
public long fromMillis(long millisSinceEpoch) {
return DurationFieldType.months().getField(ISOChronology.getInstanceUTC()).getDifference(millisSinceEpoch, 0L);
}
- }, YEARS {
+ },
+
+ YEARS {
@Override
public long fromMillis(long millisSinceEpoch) {
return DurationFieldType.years().getField(ISOChronology.getInstanceUTC()).getDifference(millisSinceEpoch, 0L);
@@ -80,6 +95,7 @@ public class DateTimeFormatUnitSpec {
* @return Time since epoch of desired time unit
*/
public abstract long fromMillis(long millisSinceEpoch);
+
}
private TimeUnit _timeUnit = null;
@@ -124,8 +140,8 @@ public class DateTimeFormatUnitSpec {
DateTimeFormatUnitSpec that = (DateTimeFormatUnitSpec) o;
- return EqualityUtils.isEqual(_timeUnit, that._timeUnit) && EqualityUtils.isEqual(_dateTimeTransformUnit,
- that._dateTimeTransformUnit);
+ return EqualityUtils.isEqual(_timeUnit, that._timeUnit) && EqualityUtils
+ .isEqual(_dateTimeTransformUnit, that._dateTimeTransformUnit);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeGranularitySpec.java b/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeGranularitySpec.java
index dc1c5f3..7a75b5c 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeGranularitySpec.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/DateTimeGranularitySpec.java
@@ -24,15 +24,14 @@ import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.EnumUtils;
import org.apache.pinot.common.utils.EqualityUtils;
+
/**
* Class to represent granularity from {@link DateTimeFieldSpec}
*/
public class DateTimeGranularitySpec {
- public static final String GRANULARITY_TOKENS_ERROR_STR =
- "granularity must be of format size:timeunit";
- public static final String GRANULARITY_PATTERN_ERROR_STR =
- "granularity must be of format [0-9]+:<TimeUnit>";
+ public static final String GRANULARITY_TOKENS_ERROR_STR = "granularity must be of format size:timeunit";
+ public static final String GRANULARITY_PATTERN_ERROR_STR = "granularity must be of format [0-9]+:<TimeUnit>";
public static final String NUMBER_REGEX = "[1-9][0-9]*";
public static final String COLON_SEPARATOR = ":";
@@ -84,7 +83,6 @@ public class DateTimeGranularitySpec {
return _timeUnit;
}
-
/**
* <ul>
* <li>Convert a granularity to millis.
@@ -102,7 +100,6 @@ public class DateTimeGranularitySpec {
return TimeUnit.MILLISECONDS.convert(_size, _timeUnit);
}
-
/**
* Check correctness of granularity of {@link DateTimeFieldSpec}
* @param granularity
@@ -111,9 +108,9 @@ public class DateTimeGranularitySpec {
public static boolean isValidGranularity(String granularity) {
Preconditions.checkNotNull(granularity);
String[] granularityTokens = granularity.split(COLON_SEPARATOR);
- Preconditions.checkArgument(granularityTokens.length == MAX_GRANULARITY_TOKENS,
- GRANULARITY_TOKENS_ERROR_STR);
- Preconditions.checkArgument(granularityTokens[GRANULARITY_SIZE_POSITION].matches(NUMBER_REGEX), GRANULARITY_PATTERN_ERROR_STR);
+ Preconditions.checkArgument(granularityTokens.length == MAX_GRANULARITY_TOKENS, GRANULARITY_TOKENS_ERROR_STR);
+ Preconditions.checkArgument(granularityTokens[GRANULARITY_SIZE_POSITION].matches(NUMBER_REGEX),
+ GRANULARITY_PATTERN_ERROR_STR);
Preconditions.checkArgument(EnumUtils.isValidEnum(TimeUnit.class, granularityTokens[GRANULARITY_UNIT_POSITION]),
GRANULARITY_PATTERN_ERROR_STR);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/FieldSpec.java b/pinot-common/src/main/java/org/apache/pinot/common/data/FieldSpec.java
index 2671150..30be748 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/FieldSpec.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/FieldSpec.java
@@ -341,9 +341,9 @@ public abstract class FieldSpec implements Comparable<FieldSpec>, ConfigNodeLife
FieldSpec that = (FieldSpec) o;
return EqualityUtils.isEqual(_name, that._name) && EqualityUtils.isEqual(_dataType, that._dataType) && EqualityUtils
- .isEqual(_isSingleValueField, that._isSingleValueField) && EqualityUtils.isEqual(
- getStringValue(_defaultNullValue), getStringValue(that._defaultNullValue)) && EqualityUtils.isEqual(_maxLength,
- that._maxLength);
+ .isEqual(_isSingleValueField, that._isSingleValueField) && EqualityUtils
+ .isEqual(getStringValue(_defaultNullValue), getStringValue(that._defaultNullValue)) && EqualityUtils
+ .isEqual(_maxLength, that._maxLength);
}
@Override
@@ -376,23 +376,17 @@ public abstract class FieldSpec implements Comparable<FieldSpec>, ConfigNodeLife
* segments, otherwise treated the same as <code>DIMENSION</code> field.
*/
public enum FieldType {
- DIMENSION,
- METRIC,
- TIME,
- DATE_TIME
+ DIMENSION, METRIC, TIME, DATE_TIME
}
/**
* The <code>DataType</code> enum is used to demonstrate the data type of a field.
*/
public enum DataType {
- INT,
- LONG,
- FLOAT,
- DOUBLE,
- BOOLEAN, // Stored as STRING
- STRING,
- BYTES;
+ INT, LONG, FLOAT, DOUBLE, BOOLEAN,
+
+ // Stored as STRING
+ STRING, BYTES;
/**
* Returns the data type stored in Pinot.
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/MetricFieldSpec.java b/pinot-common/src/main/java/org/apache/pinot/common/data/MetricFieldSpec.java
index a121893..98d0010 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/MetricFieldSpec.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/MetricFieldSpec.java
@@ -165,8 +165,8 @@ public final class MetricFieldSpec extends FieldSpec {
}
MetricFieldSpec that = (MetricFieldSpec) o;
- return EqualityUtils.isEqual(_fieldSize, that._fieldSize) && EqualityUtils.isEqual(_derivedMetricType,
- that._derivedMetricType);
+ return EqualityUtils.isEqual(_fieldSize, that._fieldSize) && EqualityUtils
+ .isEqual(_derivedMetricType, that._derivedMetricType);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/Schema.java b/pinot-common/src/main/java/org/apache/pinot/common/data/Schema.java
index 1da8094..b8739f5 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/Schema.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/Schema.java
@@ -86,17 +86,20 @@ public final class Schema {
private transient final List<String> _dateTimeNames = new ArrayList<>();
@Nonnull
- public static Schema fromFile(@Nonnull File schemaFile) throws IOException {
+ public static Schema fromFile(@Nonnull File schemaFile)
+ throws IOException {
return JsonUtils.fileToObject(schemaFile, Schema.class);
}
@Nonnull
- public static Schema fromString(@Nonnull String schemaString) throws IOException {
+ public static Schema fromString(@Nonnull String schemaString)
+ throws IOException {
return JsonUtils.stringToObject(schemaString, Schema.class);
}
@Nonnull
- public static Schema fromInputSteam(@Nonnull InputStream schemaInputStream) throws IOException {
+ public static Schema fromInputSteam(@Nonnull InputStream schemaInputStream)
+ throws IOException {
return JsonUtils.inputStreamToObject(schemaInputStream, Schema.class);
}
@@ -188,8 +191,8 @@ public final class Schema {
Preconditions.checkNotNull(fieldSpec);
String columnName = fieldSpec.getName();
Preconditions.checkNotNull(columnName);
- Preconditions.checkState(!_fieldSpecMap.containsKey(columnName),
- "Field spec already exists for column: " + columnName);
+ Preconditions
+ .checkState(!_fieldSpecMap.containsKey(columnName), "Field spec already exists for column: " + columnName);
FieldType fieldType = fieldSpec.getFieldType();
switch (fieldType) {
@@ -276,7 +279,7 @@ public final class Schema {
cols.addAll(_fieldSpecMap.keySet());
for (String col : _fieldSpecMap.keySet()) {
// exclude virtual columns
- if(isVirtualColumn(col)) {
+ if (isVirtualColumn(col)) {
cols.remove(col);
}
}
@@ -635,11 +638,11 @@ public final class Schema {
Schema that = (Schema) o;
- return EqualityUtils.isEqual(_schemaName, that._schemaName) &&
- EqualityUtils.isEqualIgnoreOrder(_dimensionFieldSpecs, that._dimensionFieldSpecs) &&
- EqualityUtils.isEqualIgnoreOrder(_metricFieldSpecs, that._metricFieldSpecs) &&
- EqualityUtils.isEqual(_timeFieldSpec, that._timeFieldSpec) &&
- EqualityUtils.isEqualIgnoreOrder(_dateTimeFieldSpecs, that._dateTimeFieldSpecs);
+ return EqualityUtils.isEqual(_schemaName, that._schemaName) && EqualityUtils
+ .isEqualIgnoreOrder(_dimensionFieldSpecs, that._dimensionFieldSpecs) && EqualityUtils
+ .isEqualIgnoreOrder(_metricFieldSpecs, that._metricFieldSpecs) && EqualityUtils
+ .isEqual(_timeFieldSpec, that._timeFieldSpec) && EqualityUtils
+ .isEqualIgnoreOrder(_dateTimeFieldSpecs, that._dateTimeFieldSpecs);
}
@Override
@@ -653,8 +656,7 @@ public final class Schema {
}
public boolean isVirtualColumn(String columnName) {
- return columnName.startsWith("$") ||
- (getFieldSpecFor(columnName).getVirtualColumnProvider() != null &&
- !getFieldSpecFor(columnName).getVirtualColumnProvider().isEmpty());
+ return columnName.startsWith("$") || (getFieldSpecFor(columnName).getVirtualColumnProvider() != null
+ && !getFieldSpecFor(columnName).getVirtualColumnProvider().isEmpty());
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/StarTreeIndexSpec.java b/pinot-common/src/main/java/org/apache/pinot/common/data/StarTreeIndexSpec.java
index b266a65..4a5f22e 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/StarTreeIndexSpec.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/StarTreeIndexSpec.java
@@ -114,7 +114,8 @@ public class StarTreeIndexSpec {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
- public String toJsonString() throws JsonProcessingException {
+ public String toJsonString()
+ throws JsonProcessingException {
return JsonUtils.objectToString(this);
}
@@ -125,11 +126,13 @@ public class StarTreeIndexSpec {
* @return StarTreeIndexSpec object de-serialized from the file.
* @throws IOException
*/
- public static StarTreeIndexSpec fromFile(File starTreeIndexSpecFile) throws IOException {
+ public static StarTreeIndexSpec fromFile(File starTreeIndexSpecFile)
+ throws IOException {
return JsonUtils.fileToObject(starTreeIndexSpecFile, StarTreeIndexSpec.class);
}
- public static StarTreeIndexSpec fromJsonString(String jsonString) throws IOException {
+ public static StarTreeIndexSpec fromJsonString(String jsonString)
+ throws IOException {
return JsonUtils.stringToObject(jsonString, StarTreeIndexSpec.class);
}
@@ -137,10 +140,10 @@ public class StarTreeIndexSpec {
StarTreeIndexSpec starTreeIndexSpec = new StarTreeIndexSpec();
starTreeIndexSpec.setMaxLeafRecords(starTreeMetadata.getMaxLeafRecords());
starTreeIndexSpec.setDimensionsSplitOrder(starTreeMetadata.getDimensionsSplitOrder());
- starTreeIndexSpec.setSkipStarNodeCreationForDimensions(
- Sets.newHashSet(starTreeMetadata.getSkipStarNodeCreationForDimensions()));
- starTreeIndexSpec.setSkipMaterializationForDimensions(
- Sets.newHashSet(starTreeMetadata.getSkipMaterializationForDimensions()));
+ starTreeIndexSpec
+ .setSkipStarNodeCreationForDimensions(Sets.newHashSet(starTreeMetadata.getSkipStarNodeCreationForDimensions()));
+ starTreeIndexSpec
+ .setSkipMaterializationForDimensions(Sets.newHashSet(starTreeMetadata.getSkipMaterializationForDimensions()));
starTreeIndexSpec.setSkipMaterializationCardinalityThreshold(starTreeMetadata.getSkipMaterializationCardinality());
return starTreeIndexSpec;
}
@@ -157,12 +160,13 @@ public class StarTreeIndexSpec {
StarTreeIndexSpec that = (StarTreeIndexSpec) o;
- return EqualityUtils.isEqual(_maxLeafRecords, that._maxLeafRecords) &&
- EqualityUtils.isEqual( _skipMaterializationCardinalityThreshold, that._skipMaterializationCardinalityThreshold) &&
- EqualityUtils.isEqual(_excludeSkipMaterializationDimensionsForStarTreeIndex, that._excludeSkipMaterializationDimensionsForStarTreeIndex) &&
- EqualityUtils.isEqual(_dimensionsSplitOrder, that._dimensionsSplitOrder) &&
- EqualityUtils.isEqual(_skipStarNodeCreationForDimensions, that._skipStarNodeCreationForDimensions) &&
- EqualityUtils.isEqual(_skipMaterializationForDimensions, that._skipMaterializationForDimensions);
+ return EqualityUtils.isEqual(_maxLeafRecords, that._maxLeafRecords) && EqualityUtils
+ .isEqual(_skipMaterializationCardinalityThreshold, that._skipMaterializationCardinalityThreshold)
+ && EqualityUtils.isEqual(_excludeSkipMaterializationDimensionsForStarTreeIndex,
+ that._excludeSkipMaterializationDimensionsForStarTreeIndex) && EqualityUtils
+ .isEqual(_dimensionsSplitOrder, that._dimensionsSplitOrder) && EqualityUtils
+ .isEqual(_skipStarNodeCreationForDimensions, that._skipStarNodeCreationForDimensions) && EqualityUtils
+ .isEqual(_skipMaterializationForDimensions, that._skipMaterializationForDimensions);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/TimeFieldSpec.java b/pinot-common/src/main/java/org/apache/pinot/common/data/TimeFieldSpec.java
index bf49dea..23a9f4f 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/TimeFieldSpec.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/TimeFieldSpec.java
@@ -230,8 +230,8 @@ public final class TimeFieldSpec extends FieldSpec {
}
TimeFieldSpec that = (TimeFieldSpec) o;
- return EqualityUtils.isEqual(_incomingGranularitySpec, that._incomingGranularitySpec) && EqualityUtils.isEqual(
- getOutgoingGranularitySpec(), that.getOutgoingGranularitySpec());
+ return EqualityUtils.isEqual(_incomingGranularitySpec, that._incomingGranularitySpec) && EqualityUtils
+ .isEqual(getOutgoingGranularitySpec(), that.getOutgoingGranularitySpec());
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/data/TimeGranularitySpec.java b/pinot-common/src/main/java/org/apache/pinot/common/data/TimeGranularitySpec.java
index 3f6e10f..7b66e42 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/data/TimeGranularitySpec.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/data/TimeGranularitySpec.java
@@ -94,8 +94,8 @@ public class TimeGranularitySpec {
Preconditions.checkNotNull(timeType);
Preconditions.checkNotNull(name);
Preconditions.checkNotNull(timeFormat);
- Preconditions.checkArgument(timeFormat.equals(TimeFormat.EPOCH.toString()) || (timeFormat.startsWith(
- TimeFormat.SIMPLE_DATE_FORMAT.toString())));
+ Preconditions.checkArgument(timeFormat.equals(TimeFormat.EPOCH.toString()) || (timeFormat
+ .startsWith(TimeFormat.SIMPLE_DATE_FORMAT.toString())));
_dataType = dataType.getStoredType();
_timeType = timeType;
@@ -119,8 +119,8 @@ public class TimeGranularitySpec {
Preconditions.checkNotNull(timeType);
Preconditions.checkNotNull(name);
Preconditions.checkNotNull(timeFormat);
- Preconditions.checkArgument(timeFormat.equals(TimeFormat.EPOCH.toString()) || (timeFormat.startsWith(
- TimeFormat.SIMPLE_DATE_FORMAT.toString())));
+ Preconditions.checkArgument(timeFormat.equals(TimeFormat.EPOCH.toString()) || (timeFormat
+ .startsWith(TimeFormat.SIMPLE_DATE_FORMAT.toString())));
_dataType = dataType.getStoredType();
_timeType = timeType;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/exception/InvalidConfigException.java b/pinot-common/src/main/java/org/apache/pinot/common/exception/InvalidConfigException.java
index 70d068f..49872db 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/exception/InvalidConfigException.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/exception/InvalidConfigException.java
@@ -23,5 +23,4 @@ public class InvalidConfigException extends Exception {
public InvalidConfigException(String message) {
super(message);
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/exception/TableNotFoundException.java b/pinot-common/src/main/java/org/apache/pinot/common/exception/TableNotFoundException.java
index 9091324..25a7516 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/exception/TableNotFoundException.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/exception/TableNotFoundException.java
@@ -23,5 +23,4 @@ public class TableNotFoundException extends Exception {
public TableNotFoundException(String message) {
super(message);
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentMergeLineage.java b/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentMergeLineage.java
index 04c173d..c913a93 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentMergeLineage.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentMergeLineage.java
@@ -304,7 +304,8 @@ public class SegmentMergeLineage {
* @param childrenGroups a list of children group ids
* @return group level
*/
- private Integer getGroupLevel(List<String> childrenGroups) throws InvalidConfigException {
+ private Integer getGroupLevel(List<String> childrenGroups)
+ throws InvalidConfigException {
// If no children exists, the group belongs to the base level.
if (childrenGroups == null || childrenGroups.isEmpty()) {
return DEFAULT_GROUP_LEVEL;
@@ -336,9 +337,9 @@ public class SegmentMergeLineage {
SegmentMergeLineage that = (SegmentMergeLineage) o;
- return EqualityUtils.isEqual(_tableNameWithType, that._tableNameWithType) && EqualityUtils.isEqual(
- _parentGroupToChildrenGroupsMap, that._parentGroupToChildrenGroupsMap) && EqualityUtils.isEqual(
- _levelToGroupToSegmentsMap, that._levelToGroupToSegmentsMap);
+ return EqualityUtils.isEqual(_tableNameWithType, that._tableNameWithType) && EqualityUtils
+ .isEqual(_parentGroupToChildrenGroupsMap, that._parentGroupToChildrenGroupsMap) && EqualityUtils
+ .isEqual(_levelToGroupToSegmentsMap, that._levelToGroupToSegmentsMap);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/messages/TimeboundaryRefreshMessage.java b/pinot-common/src/main/java/org/apache/pinot/common/messages/TimeboundaryRefreshMessage.java
index 190b8d4..aeb7b37 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/messages/TimeboundaryRefreshMessage.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/messages/TimeboundaryRefreshMessage.java
@@ -22,23 +22,24 @@ import com.google.common.base.Preconditions;
import java.util.UUID;
import org.apache.helix.model.Message;
+
// A message intended for a pinot Broker to ask it to refresh its Timeboundary Info.
public class TimeboundaryRefreshMessage extends Message {
- public static final String REFRESH_TIME_BOUNDARY_MSG_SUB_TYPE = "REFRESH_TIME_BOUNDARY";
- public TimeboundaryRefreshMessage(String tableName, String segmentName) {
- super(MessageType.USER_DEFINE_MSG, UUID.randomUUID().toString());
- setResourceName(tableName);
- setPartitionName(segmentName);
- setMsgSubType(REFRESH_TIME_BOUNDARY_MSG_SUB_TYPE);
- // Give it infinite time to process the message, as long as session is alive
- setExecutionTimeout(-1);
- }
+ public static final String REFRESH_TIME_BOUNDARY_MSG_SUB_TYPE = "REFRESH_TIME_BOUNDARY";
- public TimeboundaryRefreshMessage(Message message) {
- super(message.getRecord());
- String msgSubType = message.getMsgSubType();
- Preconditions.checkArgument(msgSubType.equals(REFRESH_TIME_BOUNDARY_MSG_SUB_TYPE),
- "Invalid message sub type: " + msgSubType + " for TimeboundaryRefreshMessage");
+ public TimeboundaryRefreshMessage(String tableName, String segmentName) {
+ super(MessageType.USER_DEFINE_MSG, UUID.randomUUID().toString());
+ setResourceName(tableName);
+ setPartitionName(segmentName);
+ setMsgSubType(REFRESH_TIME_BOUNDARY_MSG_SUB_TYPE);
+ // Give it infinite time to process the message, as long as session is alive
+ setExecutionTimeout(-1);
+ }
- }
+ public TimeboundaryRefreshMessage(Message message) {
+ super(message.getRecord());
+ String msgSubType = message.getMsgSubType();
+ Preconditions.checkArgument(msgSubType.equals(REFRESH_TIME_BOUNDARY_MSG_SUB_TYPE),
+ "Invalid message sub type: " + msgSubType + " for TimeboundaryRefreshMessage");
+ }
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metadata/ZKMetadataProvider.java b/pinot-common/src/main/java/org/apache/pinot/common/metadata/ZKMetadataProvider.java
index 74e208b..07e3533 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metadata/ZKMetadataProvider.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metadata/ZKMetadataProvider.java
@@ -60,8 +60,8 @@ public class ZKMetadataProvider {
public static void setRealtimeTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, String realtimeTableName,
ZNRecord znRecord) {
- propertyStore.set(constructPropertyStorePathForResourceConfig(realtimeTableName), znRecord,
- AccessOption.PERSISTENT);
+ propertyStore
+ .set(constructPropertyStorePathForResourceConfig(realtimeTableName), znRecord, AccessOption.PERSISTENT);
}
public static void setOfflineTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, String offlineTableName,
@@ -78,8 +78,8 @@ public class ZKMetadataProvider {
public static InstanceZKMetadata getInstanceZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore,
String instanceId) {
- ZNRecord znRecord = propertyStore.get(StringUtil.join("/", PROPERTYSTORE_INSTANCE_CONFIGS_PREFIX, instanceId), null,
- AccessOption.PERSISTENT);
+ ZNRecord znRecord = propertyStore
+ .get(StringUtil.join("/", PROPERTYSTORE_INSTANCE_CONFIGS_PREFIX, instanceId), null, AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
@@ -116,8 +116,8 @@ public class ZKMetadataProvider {
public static boolean isSegmentExisted(ZkHelixPropertyStore<ZNRecord> propertyStore, String resourceNameForResource,
String segmentName) {
- return propertyStore.exists(constructPropertyStorePathForSegment(resourceNameForResource, segmentName),
- AccessOption.PERSISTENT);
+ return propertyStore
+ .exists(constructPropertyStorePathForSegment(resourceNameForResource, segmentName), AccessOption.PERSISTENT);
}
public static void removeResourceSegmentsFromPropertyStore(ZkHelixPropertyStore<ZNRecord> propertyStore,
@@ -187,8 +187,8 @@ public class ZKMetadataProvider {
public static OfflineSegmentZKMetadata getOfflineSegmentZKMetadata(
@Nonnull ZkHelixPropertyStore<ZNRecord> propertyStore, @Nonnull String tableName, @Nonnull String segmentName) {
String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName);
- ZNRecord znRecord = propertyStore.get(constructPropertyStorePathForSegment(offlineTableName, segmentName), null,
- AccessOption.PERSISTENT);
+ ZNRecord znRecord = propertyStore
+ .get(constructPropertyStorePathForSegment(offlineTableName, segmentName), null, AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
@@ -199,8 +199,8 @@ public class ZKMetadataProvider {
public static RealtimeSegmentZKMetadata getRealtimeSegmentZKMetadata(
@Nonnull ZkHelixPropertyStore<ZNRecord> propertyStore, @Nonnull String tableName, @Nonnull String segmentName) {
String realtimeTableName = TableNameBuilder.REALTIME.tableNameWithType(tableName);
- ZNRecord znRecord = propertyStore.get(constructPropertyStorePathForSegment(realtimeTableName, segmentName), null,
- AccessOption.PERSISTENT);
+ ZNRecord znRecord = propertyStore
+ .get(constructPropertyStorePathForSegment(realtimeTableName, segmentName), null, AccessOption.PERSISTENT);
// It is possible that the segment metadata has just been deleted due to retention.
if (znRecord == null) {
return null;
@@ -215,8 +215,8 @@ public class ZKMetadataProvider {
@Nullable
public static TableConfig getTableConfig(@Nonnull ZkHelixPropertyStore<ZNRecord> propertyStore,
@Nonnull String tableNameWithType) {
- ZNRecord znRecord = propertyStore.get(constructPropertyStorePathForResourceConfig(tableNameWithType), null,
- AccessOption.PERSISTENT);
+ ZNRecord znRecord = propertyStore
+ .get(constructPropertyStorePathForResourceConfig(tableNameWithType), null, AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
@@ -303,9 +303,8 @@ public class ZKMetadataProvider {
}
String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName);
if (propertyStore.exists(constructPropertyStorePathForResource(offlineTableName), AccessOption.PERSISTENT)) {
- List<ZNRecord> znRecordList =
- propertyStore.getChildren(constructPropertyStorePathForResource(offlineTableName), null,
- AccessOption.PERSISTENT);
+ List<ZNRecord> znRecordList = propertyStore
+ .getChildren(constructPropertyStorePathForResource(offlineTableName), null, AccessOption.PERSISTENT);
if (znRecordList != null) {
for (ZNRecord record : znRecordList) {
resultList.add(new OfflineSegmentZKMetadata(record));
@@ -327,9 +326,8 @@ public class ZKMetadataProvider {
}
String realtimeTableName = TableNameBuilder.REALTIME.tableNameWithType(resourceName);
if (propertyStore.exists(constructPropertyStorePathForResource(realtimeTableName), AccessOption.PERSISTENT)) {
- List<ZNRecord> znRecordList =
- propertyStore.getChildren(constructPropertyStorePathForResource(realtimeTableName), null,
- AccessOption.PERSISTENT);
+ List<ZNRecord> znRecordList = propertyStore
+ .getChildren(constructPropertyStorePathForResource(realtimeTableName), null, AccessOption.PERSISTENT);
if (znRecordList != null) {
for (ZNRecord record : znRecordList) {
resultList.add(new RealtimeSegmentZKMetadata(record));
@@ -351,9 +349,8 @@ public class ZKMetadataProvider {
}
String realtimeTableName = TableNameBuilder.REALTIME.tableNameWithType(resourceName);
if (propertyStore.exists(constructPropertyStorePathForResource(realtimeTableName), AccessOption.PERSISTENT)) {
- List<ZNRecord> znRecordList =
- propertyStore.getChildren(constructPropertyStorePathForResource(realtimeTableName), null,
- AccessOption.PERSISTENT);
+ List<ZNRecord> znRecordList = propertyStore
+ .getChildren(constructPropertyStorePathForResource(realtimeTableName), null, AccessOption.PERSISTENT);
if (znRecordList != null) {
for (ZNRecord record : znRecordList) {
RealtimeSegmentZKMetadata realtimeSegmentZKMetadata = new RealtimeSegmentZKMetadata(record);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metadata/instance/InstanceZKMetadata.java b/pinot-common/src/main/java/org/apache/pinot/common/metadata/instance/InstanceZKMetadata.java
index aaccf7f..006ddf0 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metadata/instance/InstanceZKMetadata.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metadata/instance/InstanceZKMetadata.java
@@ -140,9 +140,9 @@ public final class InstanceZKMetadata implements ZKMetadata {
}
InstanceZKMetadata metadata = (InstanceZKMetadata) instanceMetadata;
- return isEqual(_id, metadata._id) && isEqual(_instanceName, metadata._instanceName)
- && isEqual(_instanceType, metadata._instanceType) && isEqual(_instancePort, metadata._instancePort)
- && isEqual(_groupIdMap, metadata._groupIdMap) && isEqual(_partitionMap, metadata._partitionMap);
+ return isEqual(_id, metadata._id) && isEqual(_instanceName, metadata._instanceName) && isEqual(_instanceType,
+ metadata._instanceType) && isEqual(_instancePort, metadata._instancePort) && isEqual(_groupIdMap,
+ metadata._groupIdMap) && isEqual(_partitionMap, metadata._partitionMap);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/LLCRealtimeSegmentZKMetadata.java b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/LLCRealtimeSegmentZKMetadata.java
index a55d798..3514ac5 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/LLCRealtimeSegmentZKMetadata.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/LLCRealtimeSegmentZKMetadata.java
@@ -123,19 +123,17 @@ public class LLCRealtimeSegmentZKMetadata extends RealtimeSegmentZKMetadata {
}
LLCRealtimeSegmentZKMetadata metadata = (LLCRealtimeSegmentZKMetadata) segmentMetadata;
- return super.equals(metadata) &&
- isEqual(_startOffset, metadata._startOffset) &&
- isEqual(_endOffset, metadata._endOffset) &&
- isEqual(_downloadUrl, metadata._downloadUrl) &&
- isEqual(_numReplicas, metadata._numReplicas);
+ return super.equals(metadata) && isEqual(_startOffset, metadata._startOffset) && isEqual(_endOffset,
+ metadata._endOffset) && isEqual(_downloadUrl, metadata._downloadUrl) && isEqual(_numReplicas,
+ metadata._numReplicas);
}
@Override
public int hashCode() {
int result = super.hashCode();
- result = hashCodeOf(result, _startOffset);
- result = hashCodeOf(result, _endOffset);
- result = hashCodeOf(result, _numReplicas);
+ result = hashCodeOf(result, _startOffset);
+ result = hashCodeOf(result, _endOffset);
+ result = hashCodeOf(result, _numReplicas);
result = hashCodeOf(result, _downloadUrl);
return result;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/OfflineSegmentZKMetadata.java b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/OfflineSegmentZKMetadata.java
index 9f654dc..88bc0e3 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/OfflineSegmentZKMetadata.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/OfflineSegmentZKMetadata.java
@@ -110,10 +110,8 @@ public class OfflineSegmentZKMetadata extends SegmentZKMetadata {
}
OfflineSegmentZKMetadata metadata = (OfflineSegmentZKMetadata) segmentMetadata;
- return super.equals(metadata) &&
- isEqual(_pushTime, metadata._pushTime) &&
- isEqual(_refreshTime, metadata._refreshTime) &&
- isEqual(_downloadUrl, metadata._downloadUrl);
+ return super.equals(metadata) && isEqual(_pushTime, metadata._pushTime) && isEqual(_refreshTime,
+ metadata._refreshTime) && isEqual(_downloadUrl, metadata._downloadUrl);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/RealtimeSegmentZKMetadata.java b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/RealtimeSegmentZKMetadata.java
index cc6b232..415da68 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/RealtimeSegmentZKMetadata.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/RealtimeSegmentZKMetadata.java
@@ -49,7 +49,6 @@ public class RealtimeSegmentZKMetadata extends SegmentZKMetadata {
if (flushThresholdTime != null && !flushThresholdTime.equals(NULL)) {
_timeThresholdToFlushSegment = znRecord.getSimpleField(CommonConstants.Segment.FLUSH_THRESHOLD_TIME);
}
-
}
@Override
@@ -87,10 +86,9 @@ public class RealtimeSegmentZKMetadata extends SegmentZKMetadata {
}
RealtimeSegmentZKMetadata metadata = (RealtimeSegmentZKMetadata) segmentMetadata;
- return super.equals(metadata) &&
- isEqual(_status, metadata._status) &&
- isEqual(_sizeThresholdToFlushSegment, metadata._sizeThresholdToFlushSegment) &&
- isEqual(_timeThresholdToFlushSegment, metadata._timeThresholdToFlushSegment);
+ return super.equals(metadata) && isEqual(_status, metadata._status) && isEqual(_sizeThresholdToFlushSegment,
+ metadata._sizeThresholdToFlushSegment) && isEqual(_timeThresholdToFlushSegment,
+ metadata._timeThresholdToFlushSegment);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentZKMetadata.java b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentZKMetadata.java
index 248b74d..67366a5 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentZKMetadata.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentZKMetadata.java
@@ -72,8 +72,8 @@ public abstract class SegmentZKMetadata implements ZKMetadata {
_segmentType = znRecord.getEnumField(CommonConstants.Segment.SEGMENT_TYPE, SegmentType.class, SegmentType.OFFLINE);
_startTime = znRecord.getLongField(CommonConstants.Segment.START_TIME, -1);
_endTime = znRecord.getLongField(CommonConstants.Segment.END_TIME, -1);
- if (znRecord.getSimpleFields().containsKey(CommonConstants.Segment.TIME_UNIT) && !znRecord.getSimpleField(
- CommonConstants.Segment.TIME_UNIT).equals(NULL)) {
+ if (znRecord.getSimpleFields().containsKey(CommonConstants.Segment.TIME_UNIT) && !znRecord
+ .getSimpleField(CommonConstants.Segment.TIME_UNIT).equals(NULL)) {
setTimeUnit(znRecord.getEnumField(CommonConstants.Segment.TIME_UNIT, TimeUnit.class, TimeUnit.DAYS));
}
_indexVersion = znRecord.getSimpleField(CommonConstants.Segment.INDEX_VERSION);
@@ -234,12 +234,13 @@ public abstract class SegmentZKMetadata implements ZKMetadata {
}
SegmentZKMetadata metadata = (SegmentZKMetadata) segmentMetadata;
- return isEqual(_segmentName, metadata._segmentName) && isEqual(_crypterName, metadata._crypterName) && isEqual(_tableName,
- metadata._tableName) && isEqual(_indexVersion, metadata._indexVersion) && isEqual(_timeUnit, metadata._timeUnit)
- && isEqual(_startTime, metadata._startTime) && isEqual(_endTime, metadata._endTime) && isEqual(_segmentType,
- metadata._segmentType) && isEqual(_totalRawDocs, metadata._totalRawDocs) && isEqual(_crc, metadata._crc)
- && isEqual(_creationTime, metadata._creationTime) && isEqual(_partitionMetadata, metadata._partitionMetadata)
- && isEqual(_segmentUploadStartTime, metadata._segmentUploadStartTime) && isEqual(_customMap, metadata._customMap);
+ return isEqual(_segmentName, metadata._segmentName) && isEqual(_crypterName, metadata._crypterName) && isEqual(
+ _tableName, metadata._tableName) && isEqual(_indexVersion, metadata._indexVersion) && isEqual(_timeUnit,
+ metadata._timeUnit) && isEqual(_startTime, metadata._startTime) && isEqual(_endTime, metadata._endTime)
+ && isEqual(_segmentType, metadata._segmentType) && isEqual(_totalRawDocs, metadata._totalRawDocs) && isEqual(
+ _crc, metadata._crc) && isEqual(_creationTime, metadata._creationTime) && isEqual(_partitionMetadata,
+ metadata._partitionMetadata) && isEqual(_segmentUploadStartTime, metadata._segmentUploadStartTime) && isEqual(
+ _customMap, metadata._customMap);
}
@Override
@@ -290,9 +291,9 @@ public abstract class SegmentZKMetadata implements ZKMetadata {
String partitionMetadataJson = _partitionMetadata.toJsonString();
znRecord.setSimpleField(CommonConstants.Segment.PARTITION_METADATA, partitionMetadataJson);
} catch (IOException e) {
- LOGGER.error(
- "Exception caught while writing partition metadata into ZNRecord for segment '{}', will be dropped",
- _segmentName, e);
+ LOGGER
+ .error("Exception caught while writing partition metadata into ZNRecord for segment '{}', will be dropped",
+ _segmentName, e);
}
}
if (_segmentUploadStartTime > 0) {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentZKMetadataCustomMapModifier.java b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentZKMetadataCustomMapModifier.java
index 598d653..dd91584 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentZKMetadataCustomMapModifier.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentZKMetadataCustomMapModifier.java
@@ -54,7 +54,8 @@ public class SegmentZKMetadataCustomMapModifier {
}
}
- public SegmentZKMetadataCustomMapModifier(@Nonnull String jsonString) throws IOException {
+ public SegmentZKMetadataCustomMapModifier(@Nonnull String jsonString)
+ throws IOException {
JsonNode jsonNode = JsonUtils.stringToJsonNode(jsonString);
_modifyMode = ModifyMode.valueOf(jsonNode.get(MAP_MODIFY_MODE_KEY).asText());
JsonNode jsonMap = jsonNode.get(MAP_KEY);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AbstractMetrics.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AbstractMetrics.java
index 7857f57..bf4a853 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AbstractMetrics.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AbstractMetrics.java
@@ -37,8 +37,7 @@ import org.slf4j.LoggerFactory;
* Common code for metrics implementations.
*
*/
-public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M extends AbstractMetrics.Meter, G extends
- AbstractMetrics.Gauge, T extends AbstractMetrics.Timer> {
+public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M extends AbstractMetrics.Meter, G extends AbstractMetrics.Gauge, T extends AbstractMetrics.Timer> {
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractMetrics.class);
@@ -61,7 +60,6 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
_metricsRegistry = metricsRegistry;
_clazz = clazz;
_global = global;
-
}
public interface QueryPhase {
@@ -148,8 +146,8 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
final MetricName metricName = new MetricName(_clazz, fullTimerName);
com.yammer.metrics.core.Timer timer =
MetricsHelper.newTimer(_metricsRegistry, metricName, TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
- MetricsHelper.newTimer(_metricsRegistry, metricName, TimeUnit.MILLISECONDS, TimeUnit.SECONDS).update(duration,
- timeUnit);
+ MetricsHelper.newTimer(_metricsRegistry, metricName, TimeUnit.MILLISECONDS, TimeUnit.SECONDS)
+ .update(duration, timeUnit);
}
/**
@@ -177,7 +175,8 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
* @return The return value of the callable passed as a parameter
* @throws Exception The exception thrown by the callable
*/
- public <T> T timeQueryPhase(final BrokerRequest request, final QP phase, final Callable<T> callable) throws Exception {
+ public <T> T timeQueryPhase(final BrokerRequest request, final QP phase, final Callable<T> callable)
+ throws Exception {
long startTime = System.nanoTime();
T returnValue = callable.call();
long totalNanos = System.nanoTime() - startTime;
@@ -204,7 +203,8 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
* @param unitCount The number of units to add to the meter
* @param reusedMeter The meter to reuse
*/
- public com.yammer.metrics.core.Meter addMeteredGlobalValue(final M meter, final long unitCount, com.yammer.metrics.core.Meter reusedMeter) {
+ public com.yammer.metrics.core.Meter addMeteredGlobalValue(final M meter, final long unitCount,
+ com.yammer.metrics.core.Meter reusedMeter) {
if (reusedMeter != null) {
reusedMeter.mark(unitCount);
return reusedMeter;
@@ -239,7 +239,8 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
* @param unitCount The number of units to add to the meter
* @param reusedMeter The meter to reuse
*/
- public com.yammer.metrics.core.Meter addMeteredTableValue(final String tableName, final M meter, final long unitCount, com.yammer.metrics.core.Meter reusedMeter) {
+ public com.yammer.metrics.core.Meter addMeteredTableValue(final String tableName, final M meter, final long unitCount,
+ com.yammer.metrics.core.Meter reusedMeter) {
if (reusedMeter != null) {
reusedMeter.mark(unitCount);
return reusedMeter;
@@ -298,11 +299,12 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
if (!_gaugeValues.containsKey(fullGaugeName)) {
synchronized (_gaugeValues) {
- if(!_gaugeValues.containsKey(fullGaugeName)) {
+ if (!_gaugeValues.containsKey(fullGaugeName)) {
_gaugeValues.put(fullGaugeName, new AtomicLong(unitCount));
addCallbackGauge(fullGaugeName, new Callable<Long>() {
@Override
- public Long call() throws Exception {
+ public Long call()
+ throws Exception {
return _gaugeValues.get(fullGaugeName).get();
}
});
@@ -360,7 +362,7 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
private void setValueOfGauge(long value, String gaugeName) {
if (!_gaugeValues.containsKey(gaugeName)) {
synchronized (_gaugeValues) {
- if(!_gaugeValues.containsKey(gaugeName)) {
+ if (!_gaugeValues.containsKey(gaugeName)) {
_gaugeValues.put(gaugeName, new AtomicLong(value));
addCallbackGauge(gaugeName, () -> _gaugeValues.get(gaugeName).get());
} else {
@@ -383,11 +385,12 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
if (!_gaugeValues.containsKey(gaugeName)) {
synchronized (_gaugeValues) {
- if(!_gaugeValues.containsKey(gaugeName)) {
+ if (!_gaugeValues.containsKey(gaugeName)) {
_gaugeValues.put(gaugeName, new AtomicLong(unitCount));
addCallbackGauge(gaugeName, new Callable<Long>() {
@Override
- public Long call() throws Exception {
+ public Long call()
+ throws Exception {
return _gaugeValues.get(gaugeName).get();
}
});
@@ -410,7 +413,6 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
}
}
-
@VisibleForTesting
public long getValueOfGlobalGauge(final G gauge, String suffix) {
String fullGaugeName = gauge.getGaugeName() + "." + suffix;
@@ -466,19 +468,19 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
* @param valueCallback The callback function used to retrieve the value of the gauge
*/
public void addCallbackGauge(final String metricName, final Callable<Long> valueCallback) {
- MetricsHelper.newGauge(_metricsRegistry, new MetricName(_clazz, _metricPrefix + metricName), new
- com.yammer.metrics.core.Gauge<Long>() {
- @Override
- public Long value() {
- try {
- return valueCallback.call();
- } catch (Exception e) {
- LOGGER.error("Caught exception", e);
- Utils.rethrowException(e);
- throw new AssertionError("Should not reach this");
- }
- }
- });
+ MetricsHelper.newGauge(_metricsRegistry, new MetricName(_clazz, _metricPrefix + metricName),
+ new com.yammer.metrics.core.Gauge<Long>() {
+ @Override
+ public Long value() {
+ try {
+ return valueCallback.call();
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ Utils.rethrowException(e);
+ throw new AssertionError("Should not reach this");
+ }
+ }
+ });
}
protected abstract QP[] getQueryPhases();
@@ -487,7 +489,7 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
protected abstract G[] getGauges();
- protected String getTableName(String tableName){
- return (_global ? "allTables" : tableName);
+ protected String getTableName(String tableName) {
+ return (_global ? "allTables" : tableName);
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedCounter.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedCounter.java
index ed4d4c0..4e5537b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedCounter.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedCounter.java
@@ -48,9 +48,11 @@ public class AggregatedCounter implements Metric {
private volatile long _count;
@Override
- public <T> void processWith(MetricProcessor<T> processor, MetricName name, T context) throws Exception {
- for (Metric c : _counters)
+ public <T> void processWith(MetricProcessor<T> processor, MetricName name, T context)
+ throws Exception {
+ for (Metric c : _counters) {
c.processWith(processor, name, context);
+ }
}
public AggregatedCounter() {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedHistogram.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedHistogram.java
index ec0af54..08f38f9 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedHistogram.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedHistogram.java
@@ -189,12 +189,12 @@ public class AggregatedHistogram<T extends Sampling> implements Sampling, Summar
}
@Override
- public <T2> void processWith(MetricProcessor<T2> processor, MetricName name, T2 context) throws Exception {
+ public <T2> void processWith(MetricProcessor<T2> processor, MetricName name, T2 context)
+ throws Exception {
for (T h : _histograms) {
if (h instanceof Metric) {
((Metric) h).processWith(processor, name, context);
}
}
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedMeter.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedMeter.java
index f1c3355..221bb96 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedMeter.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedMeter.java
@@ -100,12 +100,14 @@ public class AggregatedMeter<T extends Metered & Stoppable> implements Metered,
@Override
public void stop() {
- for (T m : _meters)
+ for (T m : _meters) {
m.stop();
+ }
}
@Override
- public <T2> void processWith(MetricProcessor<T2> processor, MetricName name, T2 context) throws Exception {
+ public <T2> void processWith(MetricProcessor<T2> processor, MetricName name, T2 context)
+ throws Exception {
for (T m : _meters) {
m.processWith(processor, name, context);
}
@@ -147,15 +149,17 @@ public class AggregatedMeter<T extends Metered & Stoppable> implements Metered,
@Override
public TimeUnit rateUnit() {
- if (_meters.isEmpty())
+ if (_meters.isEmpty()) {
return null;
+ }
return _meters.get(0).rateUnit();
}
@Override
public String eventType() {
- if (_meters.isEmpty())
+ if (_meters.isEmpty()) {
return null;
+ }
return _meters.get(0).eventType();
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedMetricsRegistry.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedMetricsRegistry.java
index 6b8a74c..bc154ef 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedMetricsRegistry.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/AggregatedMetricsRegistry.java
@@ -87,7 +87,8 @@ public class AggregatedMetricsRegistry extends MetricsRegistry {
* @param metricName the name of the metric
* @return a new {@link AggregatedLongGauge}
*/
- public <T extends Number, V extends Gauge<T>> AggregatedLongGauge<T, V> newAggregatedLongGauge(MetricName metricName) {
+ public <T extends Number, V extends Gauge<T>> AggregatedLongGauge<T, V> newAggregatedLongGauge(
+ MetricName metricName) {
return getOrAdd(metricName, new AggregatedLongGauge<T, V>());
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerGauge.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerGauge.java
index 257741d..a8b3797 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerGauge.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerGauge.java
@@ -22,12 +22,11 @@ import org.apache.pinot.common.Utils;
/**
-* Enumeration containing all the gauges exposed by the Pinot broker.
-*
-*/
+ * Enumeration containing all the gauges exposed by the Pinot broker.
+ *
+ */
public enum BrokerGauge implements AbstractMetrics.Gauge {
- QUERY_QUOTA_CAPACITY_UTILIZATION_RATE("tables", false),
- NETTY_CONNECTION_CONNECT_TIME_MS("nettyConnection", true);
+ QUERY_QUOTA_CAPACITY_UTILIZATION_RATE("tables", false), NETTY_CONNECTION_CONNECT_TIME_MS("nettyConnection", true);
private final String brokerGaugeName;
private final String unit;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerQueryPhase.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerQueryPhase.java
index 075d252..cc8cd58 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerQueryPhase.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerQueryPhase.java
@@ -22,9 +22,9 @@ import org.apache.pinot.common.Utils;
/**
-* Enumeration containing all the query phases executed by the Pinot broker.
-*
-*/
+ * Enumeration containing all the query phases executed by the Pinot broker.
+ *
+ */
public enum BrokerQueryPhase implements AbstractMetrics.QueryPhase {
REQUEST_COMPILATION,
QUERY_EXECUTION,
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerTimer.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerTimer.java
index 932b019..ebd8740 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerTimer.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerTimer.java
@@ -22,12 +22,11 @@ import org.apache.pinot.common.Utils;
/**
-* Enumeration containing all the timers exposed by the Pinot broker.
-*
-*/
+ * Enumeration containing all the timers exposed by the Pinot broker.
+ *
+ */
public enum BrokerTimer implements AbstractMetrics.Timer {
- ROUTING_TABLE_UPDATE_TIME(true),
- ROUTING_TABLE_UPDATE_QUEUE_TIME(true);
+ ROUTING_TABLE_UPDATE_TIME(true), ROUTING_TABLE_UPDATE_QUEUE_TIME(true);
private final String timerName;
private final boolean global;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerGauge.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerGauge.java
index 0c18040..052979a 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerGauge.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerGauge.java
@@ -25,30 +25,43 @@ import org.apache.pinot.common.Utils;
* Controller gauges.
*/
public enum ControllerGauge implements AbstractMetrics.Gauge {
- NUMBER_OF_REPLICAS("replicas", false), // Number of complete replicas of table in external view containing
- // all segments online in ideal state
- PERCENT_OF_REPLICAS("percent", false), // Percentage of complete online replicas in external view as compared
- // to replicas in ideal state
+
+ // Number of complete replicas of table in external view containing all segments online in ideal state
+ NUMBER_OF_REPLICAS("replicas", false),
+
+ // Percentage of complete online replicas in external view as compared to replicas in ideal state
+ PERCENT_OF_REPLICAS("percent", false),
+
SEGMENTS_IN_ERROR_STATE("segments", false),
- PERCENT_SEGMENTS_AVAILABLE("segments", false), // Percentage of segments with at least one online replica in external view
- // as compared to total number of segments in ideal state
+
+ // Percentage of segments with at least one online replica in external view as compared to total number of segments in
+ // ideal state
+ PERCENT_SEGMENTS_AVAILABLE("segments", false),
+
SEGMENT_COUNT("SegmentCount", false),
IDEALSTATE_ZNODE_SIZE("idealstate", false),
REALTIME_TABLE_COUNT("TableCount", true),
OFFLINE_TABLE_COUNT("TableCount", true),
DISABLED_TABLE_COUNT("TableCount", true),
-
PERIODIC_TASK_NUM_TABLES_PROCESSED("PeriodicTaskNumTablesProcessed", true),
- SHORT_OF_LIVE_INSTANCES("ShortOfLiveInstances", false), // Number of extra live instances needed.
+ // Number of extra live instances needed
+ SHORT_OF_LIVE_INSTANCES("ShortOfLiveInstances", false),
+
+ // Estimated size of realtime table
+ REALTIME_TABLE_ESTIMATED_SIZE("RealtimeTableEstimatedSize", false),
+
+ // Estimated size of offline table
+ OFFLINE_TABLE_ESTIMATED_SIZE("OfflineTableEstimatedSize", false),
- REALTIME_TABLE_ESTIMATED_SIZE("RealtimeTableEstimatedSize", false), // Estimated size of realtime table.
- OFFLINE_TABLE_ESTIMATED_SIZE("OfflineTableEstimatedSize", false), // Estimated size of offline table.
+ // Table quota based on setting in table config
+ TABLE_QUOTA("TableQuotaBasedOnTableConfig", false),
- TABLE_QUOTA("TableQuotaBasedOnTableConfig", false), // Table quota based on setting in table config.
+ // Table storage quota utilization
+ TABLE_STORAGE_QUOTA_UTILIZATION("TableStorageQuotaUtilization", false),
- TABLE_STORAGE_QUOTA_UTILIZATION("TableStorageQuotaUtilization", false), // Table storage quota utilization.
- TABLE_STORAGE_EST_MISSING_SEGMENT_PERCENT("TableStorageEstMissingSegmentPercent", false); // percentage of segments we failed to get size for
+ // Percentage of segments we failed to get size for
+ TABLE_STORAGE_EST_MISSING_SEGMENT_PERCENT("TableStorageEstMissingSegmentPercent", false);
private final String gaugeName;
private final String unit;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMeter.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMeter.java
index 647948d..9d522bc 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMeter.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMeter.java
@@ -61,7 +61,6 @@ public enum ControllerMeter implements AbstractMetrics.Meter {
NUMBER_SEGMENT_UPLOAD_TIMEOUT_EXCEEDED("SegmentUploadTimeouts", true),
PARTITION_ASSIGNMENT_GENERATION_ERROR("partitionAssignmentError", false);
-
private final String brokerMeterName;
private final String unit;
private final boolean global;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerTimer.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerTimer.java
index b0421ba..7617f5a 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerTimer.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerTimer.java
@@ -22,9 +22,9 @@ import org.apache.pinot.common.Utils;
/**
-* Enumeration containing all the timers exposed by the Pinot controller.
-*
-*/
+ * Enumeration containing all the timers exposed by the Pinot controller.
+ *
+ */
public enum ControllerTimer implements AbstractMetrics.Timer {
;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/LatencyMetric.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/LatencyMetric.java
index 0e70f3d..aee780c 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/LatencyMetric.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/LatencyMetric.java
@@ -92,5 +92,4 @@ public class LatencyMetric<T extends Sampling & Summarizable> {
+ ", _percentile99=" + _percentile99 + ", _percentile999=" + _percentile999 + ", _histogram=" + _histogram
+ "]";
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/MetricsHelper.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/MetricsHelper.java
index ee03290..0644123 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/MetricsHelper.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/MetricsHelper.java
@@ -57,7 +57,7 @@ public class MetricsHelper {
String[] listenerClassNames = configuration.getStringArray("metricsRegistryRegistrationListeners");
if (listenerClassNames.length < 1) {
- listenerClassNames = new String[] { JmxReporterMetricsRegistryRegistrationListener.class.getName() };
+ listenerClassNames = new String[]{JmxReporterMetricsRegistryRegistrationListener.class.getName()};
}
// Build each listener using their default constructor and add them
@@ -71,7 +71,8 @@ public class MetricsHelper {
addMetricsRegistryRegistrationListener(listener);
} catch (Exception e) {
- LOGGER.warn("Caught exception while initializing MetricsRegistryRegistrationListener " + listenerClassName, e);
+ LOGGER
+ .warn("Caught exception while initializing MetricsRegistryRegistrationListener " + listenerClassName, e);
}
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerGauge.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerGauge.java
index 9eedb7c..aff0c83 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerGauge.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerGauge.java
@@ -22,9 +22,9 @@ import org.apache.pinot.common.Utils;
/**
-* Enumeration containing all the gauges exposed by the Pinot server.
-*
-*/
+ * Enumeration containing all the gauges exposed by the Pinot server.
+ *
+ */
public enum ServerGauge implements AbstractMetrics.Gauge {
DOCUMENT_COUNT("documents", false),
SEGMENT_COUNT("segments", false),
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerQueryPhase.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerQueryPhase.java
index a1748a8..7a667eb 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerQueryPhase.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerQueryPhase.java
@@ -22,9 +22,9 @@ import org.apache.pinot.common.Utils;
/**
-* Enumeration containing all the query phases executed by the server.
-*
-*/
+ * Enumeration containing all the query phases executed by the server.
+ *
+ */
public enum ServerQueryPhase implements AbstractMetrics.QueryPhase {
REQUEST_DESERIALIZATION,
TOTAL_QUERY_TIME,
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerTimer.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerTimer.java
index 29dc348..a8560f0 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerTimer.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerTimer.java
@@ -22,9 +22,9 @@ import org.apache.pinot.common.Utils;
/**
-* Enumeration containing all the timers exposed by the Pinot server.
-*
-*/
+ * Enumeration containing all the timers exposed by the Pinot server.
+ *
+ */
public enum ServerTimer implements AbstractMetrics.Timer {
CURRENT_MSG_EVENT_TIMESTAMP_LAG("currentMsgEventTimestampLag", false);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ValidationMetrics.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ValidationMetrics.java
index 0a676f1..88d300b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ValidationMetrics.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ValidationMetrics.java
@@ -68,10 +68,11 @@ public class ValidationMetrics {
public Long value() {
Long gaugeValue = _gaugeValues.get(key);
- if (gaugeValue != null && gaugeValue != Long.MIN_VALUE)
+ if (gaugeValue != null && gaugeValue != Long.MIN_VALUE) {
return System.currentTimeMillis() - gaugeValue;
- else
+ } else {
return Long.MIN_VALUE;
+ }
}
}
@@ -92,10 +93,11 @@ public class ValidationMetrics {
public Double value() {
Long gaugeValue = _gaugeValues.get(key);
- if (gaugeValue != null && gaugeValue != Long.MIN_VALUE)
+ if (gaugeValue != null && gaugeValue != Long.MIN_VALUE) {
return (System.currentTimeMillis() - gaugeValue) / MILLIS_PER_HOUR;
- else
+ } else {
return Double.MIN_VALUE;
+ }
}
}
@@ -125,8 +127,10 @@ public class ValidationMetrics {
}
private final StoredValueGaugeFactory _storedValueGaugeFactory = new StoredValueGaugeFactory();
- private final CurrentTimeMillisDeltaGaugeFactory _currentTimeMillisDeltaGaugeFactory = new CurrentTimeMillisDeltaGaugeFactory();
- private final CurrentTimeMillisDeltaGaugeHoursFactory _currentTimeMillisDeltaGaugeHoursFactory = new CurrentTimeMillisDeltaGaugeHoursFactory();
+ private final CurrentTimeMillisDeltaGaugeFactory _currentTimeMillisDeltaGaugeFactory =
+ new CurrentTimeMillisDeltaGaugeFactory();
+ private final CurrentTimeMillisDeltaGaugeHoursFactory _currentTimeMillisDeltaGaugeHoursFactory =
+ new CurrentTimeMillisDeltaGaugeHoursFactory();
/**
* Builds the validation metrics.
@@ -157,9 +161,11 @@ public class ValidationMetrics {
*/
public void updateOfflineSegmentDelayGauge(final String resource, final long lastOfflineSegmentTime) {
final String fullGaugeName = makeGaugeName(resource, "offlineSegmentDelayMillis");
- makeGauge(fullGaugeName, makeMetricName(fullGaugeName), _currentTimeMillisDeltaGaugeFactory, lastOfflineSegmentTime);
+ makeGauge(fullGaugeName, makeMetricName(fullGaugeName), _currentTimeMillisDeltaGaugeFactory,
+ lastOfflineSegmentTime);
final String fullGaugeNameHours = makeGaugeName(resource, "offlineSegmentDelayHours");
- makeGauge(fullGaugeNameHours, makeMetricName(fullGaugeNameHours), _currentTimeMillisDeltaGaugeHoursFactory, lastOfflineSegmentTime);
+ makeGauge(fullGaugeNameHours, makeMetricName(fullGaugeNameHours), _currentTimeMillisDeltaGaugeHoursFactory,
+ lastOfflineSegmentTime);
}
/**
@@ -173,7 +179,8 @@ public class ValidationMetrics {
final String fullGaugeName = makeGaugeName(resource, "lastPushTimeDelayMillis");
makeGauge(fullGaugeName, makeMetricName(fullGaugeName), _currentTimeMillisDeltaGaugeFactory, lastPushTimeMillis);
final String fullGaugeNameHours = makeGaugeName(resource, "lastPushTimeDelayHours");
- makeGauge(fullGaugeNameHours, makeMetricName(fullGaugeNameHours), _currentTimeMillisDeltaGaugeHoursFactory, lastPushTimeMillis);
+ makeGauge(fullGaugeNameHours, makeMetricName(fullGaugeNameHours), _currentTimeMillisDeltaGaugeHoursFactory,
+ lastPushTimeMillis);
}
/**
@@ -182,8 +189,7 @@ public class ValidationMetrics {
* @param resource The resource for which the gauge is updated
* @param documentCount Total document count for the given resource name or table name
*/
- public void updateTotalDocumentCountGauge(final String resource, final long documentCount)
- {
+ public void updateTotalDocumentCountGauge(final String resource, final long documentCount) {
final String fullGaugeName = makeGaugeName(resource, "TotalDocumentCount");
makeGauge(fullGaugeName, makeMetricName(fullGaugeName), _storedValueGaugeFactory, documentCount);
}
@@ -205,8 +211,7 @@ public class ValidationMetrics {
* @param resource The resource for which the gauge is updated
* @param segmentCount Total segment count for the given resource name or table name
*/
- public void updateSegmentCountGauge(final String resource, final long segmentCount)
- {
+ public void updateSegmentCountGauge(final String resource, final long segmentCount) {
final String fullGaugeName = makeGaugeName(resource, "SegmentCount");
makeGauge(fullGaugeName, makeMetricName(fullGaugeName), _storedValueGaugeFactory, segmentCount);
}
@@ -219,7 +224,8 @@ public class ValidationMetrics {
return new MetricName(ValidationMetrics.class, gaugeName);
}
- private void makeGauge(final String gaugeName, final MetricName metricName, final GaugeFactory<?> gaugeFactory, final long value) {
+ private void makeGauge(final String gaugeName, final MetricName metricName, final GaugeFactory<?> gaugeFactory,
+ final long value) {
if (!_gaugeValues.containsKey(gaugeName)) {
_gaugeValues.put(gaugeName, value);
MetricsHelper.newGauge(_metricsRegistry, metricName, gaugeFactory.buildGauge(gaugeName));
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/partition/PartitionAssignment.java b/pinot-common/src/main/java/org/apache/pinot/common/partition/PartitionAssignment.java
index 690e4eb..1f9522c 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/partition/PartitionAssignment.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/partition/PartitionAssignment.java
@@ -72,7 +72,7 @@ public class PartitionAssignment {
*/
public List<String> getAllInstances() {
Set<String> serverList = new HashSet<>();
- for(List<String> servers: getPartitionToInstances().values()) {
+ for (List<String> servers : getPartitionToInstances().values()) {
serverList.addAll(servers);
}
return new ArrayList<>(serverList);
@@ -96,8 +96,8 @@ public class PartitionAssignment {
PartitionAssignment that = (PartitionAssignment) o;
- return EqualityUtils.isEqual(_tableName, that._tableName) && EqualityUtils.isEqual(_partitionToInstances,
- that._partitionToInstances);
+ return EqualityUtils.isEqual(_tableName, that._tableName) && EqualityUtils
+ .isEqual(_partitionToInstances, that._partitionToInstances);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/partition/ReplicaGroupPartitionAssignment.java b/pinot-common/src/main/java/org/apache/pinot/common/partition/ReplicaGroupPartitionAssignment.java
index 5e69d54..42e695e 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/partition/ReplicaGroupPartitionAssignment.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/partition/ReplicaGroupPartitionAssignment.java
@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
+
/**
* Class to represent a replica group partition assignment
*
@@ -120,5 +121,4 @@ public class ReplicaGroupPartitionAssignment extends PartitionAssignment {
private String createMappingKey(int partition, int replicaGroup) {
return partition + SEPARATOR + replicaGroup;
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/partition/ReplicaGroupPartitionAssignmentGenerator.java b/pinot-common/src/main/java/org/apache/pinot/common/partition/ReplicaGroupPartitionAssignmentGenerator.java
index c7076c8..9dc3631 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/partition/ReplicaGroupPartitionAssignmentGenerator.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/partition/ReplicaGroupPartitionAssignmentGenerator.java
@@ -96,7 +96,8 @@ public class ReplicaGroupPartitionAssignmentGenerator {
// which is equivalent to have the same partition number for all segments (i.e. 1 partition).
int numColumnPartitions = 1;
if (partitionColumn != null) {
- numColumnPartitions = tableConfig.getIndexingConfig().getSegmentPartitionConfig().getNumPartitions(partitionColumn);
+ numColumnPartitions =
+ tableConfig.getIndexingConfig().getSegmentPartitionConfig().getNumPartitions(partitionColumn);
}
int numReplicas = tableConfig.getValidationConfig().getReplicationNumber();
int numServers = servers.size();
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/protocols/SegmentCompletionProtocol.java b/pinot-common/src/main/java/org/apache/pinot/common/protocols/SegmentCompletionProtocol.java
index 6ea75f8..cedc8d6 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/protocols/SegmentCompletionProtocol.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/protocols/SegmentCompletionProtocol.java
@@ -59,7 +59,8 @@ public class SegmentCompletionProtocol {
* it (via a SegmentCommit message) after the server has been notified that it is the committer.
*/
private static final int DEFAULT_MAX_SEGMENT_COMMIT_TIME_SEC = 120;
- private static long MAX_SEGMENT_COMMIT_TIME_MS = TimeUnit.MILLISECONDS.convert(DEFAULT_MAX_SEGMENT_COMMIT_TIME_SEC, TimeUnit.SECONDS);
+ private static long MAX_SEGMENT_COMMIT_TIME_MS =
+ TimeUnit.MILLISECONDS.convert(DEFAULT_MAX_SEGMENT_COMMIT_TIME_SEC, TimeUnit.SECONDS);
public enum ControllerResponseStatus {
/** Never sent by the controller, but locally used by server when sending a request fails */
@@ -121,7 +122,8 @@ public class SegmentCompletionProtocol {
public static final String PARAM_MEMORY_USED_BYTES = "memoryUsedBytes";
public static final String PARAM_SEGMENT_SIZE_BYTES = "segmentSizeBytes";
public static final String PARAM_REASON = "reason";
- public static final String PARAM_EXTRA_TIME_SEC = "extraTimeSec"; // Sent by servers to request additional time to build
+ // Sent by servers to request additional time to build
+ public static final String PARAM_EXTRA_TIME_SEC = "extraTimeSec";
public static final String PARAM_ROW_COUNT = "rowCount"; // Sent by servers to indicate the number of rows read so far
public static final String PARAM_BUILD_TIME_MILLIS = "buildTimeMillis"; // Time taken to build segment
public static final String PARAM_WAIT_TIME_MILLIS = "waitTimeMillis"; // Time taken to wait for build to start.
@@ -130,20 +132,20 @@ public class SegmentCompletionProtocol {
public static final String REASON_TIME_LIMIT = "timeLimit"; // Stop reason sent by server as max time reached
// Canned responses
- public static final Response RESP_NOT_LEADER = new Response(new Response.Params().withStatus(
- ControllerResponseStatus.NOT_LEADER));
- public static final Response RESP_FAILED = new Response(new Response.Params().withStatus(
- ControllerResponseStatus.FAILED));
- public static final Response RESP_DISCARD = new Response(new Response.Params().withStatus(
- ControllerResponseStatus.DISCARD));
- public static final Response RESP_COMMIT_SUCCESS = new Response(new Response.Params().withStatus(
- ControllerResponseStatus.COMMIT_SUCCESS));
- public static final Response RESP_COMMIT_CONTINUE = new Response(new Response.Params().withStatus(
- ControllerResponseStatus.COMMIT_CONTINUE));
- public static final Response RESP_PROCESSED = new Response(new Response.Params().withStatus(
- ControllerResponseStatus.PROCESSED));
- public static final Response RESP_NOT_SENT = new Response(new Response.Params().withStatus(
- ControllerResponseStatus.NOT_SENT));
+ public static final Response RESP_NOT_LEADER =
+ new Response(new Response.Params().withStatus(ControllerResponseStatus.NOT_LEADER));
+ public static final Response RESP_FAILED =
+ new Response(new Response.Params().withStatus(ControllerResponseStatus.FAILED));
+ public static final Response RESP_DISCARD =
+ new Response(new Response.Params().withStatus(ControllerResponseStatus.DISCARD));
+ public static final Response RESP_COMMIT_SUCCESS =
+ new Response(new Response.Params().withStatus(ControllerResponseStatus.COMMIT_SUCCESS));
+ public static final Response RESP_COMMIT_CONTINUE =
+ new Response(new Response.Params().withStatus(ControllerResponseStatus.COMMIT_CONTINUE));
+ public static final Response RESP_PROCESSED =
+ new Response(new Response.Params().withStatus(ControllerResponseStatus.PROCESSED));
+ public static final Response RESP_NOT_SENT =
+ new Response(new Response.Params().withStatus(ControllerResponseStatus.NOT_SENT));
private static final long MEMORY_USED_BYTES_DEFAULT = -1L;
private static final int NUM_ROWS_DEFAULT = -1;
@@ -173,18 +175,17 @@ public class SegmentCompletionProtocol {
}
public String getUrl(String hostPort, String protocol) {
- return protocol + "://" + hostPort + "/" + _msgType + "?" +
- PARAM_SEGMENT_NAME + "=" + _params.getSegmentName() + "&" +
- PARAM_OFFSET + "=" + _params.getOffset() + "&" +
- PARAM_INSTANCE_ID + "=" + _params.getInstanceId() +
- (_params.getReason() == null ? "" : ("&" + PARAM_REASON + "=" + _params.getReason())) +
- (_params.getBuildTimeMillis() <= 0 ? "" :("&" + PARAM_BUILD_TIME_MILLIS + "=" + _params.getBuildTimeMillis())) +
- (_params.getWaitTimeMillis() <= 0 ? "" : ("&" + PARAM_WAIT_TIME_MILLIS + "=" + _params.getWaitTimeMillis())) +
- (_params.getExtraTimeSec() <= 0 ? "" : ("&" + PARAM_EXTRA_TIME_SEC + "=" + _params.getExtraTimeSec())) +
- (_params.getMemoryUsedBytes() <= 0 ? "" : ("&" + PARAM_MEMORY_USED_BYTES + "=" + _params.getMemoryUsedBytes())) +
- (_params.getSegmentSizeBytes() <= 0 ? "" : ("&" + PARAM_SEGMENT_SIZE_BYTES + "=" + _params.getSegmentSizeBytes())) +
- (_params.getNumRows() <= 0 ? "" : ("&" + PARAM_ROW_COUNT + "=" + _params.getNumRows())) +
- (_params.getSegmentLocation() == null ? "" : ("&" + PARAM_SEGMENT_LOCATION + "=" + _params.getSegmentLocation()));
+ return protocol + "://" + hostPort + "/" + _msgType + "?" + PARAM_SEGMENT_NAME + "=" + _params.getSegmentName()
+ + "&" + PARAM_OFFSET + "=" + _params.getOffset() + "&" + PARAM_INSTANCE_ID + "=" + _params.getInstanceId() + (
+ _params.getReason() == null ? "" : ("&" + PARAM_REASON + "=" + _params.getReason())) + (
+ _params.getBuildTimeMillis() <= 0 ? "" : ("&" + PARAM_BUILD_TIME_MILLIS + "=" + _params.getBuildTimeMillis()))
+ + (_params.getWaitTimeMillis() <= 0 ? "" : ("&" + PARAM_WAIT_TIME_MILLIS + "=" + _params.getWaitTimeMillis()))
+ + (_params.getExtraTimeSec() <= 0 ? "" : ("&" + PARAM_EXTRA_TIME_SEC + "=" + _params.getExtraTimeSec())) + (
+ _params.getMemoryUsedBytes() <= 0 ? "" : ("&" + PARAM_MEMORY_USED_BYTES + "=" + _params.getMemoryUsedBytes()))
+ + (_params.getSegmentSizeBytes() <= 0 ? ""
+ : ("&" + PARAM_SEGMENT_SIZE_BYTES + "=" + _params.getSegmentSizeBytes())) + (_params.getNumRows() <= 0 ? ""
+ : ("&" + PARAM_ROW_COUNT + "=" + _params.getNumRows())) + (_params.getSegmentLocation() == null ? ""
+ : ("&" + PARAM_SEGMENT_LOCATION + "=" + _params.getSegmentLocation()));
}
public static class Params {
@@ -222,6 +223,7 @@ public class SegmentCompletionProtocol {
_segmentName = segmentName;
return this;
}
+
public Params withInstanceId(String instanceId) {
_instanceId = instanceId;
return this;
@@ -312,17 +314,10 @@ public class SegmentCompletionProtocol {
}
public String toString() {
- return "Offset: " + _offset
- + ",Segment name: " + _segmentName
- + ",Instance Id: " + _instanceId
- + ",Reason: " + _reason
- + ",NumRows: " + _numRows
- + ",BuildTimeMillis: " + _buildTimeMillis
- + ",WaitTimeMillis: " + _waitTimeMillis
- + ",ExtraTimeSec: " + _extraTimeSec
- + ",SegmentLocation: " + _segmentLocation
- + ",MemoryUsedBytes: " + _memoryUsedBytes
- + ",SegmentSizeBytes: " + _segmentSizeBytes;
+ return "Offset: " + _offset + ",Segment name: " + _segmentName + ",Instance Id: " + _instanceId + ",Reason: "
+ + _reason + ",NumRows: " + _numRows + ",BuildTimeMillis: " + _buildTimeMillis + ",WaitTimeMillis: "
+ + _waitTimeMillis + ",ExtraTimeSec: " + _extraTimeSec + ",SegmentLocation: " + _segmentLocation
+ + ",MemoryUsedBytes: " + _memoryUsedBytes + ",SegmentSizeBytes: " + _segmentSizeBytes;
}
}
}
@@ -517,18 +512,23 @@ public class SegmentCompletionProtocol {
public ControllerResponseStatus getStatus() {
return _status;
}
+
public long getOffset() {
return _offset;
}
+
public long getBuildTimeSeconds() {
return _buildTimeSeconds;
}
+
public boolean isSplitCommit() {
return _splitCommit;
}
+
public String getSegmentLocation() {
return _segmentLocation;
}
+
public String getControllerVipUrl() {
return _controllerVipUrl;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/transform/TransformExpressionTree.java b/pinot-common/src/main/java/org/apache/pinot/common/request/transform/TransformExpressionTree.java
index 3a2d8df..0d2369b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/transform/TransformExpressionTree.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/transform/TransformExpressionTree.java
@@ -174,8 +174,8 @@ public class TransformExpressionTree {
}
if (obj instanceof TransformExpressionTree) {
TransformExpressionTree that = (TransformExpressionTree) obj;
- return _expressionType == that._expressionType && _value.equals(that._value) && Objects.equals(_children,
- that._children);
+ return _expressionType == that._expressionType && _value.equals(that._value) && Objects
+ .equals(_children, that._children);
}
return false;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/response/BrokerResponse.java b/pinot-common/src/main/java/org/apache/pinot/common/response/BrokerResponse.java
index eef7b43..72b95e2 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/response/BrokerResponse.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/response/BrokerResponse.java
@@ -54,7 +54,8 @@ public interface BrokerResponse {
/**
* Convert the broker response to JSON String.
*/
- String toJsonString() throws Exception;
+ String toJsonString()
+ throws Exception;
/**
* Returns the number of servers queried.
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/response/broker/BrokerResponseNative.java b/pinot-common/src/main/java/org/apache/pinot/common/response/broker/BrokerResponseNative.java
index 949e919..94c6d46 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/response/broker/BrokerResponseNative.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/response/broker/BrokerResponseNative.java
@@ -39,10 +39,7 @@ import org.apache.pinot.common.utils.JsonUtils;
*
* Supports serialization via JSON.
*/
-@JsonPropertyOrder({"selectionResults", "aggregationResults", "exceptions", "numServersQueried", "numServersResponded",
- "numSegmentsQueried", "numSegmentsProcessed", "numSegmentsMatched", "numDocsScanned", "numEntriesScannedInFilter",
- "numEntriesScannedPostFilter", "numGroupsLimitReached", "totalDocs", "timeUsedMs", "segmentStatistics",
- "traceInfo"})
+@JsonPropertyOrder({"selectionResults", "aggregationResults", "exceptions", "numServersQueried", "numServersResponded", "numSegmentsQueried", "numSegmentsProcessed", "numSegmentsMatched", "numDocsScanned", "numEntriesScannedInFilter", "numEntriesScannedPostFilter", "numGroupsLimitReached", "totalDocs", "timeUsedMs", "segmentStatistics", "traceInfo"})
public class BrokerResponseNative implements BrokerResponse {
public static final BrokerResponseNative EMPTY_RESULT = BrokerResponseNative.empty();
public static final BrokerResponseNative NO_TABLE_RESULT =
@@ -260,11 +257,13 @@ public class BrokerResponseNative implements BrokerResponse {
}
@Override
- public String toJsonString() throws IOException {
+ public String toJsonString()
+ throws IOException {
return JsonUtils.objectToString(this);
}
- public static BrokerResponseNative fromJsonString(String jsonString) throws IOException {
+ public static BrokerResponseNative fromJsonString(String jsonString)
+ throws IOException {
return JsonUtils.stringToObject(jsonString, BrokerResponseNative.class);
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/response/broker/GroupByResult.java b/pinot-common/src/main/java/org/apache/pinot/common/response/broker/GroupByResult.java
index 3e09e4d..3d7d722 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/response/broker/GroupByResult.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/response/broker/GroupByResult.java
@@ -33,7 +33,6 @@ public class GroupByResult {
public GroupByResult() {
}
-
@JsonProperty("value")
public Serializable getValue() {
return _value;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/RebalanceResult.java b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/RebalanceResult.java
index 29b613d..1d0f268 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/RebalanceResult.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/RebalanceResult.java
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
import org.apache.pinot.common.partition.PartitionAssignment;
+
@JsonIgnoreProperties(ignoreUnknown = true)
public class RebalanceResult {
private Map<String, Map<String, String>> idealStateMapping;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/TableSegments.java b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/TableSegments.java
index 093d9e4..ccda527 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/TableSegments.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/TableSegments.java
@@ -21,6 +21,7 @@ package org.apache.pinot.common.restlet.resources;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
+
public class TableSegments {
List<String> segments;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/segment/ReadMode.java b/pinot-common/src/main/java/org/apache/pinot/common/segment/ReadMode.java
index 147b886..37252eb 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/segment/ReadMode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/segment/ReadMode.java
@@ -22,8 +22,7 @@ import org.apache.pinot.common.utils.CommonConstants;
public enum ReadMode {
- heap,
- mmap;
+ heap, mmap;
public static final ReadMode DEFAULT_MODE = ReadMode.valueOf(CommonConstants.Server.DEFAULT_READ_MODE);
@@ -31,8 +30,8 @@ public enum ReadMode {
if (strVal.equalsIgnoreCase("heap")) {
return heap;
}
- if (strVal.equalsIgnoreCase("mmap") || strVal.equalsIgnoreCase("memorymapped")
- || strVal.equalsIgnoreCase("memorymap")) {
+ if (strVal.equalsIgnoreCase("mmap") || strVal.equalsIgnoreCase("memorymapped") || strVal
+ .equalsIgnoreCase("memorymap")) {
return mmap;
}
throw new IllegalArgumentException("Unknown String Value: " + strVal);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HdfsSegmentFetcher.java b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HdfsSegmentFetcher.java
index 7151b28..aae1340 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HdfsSegmentFetcher.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HdfsSegmentFetcher.java
@@ -80,8 +80,8 @@ public class HdfsSegmentFetcher implements SegmentFetcher {
UserGroupInformation.setConfiguration(hadoopConf);
if (UserGroupInformation.isSecurityEnabled()) {
try {
- if (!UserGroupInformation.getCurrentUser().hasKerberosCredentials()
- || !UserGroupInformation.getCurrentUser().getUserName().equals(principal)) {
+ if (!UserGroupInformation.getCurrentUser().hasKerberosCredentials() || !UserGroupInformation.getCurrentUser()
+ .getUserName().equals(principal)) {
LOGGER.info("Trying to authenticate user [%s] with keytab [%s]..", principal, keytab);
UserGroupInformation.loginUserFromKeytab(principal, keytab);
}
@@ -94,7 +94,8 @@ public class HdfsSegmentFetcher implements SegmentFetcher {
}
@Override
- public void fetchSegmentToLocal(final String uri, final File tempFile) throws Exception {
+ public void fetchSegmentToLocal(final String uri, final File tempFile)
+ throws Exception {
LOGGER.debug("starting to fetch segment from hdfs");
final String dstFilePath = tempFile.getAbsolutePath();
try {
@@ -109,8 +110,9 @@ public class HdfsSegmentFetcher implements SegmentFetcher {
}
long startMs = System.currentTimeMillis();
_hadoopFS.copyToLocalFile(remoteFile, localFile);
- LOGGER.debug("copied {} from hdfs to {} in local for size {}, take {} ms", uri, dstFilePath,
- tempFile.length(), System.currentTimeMillis() - startMs);
+ LOGGER
+ .debug("copied {} from hdfs to {} in local for size {}, take {} ms", uri, dstFilePath, tempFile.length(),
+ System.currentTimeMillis() - startMs);
return true;
} catch (IOException e) {
LOGGER.warn("failed to fetch segment {} from hdfs, might retry", uri, e);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HttpSegmentFetcher.java b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HttpSegmentFetcher.java
index aa801d6..bc8d728 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HttpSegmentFetcher.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HttpSegmentFetcher.java
@@ -54,7 +54,8 @@ public class HttpSegmentFetcher implements SegmentFetcher {
}
@Override
- public void fetchSegmentToLocal(final String uri, final File tempFile) throws Exception {
+ public void fetchSegmentToLocal(final String uri, final File tempFile)
+ throws Exception {
RetryPolicies.exponentialBackoffRetryPolicy(_retryCount, _retryWaitMs, 5).attempt(() -> {
try {
int statusCode = _httpClient.downloadFile(new URI(uri), tempFile);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HttpsSegmentFetcher.java b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HttpsSegmentFetcher.java
index dd2e8c2..0496f63 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HttpsSegmentFetcher.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/HttpsSegmentFetcher.java
@@ -64,9 +64,7 @@ public class HttpsSegmentFetcher extends HttpSegmentFetcher {
@Override
public Set<String> getProtectedConfigKeys() {
- return ClientSSLContextGenerator.getProtectedConfigKeys()
- .stream()
- .map(s -> CommonConstants.PREFIX_OF_SSL_SUBSET + "." + s)
- .collect(Collectors.toSet());
+ return ClientSSLContextGenerator.getProtectedConfigKeys().stream()
+ .map(s -> CommonConstants.PREFIX_OF_SSL_SUBSET + "." + s).collect(Collectors.toSet());
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/LocalFileSegmentFetcher.java b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/LocalFileSegmentFetcher.java
index 9ff1c7e..b3ab6ab 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/LocalFileSegmentFetcher.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/LocalFileSegmentFetcher.java
@@ -36,7 +36,8 @@ public class LocalFileSegmentFetcher implements SegmentFetcher {
}
@Override
- public void fetchSegmentToLocal(String uri, File tempFile) throws Exception {
+ public void fetchSegmentToLocal(String uri, File tempFile)
+ throws Exception {
FileUtils.copyFile(new File(uri), tempFile);
LOGGER.info("Copy file from {} to {}; Length of file: {}", uri, tempFile, tempFile.length());
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/PinotFSSegmentFetcher.java b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/PinotFSSegmentFetcher.java
index c45073d..8b099e9 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/PinotFSSegmentFetcher.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/PinotFSSegmentFetcher.java
@@ -36,7 +36,8 @@ public class PinotFSSegmentFetcher implements SegmentFetcher {
}
@Override
- public void fetchSegmentToLocal(String uriString, File tempFile) throws Exception {
+ public void fetchSegmentToLocal(String uriString, File tempFile)
+ throws Exception {
URI uri = new URI(uriString);
// TODO: move _pinotFS creation to init, however, it needs the right config passed in into init.
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/SegmentFetcher.java b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/SegmentFetcher.java
index 940bb79..c9e3caa 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/SegmentFetcher.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/SegmentFetcher.java
@@ -37,7 +37,8 @@ public interface SegmentFetcher {
* @param tempFile location segment will be stored locally
* @throws Exception
*/
- void fetchSegmentToLocal(String uri, File tempFile) throws Exception;
+ void fetchSegmentToLocal(String uri, File tempFile)
+ throws Exception;
/**
* Returns a list of config keys whose value should not be logged.
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/SegmentFetcherFactory.java b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/SegmentFetcherFactory.java
index c37959d..9a6e805 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/SegmentFetcherFactory.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/segment/fetcher/SegmentFetcherFactory.java
@@ -63,12 +63,13 @@ public class SegmentFetcherFactory {
* @param segmentFetcherClassConfig Segment fetcher factory config
*
*/
- public void init(Configuration segmentFetcherClassConfig) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+ public void init(Configuration segmentFetcherClassConfig)
+ throws ClassNotFoundException, IllegalAccessException, InstantiationException {
@SuppressWarnings("unchecked")
List<String> protocols = segmentFetcherClassConfig.getList(PROTOCOLS_KEY, DEFAULT_PROTOCOLS);
for (String protocol : protocols) {
- String fetcherClass =
- segmentFetcherClassConfig.getString(protocol + FETCHER_CLASS_KEY_SUFFIX, DEFAULT_FETCHER_CLASS_MAP.get(protocol));
+ String fetcherClass = segmentFetcherClassConfig
+ .getString(protocol + FETCHER_CLASS_KEY_SUFFIX, DEFAULT_FETCHER_CLASS_MAP.get(protocol));
Preconditions.checkNotNull(fetcherClass, "No fetcher class defined for protocol: " + protocol);
LOGGER.info("Creating a new segment fetcher for protocol: {} with class: {}", protocol, fetcherClass);
SegmentFetcher segmentFetcher = (SegmentFetcher) Class.forName(fetcherClass).newInstance();
@@ -84,7 +85,8 @@ public class SegmentFetcherFactory {
return _segmentFetcherMap.containsKey(protocol);
}
- public SegmentFetcher getSegmentFetcherBasedOnURI(String uri) throws URISyntaxException {
+ public SegmentFetcher getSegmentFetcherBasedOnURI(String uri)
+ throws URISyntaxException {
String protocol = new URI(uri).getScheme();
return _segmentFetcherMap.get(protocol);
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/ClientSSLContextGenerator.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/ClientSSLContextGenerator.java
index f05517d..365b0c2 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/ClientSSLContextGenerator.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/ClientSSLContextGenerator.java
@@ -69,8 +69,7 @@ public class ClientSSLContextGenerator {
}
_keyStoreFile = sslConfig.getString(CONFIG_OF_CLIENT_PKCS12_FILE);
_keyStorePassword = sslConfig.getString(CONFIG_OF_CLIENT_PKCS12_PASSWORD);
- if ((_keyStorePassword == null && _keyStoreFile != null) ||
- (_keyStorePassword != null && _keyStoreFile == null)) {
+ if ((_keyStorePassword == null && _keyStoreFile != null) || (_keyStorePassword != null && _keyStoreFile == null)) {
throw new IllegalArgumentException("Invalid configuration of keystore file and passowrd");
}
}
@@ -102,7 +101,8 @@ public class ClientSSLContextGenerator {
int i = 0;
while (is.available() > 0) {
X509Certificate cert = (X509Certificate) certificateFactory.generateCertificate(is);
- LOGGER.info("Read certificate serial number {} by issuer {} ", cert.getSerialNumber().toString(16), cert.getIssuerDN().toString());
+ LOGGER.info("Read certificate serial number {} by issuer {} ", cert.getSerialNumber().toString(16),
+ cert.getIssuerDN().toString());
String serverKey = "https-server-" + i;
trustStore.setCertificateEntry(serverKey, cert);
@@ -117,11 +117,13 @@ public class ClientSSLContextGenerator {
// Server verification disabled. Trust all servers
TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
@Override
- public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
+ public void checkClientTrusted(X509Certificate[] x509Certificates, String s)
+ throws CertificateException {
}
@Override
- public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
+ public void checkServerTrusted(X509Certificate[] x509Certificates, String s)
+ throws CertificateException {
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/CommonConstants.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/CommonConstants.java
index b6a8377..0e6f5a5 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/CommonConstants.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/CommonConstants.java
@@ -81,8 +81,7 @@ public class CommonConstants {
}
public enum TableType {
- OFFLINE,
- REALTIME;
+ OFFLINE, REALTIME;
public ServerType getServerType() {
if (this == OFFLINE) {
@@ -101,7 +100,8 @@ public class CommonConstants {
public static final String HELIX_MANAGER_FLAPPING_TIME_WINDOW_KEY = "helixmanager.flappingTimeWindow";
public static final String HELIX_MANAGER_MAX_DISCONNECT_THRESHOLD_KEY = "helixmanager.maxDisconnectThreshold";
public static final String CONFIG_OF_HELIX_FLAPPING_TIMEWINDOW_MS = "pinot.server.flapping.timeWindowMs";
- public static final String CONFIG_OF_HELIX_MAX_DISCONNECT_THRESHOLD = "pinot.server.flapping.maxDisconnectThreshold";
+ public static final String CONFIG_OF_HELIX_MAX_DISCONNECT_THRESHOLD =
+ "pinot.server.flapping.maxDisconnectThreshold";
public static final String DEFAULT_HELIX_FLAPPING_TIMEWINDOW_MS = "1";
public static final String DEFAULT_HELIX_FLAPPING_MAX_DISCONNECT_THRESHOLD = "100";
}
@@ -119,8 +119,9 @@ public class CommonConstants {
// The sleep interval time of the thread used by the Brokers to refresh TimeboundaryInfo upon segment refreshing
// events.
public static final String CONFIG_OF_BROKER_REFRESH_TIMEBOUNDARY_INFO_SLEEP_INTERVAL =
- "pinot.broker.refresh.timeBoundaryInfo.sleepInterval";
+ "pinot.broker.refresh.timeBoundaryInfo.sleepInterval";
public static final long DEFAULT_BROKER_REFRESH_TIMEBOUNDARY_INFO_SLEEP_INTERVAL_MS = 10000L;
+
public static class Request {
public static final String PQL = "pql";
public static final String TRACE = "trace";
@@ -145,7 +146,8 @@ public class CommonConstants {
public static final String CONFIG_OF_REQUEST_HANDLER_FACTORY_CLASS = "pinot.server.requestHandlerFactory.class";
public static final String CONFIG_OF_NETTY_PORT = "pinot.server.netty.port";
public static final String CONFIG_OF_ADMIN_API_PORT = "pinot.server.adminapi.port";
- public static final String CONFIG_OF_STARTER_ENABLE_SEGMENTS_LOADING_CHECK = "pinot.server.starter.enableSegmentsLoadingCheck";
+ public static final String CONFIG_OF_STARTER_ENABLE_SEGMENTS_LOADING_CHECK =
+ "pinot.server.starter.enableSegmentsLoadingCheck";
public static final String CONFIG_OF_STARTER_TIMEOUT_IN_SECONDS = "pinot.server.starter.timeoutInSeconds";
public static final String CONFIG_OF_SEGMENT_FORMAT_VERSION = "pinot.server.instance.segment.format.version";
@@ -153,11 +155,14 @@ public class CommonConstants {
public static final String CONFIG_OF_ENABLE_SHUTDOWN_DELAY = "pinot.server.instance.enable.shutdown.delay";
public static final String CONFIG_OF_ENABLE_SPLIT_COMMIT = "pinot.server.instance.enable.split.commit";
public static final String CONFIG_OF_REALTIME_OFFHEAP_ALLOCATION = "pinot.server.instance.realtime.alloc.offheap";
- public static final String CONFIG_OF_REALTIME_OFFHEAP_DIRECT_ALLOCATION = "pinot.server.instance.realtime.alloc.offheap.direct";
+ public static final String CONFIG_OF_REALTIME_OFFHEAP_DIRECT_ALLOCATION =
+ "pinot.server.instance.realtime.alloc.offheap.direct";
public static final String PREFIX_OF_CONFIG_OF_PINOT_FS_FACTORY = "pinot.server.storage.factory";
public static final String PREFIX_OF_CONFIG_OF_PINOT_CRYPTER = "pinot.server.crypter";
- public static final String CONFIG_OF_INSTANCE_MAX_SHUTDOWN_WAIT_TIME = "pinot.server.instance.starter.maxShutdownWaitTime";
- public static final String CONFIG_OF_INSTANCE_CHECK_INTERVAL_TIME = "pinot.server.instance.starter.checkIntervalTime";
+ public static final String CONFIG_OF_INSTANCE_MAX_SHUTDOWN_WAIT_TIME =
+ "pinot.server.instance.starter.maxShutdownWaitTime";
+ public static final String CONFIG_OF_INSTANCE_CHECK_INTERVAL_TIME =
+ "pinot.server.instance.starter.checkIntervalTime";
public static final int DEFAULT_ADMIN_API_PORT = 8097;
public static final boolean DEFAULT_STARTER_ENABLE_SEGMENTS_LOADING_CHECK = false;
@@ -225,9 +230,9 @@ public class CommonConstants {
public static class Segment {
public static class Realtime {
public enum Status {
- IN_PROGRESS,
- DONE
+ IN_PROGRESS, DONE
}
+
public static final String STATUS = "segment.realtime.status";
}
@@ -266,8 +271,7 @@ public class CommonConstants {
public static final String LOCAL_SEGMENT_SCHEME = "file";
public enum SegmentType {
- OFFLINE,
- REALTIME
+ OFFLINE, REALTIME
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/DataSchema.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/DataSchema.java
index 257f0cf..58f4fc2 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/DataSchema.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/DataSchema.java
@@ -111,7 +111,8 @@ public class DataSchema {
}
@Nonnull
- public byte[] toBytes() throws IOException {
+ public byte[] toBytes()
+ throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
int length = _columnNames.length;
@@ -138,7 +139,8 @@ public class DataSchema {
}
@Nonnull
- public static DataSchema fromBytes(@Nonnull byte[] buffer) throws IOException {
+ public static DataSchema fromBytes(@Nonnull byte[] buffer)
+ throws IOException {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(buffer);
DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
@@ -194,8 +196,8 @@ public class DataSchema {
}
if (anObject instanceof DataSchema) {
DataSchema anotherDataSchema = (DataSchema) anObject;
- return Arrays.equals(_columnNames, anotherDataSchema._columnNames) && Arrays.equals(_columnDataTypes,
- anotherDataSchema._columnDataTypes);
+ return Arrays.equals(_columnNames, anotherDataSchema._columnNames) && Arrays
+ .equals(_columnDataTypes, anotherDataSchema._columnDataTypes);
}
return false;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/DataSize.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/DataSize.java
index af5a54e..9e80324 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/DataSize.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/DataSize.java
@@ -41,6 +41,7 @@ public class DataSize {
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.##");
static final Map<String, Long> MULTIPLIER;
+
static {
MULTIPLIER = new HashMap<>(4);
MULTIPLIER.put("T", 1024L * 1024 * 1024 * 1024L);
@@ -48,7 +49,6 @@ public class DataSize {
MULTIPLIER.put("M", 1024 * 1024L);
MULTIPLIER.put("K", 1024L);
MULTIPLIER.put("B", 1L);
-
}
/**
@@ -62,7 +62,7 @@ public class DataSize {
}
Matcher matcher = STORAGE_VAL_PATTERN.matcher(val);
- if (! matcher.matches()) {
+ if (!matcher.matches()) {
return -1;
}
String number = matcher.group(1);
@@ -78,11 +78,11 @@ public class DataSize {
public static String fromBytes(long bytes) {
if (bytes < MULTIPLIER.get("K")) {
return String.valueOf(bytes) + "B";
- } else if (bytes < MULTIPLIER.get("M")){
+ } else if (bytes < MULTIPLIER.get("M")) {
return DECIMAL_FORMAT.format(((double) bytes) / MULTIPLIER.get("K")) + "KB";
} else if (bytes < MULTIPLIER.get("G")) {
return DECIMAL_FORMAT.format(((double) bytes) / MULTIPLIER.get("M")) + "MB";
- } else if (bytes < MULTIPLIER.get("T")){
+ } else if (bytes < MULTIPLIER.get("T")) {
return DECIMAL_FORMAT.format(((double) bytes) / MULTIPLIER.get("G")) + "GB";
} else {
return DECIMAL_FORMAT.format(((double) bytes) / MULTIPLIER.get("T")) + "TB";
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/DataTable.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/DataTable.java
index e6697e3..1a6c49d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/DataTable.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/DataTable.java
@@ -44,7 +44,8 @@ public interface DataTable {
void addException(@Nonnull ProcessingException processingException);
@Nonnull
- byte[] toBytes() throws IOException;
+ byte[] toBytes()
+ throws IOException;
@Nonnull
Map<String, String> getMetadata();
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/FileUploadDownloadClient.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/FileUploadDownloadClient.java
index 975b088..75017cf 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/FileUploadDownloadClient.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/FileUploadDownloadClient.java
@@ -117,25 +117,30 @@ public class FileUploadDownloadClient implements Closeable {
_httpClient = HttpClients.custom().setSSLContext(sslContext).build();
}
- private static URI getURI(String scheme, String host, int port, String path) throws URISyntaxException {
+ private static URI getURI(String scheme, String host, int port, String path)
+ throws URISyntaxException {
return new URI(scheme, null, host, port, path, null, null);
}
- public static URI getRetrieveTableConfigURI(String host, int port, String tableName) throws URISyntaxException {
+ public static URI getRetrieveTableConfigURI(String host, int port, String tableName)
+ throws URISyntaxException {
String path = TABLES_PATH + SLASH + tableName;
return getURI(HTTP, host, port, path);
}
- public static URI getRetrieveSchemaHttpURI(String host, int port, String tableName) throws URISyntaxException {
+ public static URI getRetrieveSchemaHttpURI(String host, int port, String tableName)
+ throws URISyntaxException {
String path = SCHEMA_PATH + SLASH + tableName;
return getURI(HTTP, host, port, path);
}
- public static URI getUploadSchemaHttpURI(String host, int port) throws URISyntaxException {
+ public static URI getUploadSchemaHttpURI(String host, int port)
+ throws URISyntaxException {
return getURI(HTTP, host, port, SCHEMA_PATH);
}
- public static URI getUploadSchemaHttpsURI(String host, int port) throws URISyntaxException {
+ public static URI getUploadSchemaHttpsURI(String host, int port)
+ throws URISyntaxException {
return getURI(HTTPS, host, port, SCHEMA_PATH);
}
@@ -144,7 +149,8 @@ public class FileUploadDownloadClient implements Closeable {
* getUploadSegmentHttpURI to construct your request.
*/
@Deprecated
- public static URI getOldUploadSegmentHttpURI(String host, int port) throws URISyntaxException {
+ public static URI getOldUploadSegmentHttpURI(String host, int port)
+ throws URISyntaxException {
return getURI(HTTP, host, port, OLD_SEGMENT_PATH);
}
@@ -153,33 +159,36 @@ public class FileUploadDownloadClient implements Closeable {
* getUploadSegmentHttpsURI to construct your request.
*/
@Deprecated
- public static URI getOldUploadSegmentHttpsURI(String host, int port) throws URISyntaxException {
+ public static URI getOldUploadSegmentHttpsURI(String host, int port)
+ throws URISyntaxException {
return getURI(HTTPS, host, port, OLD_SEGMENT_PATH);
}
- public static URI getUploadSegmentHttpURI(String host, int port) throws URISyntaxException {
+ public static URI getUploadSegmentHttpURI(String host, int port)
+ throws URISyntaxException {
return getURI(HTTP, host, port, SEGMENT_PATH);
}
- public static URI getUploadSegmentMetadataHttpURI(String host, int port) throws URISyntaxException {
+ public static URI getUploadSegmentMetadataHttpURI(String host, int port)
+ throws URISyntaxException {
return getURI(HTTP, host, port, SEGMENT_METADATA_PATH);
}
- public static URI getUploadSegmentMetadataHttpsURI(String host, int port) throws URISyntaxException {
+ public static URI getUploadSegmentMetadataHttpsURI(String host, int port)
+ throws URISyntaxException {
return getURI(HTTPS, host, port, SEGMENT_METADATA_PATH);
}
- public static URI getUploadSegmentHttpsURI(String host, int port) throws URISyntaxException {
+ public static URI getUploadSegmentHttpsURI(String host, int port)
+ throws URISyntaxException {
return getURI(HTTPS, host, port, SEGMENT_PATH);
}
private static HttpUriRequest getUploadFileRequest(String method, URI uri, ContentBody contentBody,
@Nullable List<Header> headers, @Nullable List<NameValuePair> parameters, int socketTimeoutMs) {
// Build the Http entity
- HttpEntity entity = MultipartEntityBuilder.create()
- .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
- .addPart(contentBody.getFilename(), contentBody)
- .build();
+ HttpEntity entity = MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
+ .addPart(contentBody.getFilename(), contentBody).build();
// Build the request
RequestBuilder requestBuilder =
@@ -190,8 +199,7 @@ public class FileUploadDownloadClient implements Closeable {
}
private static HttpUriRequest constructGetRequest(URI uri) {
- RequestBuilder requestBuilder = RequestBuilder.get(uri)
- .setVersion(HttpVersion.HTTP_1_1);
+ RequestBuilder requestBuilder = RequestBuilder.get(uri).setVersion(HttpVersion.HTTP_1_1);
setTimeout(requestBuilder, GET_REQUEST_SOCKET_TIMEOUT_MS);
return requestBuilder.build();
}
@@ -226,11 +234,9 @@ public class FileUploadDownloadClient implements Closeable {
private static HttpUriRequest getSendSegmentUriRequest(URI uri, String downloadUri, @Nullable List<Header> headers,
@Nullable List<NameValuePair> parameters, int socketTimeoutMs) {
- RequestBuilder requestBuilder = RequestBuilder.post(uri)
- .setVersion(HttpVersion.HTTP_1_1)
+ RequestBuilder requestBuilder = RequestBuilder.post(uri).setVersion(HttpVersion.HTTP_1_1)
.setHeader(CustomHeaders.UPLOAD_TYPE, FileUploadType.URI.toString())
- .setHeader(CustomHeaders.DOWNLOAD_URI, downloadUri)
- .setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
+ .setHeader(CustomHeaders.DOWNLOAD_URI, downloadUri).setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
addHeadersAndParameters(requestBuilder, headers, parameters);
setTimeout(requestBuilder, socketTimeoutMs);
return requestBuilder.build();
@@ -238,8 +244,7 @@ public class FileUploadDownloadClient implements Closeable {
private static HttpUriRequest getSendSegmentJsonRequest(URI uri, String jsonString, @Nullable List<Header> headers,
@Nullable List<NameValuePair> parameters, int socketTimeoutMs) {
- RequestBuilder requestBuilder = RequestBuilder.post(uri)
- .setVersion(HttpVersion.HTTP_1_1)
+ RequestBuilder requestBuilder = RequestBuilder.post(uri).setVersion(HttpVersion.HTTP_1_1)
.setHeader(CustomHeaders.UPLOAD_TYPE, FileUploadType.JSON.toString())
.setEntity(new StringEntity(jsonString, ContentType.APPLICATION_JSON));
addHeadersAndParameters(requestBuilder, headers, parameters);
@@ -286,7 +291,8 @@ public class FileUploadDownloadClient implements Closeable {
requestBuilder.setConfig(requestConfig);
}
- private SimpleHttpResponse sendRequest(HttpUriRequest request) throws IOException, HttpErrorStatusException {
+ private SimpleHttpResponse sendRequest(HttpUriRequest request)
+ throws IOException, HttpErrorStatusException {
try (CloseableHttpResponse response = _httpClient.execute(request)) {
String controllerHost = null;
String controllerVersion = null;
@@ -295,7 +301,9 @@ public class FileUploadDownloadClient implements Closeable {
controllerVersion = response.getFirstHeader(CommonConstants.Controller.VERSION_HTTP_HEADER).getValue();
}
if (controllerHost != null) {
- LOGGER.info(String.format("Sending request: %s to controller: %s, version: %s", request.getURI(), controllerHost, controllerVersion));
+ LOGGER.info(String
+ .format("Sending request: %s to controller: %s, version: %s", request.getURI(), controllerHost,
+ controllerVersion));
}
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode >= 300) {
@@ -395,12 +403,13 @@ public class FileUploadDownloadClient implements Closeable {
* @throws IOException
* @throws HttpErrorStatusException
*/
- public SimpleHttpResponse uploadSegmentMetadata(URI uri, String segmentName, File segmentMetadataFile, @Nullable List<Header> headers,
- @Nullable List<NameValuePair> parameters, int socketTimeoutMs) throws IOException, HttpErrorStatusException {
- return sendRequest(getUploadSegmentMetadataRequest(uri, segmentName, segmentMetadataFile, headers, parameters, socketTimeoutMs));
+ public SimpleHttpResponse uploadSegmentMetadata(URI uri, String segmentName, File segmentMetadataFile,
+ @Nullable List<Header> headers, @Nullable List<NameValuePair> parameters, int socketTimeoutMs)
+ throws IOException, HttpErrorStatusException {
+ return sendRequest(
+ getUploadSegmentMetadataRequest(uri, segmentName, segmentMetadataFile, headers, parameters, socketTimeoutMs));
}
-
/**
* Upload segment with segment file.
*
@@ -415,7 +424,8 @@ public class FileUploadDownloadClient implements Closeable {
* @throws HttpErrorStatusException
*/
public SimpleHttpResponse uploadSegment(URI uri, String segmentName, File segmentFile, @Nullable List<Header> headers,
- @Nullable List<NameValuePair> parameters, int socketTimeoutMs) throws IOException, HttpErrorStatusException {
+ @Nullable List<NameValuePair> parameters, int socketTimeoutMs)
+ throws IOException, HttpErrorStatusException {
return sendRequest(getUploadSegmentRequest(uri, segmentName, segmentFile, headers, parameters, socketTimeoutMs));
}
@@ -481,7 +491,8 @@ public class FileUploadDownloadClient implements Closeable {
* @throws HttpErrorStatusException
*/
public SimpleHttpResponse sendSegmentUri(URI uri, String downloadUri, @Nullable List<Header> headers,
- @Nullable List<NameValuePair> parameters, int socketTimeoutMs) throws IOException, HttpErrorStatusException {
+ @Nullable List<NameValuePair> parameters, int socketTimeoutMs)
+ throws IOException, HttpErrorStatusException {
return sendRequest(getSendSegmentUriRequest(uri, downloadUri, headers, parameters, socketTimeoutMs));
}
@@ -494,7 +505,8 @@ public class FileUploadDownloadClient implements Closeable {
* @throws IOException
* @throws HttpErrorStatusException
*/
- public SimpleHttpResponse sendSegmentUri(URI uri, String downloadUri) throws IOException, HttpErrorStatusException {
+ public SimpleHttpResponse sendSegmentUri(URI uri, String downloadUri)
+ throws IOException, HttpErrorStatusException {
return sendSegmentUri(uri, downloadUri, null, null, DEFAULT_SOCKET_TIMEOUT_MS);
}
@@ -511,7 +523,8 @@ public class FileUploadDownloadClient implements Closeable {
* @throws HttpErrorStatusException
*/
public SimpleHttpResponse sendSegmentJson(URI uri, String jsonString, @Nullable List<Header> headers,
- @Nullable List<NameValuePair> parameters, int socketTimeoutMs) throws IOException, HttpErrorStatusException {
+ @Nullable List<NameValuePair> parameters, int socketTimeoutMs)
+ throws IOException, HttpErrorStatusException {
return sendRequest(getSendSegmentJsonRequest(uri, jsonString, headers, parameters, socketTimeoutMs));
}
@@ -524,7 +537,8 @@ public class FileUploadDownloadClient implements Closeable {
* @throws IOException
* @throws HttpErrorStatusException
*/
- public SimpleHttpResponse sendSegmentJson(URI uri, String jsonString) throws IOException, HttpErrorStatusException {
+ public SimpleHttpResponse sendSegmentJson(URI uri, String jsonString)
+ throws IOException, HttpErrorStatusException {
return sendSegmentJson(uri, jsonString, null, null, DEFAULT_SOCKET_TIMEOUT_MS);
}
@@ -552,7 +566,8 @@ public class FileUploadDownloadClient implements Closeable {
* @throws IOException
* @throws HttpErrorStatusException
*/
- public int downloadFile(URI uri, int socketTimeoutMs, File dest) throws IOException, HttpErrorStatusException {
+ public int downloadFile(URI uri, int socketTimeoutMs, File dest)
+ throws IOException, HttpErrorStatusException {
HttpUriRequest request = getDownloadFileRequest(uri, socketTimeoutMs);
try (CloseableHttpResponse response = _httpClient.execute(request)) {
StatusLine statusLine = response.getStatusLine();
@@ -571,8 +586,8 @@ public class FileUploadDownloadClient implements Closeable {
long contentLength = entity.getContentLength();
if (contentLength >= 0L) {
long fileLength = dest.length();
- Preconditions.checkState(fileLength == contentLength,
- String.format("While downloading file with uri: %s, file length: %d does not match content length: %d", uri,
+ Preconditions.checkState(fileLength == contentLength, String
+ .format("While downloading file with uri: %s, file length: %d does not match content length: %d", uri,
fileLength, contentLength));
}
@@ -589,12 +604,14 @@ public class FileUploadDownloadClient implements Closeable {
* @throws IOException
* @throws HttpErrorStatusException
*/
- public int downloadFile(URI uri, File dest) throws IOException, HttpErrorStatusException {
+ public int downloadFile(URI uri, File dest)
+ throws IOException, HttpErrorStatusException {
return downloadFile(uri, DEFAULT_SOCKET_TIMEOUT_MS, dest);
}
@Override
- public void close() throws IOException {
+ public void close()
+ throws IOException {
_httpClient.close();
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/FileUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/FileUtils.java
index e94063b..57c6f67 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/FileUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/FileUtils.java
@@ -39,7 +39,8 @@ public class FileUtils {
* @param srcFile
* @param destFile
*/
- public static void moveFileWithOverwrite(File srcFile, File destFile) throws IOException {
+ public static void moveFileWithOverwrite(File srcFile, File destFile)
+ throws IOException {
if (destFile.exists()) {
org.apache.commons.io.FileUtils.deleteQuietly(destFile);
}
@@ -55,7 +56,8 @@ public class FileUtils {
* @param dest Destination file channel
* @throws IOException
*/
- public static void transferBytes(FileChannel src, long position, long count, FileChannel dest) throws IOException {
+ public static void transferBytes(FileChannel src, long position, long count, FileChannel dest)
+ throws IOException {
long numBytesTransferred;
while ((numBytesTransferred = src.transferTo(position, count, dest)) < count) {
position += numBytesTransferred;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/HLCSegmentName.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/HLCSegmentName.java
index 6f14c5e..6c1ba3d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/HLCSegmentName.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/HLCSegmentName.java
@@ -89,8 +89,7 @@ public class HLCSegmentName extends SegmentName {
* @param sequenceNumber
*/
public HLCSegmentName(String groupId, String partitionRange, String sequenceNumber) {
- if (isValidComponentName(groupId) && isValidComponentName(partitionRange) &&
- isValidComponentName(sequenceNumber)) {
+ if (isValidComponentName(groupId) && isValidComponentName(partitionRange) && isValidComponentName(sequenceNumber)) {
_isOldStyleNaming = false;
_groupId = groupId;
_partitionRange = partitionRange;
@@ -99,8 +98,9 @@ public class HLCSegmentName extends SegmentName {
_tableName = _groupId.substring(0, _groupId.indexOf(REALTIME_SUFFIX) + REALTIME_SUFFIX_LENGTH);
_segmentType = RealtimeSegmentType.HLC_SHORT;
} else {
- throw new IllegalArgumentException("Invalid group id (" + groupId + "), partition range (" + partitionRange +
- ") or sequence number (" + sequenceNumber + ")");
+ throw new IllegalArgumentException(
+ "Invalid group id (" + groupId + "), partition range (" + partitionRange + ") or sequence number ("
+ + sequenceNumber + ")");
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/HashUtil.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/HashUtil.java
index 089a632..955ab84 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/HashUtil.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/HashUtil.java
@@ -69,10 +69,9 @@ public class HashUtil {
for (int i = 0; i < length8; i++) {
final int i8 = i * 8;
long k =
- ((long) data[i8 + 0] & 0xff) + (((long) data[i8 + 1] & 0xff) << 8) + (((long) data[i8 + 2] & 0xff) << 16)
- + (((long) data[i8 + 3] & 0xff) << 24) + (((long) data[i8 + 4] & 0xff) << 32)
- + (((long) data[i8 + 5] & 0xff) << 40) + (((long) data[i8 + 6] & 0xff) << 48)
- + (((long) data[i8 + 7] & 0xff) << 56);
+ ((long) data[i8 + 0] & 0xff) + (((long) data[i8 + 1] & 0xff) << 8) + (((long) data[i8 + 2] & 0xff) << 16) + (
+ ((long) data[i8 + 3] & 0xff) << 24) + (((long) data[i8 + 4] & 0xff) << 32) + (((long) data[i8 + 5] & 0xff)
+ << 40) + (((long) data[i8 + 6] & 0xff) << 48) + (((long) data[i8 + 7] & 0xff) << 56);
k *= m;
k ^= k >>> r;
@@ -106,5 +105,4 @@ public class HashUtil {
h ^= h >>> r;
return h;
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/JsonUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/JsonUtils.java
index 7703e30..10abd41 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/JsonUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/JsonUtils.java
@@ -45,53 +45,65 @@ public class JsonUtils {
public static final ObjectWriter DEFAULT_WRITER = DEFAULT_MAPPER.writer();
public static final ObjectWriter DEFAULT_PRETTY_WRITER = DEFAULT_MAPPER.writerWithDefaultPrettyPrinter();
- public static <T> T stringToObject(String jsonString, Class<T> valueType) throws IOException {
+ public static <T> T stringToObject(String jsonString, Class<T> valueType)
+ throws IOException {
return DEFAULT_MAPPER.readValue(jsonString, valueType);
}
- public static JsonNode stringToJsonNode(String jsonString) throws IOException {
+ public static JsonNode stringToJsonNode(String jsonString)
+ throws IOException {
return DEFAULT_READER.readTree(jsonString);
}
- public static <T> T fileToObject(File jsonFile, Class<T> valueType) throws IOException {
+ public static <T> T fileToObject(File jsonFile, Class<T> valueType)
+ throws IOException {
return DEFAULT_MAPPER.readValue(jsonFile, valueType);
}
- public static JsonNode fileToJsonNode(File jsonFile) throws IOException {
+ public static JsonNode fileToJsonNode(File jsonFile)
+ throws IOException {
try (InputStream inputStream = new FileInputStream(jsonFile)) {
return inputStreamToJsonNode(inputStream);
}
}
- public static <T> T inputStreamToObject(InputStream jsonInputStream, Class<T> valueType) throws IOException {
+ public static <T> T inputStreamToObject(InputStream jsonInputStream, Class<T> valueType)
+ throws IOException {
return DEFAULT_MAPPER.readValue(jsonInputStream, valueType);
}
- public static JsonNode inputStreamToJsonNode(InputStream jsonInputStream) throws IOException {
+ public static JsonNode inputStreamToJsonNode(InputStream jsonInputStream)
+ throws IOException {
return DEFAULT_READER.readTree(jsonInputStream);
}
- public static <T> T bytesToObject(byte[] jsonBytes, Class<T> valueType) throws IOException {
+ public static <T> T bytesToObject(byte[] jsonBytes, Class<T> valueType)
+ throws IOException {
return DEFAULT_MAPPER.readValue(jsonBytes, valueType);
}
- public static JsonNode bytesToJsonNode(byte[] jsonBytes) throws IOException {
+ public static JsonNode bytesToJsonNode(byte[] jsonBytes)
+ throws IOException {
return inputStreamToJsonNode(new ByteArrayInputStream(jsonBytes));
}
- public static <T> T jsonNodeToObject(JsonNode jsonNode, Class<T> valueType) throws JsonProcessingException {
+ public static <T> T jsonNodeToObject(JsonNode jsonNode, Class<T> valueType)
+ throws JsonProcessingException {
return DEFAULT_READER.treeToValue(jsonNode, valueType);
}
- public static String objectToString(Object object) throws JsonProcessingException {
+ public static String objectToString(Object object)
+ throws JsonProcessingException {
return DEFAULT_WRITER.writeValueAsString(object);
}
- public static String objectToPrettyString(Object object) throws JsonProcessingException {
+ public static String objectToPrettyString(Object object)
+ throws JsonProcessingException {
return DEFAULT_PRETTY_WRITER.writeValueAsString(object);
}
- public static byte[] objectToBytes(Object object) throws JsonProcessingException {
+ public static byte[] objectToBytes(Object object)
+ throws JsonProcessingException {
return DEFAULT_WRITER.writeValueAsBytes(object);
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/KafkaStarterUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/KafkaStarterUtils.java
index 7a68ede..0b4e6ee 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/KafkaStarterUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/KafkaStarterUtils.java
@@ -136,8 +136,7 @@ public class KafkaStarterUtils {
public static void createTopic(String kafkaTopic, String zkStr, int partitionCount) {
invokeTopicCommand(
new String[]{"--create", "--zookeeper", zkStr, "--replication-factor", "1", "--partitions", Integer.toString(
- partitionCount), "--topic",
- kafkaTopic});
+ partitionCount), "--topic", kafkaTopic});
}
private static void invokeTopicCommand(String[] args) {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/LLCSegmentName.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/LLCSegmentName.java
index fab2e81..3596e26 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/LLCSegmentName.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/LLCSegmentName.java
@@ -97,9 +97,10 @@ public class LLCSegmentName extends SegmentName implements Comparable {
@Override
public int compareTo(Object o) {
- LLCSegmentName other = (LLCSegmentName)o;
+ LLCSegmentName other = (LLCSegmentName) o;
if (!this.getTableName().equals(other.getTableName())) {
- throw new RuntimeException("Cannot compare segment names " + this.getSegmentName() + " and " + other.getSegmentName());
+ throw new RuntimeException(
+ "Cannot compare segment names " + this.getSegmentName() + " and " + other.getSegmentName());
}
if (this.getPartitionId() > other.getPartitionId()) {
return 1;
@@ -113,7 +114,8 @@ public class LLCSegmentName extends SegmentName implements Comparable {
} else {
if (!this.getCreationTime().equals(other.getCreationTime())) {
// If sequence number is the same, time cannot be different.
- throw new RuntimeException("Cannot compare segment names " + this.getSegmentName() + " and " + other.getSegmentName());
+ throw new RuntimeException(
+ "Cannot compare segment names " + this.getSegmentName() + " and " + other.getSegmentName());
}
return 0;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/LLCUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/LLCUtils.java
index b0d3f3d..2189653 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/LLCUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/LLCUtils.java
@@ -24,6 +24,7 @@ import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
+
public class LLCUtils {
/**
* Compute the table of a sorted list of segments grouped by Kafka partition.
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/NamedThreadFactory.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/NamedThreadFactory.java
index c35aed2..dc98a5d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/NamedThreadFactory.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/NamedThreadFactory.java
@@ -81,5 +81,4 @@ public class NamedThreadFactory implements ThreadFactory {
t.setPriority(Thread.NORM_PRIORITY);
return t;
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/NetUtil.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/NetUtil.java
index 0ec49aa..1ca89ae 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/NetUtil.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/NetUtil.java
@@ -30,7 +30,8 @@ public class NetUtil {
/**
* Get the ip address of local host.
*/
- public static String getHostAddress() throws SocketException, UnknownHostException {
+ public static String getHostAddress()
+ throws SocketException, UnknownHostException {
DatagramSocket ds = new DatagramSocket();
ds.connect(InetAddress.getByName(DUMMY_OUT_IP), 80);
InetAddress localAddress = ds.getLocalAddress();
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/Pairs.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/Pairs.java
index c0542d1..c67bca3 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/Pairs.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/Pairs.java
@@ -20,6 +20,7 @@ package org.apache.pinot.common.utils;
import java.util.Comparator;
+
public class Pairs {
public static IntPair intPair(int a, int b) {
@@ -111,16 +112,14 @@ public class Pairs {
}
}
- public static class AscendingNumber2ObjectPairComparator
- implements Comparator<Number2ObjectPair> {
+ public static class AscendingNumber2ObjectPairComparator implements Comparator<Number2ObjectPair> {
@Override
public int compare(Number2ObjectPair o1, Number2ObjectPair o2) {
return new Double(o1.a.doubleValue()).compareTo(new Double(o2.a.doubleValue()));
}
}
- public static class DescendingNumber2ObjectPairComparator
- implements Comparator<Number2ObjectPair> {
+ public static class DescendingNumber2ObjectPairComparator implements Comparator<Number2ObjectPair> {
@Override
public int compare(Number2ObjectPair o1, Number2ObjectPair o2) {
return new Double(o2.a.doubleValue()).compareTo(new Double(o1.a.doubleValue()));
@@ -194,7 +193,7 @@ public class Pairs {
double v2 = o2.getDoubleValue();
if (v1 < v2) {
- return (_descending) ? 1 : -1;
+ return (_descending) ? 1 : -1;
} else if (v1 > v2) {
return (_descending) ? -1 : 1;
} else {
@@ -279,5 +278,4 @@ public class Pairs {
}
}
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/PrimitiveArrayUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/PrimitiveArrayUtils.java
index 0cc6441..a6a0343 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/PrimitiveArrayUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/PrimitiveArrayUtils.java
@@ -32,14 +32,9 @@ public class PrimitiveArrayUtils {
* @return A primitive array
*/
public static Object toPrimitive(Object array) {
- if (array instanceof int[] ||
- array instanceof long[] ||
- array instanceof short[] ||
- array instanceof byte[] ||
- array instanceof char[] ||
- array instanceof float[] ||
- array instanceof double[] ||
- array instanceof boolean[]) {
+ if (array instanceof int[] || array instanceof long[] || array instanceof short[] || array instanceof byte[]
+ || array instanceof char[] || array instanceof float[] || array instanceof double[]
+ || array instanceof boolean[]) {
return array;
} else if (array instanceof Integer[]) {
return ArrayUtils.toPrimitive((Integer[]) array);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/SchemaUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/SchemaUtils.java
index 0ffe588..b0c2016 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/SchemaUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/SchemaUtils.java
@@ -74,7 +74,8 @@ public class SchemaUtils {
* @return schema on success.
* <P><code>null</code> on failure.
*/
- public static @Nullable Schema getSchema(@Nonnull String host, int port, @Nonnull String schemaName) {
+ public static @Nullable
+ Schema getSchema(@Nonnull String host, int port, @Nonnull String schemaName) {
Preconditions.checkNotNull(host);
Preconditions.checkNotNull(schemaName);
@@ -177,8 +178,8 @@ public class SchemaUtils {
Preconditions.checkNotNull(schema1);
Preconditions.checkNotNull(schema2);
- return schema1.getSchemaName().equals(schema2.getSchemaName())
- && schema1.getFieldSpecMap().equals(schema2.getFieldSpecMap());
+ return schema1.getSchemaName().equals(schema2.getSchemaName()) && schema1.getFieldSpecMap()
+ .equals(schema2.getFieldSpecMap());
}
/**
@@ -186,10 +187,8 @@ public class SchemaUtils {
*/
public static void main(String[] args) {
Schema schema = new Schema.SchemaBuilder().setSchemaName("testSchema")
- .addSingleValueDimension("dimension", FieldSpec.DataType.DOUBLE)
- .addMetric("metric", FieldSpec.DataType.INT)
- .addTime("time", TimeUnit.DAYS, FieldSpec.DataType.INT)
- .build();
+ .addSingleValueDimension("dimension", FieldSpec.DataType.DOUBLE).addMetric("metric", FieldSpec.DataType.INT)
+ .addTime("time", TimeUnit.DAYS, FieldSpec.DataType.INT).build();
System.out.println(postSchema("localhost", 8100, schema));
Schema fetchedSchema = getSchema("localhost", 8100, "testSchema");
Preconditions.checkNotNull(fetchedSchema);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/SegmentName.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/SegmentName.java
index 9bd555c..fc35c8d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/SegmentName.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/SegmentName.java
@@ -24,10 +24,7 @@ public abstract class SegmentName {
public static final int REALTIME_SUFFIX_LENGTH = REALTIME_SUFFIX.length();
public enum RealtimeSegmentType {
- UNSUPPORTED,
- HLC_LONG,
- HLC_SHORT,
- LLC,
+ UNSUPPORTED, HLC_LONG, HLC_SHORT, LLC,
}
public static RealtimeSegmentType getSegmentType(String segmentName) {
@@ -82,7 +79,7 @@ public abstract class SegmentName {
return false;
}
- String[] parts = segmentName.split(SEPARATOR);
+ String[] parts = segmentName.split(SEPARATOR);
if (parts.length != 3 && parts.length != 5) {
return false;
}
@@ -95,7 +92,7 @@ public abstract class SegmentName {
return false;
}
- String[] parts = segmentName.split(SEPARATOR);
+ String[] parts = segmentName.split(SEPARATOR);
if (parts.length != 4) {
return false;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/ServiceStatus.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/ServiceStatus.java
index 7d47060..bdd5113 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/ServiceStatus.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/ServiceStatus.java
@@ -117,10 +117,8 @@ public class ServiceStatus {
public String getStatusDescription() {
StringBuilder statusDescription = new StringBuilder();
for (ServiceStatusCallback statusCallback : _statusCallbacks) {
- statusDescription.append(statusCallback.getClass().getSimpleName())
- .append(":")
- .append(statusCallback.getStatusDescription())
- .append(";");
+ statusDescription.append(statusCallback.getClass().getSimpleName()).append(":")
+ .append(statusCallback.getStatusDescription()).append(";");
}
return statusDescription.toString();
}
@@ -150,8 +148,8 @@ public class ServiceStatus {
_resourcesToMonitor = new HashSet<>();
for (String resourceName : _helixAdmin.getResourcesInCluster(_clusterName)) {
// Only monitor table resources and broker resource
- if (!TableNameBuilder.isTableResource(resourceName) && !resourceName.equals(
- CommonConstants.Helix.BROKER_RESOURCE_INSTANCE)) {
+ if (!TableNameBuilder.isTableResource(resourceName) && !resourceName
+ .equals(CommonConstants.Helix.BROKER_RESOURCE_INSTANCE)) {
continue;
}
// Only monitor enabled resources
@@ -206,8 +204,9 @@ public class ServiceStatus {
continue;
}
- String descriptionSuffix = String.format("resource=%s, numResourcesLeft=%d, numTotalResources=%d", resourceName,
- _resourcesToMonitor.size(), _numTotalResourcesToMonitor);
+ String descriptionSuffix = String
+ .format("resource=%s, numResourcesLeft=%d, numTotalResources=%d", resourceName, _resourcesToMonitor.size(),
+ _numTotalResourcesToMonitor);
T helixState = getState(resourceName);
if (helixState == null) {
_statusDescription = "Helix state does not exist: " + descriptionSuffix;
@@ -233,8 +232,8 @@ public class ServiceStatus {
if ("ERROR".equals(currentStateStatus)) {
LOGGER.error(String.format("Resource: %s, partition: %s is in ERROR state", resourceName, partitionName));
} else {
- _statusDescription =
- String.format("partition=%s, idealStateStatus=%s, currentStateStatus=%s, %s", partitionName,
+ _statusDescription = String
+ .format("partition=%s, idealStateStatus=%s, currentStateStatus=%s, %s", partitionName,
idealStateStatus, currentStateStatus, descriptionSuffix);
return Status.STARTING;
}
@@ -265,8 +264,7 @@ public class ServiceStatus {
* external view and current state. This callback considers the ERROR state in the current view to be equivalent to
* the ideal state value.
*/
- public static class IdealStateAndCurrentStateMatchServiceStatusCallback
- extends IdealStateMatchServiceStatusCallback<CurrentState> {
+ public static class IdealStateAndCurrentStateMatchServiceStatusCallback extends IdealStateMatchServiceStatusCallback<CurrentState> {
public IdealStateAndCurrentStateMatchServiceStatusCallback(HelixManager helixManager, String clusterName,
String instanceName) {
super(helixManager, clusterName, instanceName);
@@ -296,8 +294,7 @@ public class ServiceStatus {
* external view and ideal state. This callback considers the ERROR state in the external view to be equivalent to the
* ideal state value.
*/
- public static class IdealStateAndExternalViewMatchServiceStatusCallback
- extends IdealStateMatchServiceStatusCallback<ExternalView> {
+ public static class IdealStateAndExternalViewMatchServiceStatusCallback extends IdealStateMatchServiceStatusCallback<ExternalView> {
public IdealStateAndExternalViewMatchServiceStatusCallback(HelixManager helixManager, String clusterName,
String instanceName) {
super(helixManager, clusterName, instanceName);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/TarGzCompressionUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/TarGzCompressionUtils.java
index 98589b5..c903093 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/TarGzCompressionUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/TarGzCompressionUtils.java
@@ -66,7 +66,8 @@ public class TarGzCompressionUtils {
* @throws IOException
* If anything goes wrong
*/
- public static String createTarGzOfDirectory(String directoryPath, String tarGzPath) throws IOException {
+ public static String createTarGzOfDirectory(String directoryPath, String tarGzPath)
+ throws IOException {
return createTarGzOfDirectory(directoryPath, tarGzPath, "");
}
@@ -75,12 +76,10 @@ public class TarGzCompressionUtils {
if (!tarGzPath.endsWith(TAR_GZ_FILE_EXTENSION)) {
tarGzPath = tarGzPath + TAR_GZ_FILE_EXTENSION;
}
- try (
- FileOutputStream fOut = new FileOutputStream(new File(tarGzPath));
+ try (FileOutputStream fOut = new FileOutputStream(new File(tarGzPath));
BufferedOutputStream bOut = new BufferedOutputStream(fOut);
GzipCompressorOutputStream gzOut = new GzipCompressorOutputStream(bOut);
- TarArchiveOutputStream tOut = new TarArchiveOutputStream(gzOut)
- ) {
+ TarArchiveOutputStream tOut = new TarArchiveOutputStream(gzOut)) {
tOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
addFileToTarGz(tOut, directoryPath, entryPrefix);
} catch (IOException e) {
@@ -90,7 +89,8 @@ public class TarGzCompressionUtils {
return tarGzPath;
}
- public static String createTarGzOfDirectory(String directoryPath) throws IOException {
+ public static String createTarGzOfDirectory(String directoryPath)
+ throws IOException {
String tarGzPath = directoryPath.substring(0);
while (tarGzPath.endsWith("/")) {
tarGzPath = tarGzPath.substring(0, tarGzPath.length() - 1);
@@ -114,7 +114,8 @@ public class TarGzCompressionUtils {
* @throws IOException
* If anything goes wrong
*/
- private static void addFileToTarGz(TarArchiveOutputStream tOut, String path, String base) throws IOException {
+ private static void addFileToTarGz(TarArchiveOutputStream tOut, String path, String base)
+ throws IOException {
File f = new File(path);
String entryName = base + f.getName();
TarArchiveEntry tarEntry = new TarArchiveEntry(f, entryName);
@@ -140,7 +141,6 @@ public class TarGzCompressionUtils {
}
/** Untar an input file into an output file.
-
* The output file is created in the output folder, having the same name
* as the input file, minus the '.tar' extension.
*
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/TenantRole.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/TenantRole.java
index 21a2911..116bbdb 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/TenantRole.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/TenantRole.java
@@ -19,6 +19,5 @@
package org.apache.pinot.common.utils;
public enum TenantRole {
- SERVER,
- BROKER
+ SERVER, BROKER
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/ZkStarter.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/ZkStarter.java
index 059c848..a9489f8 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/ZkStarter.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/ZkStarter.java
@@ -50,12 +50,14 @@ public class ZkStarter {
*/
static class PublicZooKeeperServerMain extends ZooKeeperServerMain {
@Override
- public void initializeAndRun(String[] args) throws QuorumPeerConfig.ConfigException, IOException {
+ public void initializeAndRun(String[] args)
+ throws QuorumPeerConfig.ConfigException, IOException {
super.initializeAndRun(args);
}
@Override
- public void runFromConfig(final ServerConfig config) throws IOException {
+ public void runFromConfig(final ServerConfig config)
+ throws IOException {
ServerConfig newServerConfig = new ServerConfig() {
public void parse(String[] args) {
@@ -142,7 +144,7 @@ public class ZkStarter {
// Start the local ZK server
try {
final PublicZooKeeperServerMain zookeeperServerMain = new PublicZooKeeperServerMain();
- final String[] args = new String[] { Integer.toString(port), dataDirPath };
+ final String[] args = new String[]{Integer.toString(port), dataDirPath};
new Thread() {
@Override
public void run() {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java
index ac0e754..fdf2deb 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java
@@ -280,8 +280,8 @@ public class HelixHelper {
// Removing partitions from ideal state
LOGGER.info("Trying to remove resource {} from idealstate", resourceTag);
- HelixHelper.updateIdealState(helixManager, CommonConstants.Helix.BROKER_RESOURCE_INSTANCE, updater,
- DEFAULT_RETRY_POLICY);
+ HelixHelper
+ .updateIdealState(helixManager, CommonConstants.Helix.BROKER_RESOURCE_INSTANCE, updater, DEFAULT_RETRY_POLICY);
}
/**
@@ -468,10 +468,10 @@ public class HelixHelper {
*/
public static Set<String> getServerInstancesForTenant(List<InstanceConfig> instanceConfigs, String tenant) {
Set<String> serverInstances = new HashSet<>();
- serverInstances.addAll(
- HelixHelper.getInstancesWithTag(instanceConfigs, TagNameUtils.getOfflineTagForTenant(tenant)));
- serverInstances.addAll(
- HelixHelper.getInstancesWithTag(instanceConfigs, TagNameUtils.getRealtimeTagForTenant(tenant)));
+ serverInstances
+ .addAll(HelixHelper.getInstancesWithTag(instanceConfigs, TagNameUtils.getOfflineTagForTenant(tenant)));
+ serverInstances
+ .addAll(HelixHelper.getInstancesWithTag(instanceConfigs, TagNameUtils.getRealtimeTagForTenant(tenant)));
return serverInstances;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/PinotHelixPropertyStoreZnRecordProvider.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/PinotHelixPropertyStoreZnRecordProvider.java
index 718393a..98466c2 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/PinotHelixPropertyStoreZnRecordProvider.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/PinotHelixPropertyStoreZnRecordProvider.java
@@ -33,7 +33,8 @@ public class PinotHelixPropertyStoreZnRecordProvider {
this.propertyStore = null;
}
- private PinotHelixPropertyStoreZnRecordProvider(ZkHelixPropertyStore<ZNRecord> propertyStore, String relativePathName) {
+ private PinotHelixPropertyStoreZnRecordProvider(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ String relativePathName) {
this.propertyStore = propertyStore;
this.pathPrefix = relativePathName;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/request/HavingQueryTree.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/request/HavingQueryTree.java
index 7d953b1..dca93a0 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/request/HavingQueryTree.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/request/HavingQueryTree.java
@@ -58,14 +58,9 @@ public class HavingQueryTree extends QueryTree {
if (_operator == FilterOperator.OR || _operator == FilterOperator.AND) {
stringBuffer.append(_operator);
} else {
- stringBuffer.append(_aggregationInfo.getAggregationType())
- .append("(")
- .append(_aggregationInfo.getAggregationParams().toString())
- .append(")")
- .append(" ")
- .append(_operator)
- .append(" ")
- .append(_value);
+ stringBuffer.append(_aggregationInfo.getAggregationType()).append("(")
+ .append(_aggregationInfo.getAggregationParams().toString()).append(")").append(" ").append(_operator)
+ .append(" ").append(_value);
}
if (_children != null) {
for (QueryTree child : _children) {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/retry/BaseRetryPolicy.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/retry/BaseRetryPolicy.java
index ce10c1c..ad2c208 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/retry/BaseRetryPolicy.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/retry/BaseRetryPolicy.java
@@ -42,7 +42,8 @@ public abstract class BaseRetryPolicy implements RetryPolicy {
protected abstract long getDelayMs(int currentAttempt);
@Override
- public void attempt(Callable<Boolean> operation) throws AttemptsExceededException, RetriableOperationException {
+ public void attempt(Callable<Boolean> operation)
+ throws AttemptsExceededException, RetriableOperationException {
int attempt = 0;
while (attempt < _maxNumAttempts) {
try {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/retry/RetryPolicy.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/retry/RetryPolicy.java
index 4ded2ed..373ce54 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/retry/RetryPolicy.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/retry/RetryPolicy.java
@@ -34,5 +34,6 @@ public interface RetryPolicy {
* @throws AttemptsExceededException
* @throws RetriableOperationException
*/
- void attempt(Callable<Boolean> operation) throws AttemptsExceededException, RetriableOperationException;
+ void attempt(Callable<Boolean> operation)
+ throws AttemptsExceededException, RetriableOperationException;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/time/TimeConverter.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/time/TimeConverter.java
index 6b3ed3c..f8d370d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/time/TimeConverter.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/time/TimeConverter.java
@@ -30,9 +30,9 @@ public class TimeConverter {
private final TimeGranularitySpec _timeGranularitySpec;
public TimeConverter(TimeGranularitySpec timeGranularitySpec) {
- Preconditions.checkArgument(
- timeGranularitySpec.getTimeFormat().equals(TimeGranularitySpec.TimeFormat.EPOCH.toString()),
- "Cannot perform time conversion for time format other than EPOCH");
+ Preconditions
+ .checkArgument(timeGranularitySpec.getTimeFormat().equals(TimeGranularitySpec.TimeFormat.EPOCH.toString()),
+ "Cannot perform time conversion for time format other than EPOCH");
_timeGranularitySpec = timeGranularitySpec;
}
@@ -47,8 +47,8 @@ public class TimeConverter {
}
public Object fromMillisSinceEpoch(long value) {
- long duration = _timeGranularitySpec.getTimeType().convert(value, TimeUnit.MILLISECONDS)
- / _timeGranularitySpec.getTimeUnitSize();
+ long duration = _timeGranularitySpec.getTimeType().convert(value, TimeUnit.MILLISECONDS) / _timeGranularitySpec
+ .getTimeUnitSize();
switch (_timeGranularitySpec.getDataType()) {
case INT:
return (int) duration;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/time/TimeUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/time/TimeUtils.java
index a88923f..76eb66b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/time/TimeUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/time/TimeUtils.java
@@ -32,10 +32,8 @@ import org.joda.time.format.PeriodFormatterBuilder;
public class TimeUtils {
private static final Map<String, TimeUnit> TIME_UNIT_MAP = new HashMap<>();
- private static final long VALID_MIN_TIME_MILLIS =
- new DateTime(1971, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC).getMillis();
- private static final long VALID_MAX_TIME_MILLIS =
- new DateTime(2071, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC).getMillis();
+ private static final long VALID_MIN_TIME_MILLIS = new DateTime(1971, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC).getMillis();
+ private static final long VALID_MAX_TIME_MILLIS = new DateTime(2071, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC).getMillis();
static {
for (TimeUnit timeUnit : TimeUnit.values()) {
@@ -96,12 +94,9 @@ public class TimeUtils {
return VALID_MAX_TIME_MILLIS;
}
- private static final PeriodFormatter PERIOD_FORMATTER = new PeriodFormatterBuilder()
- .appendDays().appendSuffix("d")
- .appendHours().appendSuffix("h")
- .appendMinutes().appendSuffix("m")
- .appendSeconds().appendSuffix("s")
- .toFormatter();
+ private static final PeriodFormatter PERIOD_FORMATTER =
+ new PeriodFormatterBuilder().appendDays().appendSuffix("d").appendHours().appendSuffix("h").appendMinutes()
+ .appendSuffix("m").appendSeconds().appendSuffix("s").toFormatter();
/**
* Converts a string representing a period/duration to corresponding milliseconds.
@@ -133,7 +128,7 @@ public class TimeUtils {
* @param millis the value in milliseconds to be converted
* @return the corresponding human readable string or empty string if value cannot be converted
*/
- public static String convertMillisToPeriod(Long millis) {
+ public static String convertMillisToPeriod(Long millis) {
String periodStr = null;
if (millis != null) {
Period p = new Period(new Duration(millis));
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/webhdfs/WebHdfsV1Client.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/webhdfs/WebHdfsV1Client.java
index c9ace03..3e4dfd9 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/webhdfs/WebHdfsV1Client.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/webhdfs/WebHdfsV1Client.java
@@ -38,7 +38,8 @@ public class WebHdfsV1Client {
private static final int DEFAULT_PERMISSION = 755;
//Web hdfs upload path template has 6 parameters: protocol/host/port/hdfs_path/overwrite/permission
- private static final String WEB_HDFS_UPLOAD_PATH_TEMPLATE = "%s://%s:%s/webhdfs/v1%s?op=CREATE&overwrite=%s&permission=%s";
+ private static final String WEB_HDFS_UPLOAD_PATH_TEMPLATE =
+ "%s://%s:%s/webhdfs/v1%s?op=CREATE&overwrite=%s&permission=%s";
//Web hdfs download path template has 4 parameters: protocol/host/port/hdfs_path
private static final String WEB_HDFS_DOWNLOAD_PATH_TEMPLATE = "%s://%s:%s/webhdfs/v1%s?op=OPEN";
@@ -68,20 +69,21 @@ public class WebHdfsV1Client {
public synchronized boolean uploadSegment(String webHdfsPath, String localFilePath) {
// Step 1: Submit a HTTP PUT request without automatically following
// redirects and without sending the file data.
- String firstPutReqString = String.format(WEB_HDFS_UPLOAD_PATH_TEMPLATE, _protocol, _host, _port, webHdfsPath, _overwrite, _permission);
+ String firstPutReqString =
+ String.format(WEB_HDFS_UPLOAD_PATH_TEMPLATE, _protocol, _host, _port, webHdfsPath, _overwrite, _permission);
HttpMethod firstPutReq = new PutMethod(firstPutReqString);
try {
LOGGER.info("Trying to send request: {}.", firstPutReqString);
int firstResponseCode = _httpClient.executeMethod(firstPutReq);
if (firstResponseCode != 307) {
- LOGGER.error(String.format(
- "Failed to execute the first PUT request to upload segment to webhdfs: %s. "
- + "Expected response code 307, but get %s. Response body: %s",
- firstPutReqString, firstResponseCode, firstPutReq.getResponseBodyAsString()));
+ LOGGER.error(String.format("Failed to execute the first PUT request to upload segment to webhdfs: %s. "
+ + "Expected response code 307, but get %s. Response body: %s", firstPutReqString, firstResponseCode,
+ firstPutReq.getResponseBodyAsString()));
return false;
}
} catch (Exception e) {
- LOGGER.error(String.format("Failed to execute the first request to upload segment to webhdfs: %s.", firstPutReqString), e);
+ LOGGER.error(
+ String.format("Failed to execute the first request to upload segment to webhdfs: %s.", firstPutReqString), e);
return false;
} finally {
firstPutReq.releaseConnection();
@@ -98,14 +100,15 @@ public class WebHdfsV1Client {
LOGGER.info("Trying to send request: {}.", redirectedReqString);
int redirectedResponseCode = _httpClient.executeMethod(redirectedReq);
if (redirectedResponseCode != 201) {
- LOGGER.error(String.format(
- "Failed to execute the redirected PUT request to upload segment to webhdfs: %s. "
- + "Expected response code 201, but get %s. Response: %s",
- redirectedReqString, redirectedResponseCode, redirectedReq.getResponseBodyAsString()));
+ LOGGER.error(String.format("Failed to execute the redirected PUT request to upload segment to webhdfs: %s. "
+ + "Expected response code 201, but get %s. Response: %s", redirectedReqString, redirectedResponseCode,
+ redirectedReq.getResponseBodyAsString()));
}
return true;
} catch (IOException e) {
- LOGGER.error(String.format("Failed to execute the redirected request to upload segment to webhdfs: %s.", redirectedReqString), e);
+ LOGGER.error(String
+ .format("Failed to execute the redirected request to upload segment to webhdfs: %s.", redirectedReqString),
+ e);
return false;
} finally {
redirectedReq.releaseConnection();
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/AbstractCompiler.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/AbstractCompiler.java
index a14f907..1bfe53e 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/AbstractCompiler.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/AbstractCompiler.java
@@ -21,10 +21,12 @@ package org.apache.pinot.pql.parsers;
import org.apache.pinot.common.request.BrokerRequest;
import org.apache.pinot.common.request.transform.TransformExpressionTree;
+
/**
* Interface for PQL compilers.
*/
public interface AbstractCompiler {
BrokerRequest compileToBrokerRequest(String expression);
+
TransformExpressionTree compileToExpressionTree(String expression);
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/Pql2Compiler.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/Pql2Compiler.java
index 5b182f7..8a6250a 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/Pql2Compiler.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/Pql2Compiler.java
@@ -75,7 +75,8 @@ public class Pql2Compiler implements AbstractCompiler {
* @throws Pql2CompilationException
*/
@Override
- public BrokerRequest compileToBrokerRequest(String expression) throws Pql2CompilationException {
+ public BrokerRequest compileToBrokerRequest(String expression)
+ throws Pql2CompilationException {
try {
//
CharStream charStream = new ANTLRInputStream(expression);
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BaseAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BaseAstNode.java
index 522f5eb..1a8a703 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BaseAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BaseAstNode.java
@@ -83,7 +83,7 @@ public abstract class BaseAstNode implements AstNode {
@Override
public String toString(int indent) {
String str = "";
- for(int i = 0; i < indent; ++i) {
+ for (int i = 0; i < indent; ++i) {
str += " ";
}
str += toString();
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BetweenPredicateAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BetweenPredicateAstNode.java
index 77e820cb..214ef30 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BetweenPredicateAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BetweenPredicateAstNode.java
@@ -74,8 +74,8 @@ public class BetweenPredicateAstNode extends PredicateAstNode {
FilterOperator.RANGE, null);
} catch (ClassCastException e) {
throw new Pql2CompilationException(
- "BETWEEN clause was expecting two literal AST nodes, got " + getChildren().get(0) + " and "
- + getChildren().get(1));
+ "BETWEEN clause was expecting two literal AST nodes, got " + getChildren().get(0) + " and " + getChildren()
+ .get(1));
}
} else {
throw new Pql2CompilationException("BETWEEN clause does not have two children nodes");
@@ -96,8 +96,8 @@ public class BetweenPredicateAstNode extends PredicateAstNode {
FilterOperator.RANGE, null);
} catch (ClassCastException e) {
throw new Pql2CompilationException(
- "BETWEEN clause was expecting two literal AST nodes, got " + getChildren().get(0) + " and "
- + getChildren().get(1));
+ "BETWEEN clause was expecting two literal AST nodes, got " + getChildren().get(0) + " and " + getChildren()
+ .get(1));
}
} else {
throw new Pql2CompilationException("BETWEEN clause does not have two children nodes");
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BooleanOperatorAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BooleanOperatorAstNode.java
index 0d406a2..74d41d0 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BooleanOperatorAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/BooleanOperatorAstNode.java
@@ -26,8 +26,7 @@ import org.apache.pinot.common.request.BrokerRequest;
* AST node for boolean operators (AND, OR). There are an enum so that we can reuse them, as they have no state.
*/
public enum BooleanOperatorAstNode implements AstNode {
- AND,
- OR;
+ AND, OR;
@Override
public List<? extends AstNode> getChildren() {
@@ -75,7 +74,7 @@ public enum BooleanOperatorAstNode implements AstNode {
@Override
public String toString(int indent) {
String str = "";
- for(int i = 0; i < indent; ++i) {
+ for (int i = 0; i < indent; ++i) {
str += " ";
}
str += toString();
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/ComparisonPredicateAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/ComparisonPredicateAstNode.java
index e5dac8d..4719d3b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/ComparisonPredicateAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/ComparisonPredicateAstNode.java
@@ -77,9 +77,7 @@ public class ComparisonPredicateAstNode extends PredicateAstNode {
@Override
public String toString() {
- return "ComparisonPredicateAstNode{" +
- "_operand='" + _operand + '\'' +
- '}';
+ return "ComparisonPredicateAstNode{" + "_operand='" + _operand + '\'' + '}';
}
/**
@@ -150,8 +148,7 @@ public class ComparisonPredicateAstNode extends PredicateAstNode {
}
if (_identifier != null) {
- return new FilterQueryTree(_identifier, Collections.singletonList(comparison), FilterOperator.RANGE,
- null);
+ return new FilterQueryTree(_identifier, Collections.singletonList(comparison), FilterOperator.RANGE, null);
} else {
throw new Pql2CompilationException("One column is needed for comparison.");
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/HavingAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/HavingAstNode.java
index a0b2dc9..573caf0 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/HavingAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/HavingAstNode.java
@@ -31,5 +31,4 @@ public class HavingAstNode extends BaseAstNode {
PredicateAstNode predicateAstNode = (PredicateAstNode) getChildren().get(0);
RequestUtils.generateFilterFromTree(predicateAstNode.buildHavingQueryTree(), brokerRequest);
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/IdentifierAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/IdentifierAstNode.java
index 1a0a090..e5bfea2 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/IdentifierAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/IdentifierAstNode.java
@@ -27,11 +27,8 @@ public class IdentifierAstNode extends BaseAstNode {
public IdentifierAstNode(String expression) {
_expression = expression;
- if (
- expression.charAt(0) == '`'
- && expression.charAt(expression.length()-1) == '`'
- ) {
- _name = expression.substring(1, expression.length()-1);
+ if (expression.charAt(0) == '`' && expression.charAt(expression.length() - 1) == '`') {
+ _name = expression.substring(1, expression.length() - 1);
} else {
_name = expression;
}
@@ -47,8 +44,6 @@ public class IdentifierAstNode extends BaseAstNode {
@Override
public String toString() {
- return "IdentifierAstNode{" +
- "_name='" + _name + '\'' +
- '}';
+ return "IdentifierAstNode{" + "_name='" + _name + '\'' + '}';
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/LimitAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/LimitAstNode.java
index 22fdb5e..9a78047 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/LimitAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/LimitAstNode.java
@@ -45,9 +45,6 @@ public class LimitAstNode extends BaseAstNode {
@Override
public String toString() {
- return "LimitAstNode{" +
- "_count=" + _count +
- ", _offset=" + _offset +
- '}';
+ return "LimitAstNode{" + "_count=" + _count + ", _offset=" + _offset + '}';
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/PredicateAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/PredicateAstNode.java
index 3907d19..d501467 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/PredicateAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/PredicateAstNode.java
@@ -21,6 +21,7 @@ package org.apache.pinot.pql.parsers.pql2.ast;
import org.apache.pinot.common.utils.request.FilterQueryTree;
import org.apache.pinot.common.utils.request.HavingQueryTree;
+
/**
* Common interface and implementation for predicate AST nodes.
*/
@@ -72,5 +73,4 @@ public abstract class PredicateAstNode extends BaseAstNode {
public String getIdentifier() {
return _identifier;
}
-
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/RegexpLikePredicateAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/RegexpLikePredicateAstNode.java
index bd481e1..6917da1 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/RegexpLikePredicateAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/RegexpLikePredicateAstNode.java
@@ -28,6 +28,7 @@ import org.apache.pinot.common.utils.request.FilterQueryTree;
import org.apache.pinot.common.utils.request.HavingQueryTree;
import org.apache.pinot.pql.parsers.Pql2CompilationException;
+
public class RegexpLikePredicateAstNode extends PredicateAstNode {
private static final String SEPERATOR = "\t\t";
private String _identifier;
@@ -43,8 +44,7 @@ public class RegexpLikePredicateAstNode extends PredicateAstNode {
}
} else if (childNode instanceof FunctionCallAstNode) {
throw new Pql2CompilationException("REGEXP_LIKE operator can not be called for a function.");
- }
- else {
+ } else {
super.addChild(childNode);
}
}
@@ -64,7 +64,7 @@ public class RegexpLikePredicateAstNode extends PredicateAstNode {
values.add(expr);
}
}
- if(values.size() > 1) {
+ if (values.size() > 1) {
throw new Pql2CompilationException("Matching more than one regex is NOT supported currently");
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/SelectAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/SelectAstNode.java
index 001920e..c03cd7b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/SelectAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/SelectAstNode.java
@@ -104,12 +104,8 @@ public class SelectAstNode extends BaseAstNode {
@Override
public String toString() {
- return "SelectAstNode{" +
- "_tableName='" + _tableName + '\'' +
- ", _resourceName='" + _resourceName + '\'' +
- ", _recordLimit=" + _recordLimit +
- ", _offset=" + _offset +
- '}';
+ return "SelectAstNode{" + "_tableName='" + _tableName + '\'' + ", _resourceName='" + _resourceName + '\''
+ + ", _recordLimit=" + _recordLimit + ", _offset=" + _offset + '}';
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/StarColumnListAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/StarColumnListAstNode.java
index 61142a0..144f636 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/StarColumnListAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/StarColumnListAstNode.java
@@ -34,6 +34,6 @@ public class StarColumnListAstNode extends BaseAstNode {
List<String> modifiableList = new ArrayList<>(1);
modifiableList.add("*");
selection.setSelectionColumns(modifiableList);
- brokerRequest.setSelections(selection);
+ brokerRequest.setSelections(selection);
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/TableNameAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/TableNameAstNode.java
index 203b648..82af195 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/TableNameAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/TableNameAstNode.java
@@ -26,8 +26,8 @@ public class TableNameAstNode extends BaseAstNode {
private String _resourceName;
public TableNameAstNode(String tableName) {
- if ((tableName.startsWith("'") && tableName.endsWith("'")) ||
- (tableName.startsWith("\"") && tableName.endsWith("\""))) {
+ if ((tableName.startsWith("'") && tableName.endsWith("'")) || (tableName.startsWith("\"") && tableName
+ .endsWith("\""))) {
tableName = tableName.substring(1, tableName.length() - 1);
}
int firstDotIndex = tableName.indexOf('.');
diff --git a/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllConfig.java b/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllConfig.java
index e5ce705..20dd2c9 100644
--- a/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllConfig.java
@@ -146,11 +146,13 @@ public class HllConfig {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
- public String toJsonString() throws Exception {
+ public String toJsonString()
+ throws Exception {
return JsonUtils.objectToPrettyString(this);
}
- public static HllConfig fromJsonString(String jsonString) throws IOException {
+ public static HllConfig fromJsonString(String jsonString)
+ throws IOException {
return JsonUtils.stringToObject(jsonString, HllConfig.class);
}
@@ -166,11 +168,10 @@ public class HllConfig {
HllConfig hllConfig = (HllConfig) o;
- return isEqual(hllLog2m, hllConfig.hllLog2m) &&
- isEqual(hllFieldSize, hllConfig.hllFieldSize) &&
- isEqual(hllDeriveColumnSuffix, hllConfig.hllDeriveColumnSuffix) &&
- isEqual(columnsToDeriveHllFields, hllConfig.columnsToDeriveHllFields) &&
- isEqual(derivedHllFieldToOriginMap, hllConfig.derivedHllFieldToOriginMap);
+ return isEqual(hllLog2m, hllConfig.hllLog2m) && isEqual(hllFieldSize, hllConfig.hllFieldSize) && isEqual(
+ hllDeriveColumnSuffix, hllConfig.hllDeriveColumnSuffix) && isEqual(columnsToDeriveHllFields,
+ hllConfig.columnsToDeriveHllFields) && isEqual(derivedHllFieldToOriginMap,
+ hllConfig.derivedHllFieldToOriginMap);
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllConstants.java b/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllConstants.java
index 73951be..4300795 100644
--- a/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllConstants.java
+++ b/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllConstants.java
@@ -19,6 +19,6 @@
package org.apache.pinot.startree.hll;
public class HllConstants {
- public static final int DEFAULT_LOG2M = 8;
- public static final String DEFAULT_HLL_DERIVE_COLUMN_SUFFIX = "_hll";
+ public static final int DEFAULT_LOG2M = 8;
+ public static final String DEFAULT_HLL_DERIVE_COLUMN_SUFFIX = "_hll";
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllSizeUtils.java b/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllSizeUtils.java
index 7133169..065948b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllSizeUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/startree/hll/HllSizeUtils.java
@@ -35,8 +35,8 @@ public class HllSizeUtils {
}
public static int getHllFieldSizeFromLog2m(int log2m) {
- Preconditions.checkArgument(LOG2M_TO_SIZE_IN_BYTES.containsKey(log2m),
- "Log2m: " + log2m + " is not in valid range.");
+ Preconditions
+ .checkArgument(LOG2M_TO_SIZE_IN_BYTES.containsKey(log2m), "Log2m: " + log2m + " is not in valid range.");
return LOG2M_TO_SIZE_IN_BYTES.get(log2m);
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/config/IndexingConfigTest.java b/pinot-common/src/test/java/org/apache/pinot/common/config/IndexingConfigTest.java
index d486f96..e3d31d5 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/config/IndexingConfigTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/config/IndexingConfigTest.java
@@ -37,7 +37,8 @@ import static org.testng.Assert.assertTrue;
public class IndexingConfigTest {
@Test
- public void testSerDe() throws IOException {
+ public void testSerDe()
+ throws IOException {
IndexingConfig indexingConfig = new IndexingConfig();
indexingConfig.setLoadMode("MMAP");
indexingConfig.setAggregateMetrics(true);
@@ -66,7 +67,8 @@ public class IndexingConfigTest {
}
@Test
- public void testSegmentPartitionConfig() throws IOException {
+ public void testSegmentPartitionConfig()
+ throws IOException {
int numColumns = 5;
Map<String, ColumnPartitionConfig> expectedColumnPartitionMap = new HashMap<>(5);
for (int i = 0; i < numColumns; i++) {
@@ -99,7 +101,8 @@ public class IndexingConfigTest {
* </ul>
*/
@Test
- public void testStarTreeSpec() throws IOException {
+ public void testStarTreeSpec()
+ throws IOException {
Random random = new Random(System.nanoTime());
StarTreeIndexSpec expectedStarTreeSpec = new StarTreeIndexSpec();
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/config/QuotaConfigTest.java b/pinot-common/src/test/java/org/apache/pinot/common/config/QuotaConfigTest.java
index 5f53319..9f45b4d 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/config/QuotaConfigTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/config/QuotaConfigTest.java
@@ -28,7 +28,8 @@ import org.testng.annotations.Test;
public class QuotaConfigTest {
@Test
- public void testQuotaConfig() throws IOException {
+ public void testQuotaConfig()
+ throws IOException {
{
String quotaConfigStr = "{\"storage\" : \"100g\"}";
QuotaConfig quotaConfig = JsonUtils.stringToObject(quotaConfigStr, QuotaConfig.class);
@@ -45,7 +46,8 @@ public class QuotaConfigTest {
}
@Test
- public void testBadQuotaConfig() throws IOException {
+ public void testBadQuotaConfig()
+ throws IOException {
{
String quotaConfigStr = "{\"storage\" : \"124GB3GB\"}";
QuotaConfig quotaConfig = JsonUtils.stringToObject(quotaConfigStr, QuotaConfig.class);
@@ -55,14 +57,16 @@ public class QuotaConfigTest {
}
@Test(expectedExceptions = ConfigurationRuntimeException.class)
- public void testBadConfig() throws IOException {
+ public void testBadConfig()
+ throws IOException {
String quotaConfigStr = "{\"storage\":\"-1M\"}";
QuotaConfig quotaConfig = JsonUtils.stringToObject(quotaConfigStr, QuotaConfig.class);
quotaConfig.validate();
}
@Test
- public void testQpsQuota() throws IOException {
+ public void testQpsQuota()
+ throws IOException {
{
String quotaConfigStr = "{\"maxQueriesPerSecond\" : \"100.00\"}";
QuotaConfig quotaConfig = JsonUtils.stringToObject(quotaConfigStr, QuotaConfig.class);
@@ -88,7 +92,8 @@ public class QuotaConfigTest {
}
@Test(expectedExceptions = ConfigurationRuntimeException.class)
- public void testInvalidQpsQuota() throws IOException {
+ public void testInvalidQpsQuota()
+ throws IOException {
String quotaConfigStr = "{\"maxQueriesPerSecond\" : \"InvalidQpsQuota\"}";
QuotaConfig quotaConfig = JsonUtils.stringToObject(quotaConfigStr, QuotaConfig.class);
Assert.assertNotNull(quotaConfig.getMaxQueriesPerSecond());
@@ -96,7 +101,8 @@ public class QuotaConfigTest {
}
@Test(expectedExceptions = ConfigurationRuntimeException.class)
- public void testNegativeQpsQuota() throws IOException {
+ public void testNegativeQpsQuota()
+ throws IOException {
String quotaConfigStr = "{\"maxQueriesPerSecond\" : \"-1.0\"}";
QuotaConfig quotaConfig = JsonUtils.stringToObject(quotaConfigStr, QuotaConfig.class);
Assert.assertNotNull(quotaConfig.getMaxQueriesPerSecond());
@@ -104,7 +110,8 @@ public class QuotaConfigTest {
}
@Test(expectedExceptions = ConfigurationRuntimeException.class)
- public void testBadQpsQuota() throws IOException {
+ public void testBadQpsQuota()
+ throws IOException {
String quotaConfigStr = "{\"maxQueriesPerSecond\" : \"1.0Test\"}";
QuotaConfig quotaConfig = JsonUtils.stringToObject(quotaConfigStr, QuotaConfig.class);
Assert.assertNotNull(quotaConfig.getMaxQueriesPerSecond());
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/config/TableConfigTest.java b/pinot-common/src/test/java/org/apache/pinot/common/config/TableConfigTest.java
index 5a229dd..1d5e571 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/config/TableConfigTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/config/TableConfigTest.java
@@ -34,7 +34,8 @@ import org.testng.annotations.Test;
public class TableConfigTest {
@Test
- public void testSerializeDeserialize() throws Exception {
+ public void testSerializeDeserialize()
+ throws Exception {
TableConfig.Builder tableConfigBuilder = new TableConfig.Builder(TableType.OFFLINE).setTableName("myTable");
{
// No quota config
@@ -91,19 +92,20 @@ public class TableConfigTest {
TableConfig tableConfigToCompare = TableConfig.fromJSONConfig(TableConfig.toJSONConfig(tableConfig));
Assert.assertEquals(tableConfigToCompare.getTableName(), tableConfig.getTableName());
Assert.assertNotNull(tableConfigToCompare.getQuotaConfig());
- Assert.assertEquals(tableConfigToCompare.getQuotaConfig().getStorage(),
- tableConfig.getQuotaConfig().getStorage());
+ Assert
+ .assertEquals(tableConfigToCompare.getQuotaConfig().getStorage(), tableConfig.getQuotaConfig().getStorage());
ZNRecord znRecord = TableConfig.toZnRecord(tableConfig);
tableConfigToCompare = TableConfig.fromZnRecord(znRecord);
Assert.assertEquals(tableConfigToCompare.getTableName(), tableConfig.getTableName());
Assert.assertNotNull(tableConfigToCompare.getQuotaConfig());
- Assert.assertEquals(tableConfigToCompare.getQuotaConfig().getStorage(),
- tableConfig.getQuotaConfig().getStorage());
+ Assert
+ .assertEquals(tableConfigToCompare.getQuotaConfig().getStorage(), tableConfig.getQuotaConfig().getStorage());
}
{
// With tenant config
- TableConfig tableConfig = tableConfigBuilder.setServerTenant("aServerTenant").setBrokerTenant("aBrokerTenant").build();
+ TableConfig tableConfig =
+ tableConfigBuilder.setServerTenant("aServerTenant").setBrokerTenant("aBrokerTenant").build();
Assert.assertEquals(tableConfig.getTableName(), "myTable_OFFLINE");
Assert.assertEquals(tableConfig.getTableType(), TableType.OFFLINE);
@@ -117,20 +119,20 @@ public class TableConfigTest {
TableConfig tableConfigToCompare = TableConfig.fromJSONConfig(TableConfig.toJSONConfig(tableConfig));
Assert.assertEquals(tableConfigToCompare.getTableName(), tableConfig.getTableName());
Assert.assertNotNull(tableConfigToCompare.getTenantConfig());
- Assert.assertEquals(tableConfigToCompare.getTenantConfig().getServer(),
- tableConfig.getTenantConfig().getServer());
- Assert.assertEquals(tableConfigToCompare.getTenantConfig().getBroker(),
- tableConfig.getTenantConfig().getBroker());
+ Assert
+ .assertEquals(tableConfigToCompare.getTenantConfig().getServer(), tableConfig.getTenantConfig().getServer());
+ Assert
+ .assertEquals(tableConfigToCompare.getTenantConfig().getBroker(), tableConfig.getTenantConfig().getBroker());
Assert.assertNull(tableConfig.getTenantConfig().getTagOverrideConfig());
ZNRecord znRecord = TableConfig.toZnRecord(tableConfig);
tableConfigToCompare = TableConfig.fromZnRecord(znRecord);
Assert.assertEquals(tableConfigToCompare.getTableName(), tableConfig.getTableName());
Assert.assertNotNull(tableConfigToCompare.getTenantConfig());
- Assert.assertEquals(tableConfigToCompare.getTenantConfig().getServer(),
- tableConfig.getTenantConfig().getServer());
- Assert.assertEquals(tableConfigToCompare.getTenantConfig().getBroker(),
- tableConfig.getTenantConfig().getBroker());
+ Assert
+ .assertEquals(tableConfigToCompare.getTenantConfig().getServer(), tableConfig.getTenantConfig().getServer());
+ Assert
+ .assertEquals(tableConfigToCompare.getTenantConfig().getBroker(), tableConfig.getTenantConfig().getBroker());
Assert.assertNull(tableConfig.getTenantConfig().getTagOverrideConfig());
TagOverrideConfig tagOverrideConfig = new TagOverrideConfig();
@@ -143,17 +145,18 @@ public class TableConfigTest {
Assert.assertEquals(tableConfig.getTenantConfig().getServer(), "aServerTenant");
Assert.assertEquals(tableConfig.getTenantConfig().getBroker(), "aBrokerTenant");
Assert.assertNotNull(tableConfig.getTenantConfig().getTagOverrideConfig());
- Assert.assertEquals(tableConfig.getTenantConfig().getTagOverrideConfig().getRealtimeConsuming(), "aRTConsumingTag_REALTIME");
+ Assert.assertEquals(tableConfig.getTenantConfig().getTagOverrideConfig().getRealtimeConsuming(),
+ "aRTConsumingTag_REALTIME");
Assert.assertNull(tableConfig.getTenantConfig().getTagOverrideConfig().getRealtimeCompleted());
// Serialize then de-serialize
tableConfigToCompare = TableConfig.fromJSONConfig(TableConfig.toJSONConfig(tableConfig));
Assert.assertEquals(tableConfigToCompare.getTableName(), tableConfig.getTableName());
Assert.assertNotNull(tableConfigToCompare.getTenantConfig());
- Assert.assertEquals(tableConfigToCompare.getTenantConfig().getServer(),
- tableConfig.getTenantConfig().getServer());
- Assert.assertEquals(tableConfigToCompare.getTenantConfig().getBroker(),
- tableConfig.getTenantConfig().getBroker());
+ Assert
+ .assertEquals(tableConfigToCompare.getTenantConfig().getServer(), tableConfig.getTenantConfig().getServer());
+ Assert
+ .assertEquals(tableConfigToCompare.getTenantConfig().getBroker(), tableConfig.getTenantConfig().getBroker());
Assert.assertNotNull(tableConfigToCompare.getTenantConfig().getTagOverrideConfig());
Assert.assertEquals(tableConfig.getTenantConfig().getTagOverrideConfig(),
tableConfigToCompare.getTenantConfig().getTagOverrideConfig());
@@ -162,10 +165,10 @@ public class TableConfigTest {
tableConfigToCompare = TableConfig.fromZnRecord(znRecord);
Assert.assertEquals(tableConfigToCompare.getTableName(), tableConfig.getTableName());
Assert.assertNotNull(tableConfigToCompare.getTenantConfig());
- Assert.assertEquals(tableConfigToCompare.getTenantConfig().getServer(),
- tableConfig.getTenantConfig().getServer());
- Assert.assertEquals(tableConfigToCompare.getTenantConfig().getBroker(),
- tableConfig.getTenantConfig().getBroker());
+ Assert
+ .assertEquals(tableConfigToCompare.getTenantConfig().getServer(), tableConfig.getTenantConfig().getServer());
+ Assert
+ .assertEquals(tableConfigToCompare.getTenantConfig().getBroker(), tableConfig.getTenantConfig().getBroker());
Assert.assertNotNull(tableConfigToCompare.getTenantConfig().getTagOverrideConfig());
Assert.assertEquals(tableConfig.getTenantConfig().getTagOverrideConfig(),
tableConfigToCompare.getTenantConfig().getTagOverrideConfig());
@@ -193,27 +196,27 @@ public class TableConfigTest {
// With default StreamConsumptionConfig
TableConfig tableConfig = tableConfigBuilder.build();
Assert.assertEquals(
- tableConfig.getIndexingConfig().getStreamConsumptionConfig()
- .getStreamPartitionAssignmentStrategy(), "UniformStreamPartitionAssignment");
+ tableConfig.getIndexingConfig().getStreamConsumptionConfig().getStreamPartitionAssignmentStrategy(),
+ "UniformStreamPartitionAssignment");
// with streamConsumptionConfig set
tableConfig =
tableConfigBuilder.setStreamPartitionAssignmentStrategy("BalancedStreamPartitionAssignment").build();
Assert.assertEquals(
- tableConfig.getIndexingConfig().getStreamConsumptionConfig()
- .getStreamPartitionAssignmentStrategy(), "BalancedStreamPartitionAssignment");
+ tableConfig.getIndexingConfig().getStreamConsumptionConfig().getStreamPartitionAssignmentStrategy(),
+ "BalancedStreamPartitionAssignment");
// Serialize then de-serialize
TableConfig tableConfigToCompare = TableConfig.fromJSONConfig(TableConfig.toJSONConfig(tableConfig));
Assert.assertEquals(
- tableConfigToCompare.getIndexingConfig().getStreamConsumptionConfig()
- .getStreamPartitionAssignmentStrategy(), "BalancedStreamPartitionAssignment");
+ tableConfigToCompare.getIndexingConfig().getStreamConsumptionConfig().getStreamPartitionAssignmentStrategy(),
+ "BalancedStreamPartitionAssignment");
ZNRecord znRecord = TableConfig.toZnRecord(tableConfig);
tableConfigToCompare = TableConfig.fromZnRecord(znRecord);
Assert.assertEquals(
- tableConfigToCompare.getIndexingConfig().getStreamConsumptionConfig()
- .getStreamPartitionAssignmentStrategy(), "BalancedStreamPartitionAssignment");
+ tableConfigToCompare.getIndexingConfig().getStreamConsumptionConfig().getStreamPartitionAssignmentStrategy(),
+ "BalancedStreamPartitionAssignment");
}
{
// With star tree config
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/config/TagOverrideConfigTest.java b/pinot-common/src/test/java/org/apache/pinot/common/config/TagOverrideConfigTest.java
index e0f0d1e..b40e171 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/config/TagOverrideConfigTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/config/TagOverrideConfigTest.java
@@ -31,44 +31,40 @@ public class TagOverrideConfigTest {
@DataProvider(name = "realtimeTagConfigTestDataProvider")
public Object[][] realtimeTagConfigTestDataProvider() {
TableConfig.Builder tableConfigBuilder = new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE);
- tableConfigBuilder.setTableName("testRealtimeTable")
- .setTimeColumnName("timeColumn")
- .setTimeType("DAYS")
- .setRetentionTimeUnit("DAYS")
- .setRetentionTimeValue("5")
- .setServerTenant("aServerTenant");
+ tableConfigBuilder.setTableName("testRealtimeTable").setTimeColumnName("timeColumn").setTimeType("DAYS")
+ .setRetentionTimeUnit("DAYS").setRetentionTimeValue("5").setServerTenant("aServerTenant");
List<Object[]> inputs = new ArrayList<>();
TableConfig tableConfig = tableConfigBuilder.build();
- inputs.add(new Object[] {tableConfig, "aServerTenant", "aServerTenant_REALTIME", "aServerTenant_REALTIME"});
+ inputs.add(new Object[]{tableConfig, "aServerTenant", "aServerTenant_REALTIME", "aServerTenant_REALTIME"});
tableConfig = tableConfigBuilder.setTagOverrideConfig(null).build();
- inputs.add(new Object[] {tableConfig, "aServerTenant", "aServerTenant_REALTIME", "aServerTenant_REALTIME"});
+ inputs.add(new Object[]{tableConfig, "aServerTenant", "aServerTenant_REALTIME", "aServerTenant_REALTIME"});
// empty tag override
TagOverrideConfig tagOverrideConfig = new TagOverrideConfig();
tableConfig = tableConfigBuilder.setTagOverrideConfig(tagOverrideConfig).build();
- inputs.add(new Object[] {tableConfig, "aServerTenant", "aServerTenant_REALTIME", "aServerTenant_REALTIME"});
+ inputs.add(new Object[]{tableConfig, "aServerTenant", "aServerTenant_REALTIME", "aServerTenant_REALTIME"});
// defined realtime consuming override
tagOverrideConfig = new TagOverrideConfig();
tagOverrideConfig.setRealtimeConsuming("overriddenTag_REALTIME");
tableConfig = tableConfigBuilder.setTagOverrideConfig(tagOverrideConfig).build();
- inputs.add(new Object[] {tableConfig, "aServerTenant", "overriddenTag_REALTIME", "aServerTenant_REALTIME"});
+ inputs.add(new Object[]{tableConfig, "aServerTenant", "overriddenTag_REALTIME", "aServerTenant_REALTIME"});
// defined realtime completed override
tagOverrideConfig = new TagOverrideConfig();
tagOverrideConfig.setRealtimeCompleted("overriddenTag_OFFLINE");
tableConfig = tableConfigBuilder.setTagOverrideConfig(tagOverrideConfig).build();
- inputs.add(new Object[] {tableConfig, "aServerTenant", "aServerTenant_REALTIME", "overriddenTag_OFFLINE"});
+ inputs.add(new Object[]{tableConfig, "aServerTenant", "aServerTenant_REALTIME", "overriddenTag_OFFLINE"});
// defined both overrides
tagOverrideConfig = new TagOverrideConfig();
tagOverrideConfig.setRealtimeConsuming("overriddenTag_REALTIME");
tagOverrideConfig.setRealtimeCompleted("overriddenTag_OFFLINE");
tableConfig = tableConfigBuilder.setTagOverrideConfig(tagOverrideConfig).build();
- inputs.add(new Object[] {tableConfig, "aServerTenant", "overriddenTag_REALTIME", "overriddenTag_OFFLINE"});
+ inputs.add(new Object[]{tableConfig, "aServerTenant", "overriddenTag_REALTIME", "overriddenTag_OFFLINE"});
return inputs.toArray(new Object[inputs.size()][]);
}
@@ -85,39 +81,35 @@ public class TagOverrideConfigTest {
@DataProvider(name = "offlineTagConfigTestDataProvider")
public Object[][] offlineTagConfigTestDataProvider() {
TableConfig.Builder tableConfigBuilder = new TableConfig.Builder(CommonConstants.Helix.TableType.OFFLINE);
- tableConfigBuilder.setTableName("testOfflineTable")
- .setTimeColumnName("timeColumn")
- .setTimeType("DAYS")
- .setRetentionTimeUnit("DAYS")
- .setRetentionTimeValue("5")
- .setServerTenant("aServerTenant");
+ tableConfigBuilder.setTableName("testOfflineTable").setTimeColumnName("timeColumn").setTimeType("DAYS")
+ .setRetentionTimeUnit("DAYS").setRetentionTimeValue("5").setServerTenant("aServerTenant");
List<Object[]> inputs = new ArrayList<>();
TableConfig tableConfig = tableConfigBuilder.build();
- inputs.add(new Object[] {tableConfig, "aServerTenant", "aServerTenant_OFFLINE"});
+ inputs.add(new Object[]{tableConfig, "aServerTenant", "aServerTenant_OFFLINE"});
tableConfig = tableConfigBuilder.setTagOverrideConfig(null).build();
- inputs.add(new Object[] {tableConfig, "aServerTenant", "aServerTenant_OFFLINE"});
+ inputs.add(new Object[]{tableConfig, "aServerTenant", "aServerTenant_OFFLINE"});
TagOverrideConfig tagOverrideConfig = new TagOverrideConfig();
tableConfig = tableConfigBuilder.setTagOverrideConfig(tagOverrideConfig).build();
- inputs.add(new Object[] {tableConfig, "aServerTenant", "aServerTenant_OFFLINE"});
+ inputs.add(new Object[]{tableConfig, "aServerTenant", "aServerTenant_OFFLINE"});
tagOverrideConfig = new TagOverrideConfig();
tagOverrideConfig.setRealtimeConsuming("overriddenTag_REALTIME");
tagOverrideConfig.setRealtimeCompleted("overriddenTag_OFFLINE");
tableConfig = tableConfigBuilder.setTagOverrideConfig(tagOverrideConfig).build();
- inputs.add(new Object[] {tableConfig, "aServerTenant", "aServerTenant_OFFLINE"});
+ inputs.add(new Object[]{tableConfig, "aServerTenant", "aServerTenant_OFFLINE"});
return inputs.toArray(new Object[inputs.size()][]);
}
@Test(dataProvider = "offlineTagConfigTestDataProvider")
- public void testOfflineTagConfig(TableConfig tableConfig, String expectedServerTenant, String expectedOfflineServerTag) {
+ public void testOfflineTagConfig(TableConfig tableConfig, String expectedServerTenant,
+ String expectedOfflineServerTag) {
OfflineTagConfig tagConfig = new OfflineTagConfig(tableConfig);
Assert.assertEquals(tagConfig.getServerTenantName(), expectedServerTenant);
Assert.assertEquals(tagConfig.getOfflineServerTag(), expectedOfflineServerTag);
}
-
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/config/TenantTest.java b/pinot-common/src/test/java/org/apache/pinot/common/config/TenantTest.java
index ac741b5..7cf1339 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/config/TenantTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/config/TenantTest.java
@@ -29,7 +29,8 @@ import static org.testng.Assert.assertEquals;
public class TenantTest {
@Test
- public void testDeserializeFromJson() throws IOException {
+ public void testDeserializeFromJson()
+ throws IOException {
Tenant tenant = new Tenant();
tenant.setTenantRole(TenantRole.SERVER);
tenant.setTenantName("newTenant");
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/config/TestConfigSerialization.java b/pinot-common/src/test/java/org/apache/pinot/common/config/TestConfigSerialization.java
index e942a2d..45eb0e5 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/config/TestConfigSerialization.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/config/TestConfigSerialization.java
@@ -30,7 +30,8 @@ import org.testng.annotations.Test;
*/
public class TestConfigSerialization {
@Test
- public void testConfigRoundtrip() throws Exception {
+ public void testConfigRoundtrip()
+ throws Exception {
// Load the config and check it
CombinedConfig combinedConfig = CombinedConfigLoader
.loadCombinedConfig(new File(getClass().getClassLoader().getResource("test-table-config.conf").getFile()));
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/data/DateTimeFormatSpecTest.java b/pinot-common/src/test/java/org/apache/pinot/common/data/DateTimeFormatSpecTest.java
index 9660d56..6c5d69e 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/data/DateTimeFormatSpecTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/data/DateTimeFormatSpecTest.java
@@ -29,6 +29,7 @@ import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+
/**
* Tests for DateTimeFormatSpec helper methods
*/
@@ -47,44 +48,23 @@ public class DateTimeFormatSpecTest {
public Object[][] provideTestFromFormatToMillisData() {
List<Object[]> entries = new ArrayList<>();
- entries.add(new Object[] {
- "1:HOURS:EPOCH", 416359L, 1498892400000L
- });
- entries.add(new Object[] {
- "1:MILLISECONDS:EPOCH", 1498892400000L, 1498892400000L
- });
- entries.add(new Object[] {
- "1:HOURS:EPOCH", 0L, 0L
- });
- entries.add(new Object[] {
- "5:MINUTES:EPOCH", 4996308L, 1498892400000L
- });
- entries.add(new Object[] {
- "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", "20170701",
- DateTimeFormat.forPattern("yyyyMMdd").withZoneUTC().parseMillis("20170701")
- });
- entries.add(new Object[] {
- "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(America/Chicago)", "20170701",
- DateTimeFormat.forPattern("yyyyMMdd")
- .withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("America/Chicago"))).parseMillis("20170701")
- });
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH", "20170701 00",
- DateTimeFormat.forPattern("yyyyMMdd HH").withZoneUTC().parseMillis("20170701 00")
- });
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH tz(GMT+0600)", "20170701 00",
- DateTimeFormat.forPattern("yyyyMMdd HH").withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("GMT+0600")))
- .parseMillis("20170701 00")
- });
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH Z", "20170701 00 -07:00",
- 1498892400000L
- });
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a", "8/7/2017 12:45:50 AM",
- 1502066750000L
- });
+ entries.add(new Object[]{"1:HOURS:EPOCH", 416359L, 1498892400000L});
+ entries.add(new Object[]{"1:MILLISECONDS:EPOCH", 1498892400000L, 1498892400000L});
+ entries.add(new Object[]{"1:HOURS:EPOCH", 0L, 0L});
+ entries.add(new Object[]{"5:MINUTES:EPOCH", 4996308L, 1498892400000L});
+ entries.add(new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", "20170701", DateTimeFormat.forPattern("yyyyMMdd")
+ .withZoneUTC().parseMillis("20170701")});
+ entries.add(new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(America/Chicago)", "20170701", DateTimeFormat
+ .forPattern("yyyyMMdd").withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("America/Chicago"))).parseMillis(
+ "20170701")});
+ entries.add(
+ new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH", "20170701 00", DateTimeFormat.forPattern("yyyyMMdd HH")
+ .withZoneUTC().parseMillis("20170701 00")});
+ entries.add(new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH tz(GMT+0600)", "20170701 00", DateTimeFormat
+ .forPattern("yyyyMMdd HH").withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("GMT+0600"))).parseMillis(
+ "20170701 00")});
+ entries.add(new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH Z", "20170701 00 -07:00", 1498892400000L});
+ entries.add(new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a", "8/7/2017 12:45:50 AM", 1502066750000L});
return entries.toArray(new Object[entries.size()][]);
}
@@ -102,61 +82,41 @@ public class DateTimeFormatSpecTest {
public Object[][] provideTestFromMillisToFormatData() {
List<Object[]> entries = new ArrayList<>();
- entries.add(new Object[] {
- "1:HOURS:EPOCH", 1498892400000L, Long.class, 416359L
- });
- entries.add(new Object[] {
- "1:MILLISECONDS:EPOCH", 1498892400000L, Long.class, 1498892400000L
- });
- entries.add(new Object[] {
- "1:HOURS:EPOCH", 0L, Long.class, 0L
- });
- entries.add(new Object[] {
- "5:MINUTES:EPOCH", 1498892400000L, Long.class, 4996308L
- });
- entries.add(new Object[] {
- "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", 1498892400000L, String.class,
- DateTimeFormat.forPattern("yyyyMMdd").withZoneUTC().print(1498892400000L)
- });
- entries.add(new Object[] {
- "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(America/New_York)", 1498892400000L, String.class,
- DateTimeFormat.forPattern("yyyyMMdd")
- .withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("America/New_York"))).print(1498892400000L)
- });
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH", 1498892400000L, String.class,
- DateTimeFormat.forPattern("yyyyMMdd HH").withZoneUTC().print(1498892400000L)
- });
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH tz(IST)", 1498892400000L, String.class,
- DateTimeFormat.forPattern("yyyyMMdd HH").withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("IST")))
- .print(1498892400000L)
- });
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH Z", 1498892400000L, String.class,
- DateTimeFormat.forPattern("yyyyMMdd HH Z").withZoneUTC().print(1498892400000L)
- });
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH Z tz(GMT+0500)", 1498892400000L, String.class,
- DateTimeFormat.forPattern("yyyyMMdd HH Z").withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("GMT+0500")))
- .print(1498892400000L)
- });
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a", 1498892400000L, String.class,
- DateTimeFormat.forPattern("M/d/yyyy h:mm:ss a").withZoneUTC().print(1498892400000L)
- });
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h a", 1502066750000L, String.class,
- DateTimeFormat.forPattern("M/d/yyyy h a").withZoneUTC().print(1502066750000L)
- });
+ entries.add(new Object[]{"1:HOURS:EPOCH", 1498892400000L, Long.class, 416359L});
+ entries.add(new Object[]{"1:MILLISECONDS:EPOCH", 1498892400000L, Long.class, 1498892400000L});
+ entries.add(new Object[]{"1:HOURS:EPOCH", 0L, Long.class, 0L});
+ entries.add(new Object[]{"5:MINUTES:EPOCH", 1498892400000L, Long.class, 4996308L});
+ entries.add(new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", 1498892400000L, String.class, DateTimeFormat
+ .forPattern("yyyyMMdd").withZoneUTC().print(1498892400000L)});
+ entries.add(
+ new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(America/New_York)", 1498892400000L, String.class, DateTimeFormat
+ .forPattern("yyyyMMdd").withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("America/New_York"))).print(
+ 1498892400000L)});
+ entries.add(new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH", 1498892400000L, String.class, DateTimeFormat
+ .forPattern("yyyyMMdd HH").withZoneUTC().print(1498892400000L)});
+ entries.add(
+ new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH tz(IST)", 1498892400000L, String.class, DateTimeFormat
+ .forPattern("yyyyMMdd HH").withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("IST"))).print(
+ 1498892400000L)});
+ entries.add(new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH Z", 1498892400000L, String.class, DateTimeFormat
+ .forPattern("yyyyMMdd HH Z").withZoneUTC().print(1498892400000L)});
+ entries.add(
+ new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH Z tz(GMT+0500)", 1498892400000L, String.class, DateTimeFormat
+ .forPattern("yyyyMMdd HH Z").withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("GMT+0500"))).print(
+ 1498892400000L)});
+ entries.add(
+ new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a", 1498892400000L, String.class, DateTimeFormat
+ .forPattern("M/d/yyyy h:mm:ss a").withZoneUTC().print(1498892400000L)});
+ entries.add(new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h a", 1502066750000L, String.class, DateTimeFormat
+ .forPattern("M/d/yyyy h a").withZoneUTC().print(1502066750000L)});
return entries.toArray(new Object[entries.size()][]);
}
// Test fetching components of a format form a given format
@Test(dataProvider = "testGetFromFormatDataProvider")
- public void testGetFromFormat(String format, int columnSizeFromFormatExpected,
- TimeUnit columnUnitFromFormatExpected, TimeFormat timeFormatFromFormatExpected,
- String sdfPatternFromFormatExpected, DateTimeZone dateTimeZoneFromFormatExpected) {
+ public void testGetFromFormat(String format, int columnSizeFromFormatExpected, TimeUnit columnUnitFromFormatExpected,
+ TimeFormat timeFormatFromFormatExpected, String sdfPatternFromFormatExpected,
+ DateTimeZone dateTimeZoneFromFormatExpected) {
DateTimeFormatSpec dateTimeFormatSpec = new DateTimeFormatSpec(format);
@@ -186,73 +146,49 @@ public class DateTimeFormatSpecTest {
List<Object[]> entries = new ArrayList<>();
- entries.add(new Object[] {
- "1:HOURS:EPOCH", 1, TimeUnit.HOURS,
- org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.EPOCH, null, DateTimeZone.UTC
- });
-
- entries.add(new Object[] {
- "5:MINUTES:EPOCH", 5, TimeUnit.MINUTES,
- org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.EPOCH, null, DateTimeZone.UTC
- });
-
- entries.add(new Object[] {
- "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", 1, TimeUnit.DAYS,
- org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd", DateTimeZone.UTC
- });
-
- entries.add(new Object[] {
- "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(IST)", 1, TimeUnit.DAYS,
- org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd",
- DateTimeZone.forTimeZone(TimeZone.getTimeZone("IST"))
- });
-
- entries.add(new Object[] {
- "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(IST)", 1, TimeUnit.DAYS,
- org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd",
- DateTimeZone.forTimeZone(TimeZone.getTimeZone("IST"))
- });
-
- entries.add(new Object[] {
- "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz ( IST ) ", 1, TimeUnit.DAYS,
- org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd",
- DateTimeZone.forTimeZone(TimeZone.getTimeZone("IST"))
- });
-
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH", 1, TimeUnit.HOURS,
- org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT,
- "yyyyMMdd HH", DateTimeZone.UTC
- });
-
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH tz(dummy)", 1, TimeUnit.HOURS,
- org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT,
- "yyyyMMdd HH", DateTimeZone.UTC
- });
-
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a", 1, TimeUnit.HOURS,
- org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT,
- "M/d/yyyy h:mm:ss a", DateTimeZone.UTC
- });
-
- entries.add(new Object[] {
- "1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a tz(Asia/Tokyo)", 1, TimeUnit.HOURS,
- org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT,
- "M/d/yyyy h:mm:ss a", DateTimeZone.forTimeZone(TimeZone.getTimeZone("Asia/Tokyo"))
- });
+ entries.add(
+ new Object[]{"1:HOURS:EPOCH", 1, TimeUnit.HOURS, org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.EPOCH, null, DateTimeZone.UTC});
+
+ entries.add(
+ new Object[]{"5:MINUTES:EPOCH", 5, TimeUnit.MINUTES, org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.EPOCH, null, DateTimeZone.UTC});
+
+ entries.add(
+ new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", 1, TimeUnit.DAYS, org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd", DateTimeZone.UTC});
+
+ entries.add(
+ new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(IST)", 1, TimeUnit.DAYS, org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd", DateTimeZone.forTimeZone(
+ TimeZone.getTimeZone("IST"))});
+
+ entries.add(
+ new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(IST)", 1, TimeUnit.DAYS, org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd", DateTimeZone.forTimeZone(
+ TimeZone.getTimeZone("IST"))});
+
+ entries.add(
+ new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz ( IST ) ", 1, TimeUnit.DAYS, org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd", DateTimeZone.forTimeZone(
+ TimeZone.getTimeZone("IST"))});
+
+ entries.add(
+ new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH", 1, TimeUnit.HOURS, org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd HH", DateTimeZone.UTC});
+
+ entries.add(
+ new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH tz(dummy)", 1, TimeUnit.HOURS, org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd HH", DateTimeZone.UTC});
+
+ entries.add(
+ new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a", 1, TimeUnit.HOURS, org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "M/d/yyyy h:mm:ss a", DateTimeZone.UTC});
+
+ entries.add(
+ new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a tz(Asia/Tokyo)", 1, TimeUnit.HOURS, org.apache.pinot.common.data.DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "M/d/yyyy h:mm:ss a", DateTimeZone.forTimeZone(
+ TimeZone.getTimeZone("Asia/Tokyo"))});
return entries.toArray(new Object[entries.size()][]);
}
// Test construct format given its components
@Test(dataProvider = "testConstructFormatDataProvider")
- public void testConstructFormat(int columnSize, TimeUnit columnUnit, String columnTimeFormat,
- String pattern, DateTimeFormatSpec formatExpected1, DateTimeFormatSpec formatExpected2) {
+ public void testConstructFormat(int columnSize, TimeUnit columnUnit, String columnTimeFormat, String pattern,
+ DateTimeFormatSpec formatExpected1, DateTimeFormatSpec formatExpected2) {
DateTimeFormatSpec formatActual1 = null;
try {
- formatActual1 =
- new DateTimeFormatSpec(columnSize, columnUnit.toString(), columnTimeFormat);
+ formatActual1 = new DateTimeFormatSpec(columnSize, columnUnit.toString(), columnTimeFormat);
} catch (Exception e) {
// invalid arguments
}
@@ -260,8 +196,7 @@ public class DateTimeFormatSpecTest {
DateTimeFormatSpec formatActual2 = null;
try {
- formatActual2 =
- new DateTimeFormatSpec(columnSize, columnUnit.toString(), columnTimeFormat, pattern);
+ formatActual2 = new DateTimeFormatSpec(columnSize, columnUnit.toString(), columnTimeFormat, pattern);
} catch (Exception e) {
// invalid arguments
}
@@ -273,46 +208,23 @@ public class DateTimeFormatSpecTest {
List<Object[]> entries = new ArrayList<>();
- entries.add(new Object[] {
- 1, TimeUnit.HOURS, "EPOCH", null, new DateTimeFormatSpec("1:HOURS:EPOCH"), null
- });
- entries.add(new Object[] {
- 1, TimeUnit.HOURS, "EPOCH", "yyyyMMdd", new DateTimeFormatSpec("1:HOURS:EPOCH"), null
- });
- entries.add(new Object[] {
- 5, TimeUnit.MINUTES, "EPOCH", null, new DateTimeFormatSpec("5:MINUTES:EPOCH"), null
- });
- entries.add(new Object[] {
- 0, TimeUnit.HOURS, "EPOCH", null, null, null
- });
- entries.add(new Object[] {
- 1, null, "EPOCH", null, null, null
- });
- entries.add(new Object[] {
- 1, TimeUnit.HOURS, null, null, null, null
- });
- entries.add(new Object[] {
- 1, TimeUnit.HOURS, "DUMMY", "yyyyMMdd", null, null
- });
- entries.add(new Object[] {
- 1, TimeUnit.HOURS, "SIMPLE_DATE_FORMAT", "yyyyMMdd", null,
- new DateTimeFormatSpec("1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd")
- });
- entries.add(new Object[] {
- 1, TimeUnit.HOURS, "SIMPLE_DATE_FORMAT", "yyyyMMdd tz(America/Los_Angeles)", null,
- new DateTimeFormatSpec("1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(America/Los_Angeles)")
- });
- entries.add(new Object[] {
- 1, TimeUnit.HOURS, "SIMPLE_DATE_FORMAT", null, null, null
- });
- entries.add(new Object[] {
- -1, TimeUnit.HOURS, "SIMPLE_DATE_FORMAT", "yyyyMMDD", null, null
- });
- entries.add(new Object[] {
- 1, TimeUnit.HOURS, "SIMPLE_DATE_FORMAT", "M/d/yyyy h:mm:ss a", null,
- new DateTimeFormatSpec("1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a")
- });
+ entries.add(new Object[]{1, TimeUnit.HOURS, "EPOCH", null, new DateTimeFormatSpec("1:HOURS:EPOCH"), null});
+ entries.add(new Object[]{1, TimeUnit.HOURS, "EPOCH", "yyyyMMdd", new DateTimeFormatSpec("1:HOURS:EPOCH"), null});
+ entries.add(new Object[]{5, TimeUnit.MINUTES, "EPOCH", null, new DateTimeFormatSpec("5:MINUTES:EPOCH"), null});
+ entries.add(new Object[]{0, TimeUnit.HOURS, "EPOCH", null, null, null});
+ entries.add(new Object[]{1, null, "EPOCH", null, null, null});
+ entries.add(new Object[]{1, TimeUnit.HOURS, null, null, null, null});
+ entries.add(new Object[]{1, TimeUnit.HOURS, "DUMMY", "yyyyMMdd", null, null});
+ entries.add(new Object[]{1, TimeUnit.HOURS, "SIMPLE_DATE_FORMAT", "yyyyMMdd", null, new DateTimeFormatSpec(
+ "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd")});
+ entries.add(
+ new Object[]{1, TimeUnit.HOURS, "SIMPLE_DATE_FORMAT", "yyyyMMdd tz(America/Los_Angeles)", null, new DateTimeFormatSpec(
+ "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(America/Los_Angeles)")});
+ entries.add(new Object[]{1, TimeUnit.HOURS, "SIMPLE_DATE_FORMAT", null, null, null});
+ entries.add(new Object[]{-1, TimeUnit.HOURS, "SIMPLE_DATE_FORMAT", "yyyyMMDD", null, null});
+ entries.add(
+ new Object[]{1, TimeUnit.HOURS, "SIMPLE_DATE_FORMAT", "M/d/yyyy h:mm:ss a", null, new DateTimeFormatSpec(
+ "1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a")});
return entries.toArray(new Object[entries.size()][]);
}
-
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/data/DateTimeGranularitySpecTest.java b/pinot-common/src/test/java/org/apache/pinot/common/data/DateTimeGranularitySpecTest.java
index 2ddff7c..5c6a3f1 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/data/DateTimeGranularitySpecTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/data/DateTimeGranularitySpecTest.java
@@ -25,6 +25,7 @@ import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+
public class DateTimeGranularitySpecTest {
// Test construct granularity from components
@@ -44,21 +45,11 @@ public class DateTimeGranularitySpecTest {
List<Object[]> entries = new ArrayList<>();
- entries.add(new Object[] {
- 1, TimeUnit.HOURS, new DateTimeGranularitySpec("1:HOURS")
- });
- entries.add(new Object[] {
- 5, TimeUnit.MINUTES, new DateTimeGranularitySpec("5:MINUTES")
- });
- entries.add(new Object[] {
- 0, TimeUnit.HOURS, null
- });
- entries.add(new Object[] {
- -1, TimeUnit.HOURS, null
- });
- entries.add(new Object[] {
- 1, null, null
- });
+ entries.add(new Object[]{1, TimeUnit.HOURS, new DateTimeGranularitySpec("1:HOURS")});
+ entries.add(new Object[]{5, TimeUnit.MINUTES, new DateTimeGranularitySpec("5:MINUTES")});
+ entries.add(new Object[]{0, TimeUnit.HOURS, null});
+ entries.add(new Object[]{-1, TimeUnit.HOURS, null});
+ entries.add(new Object[]{1, null, null});
return entries.toArray(new Object[entries.size()][]);
}
@@ -82,26 +73,13 @@ public class DateTimeGranularitySpecTest {
List<Object[]> entries = new ArrayList<>();
- entries.add(new Object[] {
- "1:HOURS", 3600000L
- });
- entries.add(new Object[] {
- "1:MILLISECONDS", 1L
- });
- entries.add(new Object[] {
- "15:MINUTES", 900000L
- });
- entries.add(new Object[] {
- "0:HOURS", null
- });
- entries.add(new Object[] {
- null, null
- });
- entries.add(new Object[] {
- "1:DUMMY", null
- });
+ entries.add(new Object[]{"1:HOURS", 3600000L});
+ entries.add(new Object[]{"1:MILLISECONDS", 1L});
+ entries.add(new Object[]{"15:MINUTES", 900000L});
+ entries.add(new Object[]{"0:HOURS", null});
+ entries.add(new Object[]{null, null});
+ entries.add(new Object[]{"1:DUMMY", null});
return entries.toArray(new Object[entries.size()][]);
}
-
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/data/FieldSpecTest.java b/pinot-common/src/test/java/org/apache/pinot/common/data/FieldSpecTest.java
index c43f870..47af288 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/data/FieldSpecTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/data/FieldSpecTest.java
@@ -123,7 +123,8 @@ public class FieldSpecTest {
* Test derived {@link MetricFieldSpec}.
*/
@Test
- public void testDerivedMetricFieldSpec() throws Exception {
+ public void testDerivedMetricFieldSpec()
+ throws Exception {
MetricFieldSpec derivedMetricField =
new MetricFieldSpec("derivedMetric", STRING, 10, MetricFieldSpec.DerivedMetricType.HLL);
Assert.assertEquals(derivedMetricField.getFieldSize(), 10);
@@ -274,7 +275,8 @@ public class FieldSpecTest {
* Test different order of fields in serialized JSON string to deserialize {@link FieldSpec}.
*/
@Test
- public void testOrderOfFields() throws Exception {
+ public void testOrderOfFields()
+ throws Exception {
// Metric field with default null value.
String[] metricFields = {"\"name\":\"metric\"", "\"dataType\":\"INT\"", "\"defaultNullValue\":-1"};
MetricFieldSpec metricFieldSpec1 =
@@ -321,7 +323,8 @@ public class FieldSpecTest {
* Test {@link FieldSpec} serialize deserialize.
*/
@Test
- public void testSerializeDeserialize() throws Exception {
+ public void testSerializeDeserialize()
+ throws Exception {
FieldSpec first;
FieldSpec second;
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/data/SchemaTest.java b/pinot-common/src/test/java/org/apache/pinot/common/data/SchemaTest.java
index ec2572c..c3140bb 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/data/SchemaTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/data/SchemaTest.java
@@ -36,7 +36,8 @@ public class SchemaTest {
public static final Logger LOGGER = LoggerFactory.getLogger(SchemaTest.class);
@Test
- public void testValidation() throws Exception {
+ public void testValidation()
+ throws Exception {
Schema schemaToValidate;
schemaToValidate = Schema.fromString(makeSchema(FieldSpec.DataType.LONG, FieldSpec.DataType.STRING, true));
@@ -53,22 +54,13 @@ public class SchemaTest {
}
private String makeSchema(FieldSpec.DataType metricType, FieldSpec.DataType dimensionType, boolean isSingleValue) {
- return "{"
- + " \"schemaName\":\"SchemaTest\","
- + " \"metricFieldSpecs\":["
- + " {\"name\":\"m\",\"dataType\":\"" + metricType + "\"}"
- + " ],"
- + " \"dimensionFieldSpecs\":["
- + " {\"name\":\"d\",\"dataType\":\"" + dimensionType + "\",\"singleValueField\":" + isSingleValue + "}"
- + " ],"
- + " \"timeFieldSpec\":{"
+ return "{" + " \"schemaName\":\"SchemaTest\"," + " \"metricFieldSpecs\":[" + " {\"name\":\"m\",\"dataType\":\""
+ + metricType + "\"}" + " ]," + " \"dimensionFieldSpecs\":[" + " {\"name\":\"d\",\"dataType\":\""
+ + dimensionType + "\",\"singleValueField\":" + isSingleValue + "}" + " ]," + " \"timeFieldSpec\":{"
+ " \"incomingGranularitySpec\":{\"dataType\":\"LONG\",\"timeType\":\"MILLISECONDS\",\"name\":\"time\"},"
- + " \"defaultNullValue\":12345"
- + " },"
- + " \"dateTimeFieldSpecs\":["
+ + " \"defaultNullValue\":12345" + " }," + " \"dateTimeFieldSpecs\":["
+ " {\"name\":\"Date\", \"dataType\":\"LONG\", \"format\":\"1:MILLISECONDS:EPOCH\", \"granularity\":\"5:MINUTES\", \"dateTimeType\":\"PRIMARY\"}"
- + " ]"
- + "}";
+ + " ]" + "}";
}
@Test
@@ -78,14 +70,11 @@ public class SchemaTest {
.addSingleValueDimension("svDimensionWithDefault", FieldSpec.DataType.INT, 10)
.addMultiValueDimension("mvDimension", FieldSpec.DataType.STRING)
.addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, defaultString)
- .addMetric("metric", FieldSpec.DataType.INT)
- .addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
+ .addMetric("metric", FieldSpec.DataType.INT).addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
.addMetric("derivedMetric", FieldSpec.DataType.STRING, 10, MetricFieldSpec.DerivedMetricType.HLL)
.addMetric("derivedMetricWithDefault", FieldSpec.DataType.STRING, 10, MetricFieldSpec.DerivedMetricType.HLL,
- defaultString)
- .addTime("time", TimeUnit.DAYS, FieldSpec.DataType.LONG)
- .addDateTime("dateTime", FieldSpec.DataType.LONG, "1:HOURS:EPOCH", "1:HOURS")
- .build();
+ defaultString).addTime("time", TimeUnit.DAYS, FieldSpec.DataType.LONG)
+ .addDateTime("dateTime", FieldSpec.DataType.LONG, "1:HOURS:EPOCH", "1:HOURS").build();
DimensionFieldSpec dimensionFieldSpec = schema.getDimensionSpec("svDimension");
Assert.assertNotNull(dimensionFieldSpec);
@@ -194,44 +183,36 @@ public class SchemaTest {
new TimeGranularitySpec(outgoingDataType, outgoingTimeUnitSize, outgoingTimeUnit, outgoingName);
int defaultNullValue = 17050;
- Schema schema1 = new Schema.SchemaBuilder().setSchemaName("testSchema")
- .addTime(incomingName, incomingTimeUnit, incomingDataType)
- .build();
+ Schema schema1 =
+ new Schema.SchemaBuilder().setSchemaName("testSchema").addTime(incomingName, incomingTimeUnit, incomingDataType)
+ .build();
Schema schema2 = new Schema.SchemaBuilder().setSchemaName("testSchema")
- .addTime(incomingName, incomingTimeUnit, incomingDataType, defaultNullValue)
- .build();
+ .addTime(incomingName, incomingTimeUnit, incomingDataType, defaultNullValue).build();
Schema schema3 = new Schema.SchemaBuilder().setSchemaName("testSchema")
.addTime(incomingName, incomingTimeUnit, incomingDataType, outgoingName, outgoingTimeUnit, outgoingDataType)
.build();
Schema schema4 = new Schema.SchemaBuilder().setSchemaName("testSchema")
.addTime(incomingName, incomingTimeUnit, incomingDataType, outgoingName, outgoingTimeUnit, outgoingDataType,
- defaultNullValue)
- .build();
+ defaultNullValue).build();
Schema schema5 = new Schema.SchemaBuilder().setSchemaName("testSchema")
- .addTime(incomingName, incomingTimeUnitSize, incomingTimeUnit, incomingDataType)
- .build();
+ .addTime(incomingName, incomingTimeUnitSize, incomingTimeUnit, incomingDataType).build();
Schema schema6 = new Schema.SchemaBuilder().setSchemaName("testSchema")
- .addTime(incomingName, incomingTimeUnitSize, incomingTimeUnit, incomingDataType, defaultNullValue)
- .build();
+ .addTime(incomingName, incomingTimeUnitSize, incomingTimeUnit, incomingDataType, defaultNullValue).build();
Schema schema7 = new Schema.SchemaBuilder().setSchemaName("testSchema")
.addTime(incomingName, incomingTimeUnitSize, incomingTimeUnit, incomingDataType, outgoingName,
- outgoingTimeUnitSize, outgoingTimeUnit, outgoingDataType)
- .build();
+ outgoingTimeUnitSize, outgoingTimeUnit, outgoingDataType).build();
Schema schema8 = new Schema.SchemaBuilder().setSchemaName("testSchema")
.addTime(incomingName, incomingTimeUnitSize, incomingTimeUnit, incomingDataType, outgoingName,
- outgoingTimeUnitSize, outgoingTimeUnit, outgoingDataType, defaultNullValue)
- .build();
+ outgoingTimeUnitSize, outgoingTimeUnit, outgoingDataType, defaultNullValue).build();
Schema schema9 =
new Schema.SchemaBuilder().setSchemaName("testSchema").addTime(incomingTimeGranularitySpec).build();
- Schema schema10 = new Schema.SchemaBuilder().setSchemaName("testSchema")
- .addTime(incomingTimeGranularitySpec, defaultNullValue)
- .build();
+ Schema schema10 =
+ new Schema.SchemaBuilder().setSchemaName("testSchema").addTime(incomingTimeGranularitySpec, defaultNullValue)
+ .build();
Schema schema11 = new Schema.SchemaBuilder().setSchemaName("testSchema")
- .addTime(incomingTimeGranularitySpec, outgoingTimeGranularitySpec)
- .build();
+ .addTime(incomingTimeGranularitySpec, outgoingTimeGranularitySpec).build();
Schema schema12 = new Schema.SchemaBuilder().setSchemaName("testSchema")
- .addTime(incomingTimeGranularitySpec, outgoingTimeGranularitySpec, defaultNullValue)
- .build();
+ .addTime(incomingTimeGranularitySpec, outgoingTimeGranularitySpec, defaultNullValue).build();
Assert.assertNotNull(schema1.getTimeFieldSpec());
Assert.assertNotNull(schema2.getTimeFieldSpec());
@@ -279,7 +260,8 @@ public class SchemaTest {
}
@Test
- public void testSerializeDeserialize() throws Exception {
+ public void testSerializeDeserialize()
+ throws Exception {
URL resourceUrl = getClass().getClassLoader().getResource("schemaTest.schema");
Assert.assertNotNull(resourceUrl);
Schema schema = Schema.fromFile(new File(resourceUrl.getFile()));
@@ -300,7 +282,8 @@ public class SchemaTest {
}
@Test
- public void testSimpleDateFormat() throws Exception {
+ public void testSimpleDateFormat()
+ throws Exception {
TimeGranularitySpec incomingTimeGranularitySpec =
new TimeGranularitySpec(FieldSpec.DataType.STRING, 1, TimeUnit.DAYS,
TimeFormat.SIMPLE_DATE_FORMAT + ":yyyyMMdd", "Date");
@@ -308,8 +291,7 @@ public class SchemaTest {
new TimeGranularitySpec(FieldSpec.DataType.STRING, 1, TimeUnit.DAYS,
TimeFormat.SIMPLE_DATE_FORMAT + ":yyyyMMdd", "Date");
Schema schema = new Schema.SchemaBuilder().setSchemaName("testSchema")
- .addTime(incomingTimeGranularitySpec, outgoingTimeGranularitySpec)
- .build();
+ .addTime(incomingTimeGranularitySpec, outgoingTimeGranularitySpec).build();
String jsonSchema = schema.getJSONSchema();
Schema schemaFromJson = Schema.fromString(jsonSchema);
Assert.assertEquals(schemaFromJson, schema);
@@ -317,7 +299,8 @@ public class SchemaTest {
}
@Test
- public void testByteType() throws DecoderException, IOException {
+ public void testByteType()
+ throws DecoderException, IOException {
Schema expectedSchema = new Schema();
byte[] expectedEmptyDefault = new byte[0];
byte[] expectedNonEmptyDefault = Hex.decodeHex("abcd1234".toCharArray());
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/http/MultiGetRequestTest.java b/pinot-common/src/test/java/org/apache/pinot/common/http/MultiGetRequestTest.java
index 9c97f86..40d6e94 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/http/MultiGetRequestTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/http/MultiGetRequestTest.java
@@ -62,7 +62,6 @@ public class MultiGetRequestTest {
startServer(portStart, createHandler(SUCCESS_CODE, SUCCESS_MSG, 0));
startServer(portStart + 1, createHandler(ERROR_CODE, ERROR_MSG, 0));
startServer(portStart + 2, createHandler(SUCCESS_CODE, TIMEOUT_MSG, TIMEOUT_MS));
-
}
@AfterTest
@@ -72,8 +71,7 @@ public class MultiGetRequestTest {
}
}
- private HttpHandler createHandler(final int status, final String msg,
- final int sleepTimeMs) {
+ private HttpHandler createHandler(final int status, final String msg, final int sleepTimeMs) {
return new HttpHandler() {
@Override
public void handle(HttpExchange httpExchange)
@@ -107,17 +105,15 @@ public class MultiGetRequestTest {
return server;
}
-
@Test
public void testMultiGet() {
- MultiGetRequest mget = new MultiGetRequest(Executors.newCachedThreadPool(),
- new MultiThreadedHttpConnectionManager());
+ MultiGetRequest mget =
+ new MultiGetRequest(Executors.newCachedThreadPool(), new MultiThreadedHttpConnectionManager());
List<String> urls = Arrays.asList("http://localhost:" + String.valueOf(portStart) + URI_PATH,
"http://localhost:" + String.valueOf(portStart + 1) + URI_PATH,
"http://localhost:" + String.valueOf(portStart + 2) + URI_PATH,
// 2nd request to the same server
- "http://localhost:" + String.valueOf(portStart) + URI_PATH
- );
+ "http://localhost:" + String.valueOf(portStart) + URI_PATH);
// timeout value needs to be less than 5000ms set above for
// third server
final int requestTimeoutMs = 1000;
@@ -128,7 +124,7 @@ public class MultiGetRequestTest {
for (int i = 0; i < urls.size(); i++) {
GetMethod getMethod = null;
try {
- getMethod = completionService.take().get();
+ getMethod = completionService.take().get();
if (getMethod.getStatusCode() >= 300) {
++errors;
Assert.assertEquals(getMethod.getResponseBodyAsString(), ERROR_MSG);
@@ -136,7 +132,6 @@ public class MultiGetRequestTest {
++success;
Assert.assertEquals(getMethod.getResponseBodyAsString(), SUCCESS_MSG);
}
-
} catch (InterruptedException e) {
LOGGER.error("Interrupted", e);
++errors;
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentMergeLineageTest.java b/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentMergeLineageTest.java
index f9ec814..29fe07a 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentMergeLineageTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentMergeLineageTest.java
@@ -30,7 +30,8 @@ import org.testng.annotations.Test;
public class SegmentMergeLineageTest {
@Test
- public void testSegmentMergeLineage() throws Exception {
+ public void testSegmentMergeLineage()
+ throws Exception {
SegmentMergeLineage segmentMergeLineage = new SegmentMergeLineage("test_OFFLINE");
// Start with 3 original segments.
@@ -56,24 +57,24 @@ public class SegmentMergeLineageTest {
Assert.assertEquals(segmentMergeLineage.getSegmentsForGroup(groupId4), groupSegments4);
Assert.assertEquals(segmentMergeLineage.getChildrenForGroup(groupId4),
Arrays.asList(new String[]{groupId1, groupId2}));
- Assert.assertEquals(segmentMergeLineage.getSegmentsForGroup(groupId4),
- Arrays.asList(new String[]{"segment4"}));
+ Assert.assertEquals(segmentMergeLineage.getSegmentsForGroup(groupId4), Arrays.asList(new String[]{"segment4"}));
// 2 more original segments gets uploaded.
String groupId5 = "G5";
- List<String> groupSegments5 = Arrays.asList(new String[] {"segment 5"});
+ List<String> groupSegments5 = Arrays.asList(new String[]{"segment 5"});
segmentMergeLineage.addSegmentGroup(groupId5, groupSegments5, null);
Assert.assertEquals(segmentMergeLineage.getSegmentsForGroup(groupId5), groupSegments5);
String groupId6 = "G6";
- List<String> groupSegments6 = Arrays.asList(new String[] {"segment 6"});
+ List<String> groupSegments6 = Arrays.asList(new String[]{"segment 6"});
segmentMergeLineage.addSegmentGroup(groupId6, groupSegments6, null);
Assert.assertEquals(segmentMergeLineage.getSegmentsForGroup(groupId6), groupSegments6);
// Let's say a merge task merges segment 3,5,6 into 7,8.
String groupId7 = "G7";
- List<String> groupSegments7= Arrays.asList(new String[]{"segment7", "segment8"});
- segmentMergeLineage.addSegmentGroup(groupId7, groupSegments7, Arrays.asList(new String[]{groupId3, groupId5, groupId6}));
+ List<String> groupSegments7 = Arrays.asList(new String[]{"segment7", "segment8"});
+ segmentMergeLineage
+ .addSegmentGroup(groupId7, groupSegments7, Arrays.asList(new String[]{groupId3, groupId5, groupId6}));
Assert.assertEquals(segmentMergeLineage.getSegmentsForGroup(groupId7), groupSegments7);
Assert.assertEquals(segmentMergeLineage.getChildrenForGroup(groupId7),
Arrays.asList(new String[]{groupId3, groupId5, groupId6}));
@@ -101,7 +102,8 @@ public class SegmentMergeLineageTest {
}
@Test
- public void testUpdateWithDuplicateGroupId() throws Exception {
+ public void testUpdateWithDuplicateGroupId()
+ throws Exception {
SegmentMergeLineage segmentMergeLineage = new SegmentMergeLineage("test_OFFLINE");
String groupId1 = "G1";
List<String> groupSegments1 = Arrays.asList(new String[]{"segment1, segment2, segment3"});
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/metadata/MetadataEqualsHashCodeTest.java b/pinot-common/src/test/java/org/apache/pinot/common/metadata/MetadataEqualsHashCodeTest.java
index 7cc1449..7710e03 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/metadata/MetadataEqualsHashCodeTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/metadata/MetadataEqualsHashCodeTest.java
@@ -50,13 +50,17 @@ public class MetadataEqualsHashCodeTest {
usingGetClass().verify();
EqualsVerifier.forClass(Schema.class).suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS).
usingGetClass().verify();
- EqualsVerifier.forClass(DimensionFieldSpec.class).suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS, Warning.TRANSIENT_FIELDS).
+ EqualsVerifier.forClass(DimensionFieldSpec.class)
+ .suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS, Warning.TRANSIENT_FIELDS).
usingGetClass().verify();
- EqualsVerifier.forClass(MetricFieldSpec.class).suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS, Warning.TRANSIENT_FIELDS).
+ EqualsVerifier.forClass(MetricFieldSpec.class)
+ .suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS, Warning.TRANSIENT_FIELDS).
usingGetClass().verify();
- EqualsVerifier.forClass(TimeFieldSpec.class).suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS, Warning.TRANSIENT_FIELDS).
+ EqualsVerifier.forClass(TimeFieldSpec.class)
+ .suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS, Warning.TRANSIENT_FIELDS).
usingGetClass().verify();
- EqualsVerifier.forClass(DateTimeFieldSpec.class).suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS, Warning.TRANSIENT_FIELDS).
+ EqualsVerifier.forClass(DateTimeFieldSpec.class)
+ .suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS, Warning.TRANSIENT_FIELDS).
usingGetClass().verify();
}
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/metadata/SegmentZKMetadataTest.java b/pinot-common/src/test/java/org/apache/pinot/common/metadata/SegmentZKMetadataTest.java
index da7f03a..551f940 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/metadata/SegmentZKMetadataTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/metadata/SegmentZKMetadataTest.java
@@ -56,13 +56,13 @@ public class SegmentZKMetadataTest {
assertEquals(inProgressSegmentMetadata, new RealtimeSegmentZKMetadata(inProgressZnRecord));
assertEquals(doneSegmentMetadata, new RealtimeSegmentZKMetadata(doneZnRecord));
- Assert.assertTrue(MetadataUtils.comparisonZNRecords(inProgressZnRecord, new RealtimeSegmentZKMetadata(inProgressZnRecord).toZNRecord()));
- Assert.assertTrue(MetadataUtils.comparisonZNRecords(doneZnRecord, new RealtimeSegmentZKMetadata(doneZnRecord).toZNRecord()));
+ Assert.assertTrue(MetadataUtils
+ .comparisonZNRecords(inProgressZnRecord, new RealtimeSegmentZKMetadata(inProgressZnRecord).toZNRecord()));
+ Assert.assertTrue(
+ MetadataUtils.comparisonZNRecords(doneZnRecord, new RealtimeSegmentZKMetadata(doneZnRecord).toZNRecord()));
- assertEquals(inProgressSegmentMetadata,
- new RealtimeSegmentZKMetadata(inProgressSegmentMetadata.toZNRecord()));
+ assertEquals(inProgressSegmentMetadata, new RealtimeSegmentZKMetadata(inProgressSegmentMetadata.toZNRecord()));
assertEquals(doneSegmentMetadata, new RealtimeSegmentZKMetadata(doneSegmentMetadata.toZNRecord()));
-
}
@Test
@@ -71,7 +71,8 @@ public class SegmentZKMetadataTest {
OfflineSegmentZKMetadata offlineSegmentMetadata = getTestOfflineSegmentMetadata();
Assert.assertTrue(MetadataUtils.comparisonZNRecords(offlineZNRecord, offlineSegmentMetadata.toZNRecord()));
assertEquals(offlineSegmentMetadata, new OfflineSegmentZKMetadata(offlineZNRecord));
- Assert.assertTrue(MetadataUtils.comparisonZNRecords(offlineZNRecord, new OfflineSegmentZKMetadata(offlineZNRecord).toZNRecord()));
+ Assert.assertTrue(
+ MetadataUtils.comparisonZNRecords(offlineZNRecord, new OfflineSegmentZKMetadata(offlineZNRecord).toZNRecord()));
assertEquals(offlineSegmentMetadata, new OfflineSegmentZKMetadata(offlineSegmentMetadata.toZNRecord()));
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/metrics/MetricsHelperTest.java b/pinot-common/src/test/java/org/apache/pinot/common/metrics/MetricsHelperTest.java
index 7362ef8..3819cef 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/metrics/MetricsHelperTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/metrics/MetricsHelperTest.java
@@ -67,7 +67,8 @@ public class MetricsHelperTest {
// Initialize the MetricsHelper and create a new timer
MetricsHelper.initializeMetrics(configuration.subset("pinot.broker.metrics"));
MetricsHelper.registerMetricsRegistry(registry);
- MetricsHelper.newTimer(registry, new MetricName(MetricsHelperTest.class, "dummy"), TimeUnit.MILLISECONDS, TimeUnit.MILLISECONDS);
+ MetricsHelper.newTimer(registry, new MetricName(MetricsHelperTest.class, "dummy"), TimeUnit.MILLISECONDS,
+ TimeUnit.MILLISECONDS);
// Check that the two listeners fired
assertTrue(listenerOneOkay);
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/partition/IdealStateBuilderUtil.java b/pinot-common/src/test/java/org/apache/pinot/common/partition/IdealStateBuilderUtil.java
index 6fe328e..c55e758 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/partition/IdealStateBuilderUtil.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/partition/IdealStateBuilderUtil.java
@@ -76,7 +76,8 @@ public class IdealStateBuilderUtil {
return this;
}
- public IdealStateBuilderUtil addConsumingSegments(int numPartitions, int seqNum, int numReplicas, List<String> instances) {
+ public IdealStateBuilderUtil addConsumingSegments(int numPartitions, int seqNum, int numReplicas,
+ List<String> instances) {
int serverId = 0;
for (int p = 0; p < numPartitions; p++) {
LLCSegmentName llcSegmentName = new LLCSegmentName(_rawTableName, p, seqNum, System.currentTimeMillis());
@@ -135,7 +136,7 @@ public class IdealStateBuilderUtil {
Map<String, String> newInstanceStateMap = new HashMap<>(instanceStateMap.size());
int serverId = 0;
for (Map.Entry<String, String> entry : instanceStateMap.entrySet()) {
- newInstanceStateMap.put(instances.get(serverId ++), entry.getValue());
+ newInstanceStateMap.put(instances.get(serverId++), entry.getValue());
}
_idealState.setInstanceStateMap(llcSegmentName.getSegmentName(), newInstanceStateMap);
break;
@@ -169,5 +170,4 @@ public class IdealStateBuilderUtil {
_idealState.getRecord().getMapFields().clear();
return this;
}
-
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/partition/StreamPartitionAssignmentGeneratorTest.java b/pinot-common/src/test/java/org/apache/pinot/common/partition/StreamPartitionAssignmentGeneratorTest.java
index 261a846..2ac46cc 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/partition/StreamPartitionAssignmentGeneratorTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/partition/StreamPartitionAssignmentGeneratorTest.java
@@ -53,7 +53,8 @@ public class StreamPartitionAssignmentGeneratorTest {
}
@BeforeMethod
- public void setUp() throws Exception {
+ public void setUp()
+ throws Exception {
_mockHelixManager = mock(HelixManager.class);
final int maxInstances = 20;
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/query/gen/AvroQueryGenerator.java b/pinot-common/src/test/java/org/apache/pinot/common/query/gen/AvroQueryGenerator.java
index e8d3a34..42fb53c 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/query/gen/AvroQueryGenerator.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/query/gen/AvroQueryGenerator.java
@@ -42,6 +42,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.pinot.common.data.FieldSpec.DataType;
+
public class AvroQueryGenerator {
public interface TestAggreationQuery {
@@ -108,7 +109,8 @@ public class AvroQueryGenerator {
private boolean isRealtimeSegment = false;
public AvroQueryGenerator(File avroFile, List<String> dimensions, List<String> metrics, String time,
- String resourceName) throws FileNotFoundException, IOException {
+ String resourceName)
+ throws FileNotFoundException, IOException {
this.avroFile = avroFile;
this.dimensions = dimensions;
this.metrics = metrics;
@@ -119,7 +121,8 @@ public class AvroQueryGenerator {
}
public AvroQueryGenerator(File avroFile, List<String> dimensions, List<String> metrics, String time,
- String resourceName, boolean isRealtimeSegment) throws FileNotFoundException, IOException {
+ String resourceName, boolean isRealtimeSegment)
+ throws FileNotFoundException, IOException {
this.avroFile = avroFile;
this.dimensions = dimensions;
this.metrics = metrics;
@@ -130,7 +133,8 @@ public class AvroQueryGenerator {
this.isRealtimeSegment = isRealtimeSegment;
}
- public void init() throws FileNotFoundException, IOException {
+ public void init()
+ throws FileNotFoundException, IOException {
dataStream =
new DataFileStream<GenericRecord>(new FileInputStream(avroFile), new GenericDatumReader<GenericRecord>());
schema = dataStream.getSchema();
@@ -156,7 +160,8 @@ public class AvroQueryGenerator {
... 41415 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org