You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2021/08/21 04:34:06 UTC
[pinot] branch master updated: Reformat code base with line length
120 (#7342)
This is an automated email from the ASF dual-hosted git repository.
xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 7e9ca6a Reformat code base with line length 120 (#7342)
7e9ca6a is described below
commit 7e9ca6a5a4afe0d4e283ac1307c45430e474cbf2
Author: Xiang Fu <xi...@gmail.com>
AuthorDate: Fri Aug 20 21:33:52 2021 -0700
Reformat code base with line length 120 (#7342)
---
config/checkstyle.xml | 4 +-
config/codestyle-intellij.xml | 12 +-
.../pinotdruidbenchmark/PinotThroughput.java | 1 +
.../images/pinot/etc/conf/pinot-broker-log4j2.xml | 8 +-
.../pinot/etc/conf/pinot-controller-log4j2.xml | 8 +-
.../images/pinot/etc/conf/pinot-server-log4j2.xml | 8 +-
.../apache/pinot/broker/api/RequestStatistics.java | 4 +-
.../broker/api/resources/PinotBrokerDebug.java | 26 +-
.../api/resources/PinotBrokerHealthCheck.java | 5 +-
.../broker/api/resources/PinotBrokerRouting.java | 15 +-
.../broker/api/resources/PinotClientRequest.java | 32 +-
.../broker/broker/helix/BaseBrokerStarter.java | 3 +-
.../broker/broker/helix/ClusterChangeMediator.java | 3 +-
.../broker/broker/helix/HelixBrokerStarter.java | 6 +-
.../HelixExternalViewBasedQueryQuotaManager.java | 22 +-
.../apache/pinot/broker/queryquota/HitCounter.java | 6 +-
.../pinot/broker/queryquota/MaxHitRateTracker.java | 4 +-
.../requesthandler/BaseBrokerRequestHandler.java | 9 +-
.../pinot/broker/routing/RoutingManager.java | 20 +-
.../instanceselector/BaseInstanceSelector.java | 11 +-
.../segmentpruner/SegmentPrunerFactory.java | 11 +-
.../routing/segmentpruner/TimeSegmentPruner.java | 18 +-
.../segmentpruner/interval/IntervalTree.java | 5 +-
.../segmentselector/RealtimeSegmentSelector.java | 23 +-
.../segmentselector/SegmentSelectorFactory.java | 1 +
...elixExternalViewBasedQueryQuotaManagerTest.java | 3 +-
.../broker/queryquota/MaxHitRateTrackerTest.java | 3 +-
.../request/PqlAndCalciteSqlCompatibilityTest.java | 51 +-
.../LiteralOnlyBrokerRequestTest.java | 16 +-
.../broker/requesthandler/QueryValidationTest.java | 26 +-
pinot-broker/src/test/resources/log4j2.xml | 2 +-
.../org/apache/pinot/client/ExecutionStats.java | 12 +-
.../apache/pinot/client/ExecutionStatsTest.java | 7 +-
.../pinot/client/ExternalViewReaderTest.java | 16 +-
.../pinot/client/ResultTableResultSetTest.java | 4 +-
.../pinot/client/SelectionResultSetTest.java | 3 +-
pinot-clients/pinot-jdbc-client/pom.xml | 3 +-
.../pinot/client/PinotConnectionMetaData.java | 7 +-
.../java/org/apache/pinot/client/PinotDriver.java | 6 +-
.../apache/pinot/client/PinotResultMetadata.java | 3 +-
.../response/ControllerTenantBrokerResponse.java | 3 +-
.../org/apache/pinot/client/utils/Constants.java | 25 +-
.../org/apache/pinot/client/PinotDriverTest.java | 3 +-
.../pinot/client/PinotPreparedStatementTest.java | 16 +-
pinot-common/pom.xml | 36 +-
.../assignment/InstanceAssignmentConfigUtils.java | 33 +-
.../common/assignment/InstancePartitions.java | 9 +-
.../common/assignment/InstancePartitionsUtils.java | 26 +-
.../pinot/common/exception/QueryException.java | 33 +-
.../pinot/common/function/DateTimeUtils.java | 4 +-
.../pinot/common/function/FunctionInvoker.java | 10 +-
.../pinot/common/function/FunctionRegistry.java | 10 +-
.../apache/pinot/common/function/TimeZoneKey.java | 8 +-
.../common/function/scalar/DateTimeFunctions.java | 6 +-
.../apache/pinot/common/lineage/LineageEntry.java | 4 +-
.../common/lineage/SegmentLineageAccessHelper.java | 6 +-
.../pinot/common/metadata/ZKMetadataProvider.java | 72 +-
.../metadata/instance/InstanceZKMetadata.java | 6 +-
.../metadata/segment/SegmentPartitionMetadata.java | 3 +-
.../common/metadata/segment/SegmentZKMetadata.java | 3 +-
.../pinot/common/metrics/AbstractMetrics.java | 40 +-
.../apache/pinot/common/metrics/BrokerMetrics.java | 3 +-
.../pinot/common/metrics/BrokerQueryPhase.java | 9 +-
.../apache/pinot/common/metrics/BrokerTimer.java | 6 +-
.../pinot/common/metrics/ControllerMetrics.java | 3 +-
.../pinot/common/metrics/PinotMetricUtils.java | 21 +-
.../apache/pinot/common/metrics/ServerMetrics.java | 3 +-
.../pinot/common/metrics/ValidationMetrics.java | 9 +-
.../apache/pinot/common/minion/MinionClient.java | 20 +-
.../common/minion/MinionTaskMetadataUtils.java | 19 +-
.../protocols/SegmentCompletionProtocol.java | 27 +-
.../response/broker/BrokerResponseNative.java | 12 +-
.../common/response/broker/SelectionResults.java | 3 +-
.../restlet/resources/SegmentConsumerInfo.java | 3 +-
.../common/restlet/resources/SegmentErrorInfo.java | 4 +-
.../restlet/resources/SegmentServerDebugInfo.java | 5 +-
.../common/restlet/resources/SegmentSizeInfo.java | 3 +-
.../resources/StartReplaceSegmentsRequest.java | 3 +-
.../restlet/resources/TableMetadataInfo.java | 6 +-
.../segment/generation/SegmentGenerationUtils.java | 11 +-
.../common/tier/TimeBasedTierSegmentSelector.java | 6 +-
.../common/utils/ClientSSLContextGenerator.java | 32 +-
.../org/apache/pinot/common/utils/DataSchema.java | 10 +-
.../common/utils/FileUploadDownloadClient.java | 125 ++-
.../apache/pinot/common/utils/HLCSegmentName.java | 3 +-
.../org/apache/pinot/common/utils/HashUtil.java | 11 +-
.../apache/pinot/common/utils/LLCSegmentName.java | 6 +-
.../pinot/common/utils/NamedThreadFactory.java | 6 +-
.../apache/pinot/common/utils/PinotAppConfigs.java | 50 +-
.../apache/pinot/common/utils/PinotDataType.java | 9 +-
.../pinot/common/utils/PrimitiveArrayUtils.java | 5 +-
.../org/apache/pinot/common/utils/SchemaUtils.java | 12 +-
.../apache/pinot/common/utils/SegmentUtils.java | 19 +-
.../apache/pinot/common/utils/ServiceStatus.java | 55 +-
.../pinot/common/utils/TarGzCompressionUtils.java | 22 +-
.../common/utils/config/TableConfigUtils.java | 28 +-
.../pinot/common/utils/config/TierConfigUtils.java | 13 +-
.../common/utils/fetcher/BaseSegmentFetcher.java | 5 +-
.../common/utils/fetcher/HttpSegmentFetcher.java | 14 +-
.../pinot/common/utils/grpc/GrpcQueryClient.java | 3 +-
.../common/utils/grpc/GrpcRequestBuilder.java | 7 +-
.../pinot/common/utils/helix/HelixHelper.java | 61 +-
.../common/utils/helix/LeadControllerUtils.java | 6 +-
.../PinotHelixPropertyStoreZnRecordProvider.java | 3 +-
.../pinot/common/utils/request/RequestUtils.java | 4 +-
.../common/utils/webhdfs/WebHdfsV1Client.java | 14 +-
.../utils/BrokerRequestComparisonUtils.java | 54 +-
.../parsers/PinotQuery2BrokerRequestConverter.java | 3 +-
.../pql/parsers/Pql2CompilationException.java | 3 +-
.../org/apache/pinot/pql/parsers/Pql2Compiler.java | 16 +-
.../parsers/pql2/ast/BetweenPredicateAstNode.java | 7 +-
.../pql2/ast/ComparisonPredicateAstNode.java | 6 +-
.../pinot/pql/parsers/pql2/ast/FilterKind.java | 4 +-
.../pinot/pql/parsers/pql2/ast/OrderByAstNode.java | 12 +-
.../pql/parsers/pql2/ast/PredicateListAstNode.java | 3 +-
.../pinot/pql/parsers/pql2/ast/SelectAstNode.java | 4 +-
.../pql/parsers/pql2/ast/TableNameAstNode.java | 3 +-
.../pql2/ast/TextMatchPredicateAstNode.java | 3 +-
.../apache/pinot/sql/parsers/CalciteSqlParser.java | 64 +-
.../pinot/common/data/DateTimeFormatSpecTest.java | 173 +--
.../apache/pinot/common/data/FieldSpecTest.java | 65 +-
.../org/apache/pinot/common/data/SchemaTest.java | 48 +-
.../function/AggregationFunctionTypeTest.java | 35 +-
.../pinot/common/function/JsonFunctionsTest.java | 27 +-
.../common/function/TransformFunctionTypeTest.java | 3 +-
.../pinot/common/http/MultiGetRequestTest.java | 6 +-
.../pinot/common/lineage/SegmentLineageTest.java | 13 +-
.../metadata/MetadataEqualsHashCodeTest.java | 20 +-
.../RealtimeToOfflineSegmentsTaskMetadataTest.java | 3 +-
.../common/metadata/SegmentZKMetadataTest.java | 45 +-
.../segment/ColumnPartitionMetadataTest.java | 3 +-
.../pinot/common/metrics/PinotMetricUtilsTest.java | 15 +-
.../pinot/common/minion/MinionClientTest.java | 11 +-
.../protocols/SegmentCompletionProtocolTest.java | 54 +-
.../transform/TransformExpressionTreeTest.java | 4 +-
.../generation/SegmentGenerationUtilsTest.java | 34 +-
.../pinot/common/tier/TierConfigUtilsTest.java | 41 +-
.../pinot/common/tier/TierSegmentSelectorTest.java | 10 +-
.../apache/pinot/common/utils/DataSchemaTest.java | 11 +-
.../common/utils/FileUploadDownloadClientTest.java | 12 +-
.../pinot/common/utils/PinotDataTypeTest.java | 63 +-
.../pinot/common/utils/SegmentNameBuilderTest.java | 15 +-
.../pinot/common/utils/ServiceStatusTest.java | 31 +-
.../apache/pinot/common/utils/URIUtilsTest.java | 16 +-
.../common/utils/config/InstanceUtilsTest.java | 3 +-
.../common/utils/config/TableConfigSerDeTest.java | 47 +-
.../common/utils/config/TableConfigUtilsTest.java | 25 +-
.../common/utils/config/TagNameUtilsTest.java | 7 +-
.../utils/fetcher/SegmentFetcherFactoryTest.java | 3 +-
.../apache/pinot/pql/parsers/Pql2CompilerTest.java | 120 +-
.../request/BrokerRequestSerializationTest.java | 6 +-
.../pinot/request/BrokerResponseNativeTest.java | 7 +-
.../pinot/sql/parsers/CalciteSqlCompilerTest.java | 846 ++++++++------
.../test/java/org/apache/pinot/util/TestUtils.java | 3 +-
pinot-connectors/pinot-spark-connector/pom.xml | 494 ++++-----
pinot-connectors/pom.xml | 38 +-
.../pinot/controller/BaseControllerStarter.java | 15 +-
.../apache/pinot/controller/ControllerConf.java | 18 +-
.../pinot/controller/LeadControllerManager.java | 18 +-
.../api/ControllerAdminApiApplication.java | 3 +-
.../api/access/BasicAuthAccessControlFactory.java | 3 +-
.../pinot/controller/api/debug/TableDebugInfo.java | 9 +-
.../api/events/DefaultMetadataEventNotifier.java | 1 +
.../api/events/MetadataEventNotifier.java | 1 +
.../api/resources/ControllerFilePathProvider.java | 4 +-
.../resources/LLCSegmentCompletionHandlers.java | 69 +-
.../api/resources/PinotBrokerRestletResource.java | 33 +-
.../api/resources/PinotClusterConfigs.java | 20 +-
.../api/resources/PinotControllerAuthResource.java | 5 +-
.../resources/PinotIngestionRestletResource.java | 26 +-
.../PinotInstanceAssignmentRestletResource.java | 18 +-
.../resources/PinotInstanceRestletResource.java | 68 +-
.../api/resources/PinotSchemaRestletResource.java | 71 +-
.../api/resources/PinotSegmentRestletResource.java | 94 +-
.../PinotSegmentUploadDownloadRestletResource.java | 62 +-
.../api/resources/PinotTableIndexingConfigs.java | 6 +-
.../api/resources/PinotTableInstances.java | 9 +-
.../api/resources/PinotTableMetadataConfigs.java | 6 +-
.../api/resources/PinotTableRestletResource.java | 47 +-
.../controller/api/resources/PinotTableSchema.java | 5 +-
.../api/resources/PinotTableSegmentConfigs.java | 9 +-
.../api/resources/PinotTableTenantConfigs.java | 11 +-
.../api/resources/PinotTaskRestletResource.java | 18 +-
.../api/resources/PinotTenantRestletResource.java | 83 +-
.../api/resources/ServerTableSizeReader.java | 7 +-
.../api/resources/TableConfigsRestletResource.java | 28 +-
.../api/resources/TableDebugResource.java | 17 +-
.../pinot/controller/api/resources/TableSize.java | 15 +-
.../api/resources/ZookeeperResource.java | 92 +-
.../controller/api/upload/SegmentValidator.java | 3 +-
.../pinot/controller/api/upload/ZKOperator.java | 11 +-
.../helix/core/PinotHelixResourceManager.java | 26 +-
.../helix/core/PinotTableIdealStateBuilder.java | 15 +-
.../InstanceReplicaGroupPartitionSelector.java | 4 +-
.../segment/OfflineDimTableSegmentAssignment.java | 3 +-
.../segment/OfflineSegmentAssignment.java | 6 +-
.../segment/RealtimeSegmentAssignment.java | 19 +-
.../core/assignment/segment/SegmentAssignment.java | 5 +-
.../segment/SegmentAssignmentFactory.java | 3 +-
.../assignment/segment/SegmentAssignmentUtils.java | 3 +-
.../core/minion/MinionInstancesCleanupTask.java | 10 +-
.../realtime/PinotLLCRealtimeSegmentManager.java | 58 +-
.../core/realtime/PinotRealtimeSegmentManager.java | 7 +-
.../core/realtime/SegmentCompletionManager.java | 25 +-
.../segment/CommittingSegmentDescriptor.java | 6 +-
.../SegmentSizeBasedFlushThresholdUpdater.java | 6 +-
.../helix/core/rebalance/TableRebalancer.java | 27 +-
.../helix/core/retention/RetentionManager.java | 3 +-
.../helix/core/util/HelixSetupUtils.java | 18 +-
.../controller/recommender/RecommenderDriver.java | 9 +-
.../recommender/data/generator/DataGenerator.java | 23 +-
.../data/generator/DataGeneratorSpec.java | 9 +-
.../data/generator/PatternMixtureGenerator.java | 86 +-
.../data/generator/PatternSeasonalGenerator.java | 113 +-
.../data/generator/PatternSequenceGenerator.java | 47 +-
.../data/generator/PatternSpikeGenerator.java | 123 +-
.../data/generator/PatternStringGenerator.java | 39 +-
.../recommender/data/generator/PatternType.java | 6 +-
.../data/generator/SchemaAnnotation.java | 1 +
.../exceptions/InvalidInputException.java | 4 +-
.../controller/recommender/io/ConfigManager.java | 3 +-
.../controller/recommender/io/InputManager.java | 6 +-
.../recommender/io/metadata/FieldMetadata.java | 3 +-
.../io/metadata/SchemaWithMetaData.java | 1 -
.../realtime/provisioning/MemoryEstimator.java | 46 +-
.../controller/recommender/rules/AbstractRule.java | 4 +-
.../recommender/rules/RulesToExecute.java | 13 +-
.../rules/impl/AggregateMetricsRule.java | 5 +-
.../recommender/rules/impl/BloomFilterRule.java | 5 +-
.../recommender/rules/impl/FlagQueryRule.java | 10 +-
.../rules/impl/InvertedSortedIndexJointRule.java | 9 +-
.../recommender/rules/impl/KafkaPartitionRule.java | 13 +-
.../NoDictionaryOnHeapDictionaryJointRule.java | 9 +-
.../rules/impl/PinotTablePartitionRule.java | 35 +-
.../recommender/rules/impl/RangeIndexRule.java | 9 +-
.../rules/impl/RealtimeProvisioningRule.java | 9 +-
.../recommender/rules/impl/SegmentSizeRule.java | 12 +-
.../rules/impl/VariedLengthDictionaryRule.java | 6 +-
.../recommender/rules/io/FlaggedQueries.java | 9 +-
.../recommender/rules/io/configs/IndexConfig.java | 200 ++--
.../rules/io/params/BloomFilterRuleParams.java | 9 +-
.../rules/io/params/FlagQueryRuleParams.java | 1 +
.../params/InvertedSortedIndexJointRuleParams.java | 17 +-
...oDictionaryOnHeapDictionaryJointRuleParams.java | 8 +-
.../rules/io/params/PartitionRuleParams.java | 1 +
.../rules/io/params/RangeIndexRuleParams.java | 4 +-
.../io/params/RealtimeProvisioningRuleParams.java | 3 +-
.../rules/io/params/RecommenderConstants.java | 14 +-
.../rules/io/params/SegmentSizeRuleParams.java | 1 -
.../recommender/rules/utils/FixedLenBitset.java | 51 +-
.../rules/utils/PredicateParseResult.java | 10 +-
.../utils/QueryInvertedSortedIndexRecommender.java | 27 +-
.../controller/tuner/TableConfigTunerUtils.java | 3 +-
.../controller/util/AutoAddInvertedIndex.java | 4 +-
.../util/ConsumingSegmentInfoReader.java | 13 +-
.../pinot/controller/util/FileIngestionHelper.java | 3 +-
.../util/ServerSegmentMetadataReader.java | 3 +-
.../BrokerResourceValidationManager.java | 3 +-
.../controller/validation/StorageQuotaChecker.java | 34 +-
.../pinot/controller/api/AccessControlTest.java | 3 +-
.../pinot/controller/api/TableViewsTest.java | 39 +-
.../api/access/AuthenticationFilterTest.java | 2 +-
.../org/apache/pinot/core/auth/BasicAuthUtils.java | 3 +-
.../core/data/manager/InstanceDataManager.java | 3 +-
.../manager/realtime/DefaultSegmentCommitter.java | 3 +-
.../realtime/HLRealtimeSegmentDataManager.java | 9 +-
.../realtime/LLRealtimeSegmentDataManager.java | 42 +-
.../manager/realtime/PinotFSSegmentUploader.java | 4 +-
.../manager/realtime/RealtimeTableDataManager.java | 15 +-
.../realtime/SegmentBuildTimeLeaseExtender.java | 11 +-
.../core/data/table/ConcurrentIndexedTable.java | 5 +-
.../pinot/core/data/table/SimpleIndexedTable.java | 3 +-
.../apache/pinot/core/data/table/TableResizer.java | 9 +-
.../table/UnboundedConcurrentIndexedTable.java | 4 +-
.../core/operator/InstanceResponseOperator.java | 6 +-
.../operator/blocks/PassThroughTransformBlock.java | 2 +-
.../combine/GroupByOrderByCombineOperator.java | 5 +-
.../BaseRawValueBasedPredicateEvaluator.java | 1 -
.../FSTBasedRegexpPredicateEvaluatorFactory.java | 209 ++--
.../predicate/RangePredicateEvaluatorFactory.java | 3 +-
.../query/DictionaryBasedDistinctOperator.java | 7 +-
.../transform/PassThroughTransformOperator.java | 4 +-
.../function/BinaryOperatorTransformFunction.java | 33 +-
.../transform/function/CaseTransformFunction.java | 3 +-
.../DateTimeConversionTransformFunction.java | 3 +-
.../function/DateTruncTransformFunction.java | 12 +-
.../function/GroovyTransformFunction.java | 12 +-
.../function/JsonExtractKeyTransformFunction.java | 3 +-
.../JsonExtractScalarTransformFunction.java | 11 +-
.../function/LookupTransformFunction.java | 3 +-
.../function/MapValueTransformFunction.java | 3 +-
.../function/TimeConversionTransformFunction.java | 3 +-
.../function/TransformFunctionFactory.java | 36 +-
.../core/periodictask/PeriodicTaskScheduler.java | 3 +-
.../plan/AggregationGroupByOrderByPlanNode.java | 3 +-
.../apache/pinot/core/plan/TransformPlanNode.java | 6 +-
.../aggregation/function/AggregationFunction.java | 3 +-
.../DistinctCountRawHLLAggregationFunction.java | 3 +-
...istinctCountThetaSketchAggregationFunction.java | 9 +-
.../function/ModeAggregationFunction.java | 24 +-
.../groupby/DictionaryBasedGroupKeyGenerator.java | 6 +-
.../core/query/config/QueryExecutorConfig.java | 3 +-
...ryBasedSingleColumnDistinctOrderByExecutor.java | 3 +-
.../pinot/core/query/optimizer/QueryOptimizer.java | 3 +-
.../optimizer/filter/NumericalFilterOptimizer.java | 18 +-
.../statement/JsonStatementOptimizer.java | 12 +-
.../query/pruner/ColumnValueSegmentPruner.java | 9 +-
.../core/query/reduce/BrokerReduceService.java | 7 +-
.../core/query/reduce/GroupByDataTableReducer.java | 6 +-
.../query/reduce/SelectionDataTableReducer.java | 4 +-
.../core/query/request/context/QueryContext.java | 9 +-
.../core/query/request/context/ThreadTimer.java | 2 +-
.../query/scheduler/MultiLevelPriorityQueue.java | 6 +-
.../core/query/scheduler/PriorityScheduler.java | 4 +-
.../pinot/core/query/scheduler/QueryScheduler.java | 6 +-
.../query/selection/SelectionOperatorUtils.java | 3 +-
.../processing/partitioner/PartitionerConfig.java | 3 +-
.../TransformFunctionRecordTransformer.java | 3 +-
.../pinot/core/transport/AsyncQueryResponse.java | 4 +-
.../core/transport/InstanceRequestHandler.java | 24 +-
.../apache/pinot/core/transport/QueryServer.java | 1 -
.../pinot/core/transport/ServerChannels.java | 6 +-
.../apache/pinot/core/util/ListenerConfigUtil.java | 53 +-
.../pinot/core/util/PeerServerSegmentFinder.java | 11 +-
.../pinot/core/util/SegmentProcessorAvroUtils.java | 3 +-
.../java/org/apache/pinot/core/util/TlsUtils.java | 16 +-
.../server/realtime/ControllerLeaderLocator.java | 24 +-
.../ServerSegmentCompletionProtocolHandler.java | 6 +-
.../core/common/datatable/DataTableUtilsTest.java | 5 +-
.../core/data/function/ArrayFunctionsTest.java | 159 ++-
.../core/data/function/DateTimeFunctionsTest.java | 71 +-
.../data/function/GroovyFunctionEvaluatorTest.java | 34 +-
.../core/data/function/JsonFunctionsTest.java | 41 +-
.../data/manager/BaseTableDataManagerTest.java | 6 +-
.../offline/DimensionTableDataManagerTest.java | 3 +-
.../realtime/LLRealtimeSegmentDataManagerTest.java | 3 +-
.../realtime/PinotFSSegmentUploaderTest.java | 17 +-
.../pinot/core/data/table/IndexedTableTest.java | 26 +-
.../pinot/core/data/table/TableResizerTest.java | 19 +-
.../core/geospatial/serde/GeometrySerdeTest.java | 2 +-
.../core/geospatial/transform/GeoFunctionTest.java | 2 +-
.../geospatial/transform/StAreaFunctionTest.java | 6 +-
.../geospatial/transform/StPointFunctionTest.java | 10 +-
.../operator/ThreadCpuTimeMeasurementTest.java | 14 +-
.../dociditerators/AndDocIdIteratorTest.java | 7 +-
.../dociditerators/OrDocIdIteratorTest.java | 7 +-
.../function/AdditionTransformFunctionTest.java | 7 +-
.../function/ArrayBaseTransformFunctionTest.java | 10 +-
.../BinaryOperatorTransformFunctionTest.java | 10 +-
.../function/CaseTransformFunctionTest.java | 25 +-
.../DateTimeConversionTransformFunctionTest.java | 18 +-
.../function/DivisionTransformFunctionTest.java | 10 +-
.../function/GroovyTransformFunctionTest.java | 32 +-
.../function/LookupTransformFunctionTest.java | 44 +-
.../function/ModuloTransformFunctionTest.java | 10 +-
.../MultiplicationTransformFunctionTest.java | 7 +-
.../function/SubtractionTransformFunctionTest.java | 10 +-
.../TimeConversionTransformFunctionTest.java | 29 +-
.../function/ValueInTransformFunctionTest.java | 17 +-
.../datetime/DateTimeConverterTest.java | 257 +++--
...adataAndDictionaryAggregationPlanMakerTest.java | 103 +-
.../DictionaryBasedGroupKeyGeneratorTest.java | 3 +-
.../query/aggregation/groupby/GroupByTrimTest.java | 9 +-
.../core/query/optimizer/QueryOptimizerTest.java | 22 +-
.../filter/NumericalFilterOptimizerTest.java | 106 +-
.../filter/TimePredicateFilterOptimizerTest.java | 34 +-
.../statement/JsonStatementOptimizerTest.java | 99 +-
.../core/query/reduce/HavingFilterHandlerTest.java | 13 +-
.../query/reduce/PostAggregationHandlerTest.java | 7 +-
.../BrokerRequestToQueryContextConverterTest.java | 21 +-
.../scheduler/MultiLevelPriorityQueueTest.java | 2 +-
.../selection/SelectionOperatorServiceTest.java | 120 +-
.../fakestream/FakePartitionLevelConsumer.java | 15 +-
.../impl/fakestream/FakeStreamConsumerFactory.java | 3 +-
.../impl/fakestream/FakeStreamLevelConsumer.java | 6 +-
.../fakestream/FakeStreamMetadataProvider.java | 9 +-
.../core/realtime/stream/StreamConfigTest.java | 8 +-
.../segment/processing/framework/ReducerTest.java | 24 +-
.../core/util/PeerServerSegmentFinderTest.java | 12 +-
.../apache/pinot/core/util/SchemaUtilsTest.java | 53 +-
.../apache/pinot/queries/BooleanQueriesTest.java | 3 +-
.../queries/DistinctCountBitmapQueriesTest.java | 14 +-
.../pinot/queries/DistinctCountQueriesTest.java | 7 +-
.../DistinctCountThetaSketchQueriesTest.java | 6 +-
.../apache/pinot/queries/DistinctQueriesTest.java | 21 +-
.../queries/FSTBasedRegexpLikeQueriesTest.java | 59 +-
.../apache/pinot/queries/H3IndexQueriesTest.java | 7 +-
.../org/apache/pinot/queries/IdSetQueriesTest.java | 6 +-
...erSegmentAggregationSingleValueQueriesTest.java | 3 +-
...terSegmentAggregationMultiValueQueriesTest.java | 15 +-
.../InterSegmentOrderByMultiValueQueriesTest.java | 9 +-
.../InterSegmentOrderBySingleValueQueriesTest.java | 284 +++--
...terSegmentResultTableMultiValueQueriesTest.java | 380 ++++---
...erSegmentResultTableSingleValueQueriesTest.java | 80 +-
.../pinot/queries/JsonDataTypeQueriesTest.java | 72 +-
.../apache/pinot/queries/JsonPathQueriesTest.java | 79 +-
.../org/apache/pinot/queries/ModeQueriesTest.java | 148 ++-
.../NoDictionaryCompressionQueriesTest.java | 123 +-
.../queries/PercentileTDigestQueriesTest.java | 3 +-
.../org/apache/pinot/queries/QueriesTestUtils.java | 9 +-
.../RangePredicateWithSortedInvertedIndexTest.java | 4 +-
...SegmentPartitionedDistinctCountQueriesTest.java | 10 +-
.../apache/pinot/queries/StUnionQueriesTest.java | 20 +-
.../pinot/queries/SumPrecisionQueriesTest.java | 41 +-
.../pinot/queries/TextSearchQueriesTest.java | 1172 ++++++++++++++------
.../apache/pinot/queries/TimestampQueriesTest.java | 9 +-
.../apache/pinot/queries/TransformQueriesTest.java | 6 +-
.../realtime/ControllerLeaderLocatorTest.java | 6 +-
pinot-core/src/test/resources/log4j2.xml | 2 +-
pinot-distribution/pinot-assembly.xml | 128 ++-
pinot-integration-tests/pom.xml | 106 +-
.../java/org/apache/pinot/compat/tests/BaseOp.java | 12 +-
.../pinot/compat/tests/ClusterDescriptor.java | 1 -
.../pinot/compat/tests/CompatibilityOpsRunner.java | 6 +-
.../org/apache/pinot/compat/tests/QueryOp.java | 11 +-
.../org/apache/pinot/compat/tests/SegmentOp.java | 31 +-
.../pinot/compat/tests/SqlResultComparator.java | 3 +-
.../org/apache/pinot/compat/tests/StreamOp.java | 30 +-
.../org/apache/pinot/compat/tests/TableOp.java | 23 +-
.../tests/AdminConsoleIntegrationTest.java | 32 +-
.../tests/BaseClusterIntegrationTestSet.java | 101 +-
.../tests/ChaosMonkeyIntegrationTest.java | 31 +-
.../ControllerPeriodicTasksIntegrationTest.java | 26 +-
...eTimeFieldSpecHybridClusterIntegrationTest.java | 4 +-
...ridClusterIntegrationTestCommandLineRunner.java | 3 +-
.../IngestionConfigHybridIntegrationTest.java | 31 +-
.../tests/JsonPathClusterIntegrationTest.java | 23 +-
.../tests/LLCRealtimeClusterIntegrationTest.java | 3 +-
.../MergeRollupMinionClusterIntegrationTest.java | 3 +-
...onaryAggregationPlanClusterIntegrationTest.java | 6 +-
.../tests/NullHandlingIntegrationTest.java | 4 +-
.../tests/OfflineClusterIntegrationTest.java | 83 +-
...rDownloadLLCRealtimeClusterIntegrationTest.java | 3 +-
...fflineSegmentsMinionClusterIntegrationTest.java | 3 +-
.../tests/SegmentCompletionIntegrationTest.java | 5 +-
.../tests/ServerStarterIntegrationTest.java | 25 +-
.../tests/SimpleMinionClusterIntegrationTest.java | 2 +-
.../tests/StarTreeClusterIntegrationTest.java | 3 +-
.../tests/ThetaSketchIntegrationTest.java | 9 +-
.../UpsertTableSegmentUploadIntegrationTest.java | 4 +-
.../executor/MinionTaskZkMetadataManager.java | 6 +-
pinot-minion/src/test/resources/log4j2.xml | 2 +-
.../apache/pinot/perf/BenchmarkCombineGroupBy.java | 13 +-
.../pinot/perf/BenchmarkDictionaryCreation.java | 4 +-
.../pinot/perf/BenchmarkFixedBitIntReader.java | 5 +-
.../BenchmarkFixedBitSVForwardIndexReader.java | 5 +-
.../perf/BenchmarkFixedIntArrayOffHeapIdMap.java | 6 +-
.../pinot/perf/BenchmarkGeospatialSerde.java | 6 +-
.../apache/pinot/perf/BenchmarkIndexedTable.java | 13 +-
.../BenchmarkNoDictionaryIntegerCompression.java | 33 +-
.../perf/BenchmarkNoDictionaryLongCompression.java | 32 +-
.../BenchmarkNoDictionaryStringCompression.java | 32 +-
...BenchmarkOffheapBitmapInvertedIndexCreator.java | 25 +-
.../apache/pinot/perf/BenchmarkQueryEngine.java | 3 +-
.../org/apache/pinot/perf/RawIndexBenchmark.java | 3 +-
.../pinot/perf/StringDictionaryPerfTest.java | 19 +-
.../batch/common/SegmentGenerationJobUtils.java | 1 +
.../batch/common/SegmentGenerationTaskRunner.java | 5 +-
.../src/test/resources/log4j2.xml | 2 +-
.../pinot-batch-ingestion-hadoop/pom.xml | 4 +-
.../src/test/resources/log4j2.xml | 2 +-
.../spark/SparkSegmentGenerationJobRunner.java | 3 +-
.../spark/SparkSegmentMetadataPushJobRunner.java | 3 +-
.../batch/spark/SparkSegmentTarPushJobRunner.java | 3 +-
.../batch/spark/SparkSegmentUriPushJobRunner.java | 3 +-
.../pinot-batch-ingestion-standalone/pom.xml | 4 +-
.../src/test/resources/log4j2.xml | 2 +-
.../pinot/hadoop/PinotHadoopJobLauncher.java | 3 +-
.../pinot/hadoop/io/CombineAvroKeyInputFormat.java | 3 +-
.../apache/pinot/hadoop/io/PinotOutputFormat.java | 8 +-
.../apache/pinot/hadoop/io/PinotRecordWriter.java | 7 +-
.../pinot/hadoop/job/HadoopSegmentCreationJob.java | 7 +-
.../hadoop/job/HadoopSegmentPreprocessingJob.java | 40 +-
.../job/mappers/AvroDataPreprocessingMapper.java | 17 +-
.../job/mappers/OrcDataPreprocessingMapper.java | 14 +-
.../hadoop/job/mappers/SegmentCreationMapper.java | 69 +-
.../job/mappers/SegmentPreprocessingMapper.java | 12 +-
.../AvroDataPreprocessingPartitioner.java | 18 +-
.../job/partitioners/GenericPartitioner.java | 3 +-
.../OrcDataPreprocessingPartitioner.java | 11 +-
.../preprocess/AvroDataPreprocessingHelper.java | 6 +-
.../job/preprocess/DataPreprocessingHelper.java | 17 +-
.../preprocess/DataPreprocessingHelperFactory.java | 7 +-
.../job/preprocess/OrcDataPreprocessingHelper.java | 12 +-
.../job/reducers/AvroDataPreprocessingReducer.java | 3 +-
.../utils/preprocess/DataPreprocessingUtils.java | 3 +-
.../pinot/hadoop/utils/preprocess/OrcUtils.java | 3 +-
.../hadoop/data/IngestionSchemaValidatorTest.java | 59 +-
.../pinot/hadoop/io/PinotOutputFormatTest.java | 9 +-
.../ingestion/jobs/SegmentPreprocessingJob.java | 3 +-
.../apache/pinot/spark/PinotSparkJobLauncher.java | 3 +-
.../spark/jobs/SparkSegmentCreationFunction.java | 51 +-
.../pinot/spark/jobs/SparkSegmentCreationJob.java | 16 +-
.../pinot/spark/jobs/SparkSegmentTarPushJob.java | 13 +-
.../pinot/spark/jobs/SparkSegmentUriPushJob.java | 7 +-
.../utils/PinotSparkJobPreparationHelper.java | 3 +-
.../pinot/spark/SegmentCreationSparkTest.java | 6 +-
.../pinot-environment/pinot-azure/pom.xml | 56 +-
.../plugin/provider/AzureEnvironmentProvider.java | 33 +-
.../provider/AzureEnvironmentProviderTest.java | 27 +-
pinot-plugins/pinot-environment/pom.xml | 2 +-
.../pinot/plugin/filesystem/ADLSGen2PinotFS.java | 55 +-
.../pinot/plugin/filesystem/AzurePinotFS.java | 4 +-
.../filesystem/test/ADLSGen2PinotFSTest.java | 20 +-
.../plugin/filesystem/test/AzurePinotFSTest.java | 3 +-
.../filesystem/test/AzurePinotFSUtilTest.java | 3 +-
.../apache/pinot/plugin/filesystem/GcsPinotFS.java | 6 +-
.../org/apache/pinot/plugin/filesystem/GcsUri.java | 4 +-
.../pinot/plugin/filesystem/TestGcsPinotFS.java | 9 +-
.../pinot/plugin/filesystem/HadoopPinotFS.java | 12 +-
.../pinot-hdfs/src/test/resources/log4j2.xml | 2 +-
pinot-plugins/pinot-file-system/pinot-s3/pom.xml | 3 +-
.../apache/pinot/plugin/filesystem/S3PinotFS.java | 38 +-
.../pinot/plugin/filesystem/S3PinotFSTest.java | 52 +-
pinot-plugins/pinot-file-system/pom.xml | 2 +-
.../avro/AvroIngestionSchemaValidator.java | 36 +-
.../pinot/plugin/inputformat/avro/AvroUtils.java | 67 +-
.../avro/AvroRecordExtractorComplexTypesTest.java | 19 +-
.../inputformat/avro/AvroRecordExtractorTest.java | 20 +-
.../avro/AvroRecordToPinotRowGeneratorTest.java | 6 +-
.../plugin/inputformat/avro/AvroUtilsTest.java | 98 +-
.../pinot-avro-base/src/test/resources/log4j2.xml | 2 +-
.../inputformat/avro/KafkaAvroMessageDecoder.java | 19 +-
...aConfluentSchemaRegistryAvroMessageDecoder.java | 3 +-
.../plugin/inputformat/csv/CSVRecordExtractor.java | 6 +-
.../inputformat/csv/CSVRecordExtractorConfig.java | 4 +-
.../inputformat/csv/CSVRecordExtractorTest.java | 3 +-
.../inputformat/csv/CSVRecordReaderTest.java | 9 +-
.../pinot-csv/src/test/resources/log4j2.xml | 2 +-
.../inputformat/json/JSONMessageDecoder.java | 3 +-
.../inputformat/json/JSONRecordExtractorTest.java | 5 +-
.../inputformat/json/JSONRecordReaderTest.java | 6 +-
.../pinot-json/src/test/resources/log4j2.xml | 2 +-
.../plugin/inputformat/orc/ORCRecordReader.java | 21 +-
.../inputformat/orc/ORCRecordExtractorTest.java | 87 +-
.../inputformat/orc/ORCRecordReaderTest.java | 11 +-
.../pinot-orc/src/test/resources/log4j2.xml | 2 +-
.../parquet/ParquetNativeRecordExtractor.java | 13 +-
.../parquet/ParquetNativeRecordReader.java | 11 +-
.../plugin/inputformat/parquet/ParquetUtils.java | 10 +-
.../parquet/ParquetRecordReaderTest.java | 6 +-
.../pinot-parquet/src/test/resources/log4j2.xml | 2 +-
.../protobuf/ProtoBufRecordExtractor.java | 12 +-
.../inputformat/protobuf/ProtoBufRecordReader.java | 3 +-
.../protobuf/ProtoBufRecordExtractorTest.java | 30 +-
.../protobuf/ProtoBufRecordReaderTest.java | 10 +-
.../inputformat/thrift/ThriftRecordReader.java | 3 +-
.../thrift/ThriftRecordExtractorTest.java | 39 +-
.../inputformat/thrift/ThriftRecordReaderTest.java | 9 +-
pinot-plugins/pinot-input-format/pom.xml | 2 +-
.../metrics/yammer/YammerMetricsRegistry.java | 3 +-
.../BaseMultipleSegmentsConversionExecutor.java | 43 +-
.../tasks/BaseSingleSegmentConversionExecutor.java | 35 +-
.../plugin/minion/tasks/BaseTaskExecutor.java | 10 +-
.../pinot/plugin/minion/tasks/MergeTaskUtils.java | 21 +-
.../minion/tasks/SegmentConversionResult.java | 3 +-
.../minion/tasks/SegmentConversionUtils.java | 37 +-
.../ConvertToRawIndexTaskExecutor.java | 9 +-
.../ConvertToRawIndexTaskGenerator.java | 9 +-
.../tasks/mergerollup/MergeRollupTaskExecutor.java | 19 +-
.../mergerollup/MergeRollupTaskGenerator.java | 139 ++-
.../minion/tasks/purge/PurgeTaskExecutor.java | 14 +-
.../RealtimeToOfflineSegmentsTaskExecutor.java | 37 +-
.../RealtimeToOfflineSegmentsTaskGenerator.java | 86 +-
.../SegmentGenerationAndPushResult.java | 3 +-
.../SegmentGenerationAndPushTaskExecutor.java | 48 +-
.../SegmentGenerationAndPushTaskGenerator.java | 55 +-
.../plugin/minion/tasks/MergeTaskUtilsTest.java | 25 +-
.../mergerollup/MergeRollupTaskExecutorTest.java | 6 +-
.../mergerollup/MergeRollupTaskGeneratorTest.java | 285 +++--
.../minion/tasks/purge/PurgeTaskExecutorTest.java | 4 +-
.../RealtimeToOfflineSegmentsTaskExecutorTest.java | 125 ++-
...RealtimeToOfflineSegmentsTaskGeneratorTest.java | 131 ++-
.../SegmentGenerationAndPushTaskGeneratorTest.java | 9 +-
.../filebased/FileBasedSegmentWriter.java | 37 +-
.../filebased/FileBasedSegmentWriterTest.java | 90 +-
.../stream/kafka09/KafkaLowLevelStreamConfig.java | 4 +-
.../kafka09/KafkaPartitionLevelConsumer.java | 3 +-
.../stream/kafka09/KafkaStreamLevelConsumer.java | 3 +-
.../kafka09/KafkaStreamMetadataProvider.java | 3 +-
.../stream/kafka09/SimpleConsumerFactory.java | 3 +-
.../kafka09/server/KafkaDataServerStartable.java | 6 +-
.../pinot-kafka-0.9/src/test/resources/log4j2.xml | 2 +-
.../kafka20/KafkaPartitionLevelConsumer.java | 3 +-
.../stream/kafka20/KafkaStreamLevelConsumer.java | 3 +-
.../kafka20/KafkaStreamLevelConsumerManager.java | 6 +-
.../kafka20/KafkaStreamLevelStreamConfig.java | 21 +-
.../kafka20/KafkaStreamMetadataProvider.java | 7 +-
.../pinot-kafka-2.0/src/test/resources/log4j2.xml | 2 +-
.../stream/kafka/KafkaJSONMessageDecoder.java | 3 +-
.../pinot-kafka-base/src/test/resources/log4j2.xml | 2 +-
.../pinot-stream-ingestion/pinot-kinesis/pom.xml | 3 +-
.../kinesis/KinesisPartitionGroupOffset.java | 6 +-
.../kinesis/KinesisStreamMetadataProvider.java | 2 +-
.../kinesis/KinesisStreamMetadataProviderTest.java | 7 +-
.../plugin/stream/pulsar/PulsarMessageBatch.java | 6 +-
.../PulsarPartitionLevelConnectionHandler.java | 3 +-
.../pulsar/PulsarPartitionLevelConsumer.java | 6 +-
.../pulsar/PulsarStreamMetadataProvider.java | 3 +-
.../src/test/resources/standalone.properties | 28 +-
pinot-plugins/pom.xml | 5 +-
.../segment/local/customobject/QuantileDigest.java | 8 +-
.../local/data/manager/TableDataManager.java | 5 +-
.../local/data/manager/TableDataManagerConfig.java | 7 +-
.../local/function/FunctionEvaluatorFactory.java | 23 +-
.../local/function/GroovyFunctionEvaluator.java | 3 +-
.../local/function/InbuiltFunctionEvaluator.java | 3 +-
.../local/function/TimeSpecFunctionEvaluator.java | 6 +-
.../indexsegment/mutable/IntermediateSegment.java | 3 +-
.../indexsegment/mutable/MutableSegmentImpl.java | 15 +-
.../local/io/reader/impl/FixedBitIntReader.java | 21 +-
.../RealtimeIndexOffHeapMemoryManager.java | 7 +-
...ixedByteSingleValueMultiColumnReaderWriter.java | 3 +-
.../local/io/util/FixedBitIntReaderWriter.java | 3 +-
.../local/io/util/FixedBitIntReaderWriterV2.java | 6 +-
.../segment/local/io/util/PinotDataBitSet.java | 12 +-
.../segment/local/io/util/PinotDataBitSetV2.java | 12 +-
.../writer/impl/BaseChunkSVForwardIndexWriter.java | 7 +-
.../writer/impl/FixedBitMVForwardIndexWriter.java | 7 +-
.../impl/FixedByteChunkSVForwardIndexWriter.java | 7 +-
.../writer/impl/MutableOffHeapByteArrayStore.java | 10 +-
.../impl/VarByteChunkSVForwardIndexWriter.java | 7 +-
.../local/loader/LocalSegmentDirectoryLoader.java | 3 +-
.../dictionary/BaseOffHeapMutableDictionary.java | 13 +-
.../dictionary/IntOffHeapMutableDictionary.java | 7 +-
.../dictionary/LongOffHeapMutableDictionary.java | 7 +-
.../impl/dictionary/MutableDictionaryFactory.java | 6 +-
.../forward/FixedByteMVMutableForwardIndex.java | 16 +-
.../forward/FixedByteSVMutableForwardIndex.java | 6 +-
.../impl/forward/VarByteSVMutableForwardIndex.java | 8 +-
.../RealtimeLuceneDocIdCollector.java | 7 +-
.../RealtimeLuceneIndexReaderRefreshThread.java | 3 +-
.../local/realtime/impl/json/MutableJsonIndex.java | 27 +-
.../recordtransformer/ComplexTypeTransformer.java | 15 +-
.../recordtransformer/CompositeTransformer.java | 3 +-
.../recordtransformer/ExpressionTransformer.java | 3 +-
.../recordtransformer/NullValueTransformer.java | 3 +-
.../RecordReaderSegmentCreationDataSource.java | 4 +-
.../creator/impl/SegmentColumnarIndexCreator.java | 179 +--
.../creator/impl/SegmentCreationDriverFactory.java | 1 +
.../creator/impl/SegmentDictionaryCreator.java | 49 +-
.../impl/SegmentIndexCreationDriverImpl.java | 40 +-
.../impl/bloom/OnHeapGuavaBloomFilterCreator.java | 3 +-
.../fwd/MultiValueUnsortedForwardIndexCreator.java | 6 +-
.../fwd/SingleValueFixedByteRawIndexCreator.java | 11 +-
.../fwd/SingleValueSortedForwardIndexCreator.java | 3 +-
.../fwd/SingleValueVarByteRawIndexCreator.java | 14 +-
.../inv/OffHeapBitmapInvertedIndexCreator.java | 23 +-
.../creator/impl/inv/RangeIndexCreator.java | 26 +-
.../impl/inv/geospatial/BaseH3IndexCreator.java | 6 +-
.../impl/inv/json/BaseJsonIndexCreator.java | 6 +-
.../impl/inv/json/OffHeapJsonIndexCreator.java | 12 +-
.../impl/inv/json/OnHeapJsonIndexCreator.java | 3 +-
.../stats/AbstractColumnStatisticsCollector.java | 4 +-
.../creator/impl/text/LuceneTextIndexCreator.java | 11 +-
.../index/column/BaseVirtualColumnProvider.java | 6 +-
.../DefaultNullValueVirtualColumnProvider.java | 4 +-
.../index/column/IntermediateIndexContainer.java | 10 +-
.../index/column/PhysicalColumnIndexContainer.java | 35 +-
.../converter/SegmentV1V2ToV3FormatConverter.java | 15 +-
.../segment/index/datasource/BaseDataSource.java | 5 +-
.../index/datasource/ImmutableDataSource.java | 9 +-
.../index/datasource/MutableDataSource.java | 10 +-
.../segment/index/loader/IndexLoadingConfig.java | 6 +-
.../local/segment/index/loader/LoaderUtils.java | 26 +-
.../segment/index/loader/SegmentPreProcessor.java | 25 +-
.../loader/bloomfilter/BloomFilterHandler.java | 17 +-
.../ColumnMinMaxValueGenerator.java | 40 +-
.../defaultcolumn/BaseDefaultColumnHandler.java | 101 +-
.../defaultcolumn/DefaultColumnStatistics.java | 4 +-
.../defaultcolumn/V1DefaultColumnHandler.java | 4 +-
.../defaultcolumn/V3DefaultColumnHandler.java | 10 +-
.../index/loader/invertedindex/H3IndexHandler.java | 3 +-
.../loader/invertedindex/InvertedIndexHandler.java | 5 +-
.../loader/invertedindex/JsonIndexHandler.java | 3 +-
.../invertedindex/LuceneFSTIndexHandler.java | 3 +-
.../loader/invertedindex/RangeIndexHandler.java | 8 +-
.../loader/invertedindex/TextIndexHandler.java | 6 +-
.../index/readers/BaseImmutableDictionary.java | 3 +-
.../segment/index/readers/RangeIndexReader.java | 3 +-
.../readers/bloom/BloomFilterReaderFactory.java | 6 +-
.../forward/BaseChunkSVForwardIndexReader.java | 3 +-
.../forward/FixedBitMVForwardIndexReader.java | 3 +-
.../readers/json/ImmutableJsonIndexReader.java | 32 +-
.../index/readers/text/LuceneTextIndexReader.java | 21 +-
.../readers/MultiplePinotSegmentRecordReader.java | 3 +-
.../segment/readers/PinotSegmentRecordReader.java | 3 +-
.../segment/readers/sort/PinotSegmentSorter.java | 9 +-
.../local/segment/store/FilePerIndexDirectory.java | 12 +-
.../segment/store/SegmentLocalFSDirectory.java | 9 +-
.../segment/store/SingleFileIndexDirectory.java | 32 +-
.../virtualcolumn/VirtualColumnIndexContainer.java | 3 +-
.../VirtualColumnProviderFactory.java | 6 +-
.../startree/v2/builder/BaseSingleTreeBuilder.java | 4 +-
.../startree/v2/builder/StarTreeIndexCombiner.java | 6 +-
.../v2/builder/StarTreeV2BuilderConfig.java | 3 +-
.../startree/v2/store/StarTreeDataSource.java | 5 +-
.../startree/v2/store/StarTreeIndexMapUtils.java | 11 +-
.../segment/local/upsert/PartialUpsertHandler.java | 16 +-
.../upsert/PartitionUpsertMetadataManager.java | 173 +--
.../local/upsert/TableUpsertMetadataManager.java | 3 +-
.../apache/pinot/segment/local/utils/CrcUtils.java | 3 +-
.../local/utils/FixedIntArrayOffHeapIdMap.java | 3 +-
.../segment/local/utils/GeometrySerializer.java | 3 +-
.../pinot/segment/local/utils/GeometryType.java | 5 +-
.../pinot/segment/local/utils/IngestionUtils.java | 81 +-
.../segment/local/utils/ReplicationUtils.java | 6 +-
.../pinot/segment/local/utils/SchemaUtils.java | 36 +-
.../segment/local/utils/SegmentPushUtils.java | 79 +-
.../segment/local/utils/TableConfigUtils.java | 174 +--
.../segment/local/utils/fst/RegexpMatcher.java | 7 +-
.../MutableSegmentImplUpsertComparisonColTest.java | 3 +-
.../mutable/MutableSegmentImplUpsertTest.java | 3 +-
.../segment/local/io/util/PinotDataBitSetTest.java | 5 +-
.../impl/RealtimeSegmentStatsHistoryTest.java | 3 +-
.../impl/dictionary/MutableDictionaryTest.java | 40 +-
.../recordtransformer/DataTypeTransformerTest.java | 12 +-
.../ExpressionTransformerTest.java | 3 +-
.../ExpressionTransformerTimeTest.java | 24 +-
.../recordtransformer/RecordTransformerTest.java | 51 +-
.../segment/local/segment/index/JsonIndexTest.java | 54 +-
.../SegmentGenerationWithBytesTypeTest.java | 4 +-
.../SegmentGenerationWithFilterRecordsTest.java | 7 +-
.../SegmentGenerationWithNoRecordsTest.java | 21 +-
.../index/creator/SegmentPartitionTest.java | 3 +-
.../forward/VarByteChunkSVForwardIndexTest.java | 10 +-
...FixedByteWidthRowColForwardIndexWriterTest.java | 11 +-
.../MultiplePinotSegmentRecordReaderTest.java | 10 +-
.../readers/PinotSegmentRecordReaderTest.java | 12 +-
.../readers/RecordReaderSampleDataTest.java | 27 +-
.../store/ColumnIndexDirectoryTestHelper.java | 7 +-
.../store/SingleFileIndexDirectoryTest.java | 7 +-
.../upsert/PartitionUpsertMetadataManagerTest.java | 24 +-
.../segment/local/utils/IngestionUtilsTest.java | 6 +-
.../segment/local/utils/TableConfigUtilsTest.java | 12 +-
.../segment/local/utils/fst/FSTBuilderTest.java | 3 +-
.../src/test/resources/data/log4j2.xml | 2 +-
pinot-segment-spi/pom.xml | 2 +-
.../org/apache/pinot/segment/spi/V1Constants.java | 3 +-
.../spi/creator/ColumnIndexCreationInfo.java | 4 +-
.../segment/spi/creator/ColumnStatistics.java | 3 +-
.../spi/creator/SegmentGeneratorConfig.java | 13 +-
.../segment/spi/creator/StatsCollectorConfig.java | 3 +-
.../name/NormalizedDateSegmentNameGenerator.java | 14 +-
.../creator/name/SimpleSegmentNameGenerator.java | 6 +-
.../segment/spi/index/creator/H3IndexConfig.java | 3 +-
.../spi/index/metadata/ColumnMetadataImpl.java | 49 +-
.../spi/index/metadata/SegmentMetadataImpl.java | 24 +-
.../spi/index/reader/H3IndexResolution.java | 3 +-
.../spi/index/reader/SortedIndexReader.java | 3 +-
.../startree/AggregationFunctionColumnPair.java | 3 +-
.../spi/index/startree/StarTreeV2Metadata.java | 4 +-
.../spi/loader/SegmentDirectoryLoaderRegistry.java | 14 +-
.../pinot/segment/spi/memory/CleanerUtil.java | 21 +-
.../pinot/segment/spi/memory/PinotDataBuffer.java | 30 +-
.../spi/partition/ModuloPartitionFunction.java | 3 +-
.../spi/partition/MurmurPartitionFunction.java | 4 +-
.../spi/partition/PartitionFunctionFactory.java | 3 +-
.../metadata/ColumnPartitionMetadata.java | 7 +-
.../segment/spi/store/SegmentDirectoryPaths.java | 3 +-
.../spi/creator/SegmentGeneratorConfigTest.java | 25 +-
.../name/InputFileSegmentNameGeneratorTest.java | 4 +-
.../NormalizedDateSegmentNameGeneratorTest.java | 48 +-
.../name/SimpleSegmentNameGeneratorTest.java | 9 +-
.../segment/spi/memory/PinotDataBufferTest.java | 60 +-
.../spi/partition/PartitionFunctionTest.java | 27 +-
.../pinot/server/api/resources/DebugResource.java | 3 +-
.../server/api/resources/HealthCheckResource.java | 5 +-
.../server/api/resources/MmapDebugResource.java | 12 +-
.../server/api/resources/TableSizeResource.java | 15 +-
.../pinot/server/api/resources/TablesResource.java | 83 +-
.../pinot/server/starter/ServerInstance.java | 3 +-
.../starter/ServerQueriesDisabledTracker.java | 10 +-
.../server/starter/helix/AdminApiApplication.java | 3 +-
.../server/starter/helix/BaseServerStarter.java | 6 +-
.../helix/HelixInstanceDataManagerConfig.java | 3 +-
.../server/starter/helix/HelixServerStarter.java | 6 +-
.../apache/pinot/server/api/AccessControlTest.java | 9 +-
.../apache/pinot/server/api/BaseResourceTest.java | 4 +-
pinot-server/src/test/resources/log4j2.xml | 2 +-
.../spi/annotations/metrics/MetricsFactory.java | 3 +-
.../annotations/minion/EventObserverFactory.java | 3 +-
.../annotations/minion/TaskExecutorFactory.java | 3 +-
.../spi/annotations/minion/TaskGenerator.java | 3 +-
.../org/apache/pinot/spi/config/ConfigUtils.java | 4 +-
.../org/apache/pinot/spi/config/TableConfigs.java | 3 +-
.../apache/pinot/spi/config/instance/Instance.java | 10 +-
.../pinot/spi/config/table/BloomFilterConfig.java | 3 +-
.../pinot/spi/config/table/IndexingConfig.java | 3 +-
.../spi/config/table/SegmentPartitionConfig.java | 4 +-
.../spi/config/table/StarTreeIndexConfig.java | 9 +-
.../apache/pinot/spi/config/table/TableConfig.java | 16 +-
.../apache/pinot/spi/config/table/TableStatus.java | 3 +-
.../pinot/spi/config/table/TableTaskConfig.java | 3 +-
.../apache/pinot/spi/config/table/TierConfig.java | 9 +-
.../table/assignment/InstanceAssignmentConfig.java | 12 +-
.../InstanceReplicaGroupPartitionConfig.java | 20 +-
.../table/assignment/InstanceTagPoolConfig.java | 15 +-
.../config/table/ingestion/IngestionConfig.java | 3 +-
.../config/table/ingestion/TransformConfig.java | 3 +-
.../org/apache/pinot/spi/config/tenant/Tenant.java | 5 +-
.../apache/pinot/spi/data/DateTimeFieldSpec.java | 17 +-
.../pinot/spi/data/DateTimeFormatPatternSpec.java | 8 +-
.../apache/pinot/spi/data/DateTimeFormatSpec.java | 19 +-
.../pinot/spi/data/DateTimeFormatUnitSpec.java | 6 +-
.../pinot/spi/data/DateTimeGranularitySpec.java | 11 +-
.../apache/pinot/spi/data/DimensionFieldSpec.java | 8 +-
.../java/org/apache/pinot/spi/data/FieldSpec.java | 13 +-
.../org/apache/pinot/spi/data/MetricFieldSpec.java | 3 +-
.../java/org/apache/pinot/spi/data/Schema.java | 55 +-
.../pinot/spi/data/SchemaValidatorFactory.java | 12 +-
.../org/apache/pinot/spi/data/TimeFieldSpec.java | 8 +-
.../apache/pinot/spi/data/TimeGranularitySpec.java | 18 +-
.../apache/pinot/spi/data/readers/GenericRow.java | 6 +-
.../spi/data/readers/RecordReaderFactory.java | 31 +-
.../pinot/spi/env/CommonsConfigurationUtils.java | 3 +-
.../apache/pinot/spi/env/PinotConfiguration.java | 58 +-
.../PinotEnvironmentProviderFactory.java | 14 +-
.../pinot/spi/ingestion/batch/BatchConfig.java | 13 +-
.../spi/ingestion/batch/IngestionJobLauncher.java | 19 +-
.../batch/spec/SegmentGenerationTaskSpec.java | 2 +-
.../apache/pinot/spi/metrics/PinotMetricName.java | 3 +-
.../pinot/spi/metrics/PinotMetricsRegistry.java | 3 +-
.../apache/pinot/spi/plugin/PluginClassLoader.java | 3 +-
.../org/apache/pinot/spi/plugin/PluginManager.java | 91 +-
.../apache/pinot/spi/stream/OffsetCriteria.java | 6 +-
.../stream/PartitionGroupConsumptionStatus.java | 3 +-
.../pinot/spi/stream/PartitionGroupMetadata.java | 3 +-
.../spi/stream/PartitionGroupMetadataFetcher.java | 10 +-
.../pinot/spi/stream/PartitionLevelConsumer.java | 3 +-
.../spi/stream/PartitionLevelStreamConfig.java | 12 +-
.../org/apache/pinot/spi/stream/StreamConfig.java | 82 +-
.../pinot/spi/stream/StreamConsumerFactory.java | 4 +-
.../spi/stream/StreamConsumerFactoryProvider.java | 3 +-
.../pinot/spi/stream/StreamDecoderProvider.java | 3 +-
.../pinot/spi/stream/StreamLevelConsumer.java | 3 +-
.../pinot/spi/stream/StreamMessageDecoder.java | 3 +-
.../pinot/spi/stream/StreamMetadataProvider.java | 14 +-
.../apache/pinot/spi/utils/CommonConstants.java | 72 +-
.../org/apache/pinot/spi/utils/DataSizeUtils.java | 3 +-
.../pinot/spi/utils/IngestionConfigUtils.java | 31 +-
.../java/org/apache/pinot/spi/utils/JsonUtils.java | 51 +-
.../pinot/spi/utils/PinotReflectionUtils.java | 8 +-
.../java/org/apache/pinot/spi/utils/ReadMode.java | 3 +-
.../org/apache/pinot/spi/utils/TimeConverter.java | 8 +-
.../java/org/apache/pinot/spi/utils/TimeUtils.java | 10 +-
.../spi/utils/builder/TableConfigBuilder.java | 9 +-
.../apache/pinot/spi/config/ConfigUtilsTest.java | 40 +-
.../pinot/spi/config/table/IndexingConfigTest.java | 3 +-
.../pinot/spi/data/DateTimeFieldSpecUtilsTest.java | 44 +-
.../spi/data/readers/AbstractRecordReaderTest.java | 18 +-
.../pinot/spi/env/PinotConfigurationTest.java | 3 +-
.../PinotEnvironmentProviderFactoryTest.java | 17 +-
.../pinot/spi/filesystem/LocalPinotFSTest.java | 13 +-
.../pinot/spi/ingestion/batch/BatchConfigTest.java | 9 +-
.../ingestion/batch/IngestionJobLauncherTest.java | 27 +-
.../apache/pinot/spi/plugin/PluginManagerTest.java | 50 +-
.../pinot/spi/utils/GroovyTemplateUtilsTest.java | 16 +-
.../pinot/spi/utils/IngestionConfigUtilsTest.java | 24 +-
.../org/apache/pinot/spi/utils/JsonUtilsTest.java | 94 +-
.../apache/pinot/spi/utils/TimeConverterTest.java | 15 +-
.../spi/utils/builder/TableNameBuilderTest.java | 3 +-
.../pinot/spi/utils/retry/RetryPolicyTest.java | 9 +-
.../org/apache/pinot/tools/AuthQuickstart.java | 3 +-
.../pinot/tools/AutoAddInvertedIndexTool.java | 30 +-
.../apache/pinot/tools/GitHubEventsQuickstart.java | 3 +-
.../org/apache/pinot/tools/HybridQuickstart.java | 14 +-
.../org/apache/pinot/tools/JoinQuickStart.java | 6 +-
.../apache/pinot/tools/JsonIndexQuickStart.java | 3 +-
.../OfflineComplexTypeHandlingQuickStart.java | 6 +-
.../pinot/tools/PartialUpsertQuickStart.java | 12 +-
.../org/apache/pinot/tools/PinotToolLauncher.java | 3 +-
.../java/org/apache/pinot/tools/Quickstart.java | 7 +-
.../RealtimeComplexTypeHandlingQuickStart.java | 6 +-
.../pinot/tools/RealtimeJsonIndexQuickStart.java | 4 +-
.../org/apache/pinot/tools/RealtimeQuickStart.java | 6 +-
.../org/apache/pinot/tools/SegmentDumpTool.java | 4 +-
.../org/apache/pinot/tools/UpdateSegmentState.java | 14 +-
.../apache/pinot/tools/ValidateTableRetention.java | 10 +-
.../pinot/tools/admin/PinotAdministrator.java | 9 +-
.../tools/admin/PinotServiceManagerStarter.java | 1 +
.../admin/command/AbstractBaseAdminCommand.java | 11 +-
.../tools/admin/command/AddSchemaCommand.java | 3 +-
.../pinot/tools/admin/command/AddTableCommand.java | 12 +-
.../tools/admin/command/AddTenantCommand.java | 15 +-
.../tools/admin/command/AnonymizeDataCommand.java | 108 +-
.../admin/command/AvroSchemaToPinotSchema.java | 12 +-
.../tools/admin/command/BootstrapTableCommand.java | 9 +-
.../admin/command/ChangeNumReplicasCommand.java | 6 +-
.../tools/admin/command/ChangeTableState.java | 3 +-
.../tools/admin/command/CreateSegmentCommand.java | 10 +-
.../tools/admin/command/DeleteClusterCommand.java | 3 +-
.../tools/admin/command/GenerateDataCommand.java | 14 +-
.../command/GitHubEventsQuickStartCommand.java | 1 +
.../tools/admin/command/ImportDataCommand.java | 12 +-
.../tools/admin/command/JsonToPinotSchema.java | 6 +-
.../command/LaunchDataIngestionJobCommand.java | 12 +-
.../tools/admin/command/MoveReplicaGroup.java | 24 +-
.../OfflineSegmentIntervalCheckerCommand.java | 3 +-
.../admin/command/OperateClusterConfigCommand.java | 9 +-
.../tools/admin/command/PostQueryCommand.java | 3 +-
.../tools/admin/command/QuickStartCommand.java | 9 +-
.../command/RealtimeProvisioningHelperCommand.java | 77 +-
.../tools/admin/command/RebalanceTableCommand.java | 70 +-
.../command/SegmentProcessorFrameworkCommand.java | 3 +-
.../admin/command/ShowClusterInfoCommand.java | 3 +-
.../tools/admin/command/StartBrokerCommand.java | 10 +-
.../admin/command/StartControllerCommand.java | 14 +-
.../tools/admin/command/StartKafkaCommand.java | 3 +-
.../tools/admin/command/StartMinionCommand.java | 9 +-
.../tools/admin/command/StartServerCommand.java | 21 +-
.../admin/command/StartServiceManagerCommand.java | 51 +-
.../tools/admin/command/StartZookeeperCommand.java | 3 +-
.../tools/admin/command/StopProcessCommand.java | 3 +-
.../admin/command/StreamAvroIntoKafkaCommand.java | 9 +-
.../admin/command/StreamGitHubEventsCommand.java | 13 +-
.../tools/admin/command/UploadSegmentCommand.java | 16 +-
.../tools/admin/command/ValidateConfigCommand.java | 9 +-
.../admin/command/VerifyClusterStateCommand.java | 6 +-
.../tools/admin/command/VerifySegmentState.java | 6 +-
.../anonymizer/ArrayBasedGlobalDictionaries.java | 57 +-
.../pinot/tools/anonymizer/GlobalDictionaries.java | 3 +-
.../anonymizer/MapBasedGlobalDictionaries.java | 30 +-
.../anonymizer/PinotDataAndQueryAnonymizer.java | 186 ++--
.../config/validator/TableConfigValidator.java | 1 +
.../tools/filesystem/PinotFSBenchmarkDriver.java | 35 +-
.../tools/filesystem/PinotFSBenchmarkRunner.java | 30 +-
.../pinot/tools/perf/PerfBenchmarkDriver.java | 12 +-
.../pinot/tools/perf/PerfBenchmarkRunner.java | 30 +-
.../org/apache/pinot/tools/perf/QueryRunner.java | 84 +-
.../tools/query/comparison/QueryComparison.java | 4 +-
.../converter/PinotSegmentConvertCommand.java | 15 +-
.../segment/converter/SegmentMergeCommand.java | 21 +-
.../resources/PinotServiceManagerHealthCheck.java | 15 +-
.../PinotServiceManagerInstanceResource.java | 52 +-
.../pinot/tools/streams/AirlineDataStream.java | 3 +-
.../apache/pinot/tools/utils/PinotConfigUtils.java | 39 +-
pinot-tools/src/main/resources/conf/log4j2.xml | 4 +-
.../src/main/resources/conf/pinot-admin-log4j2.xml | 2 +-
.../src/main/resources/conf/pinot-tools-log4j2.xml | 2 +-
.../src/main/resources/conf/quickstart-log4j2.xml | 4 +-
pinot-tools/src/main/resources/log4j2.xml | 57 +-
.../pinot/tools/TestCreateSegmentCommand.java | 6 +-
.../pinot/tools/TestDataAndQueryAnonymizer.java | 17 +-
pinot-tools/src/test/resources/log4j2.xml | 2 +-
pom.xml | 11 +-
946 files changed, 12540 insertions(+), 7984 deletions(-)
diff --git a/config/checkstyle.xml b/config/checkstyle.xml
index 5859a75..9a5daa6 100644
--- a/config/checkstyle.xml
+++ b/config/checkstyle.xml
@@ -28,9 +28,9 @@
<!-- LENGTHS -->
- <!-- Desired line length is 120 but allow some overrun beyond that -->
+ <!-- Desired line length is 120 -->
<module name="LineLength">
- <property name="max" value="160"/>
+ <property name="max" value="120"/>
<message key="maxLineLen"
value="Line is longer than {0,number,integer} characters (found {1,number,integer}). Try to keep lines under 120 characters."/>
</module>
diff --git a/config/codestyle-intellij.xml b/config/codestyle-intellij.xml
index d5ef7f1..cea726d 100644
--- a/config/codestyle-intellij.xml
+++ b/config/codestyle-intellij.xml
@@ -101,6 +101,9 @@
<option name="METHOD_PARAMETERS_WRAP" value="5"/>
<option name="PARENT_SETTINGS_INSTALLED" value="true"/>
</codeStyleSettings>
+ <Properties>
+ <option name="KEEP_BLANK_LINES" value="true" />
+ </Properties>
<codeStyleSettings language="CSS">
<indentOptions>
<option name="INDENT_SIZE" value="2"/>
@@ -181,7 +184,7 @@
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JAVA">
- <option name="KEEP_LINE_BREAKS" value="false"/>
+ <option name="RIGHT_MARGIN" value="120" />
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/>
<option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0"/>
@@ -194,7 +197,9 @@
<option name="CALL_PARAMETERS_WRAP" value="1"/>
<option name="METHOD_PARAMETERS_WRAP" value="1"/>
<option name="RESOURCE_LIST_WRAP" value="1"/>
+ <option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="1"/>
+ <option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="2"/>
<option name="METHOD_CALL_CHAIN_WRAP" value="1"/>
<option name="BINARY_OPERATION_WRAP" value="1"/>
@@ -202,12 +207,17 @@
<option name="TERNARY_OPERATION_WRAP" value="1"/>
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true"/>
<option name="FOR_STATEMENT_WRAP" value="1"/>
+ <option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
+ <option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
<option name="ASSIGNMENT_WRAP" value="1"/>
<option name="WRAP_COMMENTS" value="true"/>
+ <option name="ASSERT_STATEMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="3"/>
<option name="DOWHILE_BRACE_FORCE" value="3"/>
<option name="WHILE_BRACE_FORCE" value="3"/>
<option name="FOR_BRACE_FORCE" value="3"/>
+ <option name="WRAP_LONG_LINES" value="true" />
+ <option name="PARAMETER_ANNOTATION_WRAP" value="1" />
<option name="VARIABLE_ANNOTATION_WRAP" value="2"/>
<option name="ENUM_CONSTANTS_WRAP" value="5"/>
<option name="PARENT_SETTINGS_INSTALLED" value="true"/>
diff --git a/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/PinotThroughput.java b/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/PinotThroughput.java
index 3d7c3ee..6ec94c9 100644
--- a/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/PinotThroughput.java
+++ b/contrib/pinot-druid-benchmark/src/main/java/org/apache/pinotdruidbenchmark/PinotThroughput.java
@@ -35,6 +35,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
+
/**
* Test throughput for Pinot.
*/
diff --git a/docker/images/pinot/etc/conf/pinot-broker-log4j2.xml b/docker/images/pinot/etc/conf/pinot-broker-log4j2.xml
index e3715a4..5f2c7db 100644
--- a/docker/images/pinot/etc/conf/pinot-broker-log4j2.xml
+++ b/docker/images/pinot/etc/conf/pinot-broker-log4j2.xml
@@ -39,11 +39,11 @@
<Pattern>%d{yyyy/MM/dd HH:mm:ss.SSS} %p [%c{1}] [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
- <OnStartupTriggeringPolicy />
- <SizeBasedTriggeringPolicy size="20 MB" />
- <TimeBasedTriggeringPolicy />
+ <OnStartupTriggeringPolicy/>
+ <SizeBasedTriggeringPolicy size="20 MB"/>
+ <TimeBasedTriggeringPolicy/>
</Policies>
- <DefaultRolloverStrategy max="10" />
+ <DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
diff --git a/docker/images/pinot/etc/conf/pinot-controller-log4j2.xml b/docker/images/pinot/etc/conf/pinot-controller-log4j2.xml
index 6f5da83..e227fe3 100644
--- a/docker/images/pinot/etc/conf/pinot-controller-log4j2.xml
+++ b/docker/images/pinot/etc/conf/pinot-controller-log4j2.xml
@@ -38,11 +38,11 @@
<Pattern>%d{yyyy/MM/dd HH:mm:ss.SSS} %p [%c{1}] [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
- <OnStartupTriggeringPolicy />
- <SizeBasedTriggeringPolicy size="20 MB" />
- <TimeBasedTriggeringPolicy />
+ <OnStartupTriggeringPolicy/>
+ <SizeBasedTriggeringPolicy size="20 MB"/>
+ <TimeBasedTriggeringPolicy/>
</Policies>
- <DefaultRolloverStrategy max="10" />
+ <DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
diff --git a/docker/images/pinot/etc/conf/pinot-server-log4j2.xml b/docker/images/pinot/etc/conf/pinot-server-log4j2.xml
index dcb03a8..d6bd3f7 100644
--- a/docker/images/pinot/etc/conf/pinot-server-log4j2.xml
+++ b/docker/images/pinot/etc/conf/pinot-server-log4j2.xml
@@ -38,11 +38,11 @@
<Pattern>%d{yyyy/MM/dd HH:mm:ss.SSS} %p [%c{1}] [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
- <OnStartupTriggeringPolicy />
- <SizeBasedTriggeringPolicy size="20 MB" />
- <TimeBasedTriggeringPolicy />
+ <OnStartupTriggeringPolicy/>
+ <SizeBasedTriggeringPolicy size="20 MB"/>
+ <TimeBasedTriggeringPolicy/>
</Policies>
- <DefaultRolloverStrategy max="10" />
+ <DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
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 d12ec66..514eb12 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
@@ -235,10 +235,10 @@ public class RequestStatistics {
}
public boolean hasValidTableName() {
- return ! DEFAULT_TABLE_NAME.equals(_tableName);
+ return !DEFAULT_TABLE_NAME.equals(_tableName);
}
public int getNumRowsResultSet() {
- return _numRowsResultSet;
+ return _numRowsResultSet;
}
}
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 cb6f71a..dd4ac77 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,7 +59,11 @@ public class PinotBrokerDebug {
@Produces(MediaType.APPLICATION_JSON)
@Path("/debug/timeBoundary/{tableName}")
@ApiOperation(value = "Get the time boundary information for a table")
- @ApiResponses(value = {@ApiResponse(code = 200, message = "Time boundary information for a table"), @ApiResponse(code = 404, message = "Time boundary not found"), @ApiResponse(code = 500, message = "Internal server error")})
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Time boundary information for a table"),
+ @ApiResponse(code = 404, message = "Time boundary not found"),
+ @ApiResponse(code = 500, message = "Internal server error")
+ })
public TimeBoundaryInfo getTimeBoundary(
@ApiParam(value = "Name of the table") @PathParam("tableName") String tableName) {
String offlineTableName =
@@ -76,7 +80,11 @@ public class PinotBrokerDebug {
@Produces(MediaType.APPLICATION_JSON)
@Path("/debug/routingTable/{tableName}")
@ApiOperation(value = "Get the routing table for a table")
- @ApiResponses(value = {@ApiResponse(code = 200, message = "Routing table"), @ApiResponse(code = 404, message = "Routing not found"), @ApiResponse(code = 500, message = "Internal server error")})
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Routing table"),
+ @ApiResponse(code = 404, message = "Routing not found"),
+ @ApiResponse(code = 500, message = "Internal server error")
+ })
public Map<String, Map<ServerInstance, List<String>>> getRoutingTable(
@ApiParam(value = "Name of the table") @PathParam("tableName") String tableName) {
Map<String, Map<ServerInstance, List<String>>> result = new TreeMap<>();
@@ -108,7 +116,11 @@ public class PinotBrokerDebug {
@Produces(MediaType.APPLICATION_JSON)
@Path("/debug/routingTable")
@ApiOperation(value = "Get the routing table for a query")
- @ApiResponses(value = {@ApiResponse(code = 200, message = "Routing table"), @ApiResponse(code = 404, message = "Routing not found"), @ApiResponse(code = 500, message = "Internal server error")})
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Routing table"),
+ @ApiResponse(code = 404, message = "Routing not found"),
+ @ApiResponse(code = 500, message = "Internal server error")
+ })
public Map<ServerInstance, List<String>> getRoutingTableForQuery(
@ApiParam(value = "Pql query (table name should have type suffix)") @QueryParam("pql") String pql) {
RoutingTable routingTable = _routingManager.getRoutingTable(PQL_COMPILER.compileToBrokerRequest(pql));
@@ -123,9 +135,13 @@ public class PinotBrokerDebug {
@Produces(MediaType.APPLICATION_JSON)
@Path("/debug/routingTable/sql")
@ApiOperation(value = "Get the routing table for a SQL query")
- @ApiResponses(value = {@ApiResponse(code = 200, message = "Routing table"), @ApiResponse(code = 404, message = "Routing not found"), @ApiResponse(code = 500, message = "Internal server error")})
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Routing table"),
+ @ApiResponse(code = 404, message = "Routing not found"),
+ @ApiResponse(code = 500, message = "Internal server error")
+ })
public Map<ServerInstance, List<String>> getRoutingTableForSQLQuery(
- @ApiParam(value = "SQL query (table name should have type suffix)") @QueryParam("query") String query) {
+ @ApiParam(value = "SQL query (table name should have type suffix)") @QueryParam("query") String query) {
RoutingTable routingTable = _routingManager.getRoutingTable(CALCITE_COMPILER.compileToBrokerRequest(query));
if (routingTable != null) {
return routingTable.getServerInstanceToSegmentsMap();
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 75e53ab..88bbb33 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
@@ -45,7 +45,10 @@ 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 not healthy")})
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Broker is healthy"),
+ @ApiResponse(code = 503, message = "Broker is not healthy")
+ })
public String getBrokerHealth() {
ServiceStatus.Status status = ServiceStatus.getServiceStatus();
if (status == ServiceStatus.Status.GOOD) {
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerRouting.java b/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerRouting.java
index 6d90c19..bf8ad32 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerRouting.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerRouting.java
@@ -44,7 +44,10 @@ public class PinotBrokerRouting {
@Produces(MediaType.TEXT_PLAIN)
@Path("/routing/{tableName}")
@ApiOperation(value = "Build/rebuild the routing for a table", notes = "Build/rebuild the routing for a table")
- @ApiResponses(value = {@ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 500, message = "Internal server error")})
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Success"),
+ @ApiResponse(code = 500, message = "Internal server error")
+ })
public String buildRouting(
@ApiParam(value = "Table name (with type)") @PathParam("tableName") String tableNameWithType) {
_routingManager.buildRouting(tableNameWithType);
@@ -55,7 +58,10 @@ public class PinotBrokerRouting {
@Produces(MediaType.TEXT_PLAIN)
@Path("/routing/refresh/{tableName}/{segmentName}")
@ApiOperation(value = "Refresh the routing for a segment", notes = "Refresh the routing for a segment")
- @ApiResponses(value = {@ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 500, message = "Internal server error")})
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Success"),
+ @ApiResponse(code = 500, message = "Internal server error")
+ })
public String refreshRouting(
@ApiParam(value = "Table name (with type)") @PathParam("tableName") String tableNameWithType,
@ApiParam(value = "Segment name") @PathParam("segmentName") String segmentName) {
@@ -67,7 +73,10 @@ public class PinotBrokerRouting {
@Produces(MediaType.TEXT_PLAIN)
@Path("/routing/{tableName}")
@ApiOperation(value = "Remove the routing for a table", notes = "Remove the routing for a table")
- @ApiResponses(value = {@ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 500, message = "Internal server error")})
+ @ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Success"),
+ @ApiResponse(code = 500, message = "Internal server error")
+ })
public String removeRouting(
@ApiParam(value = "Table name (with type)") @PathParam("tableName") String tableNameWithType) {
_routingManager.removeRouting(tableNameWithType);
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 d85e907..b8568c0 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
@@ -75,7 +75,10 @@ public class PinotClientRequest {
@Produces(MediaType.APPLICATION_JSON)
@Path("query")
@ApiOperation(value = "Querying pinot using PQL")
- @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 void processQueryGet(
// Query param "bql" is for backward compatibility
@ApiParam(value = "Query", required = true) @QueryParam("bql") String query,
@@ -91,7 +94,8 @@ public class PinotClientRequest {
if (debugOptions != null) {
requestJson.put(Request.DEBUG_OPTIONS, debugOptions);
}
- BrokerResponse brokerResponse = requestHandler.handleRequest(requestJson, makeHttpIdentity(requestContext), new RequestStatistics());
+ BrokerResponse brokerResponse =
+ requestHandler.handleRequest(requestJson, makeHttpIdentity(requestContext), new RequestStatistics());
asyncResponse.resume(brokerResponse.toJsonString());
} catch (Exception e) {
LOGGER.error("Caught exception while processing GET request", e);
@@ -112,12 +116,16 @@ public class PinotClientRequest {
@Produces(MediaType.APPLICATION_JSON)
@Path("query")
@ApiOperation(value = "Querying pinot using PQL")
- @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 void processQueryPost(String query, @Suspended AsyncResponse asyncResponse,
@Context org.glassfish.grizzly.http.server.Request requestContext) {
try {
JsonNode requestJson = JsonUtils.stringToJsonNode(query);
- BrokerResponse brokerResponse = requestHandler.handleRequest(requestJson, makeHttpIdentity(requestContext), new RequestStatistics());
+ BrokerResponse brokerResponse =
+ requestHandler.handleRequest(requestJson, makeHttpIdentity(requestContext), new RequestStatistics());
asyncResponse.resume(brokerResponse);
} catch (Exception e) {
LOGGER.error("Caught exception while processing POST request", e);
@@ -131,7 +139,10 @@ public class PinotClientRequest {
@Produces(MediaType.APPLICATION_JSON)
@Path("query/sql")
@ApiOperation(value = "Querying pinot using sql")
- @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 void processSqlQueryGet(@ApiParam(value = "Query", required = true) @QueryParam("sql") String query,
@ApiParam(value = "Trace enabled") @QueryParam(Request.TRACE) String traceEnabled,
@ApiParam(value = "Debug options") @QueryParam(Request.DEBUG_OPTIONS) String debugOptions,
@@ -147,7 +158,8 @@ public class PinotClientRequest {
if (debugOptions != null) {
requestJson.put(Request.DEBUG_OPTIONS, debugOptions);
}
- BrokerResponse brokerResponse = requestHandler.handleRequest(requestJson, makeHttpIdentity(requestContext), new RequestStatistics());
+ BrokerResponse brokerResponse =
+ requestHandler.handleRequest(requestJson, makeHttpIdentity(requestContext), new RequestStatistics());
asyncResponse.resume(brokerResponse.toJsonString());
} catch (Exception e) {
LOGGER.error("Caught exception while processing GET request", e);
@@ -161,7 +173,10 @@ public class PinotClientRequest {
@Produces(MediaType.APPLICATION_JSON)
@Path("query/sql")
@ApiOperation(value = "Querying pinot using sql")
- @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 void processSqlQueryPost(String query, @Suspended AsyncResponse asyncResponse,
@Context org.glassfish.grizzly.http.server.Request requestContext) {
try {
@@ -172,7 +187,8 @@ public class PinotClientRequest {
String queryOptions = constructSqlQueryOptions();
// the only query options as of now are sql related. do not allow any custom query options in sql endpoint
ObjectNode sqlRequestJson = ((ObjectNode) requestJson).put(Request.QUERY_OPTIONS, queryOptions);
- BrokerResponse brokerResponse = requestHandler.handleRequest(sqlRequestJson, makeHttpIdentity(requestContext), new RequestStatistics());
+ BrokerResponse brokerResponse =
+ requestHandler.handleRequest(sqlRequestJson, makeHttpIdentity(requestContext), new RequestStatistics());
asyncResponse.resume(brokerResponse.toJsonString());
} catch (Exception e) {
LOGGER.error("Caught exception while processing POST request", e);
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BaseBrokerStarter.java b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BaseBrokerStarter.java
index 44cc05c..0914ba6 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BaseBrokerStarter.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BaseBrokerStarter.java
@@ -335,7 +335,8 @@ public abstract class BaseBrokerStarter implements ServiceStartable {
}
/**
- * Fetches the resources to monitor and registers the {@link org.apache.pinot.common.utils.ServiceStatus.ServiceStatusCallback}s
+ * Fetches the resources to monitor and registers the
+ * {@link org.apache.pinot.common.utils.ServiceStatus.ServiceStatusCallback}s
*/
private void registerServiceStatusHandler() {
List<String> resourcesToMonitor = new ArrayList<>(1);
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 e021163..da4db31 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
@@ -50,7 +50,8 @@ import org.slf4j.LoggerFactory;
*/
@BatchMode(enabled = false)
@PreFetch(enabled = false)
-public class ClusterChangeMediator implements ExternalViewChangeListener, InstanceConfigChangeListener, LiveInstanceChangeListener {
+public class ClusterChangeMediator
+ implements ExternalViewChangeListener, InstanceConfigChangeListener, LiveInstanceChangeListener {
private static final Logger LOGGER = LoggerFactory.getLogger(ClusterChangeMediator.class);
// If no change got for 1 hour, proactively check changes
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 8b9f622..fefcd8b 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
@@ -50,7 +50,8 @@ public class HelixBrokerStarter extends BaseBrokerStarter {
}
@Deprecated
- private static PinotConfiguration applyBrokerConfigs(PinotConfiguration brokerConf, String clusterName, String zkServers, @Nullable String brokerHost) {
+ private static PinotConfiguration applyBrokerConfigs(PinotConfiguration brokerConf, String clusterName,
+ String zkServers, @Nullable String brokerHost) {
brokerConf.setProperty(Helix.CONFIG_OF_CLUSTER_NAME, clusterName);
brokerConf.setProperty(Helix.CONFIG_OF_ZOOKEEPR_SERVER, zkServers);
if (brokerHost == null) {
@@ -62,7 +63,8 @@ public class HelixBrokerStarter extends BaseBrokerStarter {
}
@Deprecated
- public HelixBrokerStarter(PinotConfiguration brokerConf) throws Exception {
+ public HelixBrokerStarter(PinotConfiguration brokerConf)
+ throws Exception {
init(brokerConf);
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java b/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java
index 5af0fdc..216f827 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java
@@ -127,7 +127,8 @@ public class HelixExternalViewBasedQueryQuotaManager implements ClusterChangeHan
removeRateLimiter(tableNameWithType);
}
- /** Remove or update rate limiter if another table with the same raw table name but different type is still using the quota config.
+ /** Remove or update rate limiter if another table with the same raw table name but different type is still using
+ * the quota config.
* @param tableNameWithType table name with type
*/
private void removeRateLimiter(String tableNameWithType) {
@@ -198,8 +199,9 @@ public class HelixExternalViewBasedQueryQuotaManager implements ClusterChangeHan
new MaxHitRateTracker(ONE_MINUTE_TIME_RANGE_IN_SECOND), onlineCount, overallRate, stat.getVersion());
_rateLimiterMap.put(tableNameWithType, queryQuotaEntity);
LOGGER.info(
- "Rate limiter for table: {} has been initialized. Overall rate: {}. Per-broker rate: {}. Number of online broker instances: {}. Table config stat version: {}",
- tableNameWithType, overallRate, perBrokerRate, onlineCount, stat.getVersion());
+ "Rate limiter for table: {} has been initialized. Overall rate: {}. Per-broker rate: {}. Number of online "
+ + "broker instances: {}. Table config stat version: {}", tableNameWithType, overallRate, perBrokerRate,
+ onlineCount, stat.getVersion());
} else {
RateLimiter rateLimiter = queryQuotaEntity.getRateLimiter();
if (rateLimiter == null) {
@@ -214,8 +216,9 @@ public class HelixExternalViewBasedQueryQuotaManager implements ClusterChangeHan
queryQuotaEntity.setOverallRate(overallRate);
queryQuotaEntity.setTableConfigStatVersion(stat.getVersion());
LOGGER.info(
- "Rate limiter for table: {} has been updated. Overall rate: {}. Per-broker rate: {}. Number of online broker instances: {}. Table config stat version: {}",
- tableNameWithType, overallRate, perBrokerRate, onlineCount, stat.getVersion());
+ "Rate limiter for table: {} has been updated. Overall rate: {}. Per-broker rate: {}. Number of online "
+ + "broker instances: {}. Table config stat version: {}", tableNameWithType, overallRate, perBrokerRate,
+ onlineCount, stat.getVersion());
}
addMaxBurstQPSCallbackTableGaugeIfNeeded(tableNameWithType, queryQuotaEntity);
if (isQueryRateLimitDisabled()) {
@@ -224,7 +227,8 @@ public class HelixExternalViewBasedQueryQuotaManager implements ClusterChangeHan
}
/**
- * Build an empty rate limiter in the new query quota entity, or set the rate limiter to null in an existing query quota entity.
+ * Build an empty rate limiter in the new query quota entity, or set the rate limiter to null in an existing query
+ * quota entity.
*/
private void buildEmptyOrResetRateLimiterInQueryQuotaEntity(String tableNameWithType) {
QueryQuotaEntity queryQuotaEntity = _rateLimiterMap.get(tableNameWithType);
@@ -419,9 +423,9 @@ public class HelixExternalViewBasedQueryQuotaManager implements ClusterChangeHan
queryQuotaEntity.setNumOnlineBrokers(onlineBrokerCount);
queryQuotaEntity.setOverallRate(overallRate);
queryQuotaEntity.setTableConfigStatVersion(stat.getVersion());
- LOGGER.info(
- "Rate limiter for table: {} has been updated. Overall rate: {}. Previous per-broker rate: {}. New per-broker rate: {}. Number of online broker instances: {}",
- tableNameWithType, overallRate, previousRate, latestRate, onlineBrokerCount);
+ LOGGER.info("Rate limiter for table: {} has been updated. Overall rate: {}. Previous per-broker rate: {}. New "
+ + "per-broker rate: {}. Number of online broker instances: {}", tableNameWithType, overallRate,
+ previousRate, latestRate, onlineBrokerCount);
numRebuilt++;
}
}
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 3d4d8d4..a089e8e 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
@@ -24,9 +24,11 @@ import java.util.concurrent.atomic.AtomicLongArray;
/**
- * This hit counter is for counting the number of hits within a range of time. Right now the granularity we use is second.
+ * This hit counter is for counting the number of hits within a range of time. Right now the granularity we use is
+ * second.
* In order to save the space and time, we store the number of hits over the last 100 time buckets. When the method hit
- * gets called, we put the timestamp to the specified bucket. When the method getHitCount gets called, we sum all the number
+ * gets called, we put the timestamp to the specified bucket. When the method getHitCount gets called, we sum all the
+ * number
* of hits within the last 100 time buckets.
*/
public class HitCounter {
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/MaxHitRateTracker.java b/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/MaxHitRateTracker.java
index 25c6767..cf7ac60 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/MaxHitRateTracker.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/MaxHitRateTracker.java
@@ -20,11 +20,13 @@ package org.apache.pinot.broker.queryquota;
import com.google.common.annotations.VisibleForTesting;
+
/**
* A stateful version of hit counter. Similar to the default hit counter, it maintains a list of buckets.
* Whereas it maintains an extra variable called _lastAccessTimestamp which tracks the last access time.
* If the stateful hit counter gets queried, it firstly compares the current timestamp and the last access timestamp,
- * calculating the start index and end index among the buckets. Then, it traverses through all the valid candidate buckets.
+ * calculating the start index and end index among the buckets. Then, it traverses through all the valid candidate
+ * buckets.
* If the current timestamp has exceeded the current time range of all the buckets, this hit counter will use
* the current timestamp minus the default time queried time range to calculate the start time index.
*/
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 d692619..c99d768 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
@@ -981,7 +981,8 @@ public abstract class BaseBrokerRequestHandler implements BrokerRequestHandler {
}
// Use RoutingManager to handle case-sensitive table name
- // Update table name if there is no existing table in the format of [database_name].[table_name] but only [table_name]
+ // Update table name if there is no existing table in the format of [database_name].[table_name] but only
+ // [table_name]
if (TableNameBuilder.isTableResource(tableName)) {
if (_routingManager.routingExists(tableNameSplits[1]) && !_routingManager.routingExists(tableName)) {
return tableNameSplits[1];
@@ -1627,14 +1628,16 @@ public abstract class BaseBrokerRequestHandler implements BrokerRequestHandler {
// The behavior of GROUP BY with multiple aggregations, is different in PQL vs SQL.
// As a result, we have 2 groupByModes, to maintain backward compatibility.
- // The results of PQL groupByMode (if numAggregations > 1) cannot be returned in SQL responseFormat, as the results are non-tabular
+ // The results of PQL groupByMode (if numAggregations > 1) cannot be returned in SQL responseFormat, as the
+ // results are non-tabular
// Checking for this upfront, to avoid executing the query and wasting resources
QueryOptions queryOptions = new QueryOptions(brokerRequest.getQueryOptions());
if (brokerRequest.isSetAggregationsInfo() && brokerRequest.getGroupBy() != null) {
if (brokerRequest.getAggregationsInfoSize() > 1 && queryOptions.isResponseFormatSQL() && !queryOptions
.isGroupByModeSQL()) {
throw new UnsupportedOperationException(
- "The results of a GROUP BY query with multiple aggregations in PQL is not tabular, and cannot be returned in SQL responseFormat");
+ "The results of a GROUP BY query with multiple aggregations in PQL is not tabular, and cannot be returned"
+ + " in SQL responseFormat");
}
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingManager.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingManager.java
index d097dc8..63e036f 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingManager.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/RoutingManager.java
@@ -173,9 +173,10 @@ public class RoutingManager implements ClusterChangeHandler {
long updateRoutingEntriesEndTimeMs = System.currentTimeMillis();
LOGGER.info(
- "Processed external view change in {}ms (fetch {} external view stats: {}ms, update routing entry for {} tables ({}): {}ms)",
- updateRoutingEntriesEndTimeMs - startTimeMs, numTables, fetchStatsEndTimeMs - startTimeMs,
- tablesToUpdate.size(), tablesToUpdate, updateRoutingEntriesEndTimeMs - fetchStatsEndTimeMs);
+ "Processed external view change in {}ms (fetch {} external view stats: {}ms, update routing entry for {} "
+ + "tables ({}): {}ms)", updateRoutingEntriesEndTimeMs - startTimeMs, numTables,
+ fetchStatsEndTimeMs - startTimeMs, tablesToUpdate.size(), tablesToUpdate,
+ updateRoutingEntriesEndTimeMs - fetchStatsEndTimeMs);
}
@Nullable
@@ -240,9 +241,9 @@ public class RoutingManager implements ClusterChangeHandler {
// Early terminate if there is no instance changed
if (changedInstances.isEmpty()) {
LOGGER.info(
- "Processed instance config change in {}ms (fetch {} instance configs: {}ms, calculate changed instances: {}ms) without instance change",
- calculateChangedInstancesEndTimeMs - startTimeMs, instanceConfigZNRecords.size(),
- fetchInstanceConfigsEndTimeMs - startTimeMs,
+ "Processed instance config change in {}ms (fetch {} instance configs: {}ms, calculate changed instances: "
+ + "{}ms) without instance change", calculateChangedInstancesEndTimeMs - startTimeMs,
+ instanceConfigZNRecords.size(), fetchInstanceConfigsEndTimeMs - startTimeMs,
calculateChangedInstancesEndTimeMs - fetchInstanceConfigsEndTimeMs);
return;
}
@@ -263,7 +264,8 @@ public class RoutingManager implements ClusterChangeHandler {
_enabledServerInstanceMap.keySet().removeAll(newDisabledInstances);
LOGGER.info(
- "Processed instance config change in {}ms (fetch {} instance configs: {}ms, calculate changed instances: {}ms, update {} routing entries: {}ms), new enabled instances: {}, new disabled instances: {}",
+ "Processed instance config change in {}ms (fetch {} instance configs: {}ms, calculate changed instances: "
+ + "{}ms, update {} routing entries: {}ms), new enabled instances: {}, new disabled instances: {}",
updateRoutingEntriesEndTimeMs - startTimeMs, instanceConfigZNRecords.size(),
fetchInstanceConfigsEndTimeMs - startTimeMs, calculateChangedInstancesEndTimeMs - fetchInstanceConfigsEndTimeMs,
_routingEntryMap.size(), updateRoutingEntriesEndTimeMs - calculateChangedInstancesEndTimeMs,
@@ -271,8 +273,8 @@ public class RoutingManager implements ClusterChangeHandler {
}
private static boolean isInstanceEnabled(ZNRecord instanceConfigZNRecord) {
- if ("false"
- .equalsIgnoreCase(instanceConfigZNRecord.getSimpleField(InstanceConfig.InstanceConfigProperty.HELIX_ENABLED.name()))) {
+ if ("false".equalsIgnoreCase(
+ instanceConfigZNRecord.getSimpleField(InstanceConfig.InstanceConfigProperty.HELIX_ENABLED.name()))) {
return false;
}
if ("true".equalsIgnoreCase(instanceConfigZNRecord.getSimpleField(CommonConstants.Helix.IS_SHUTDOWN_IN_PROGRESS))) {
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/BaseInstanceSelector.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/BaseInstanceSelector.java
index e927f52..28e427d 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/BaseInstanceSelector.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/BaseInstanceSelector.java
@@ -225,14 +225,17 @@ abstract class BaseInstanceSelector implements InstanceSelector {
for (String offlineInstance : offlineInstancesForSegment) {
if (_enabledInstances.contains(offlineInstance)) {
LOGGER.info(
- "Failed to find servers hosting segment: {} for table: {} (all ONLINE/CONSUMING instances: {} are disabled, but find enabled OFFLINE instance: {} from OFFLINE instances: {}, not counting the segment as unavailable)",
- segment, _tableNameWithType, onlineInstancesForSegment, offlineInstance, offlineInstancesForSegment);
+ "Failed to find servers hosting segment: {} for table: {} (all ONLINE/CONSUMING instances: {} are "
+ + "disabled, but find enabled OFFLINE instance: {} from OFFLINE instances: {}, not counting the "
+ + "segment as unavailable)", segment, _tableNameWithType, onlineInstancesForSegment, offlineInstance,
+ offlineInstancesForSegment);
return null;
}
}
LOGGER.warn(
- "Failed to find servers hosting segment: {} for table: {} (all ONLINE/CONSUMING instances: {} and OFFLINE instances: {} are disabled, counting segment as unavailable)",
- segment, _tableNameWithType, onlineInstancesForSegment, offlineInstancesForSegment);
+ "Failed to find servers hosting segment: {} for table: {} (all ONLINE/CONSUMING instances: {} and OFFLINE "
+ + "instances: {} are disabled, counting segment as unavailable)", segment, _tableNameWithType,
+ onlineInstancesForSegment, offlineInstancesForSegment);
unavailableSegments.add(segment);
_brokerMetrics.addMeteredTableValue(_tableNameWithType, BrokerMeter.NO_SERVING_HOST_FOR_SEGMENT, 1);
return null;
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/SegmentPrunerFactory.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/SegmentPrunerFactory.java
index 6b645a4..9837db3 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/SegmentPrunerFactory.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/SegmentPrunerFactory.java
@@ -115,19 +115,16 @@ public class SegmentPrunerFactory {
String tableNameWithType = tableConfig.getTableName();
SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig();
if (validationConfig == null) {
- LOGGER.warn("Cannot enable time range pruning without validation config for table: {}",
- tableNameWithType);
+ LOGGER.warn("Cannot enable time range pruning without validation config for table: {}", tableNameWithType);
return null;
}
String timeColumn = validationConfig.getTimeColumnName();
if (timeColumn == null) {
- LOGGER.warn("Cannot enable time range pruning without time column for table: {}",
- tableNameWithType);
+ LOGGER.warn("Cannot enable time range pruning without time column for table: {}", tableNameWithType);
return null;
}
- LOGGER.info("Using TimeRangePruner on time column: {} for table: {}", timeColumn,
- tableNameWithType);
+ LOGGER.info("Using TimeRangePruner on time column: {} for table: {}", timeColumn, tableNameWithType);
return new TimeSegmentPruner(tableConfig, propertyStore);
}
@@ -141,7 +138,7 @@ public class SegmentPrunerFactory {
sortedPruners.add(pruner);
}
}
- for (SegmentPruner pruner: pruners) {
+ for (SegmentPruner pruner : pruners) {
if (!(pruner instanceof TimeSegmentPruner)) {
sortedPruners.add(pruner);
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/TimeSegmentPruner.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/TimeSegmentPruner.java
index de2a529..b56a528 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/TimeSegmentPruner.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/TimeSegmentPruner.java
@@ -56,7 +56,8 @@ import org.slf4j.LoggerFactory;
/**
- * The {@code TimeSegmentPruner} prunes segments based on their time column start & end time metadata stored in ZK. The pruner
+ * The {@code TimeSegmentPruner} prunes segments based on their time column start & end time metadata stored in ZK.
+ * The pruner
* supports queries with filter (or nested filter) of EQUALITY and RANGE predicates.
*/
public class TimeSegmentPruner implements SegmentPruner {
@@ -110,7 +111,8 @@ public class TimeSegmentPruner implements SegmentPruner {
}
private Interval extractIntervalFromSegmentZKMetaZNRecord(String segment, @Nullable ZNRecord znRecord) {
- // Segments without metadata or with invalid time interval will be set with [min_start, max_end] and will not be pruned
+ // Segments without metadata or with invalid time interval will be set with [min_start, max_end] and will not be
+ // pruned
if (znRecord == null) {
LOGGER.warn("Failed to find segment ZK metadata for segment: {}, table: {}", segment, _tableNameWithType);
return DEFAULT_INTERVAL;
@@ -194,8 +196,10 @@ public class TimeSegmentPruner implements SegmentPruner {
}
/**
- * @return Null if no time condition or cannot filter base on the condition (e.g. 'SELECT * from myTable where time < 50 OR firstName = Jason')
- * Empty list if time condition is specified but invalid (e.g. 'SELECT * from myTable where time < 50 AND time > 100')
+ * @return Null if no time condition or cannot filter base on the condition (e.g. 'SELECT * from myTable where time
+ * < 50 OR firstName = Jason')
+ * Empty list if time condition is specified but invalid (e.g. 'SELECT * from myTable where time < 50 AND
+ * time > 100')
*/
@Nullable
private List<Interval> getFilterTimeIntervals(Expression filterExpression) {
@@ -325,8 +329,10 @@ public class TimeSegmentPruner implements SegmentPruner {
}
/**
- * @return Null if no time condition or cannot filter base on the condition (e.g. 'SELECT * from myTable where time < 50 OR firstName = Jason')
- * @return Empty list if time condition is specified but invalid (e.g. 'SELECT * from myTable where time < 50 AND time > 100')
+ * @return Null if no time condition or cannot filter base on the condition (e.g. 'SELECT * from myTable where time
+ * < 50 OR firstName = Jason')
+ * Empty list if time condition is specified but invalid (e.g. 'SELECT * from myTable where time < 50 AND
+ * time > 100')
*/
@Deprecated
@Nullable
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/interval/IntervalTree.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/interval/IntervalTree.java
index aa35af9..c67b206 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/interval/IntervalTree.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/interval/IntervalTree.java
@@ -33,7 +33,8 @@ import org.apache.pinot.spi.utils.Pairs;
*/
public class IntervalTree<Value> {
- // List representation of BST with root at index 0. For node with index x, it's left child index is (2x+1), right child index is (2x+2)
+ // List representation of BST with root at index 0. For node with index x, it's left child index is (2x+1), right
+ // child index is (2x+2)
private final List<Node> _nodes;
public IntervalTree(Map<Value, Interval> valueToIntervalMap) {
@@ -111,7 +112,7 @@ public class IntervalTree<Value> {
}
private int getRightChildIndex(int nodeIndex) {
- return nodeIndex * 2 + 2;
+ return nodeIndex * 2 + 2;
}
private long getMax(int index) {
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/RealtimeSegmentSelector.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/RealtimeSegmentSelector.java
index 331a684..75d66ba 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/RealtimeSegmentSelector.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/RealtimeSegmentSelector.java
@@ -96,17 +96,18 @@ public class RealtimeSegmentSelector implements SegmentSelector {
if (instanceStateMap.containsValue(SegmentStateModel.CONSUMING)) {
// Keep the first CONSUMING segment for each partition
LLCSegmentName llcSegmentName = new LLCSegmentName(segment);
- partitionIdToFirstConsumingLLCSegmentMap.compute(llcSegmentName.getPartitionGroupId(), (k, consumingSegment) -> {
- if (consumingSegment == null) {
- return llcSegmentName;
- } else {
- if (llcSegmentName.getSequenceNumber() < consumingSegment.getSequenceNumber()) {
- return llcSegmentName;
- } else {
- return consumingSegment;
- }
- }
- });
+ partitionIdToFirstConsumingLLCSegmentMap
+ .compute(llcSegmentName.getPartitionGroupId(), (k, consumingSegment) -> {
+ if (consumingSegment == null) {
+ return llcSegmentName;
+ } else {
+ if (llcSegmentName.getSequenceNumber() < consumingSegment.getSequenceNumber()) {
+ return llcSegmentName;
+ } else {
+ return consumingSegment;
+ }
+ }
+ });
} else {
completedLLCSegments.add(segment);
}
diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/SegmentSelectorFactory.java b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/SegmentSelectorFactory.java
index 5b3ecdb..4085a54 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/SegmentSelectorFactory.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentselector/SegmentSelectorFactory.java
@@ -17,6 +17,7 @@
* under the License.
*/
package org.apache.pinot.broker.routing.segmentselector;
+
import org.apache.pinot.spi.config.table.TableConfig;
import org.apache.pinot.spi.config.table.TableType;
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManagerTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManagerTest.java
index 2a307f2..f9c1886 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManagerTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManagerTest.java
@@ -72,7 +72,8 @@ public class HelixExternalViewBasedQueryQuotaManagerTest {
_helixManager = initHelixManager(helixClusterName);
_testPropertyStore = _helixManager.getHelixPropertyStore();
- _queryQuotaManager = new HelixExternalViewBasedQueryQuotaManager(Mockito.mock(BrokerMetrics.class), BROKER_INSTANCE_ID);
+ _queryQuotaManager =
+ new HelixExternalViewBasedQueryQuotaManager(Mockito.mock(BrokerMetrics.class), BROKER_INSTANCE_ID);
_queryQuotaManager.init(_helixManager);
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/MaxHitRateTrackerTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/MaxHitRateTrackerTest.java
index 26ccb1f..b4d9cc5 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/MaxHitRateTrackerTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/queryquota/MaxHitRateTrackerTest.java
@@ -42,7 +42,8 @@ public class MaxHitRateTrackerTest {
latestTimeStamp = latestTimeStamp + 2000L;
Assert.assertEquals(5, hitCounter.getMaxCountPerBucket(latestTimeStamp));
- // This time it should return 0 as the internal lastAccessTimestamp has already been updated and there is no more hits between the gap.
+ // This time it should return 0 as the internal lastAccessTimestamp has already been updated and there is no more
+ // hits between the gap.
latestTimeStamp = latestTimeStamp + 2000L;
Assert.assertEquals(0, hitCounter.getMaxCountPerBucket(latestTimeStamp));
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/request/PqlAndCalciteSqlCompatibilityTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/request/PqlAndCalciteSqlCompatibilityTest.java
index 335506d..a4f2c54 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/request/PqlAndCalciteSqlCompatibilityTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/request/PqlAndCalciteSqlCompatibilityTest.java
@@ -35,7 +35,8 @@ import org.testng.annotations.Test;
/**
* Some tests for the SQL compiler.
- * Please note that this test will load test resources: `pql_queries.list` and `pql_queries.list` under `pinot-common` module.
+ * Please note that this test will load test resources: `pql_queries.list` and `pql_queries.list` under
+ * `pinot-common` module.
*/
public class PqlAndCalciteSqlCompatibilityTest {
private static final Pql2Compiler PQL_COMPILER = new Pql2Compiler();
@@ -48,15 +49,16 @@ public class PqlAndCalciteSqlCompatibilityTest {
@Test
public void testSinglePqlAndSqlCompatible() {
- String query =
- "SELECT CarrierDelay, Origin, DayOfWeek FROM mytable WHERE ActualElapsedTime BETWEEN 163 AND 322 OR CarrierDelay IN (17, 266) OR AirlineID IN (19690, 20366) ORDER BY TaxiIn, TailNum LIMIT 1";
+ String query = "SELECT CarrierDelay, Origin, DayOfWeek FROM mytable WHERE ActualElapsedTime BETWEEN 163 AND 322 OR "
+ + "CarrierDelay IN (17, 266) OR AirlineID IN (19690, 20366) ORDER BY TaxiIn, TailNum LIMIT 1";
testPqlSqlCompatibilityHelper(query, query);
}
@Test
public void testSinglePqlAndSqlGroupByOrderByCompatible() {
String query =
- "select group_city, sum(rsvp_count), count(*) from meetupRsvp group by group_city order by sum(rsvp_count), group_city DESC limit 100";
+ "select group_city, sum(rsvp_count), count(*) from meetupRsvp group by group_city order by sum(rsvp_count), "
+ + "group_city DESC limit 100";
testPqlSqlCompatibilityHelper(query, query);
}
@@ -88,44 +90,47 @@ public class PqlAndCalciteSqlCompatibilityTest {
public void testPqlSqlOrderByCompatibility() {
String pql = "SELECT count(*) FROM Foo GROUP BY VALUEIN(mv_col, 10790, 16344) TOP 10";
String sql =
- "SELECT VALUEIN(mv_col, 10790, 16344), count(*) FROM Foo GROUP BY VALUEIN(mv_col, 10790, 16344) ORDER BY count(*) LIMIT 10";
+ "SELECT VALUEIN(mv_col, 10790, 16344), count(*) FROM Foo GROUP BY VALUEIN(mv_col, 10790, 16344) ORDER BY "
+ + "count(*) LIMIT 10";
testPqlSqlOrderByCompatibilityHelper(pql, sql, "count(*)");
pql = "SELECT sum(col1) FROM Foo GROUP BY TIMECONVERT(timeCol, 'MILLISECONDS', 'SECONDS') TOP 10";
- sql =
- "SELECT TIMECONVERT(timeCol, 'MILLISECONDS', 'SECONDS'), sum(col1) FROM Foo GROUP BY TIMECONVERT(timeCol, 'MILLISECONDS', 'SECONDS') ORDER BY sum(col1) LIMIT 10";
+ sql = "SELECT TIMECONVERT(timeCol, 'MILLISECONDS', 'SECONDS'), sum(col1) FROM Foo GROUP BY TIMECONVERT(timeCol, "
+ + "'MILLISECONDS', 'SECONDS') ORDER BY sum(col1) LIMIT 10";
testPqlSqlOrderByCompatibilityHelper(pql, sql, "sum(col1)");
- pql =
- "SELECT max(add(col1,col2)) FROM Foo GROUP BY DATETIMECONVERT(timeCol, '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES') TOP 10";
- sql =
- "SELECT DATETIMECONVERT(timeCol, '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES'), max(add(col1,col2)) FROM Foo GROUP BY DATETIMECONVERT(timeCol, '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES') ORDER BY max(add(col1,col2)) LIMIT 10";
+ pql = "SELECT max(add(col1,col2)) FROM Foo GROUP BY DATETIMECONVERT(timeCol, '1:MILLISECONDS:EPOCH', "
+ + "'1:SECONDS:EPOCH', '15:MINUTES') TOP 10";
+ sql = "SELECT DATETIMECONVERT(timeCol, '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES'), max(add(col1,col2)"
+ + ") FROM Foo GROUP BY DATETIMECONVERT(timeCol, '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES') "
+ + "ORDER BY max(add(col1,col2)) LIMIT 10";
testPqlSqlOrderByCompatibilityHelper(pql, sql, "max(add(col1,col2))");
pql = "SELECT max(div(col1,col2)) FROM Foo GROUP BY TIMECONVERT(timeCol, 'MILLISECONDS', 'SECONDS')";
- sql =
- "SELECT TIMECONVERT(timeCol, 'MILLISECONDS', 'SECONDS'), max(div(col1,col2)) FROM Foo GROUP BY TIMECONVERT(timeCol, 'MILLISECONDS', 'SECONDS') ORDER BY max(div(col1,col2)) LIMIT 10";
+ sql = "SELECT TIMECONVERT(timeCol, 'MILLISECONDS', 'SECONDS'), max(div(col1,col2)) FROM Foo GROUP BY TIMECONVERT"
+ + "(timeCol, 'MILLISECONDS', 'SECONDS') ORDER BY max(div(col1,col2)) LIMIT 10";
testPqlSqlOrderByCompatibilityHelper(pql, sql, "max(div(col1,col2))");
pql = "SELECT count(*) FROM Foo GROUP BY VALUEIN(time, 10790, 16344) TOP 10";
- sql =
- "SELECT VALUEIN(\"time\", 10790, 16344), count(*) FROM Foo GROUP BY VALUEIN(\"time\", 10790, 16344) ORDER BY count(*) LIMIT 10";
+ sql = "SELECT VALUEIN(\"time\", 10790, 16344), count(*) FROM Foo GROUP BY VALUEIN(\"time\", 10790, 16344) ORDER BY "
+ + "count(*) LIMIT 10";
testPqlSqlOrderByCompatibilityHelper(pql, sql, "count(*)");
pql = "SELECT count(*) FROM Foo GROUP BY TIMECONVERT(time, 'MILLISECONDS', 'SECONDS') TOP 10";
- sql =
- "SELECT TIMECONVERT(\"time\", 'MILLISECONDS', 'SECONDS'), count(*) FROM Foo GROUP BY TIMECONVERT(\"time\", 'MILLISECONDS', 'SECONDS') ORDER BY count(*) LIMIT 10";
+ sql = "SELECT TIMECONVERT(\"time\", 'MILLISECONDS', 'SECONDS'), count(*) FROM Foo GROUP BY TIMECONVERT(\"time\", "
+ + "'MILLISECONDS', 'SECONDS') ORDER BY count(*) LIMIT 10";
testPqlSqlOrderByCompatibilityHelper(pql, sql, "count(*)");
- pql =
- "SELECT count(*) FROM Foo GROUP BY DATETIMECONVERT(time, '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES') TOP 10";
- sql =
- "SELECT DATETIMECONVERT(\"time\", '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES'), count(*) FROM Foo GROUP BY DATETIMECONVERT(\"time\", '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES') ORDER BY count(*) LIMIT 10";
+ pql = "SELECT count(*) FROM Foo GROUP BY DATETIMECONVERT(time, '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', "
+ + "'15:MINUTES') TOP 10";
+ sql = "SELECT DATETIMECONVERT(\"time\", '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES'), count(*) FROM Foo"
+ + " GROUP BY DATETIMECONVERT(\"time\", '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES') ORDER BY "
+ + "count(*) LIMIT 10";
testPqlSqlOrderByCompatibilityHelper(pql, sql, "count(*)");
pql = "SELECT max(div(col1,col2)) FROM Foo GROUP BY TIMECONVERT(time, 'MILLISECONDS', 'SECONDS') TOP 10";
- sql =
- "SELECT TIMECONVERT(\"time\", 'MILLISECONDS', 'SECONDS'), max(div(col1,col2)) FROM Foo GROUP BY TIMECONVERT(\"time\", 'MILLISECONDS', 'SECONDS') ORDER BY max(div(col1,col2)) LIMIT 10";
+ sql = "SELECT TIMECONVERT(\"time\", 'MILLISECONDS', 'SECONDS'), max(div(col1,col2)) FROM Foo GROUP BY TIMECONVERT"
+ + "(\"time\", 'MILLISECONDS', 'SECONDS') ORDER BY max(div(col1,col2)) LIMIT 10";
testPqlSqlOrderByCompatibilityHelper(pql, sql, "max(div(col1,col2))");
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/LiteralOnlyBrokerRequestTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/LiteralOnlyBrokerRequestTest.java
index 39e92b7..45f406e 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/LiteralOnlyBrokerRequestTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/LiteralOnlyBrokerRequestTest.java
@@ -154,13 +154,13 @@ public class LiteralOnlyBrokerRequestTest {
Assert.assertEquals(brokerResponse.getResultTable().getRows().get(0)[1], 1577836800000L);
Assert.assertEquals(brokerResponse.getTotalDocs(), 0);
-
long ONE_HOUR_IN_MS = TimeUnit.HOURS.toMillis(1);
long oneHourAgoTsMin = System.currentTimeMillis() - ONE_HOUR_IN_MS;
- request = new ObjectMapper().readTree(
- "{\"sql\":\"SELECT ago('PT1H') as oneHourAgoTs, fromDateTime('2020-01-01 UTC', 'yyyy-MM-dd z') as firstDayOf2020\"}");
- requestStats = new RequestStatistics();
- brokerResponse = requestHandler.handleRequest(request, null, requestStats);
+ request = new ObjectMapper().readTree(
+ "{\"sql\":\"SELECT ago('PT1H') as oneHourAgoTs, fromDateTime('2020-01-01 UTC', 'yyyy-MM-dd z') as "
+ + "firstDayOf2020\"}");
+ requestStats = new RequestStatistics();
+ brokerResponse = requestHandler.handleRequest(request, null, requestStats);
long oneHourAgoTsMax = System.currentTimeMillis() - ONE_HOUR_IN_MS;
Assert.assertEquals(brokerResponse.getResultTable().getDataSchema().getColumnName(0), "oneHourAgoTs");
Assert.assertEquals(brokerResponse.getResultTable().getDataSchema().getColumnDataType(0),
@@ -170,8 +170,10 @@ public class LiteralOnlyBrokerRequestTest {
DataSchema.ColumnDataType.LONG);
Assert.assertEquals(brokerResponse.getResultTable().getRows().size(), 1);
Assert.assertEquals(brokerResponse.getResultTable().getRows().get(0).length, 2);
- Assert.assertTrue(Long.parseLong(brokerResponse.getResultTable().getRows().get(0)[0].toString()) >= oneHourAgoTsMin);
- Assert.assertTrue(Long.parseLong(brokerResponse.getResultTable().getRows().get(0)[0].toString()) <= oneHourAgoTsMax);
+ Assert
+ .assertTrue(Long.parseLong(brokerResponse.getResultTable().getRows().get(0)[0].toString()) >= oneHourAgoTsMin);
+ Assert
+ .assertTrue(Long.parseLong(brokerResponse.getResultTable().getRows().get(0)[0].toString()) <= oneHourAgoTsMax);
Assert.assertEquals(brokerResponse.getResultTable().getRows().get(0)[1], 1577836800000L);
Assert.assertEquals(brokerResponse.getTotalDocs(), 0);
}
diff --git a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/QueryValidationTest.java b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/QueryValidationTest.java
index 7dac470..a5a7dd0 100644
--- a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/QueryValidationTest.java
+++ b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/QueryValidationTest.java
@@ -48,7 +48,8 @@ public class QueryValidationTest {
/**
* The behavior of GROUP BY with multiple aggregations, is different in PQL vs SQL.
* As a result, we have 2 groupByModes, to maintain backward compatibility.
- * The results of PQL groupByMode (if numAggregations > 1) cannot be returned in SQL responseFormat, as the results are non-tabular
+ * The results of PQL groupByMode (if numAggregations > 1) cannot be returned in SQL responseFormat, as the results
+ * are non-tabular
* Checking for this upfront, in validateRequest, to avoid executing the query and wasting resources
*
* Tests for this case as described above
@@ -56,33 +57,34 @@ public class QueryValidationTest {
@Test
public void testUnsupportedGroupByQueries() {
String pqlErrorMessage =
- "The results of a GROUP BY query with multiple aggregations in PQL is not tabular, and cannot be returned in SQL responseFormat";
+ "The results of a GROUP BY query with multiple aggregations in PQL is not tabular, and cannot be returned in "
+ + "SQL responseFormat";
String pql =
"SELECT MAX(column1), SUM(column2) FROM testTable GROUP BY column3 ORDER BY column3 option(responseFormat=sql)";
testUnsupportedPQLQuery(pql, pqlErrorMessage);
- pql =
- "SELECT MAX(column1), SUM(column2) FROM testTable GROUP BY column3 TOP 3 option(groupByMode=pql,responseFormat=sql)";
+ pql = "SELECT MAX(column1), SUM(column2) FROM testTable GROUP BY column3 TOP 3 option(groupByMode=pql,"
+ + "responseFormat=sql)";
testUnsupportedPQLQuery(pql, pqlErrorMessage);
- pql =
- "SELECT MAX(column1), SUM(column2) FROM testTable WHERE column5 = '100' GROUP BY column3 option(responseFormat=sql)";
+ pql = "SELECT MAX(column1), SUM(column2) FROM testTable WHERE column5 = '100' GROUP BY column3 option"
+ + "(responseFormat=sql)";
testUnsupportedPQLQuery(pql, pqlErrorMessage);
- pql =
- "SELECT MAX(column1), SUM(column2), SUM(column10) FROM testTable GROUP BY column3 option(groupByMode=pql,responseFormat=sql)";
+ pql = "SELECT MAX(column1), SUM(column2), SUM(column10) FROM testTable GROUP BY column3 option(groupByMode=pql,"
+ + "responseFormat=sql)";
testUnsupportedPQLQuery(pql, pqlErrorMessage);
pql = "SELECT MAXMV(column1), SUMMV(column2) FROM testTable GROUP BY column3 option(responseFormat=sql)";
testUnsupportedPQLQuery(pql, pqlErrorMessage);
- pql =
- "SELECT MAXMV(column1), SUM(column2) FROM testTable GROUP BY column3 ORDER BY MAXMV(column1) option(responseFormat=sql)";
+ pql = "SELECT MAXMV(column1), SUM(column2) FROM testTable GROUP BY column3 ORDER BY MAXMV(column1) option"
+ + "(responseFormat=sql)";
testUnsupportedPQLQuery(pql, pqlErrorMessage);
- pql =
- "SELECT PERCENTILE95(column1), DISTINCTCOUNTHLL(column2) FROM testTable GROUP BY column3 option(responseFormat=sql)";
+ pql = "SELECT PERCENTILE95(column1), DISTINCTCOUNTHLL(column2) FROM testTable GROUP BY column3 option"
+ + "(responseFormat=sql)";
testUnsupportedPQLQuery(pql, pqlErrorMessage);
String sqlErrorMessage = "SQL query should always have response format and group-by mode set to SQL";
diff --git a/pinot-broker/src/test/resources/log4j2.xml b/pinot-broker/src/test/resources/log4j2.xml
index 4bbc67f..f0d887a 100644
--- a/pinot-broker/src/test/resources/log4j2.xml
+++ b/pinot-broker/src/test/resources/log4j2.xml
@@ -29,7 +29,7 @@
</Appenders>
<Loggers>
<AsyncRoot level="warn" additivity="false">
- <AppenderRef ref="console" />
+ <AppenderRef ref="console"/>
</AsyncRoot>
</Loggers>
</Configuration>
diff --git a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ExecutionStats.java b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ExecutionStats.java
index 3c1685e..c66ca39 100644
--- a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ExecutionStats.java
+++ b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ExecutionStats.java
@@ -70,11 +70,13 @@ public class ExecutionStats {
}
public long getNumEntriesScannedInFilter() {
- return _brokerResponse.has(NUM_ENTRIES_SCANNED_IN_FILTER) ? _brokerResponse.get(NUM_ENTRIES_SCANNED_IN_FILTER).asLong() : -1L;
+ return _brokerResponse.has(NUM_ENTRIES_SCANNED_IN_FILTER) ? _brokerResponse.get(NUM_ENTRIES_SCANNED_IN_FILTER)
+ .asLong() : -1L;
}
public long getNumEntriesScannedPostFilter() {
- return _brokerResponse.has(NUM_ENTRIES_SCANNED_POST_FILTER) ? _brokerResponse.get(NUM_ENTRIES_SCANNED_POST_FILTER).asLong() : -1L;
+ return _brokerResponse.has(NUM_ENTRIES_SCANNED_POST_FILTER) ? _brokerResponse.get(NUM_ENTRIES_SCANNED_POST_FILTER)
+ .asLong() : -1L;
}
public long getNumSegmentsQueried() {
@@ -90,11 +92,13 @@ public class ExecutionStats {
}
public long getNumConsumingSegmentsQueried() {
- return _brokerResponse.has(NUM_CONSUMING_SEGMENTS_QUERIED) ? _brokerResponse.get(NUM_CONSUMING_SEGMENTS_QUERIED).asLong() : -1L;
+ return _brokerResponse.has(NUM_CONSUMING_SEGMENTS_QUERIED) ? _brokerResponse.get(NUM_CONSUMING_SEGMENTS_QUERIED)
+ .asLong() : -1L;
}
public long getMinConsumingFreshnessTimeMs() {
- return _brokerResponse.has(MIN_CONSUMING_FRESHNESS_TIME_MS) ? _brokerResponse.get(MIN_CONSUMING_FRESHNESS_TIME_MS).asLong() : -1L;
+ return _brokerResponse.has(MIN_CONSUMING_FRESHNESS_TIME_MS) ? _brokerResponse.get(MIN_CONSUMING_FRESHNESS_TIME_MS)
+ .asLong() : -1L;
}
public long getTotalDocs() {
diff --git a/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ExecutionStatsTest.java b/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ExecutionStatsTest.java
index 41d1eeb..476bea8 100644
--- a/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ExecutionStatsTest.java
+++ b/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ExecutionStatsTest.java
@@ -39,9 +39,10 @@ public class ExecutionStatsTest {
public void setUp()
throws Exception {
String json =
- "{\"numServersQueried\":10, \"numServersResponded\":10, \"numDocsScanned\":10, \"numEntriesScannedInFilter\":10, "
- + "\"numEntriesScannedPostFilter\":10, \"numSegmentsQueried\":10, \"numSegmentsProcessed\":10, \"numSegmentsMatched\":10, "
- + "\"numConsumingSegmentsQueried\":10, \"minConsumingFreshnessTimeMs\":10, \"totalDocs\":10, \"numGroupsLimitReached\":true, "
+ "{\"numServersQueried\":10, \"numServersResponded\":10, \"numDocsScanned\":10, "
+ + "\"numEntriesScannedInFilter\":10, \"numEntriesScannedPostFilter\":10, \"numSegmentsQueried\":10, "
+ + "\"numSegmentsProcessed\":10, \"numSegmentsMatched\":10, \"numConsumingSegmentsQueried\":10, "
+ + "\"minConsumingFreshnessTimeMs\":10, \"totalDocs\":10, \"numGroupsLimitReached\":true, "
+ "\"timeUsedMs\":10}";
ObjectMapper objectMapper = new ObjectMapper();
_mockBrokerResponse = objectMapper.readTree(json);
diff --git a/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ExternalViewReaderTest.java b/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ExternalViewReaderTest.java
index 24f6ef8..36fb91d 100644
--- a/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ExternalViewReaderTest.java
+++ b/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ExternalViewReaderTest.java
@@ -48,8 +48,8 @@ public class ExternalViewReaderTest {
public void setUp()
throws Exception {
initMocks(this);
- InputStream mockInputStream = IOUtils.toInputStream(
- "{\"mapFields\":{\"field1\":{\"Broker_12.34.56.78_1234\":\"ONLINE\"}}}", "UTF-8");
+ InputStream mockInputStream =
+ IOUtils.toInputStream("{\"mapFields\":{\"field1\":{\"Broker_12.34.56.78_1234\":\"ONLINE\"}}}", "UTF-8");
_externalViewReaderUnderTest = Mockito.spy(new ExternalViewReader(_mockZkClient) {
@Override
protected ByteArrayInputStream getInputStream(byte[] brokerResourceNodeData) {
@@ -63,8 +63,7 @@ public class ExternalViewReaderTest {
throws IOException {
// Setup
final List<String> expectedResult = Arrays.asList("12.34.56.78:1234");
- when(_mockZkClient.readData(Mockito.anyString(), Mockito.anyBoolean())).thenReturn(
- "json".getBytes());
+ when(_mockZkClient.readData(Mockito.anyString(), Mockito.anyBoolean())).thenReturn("json".getBytes());
// Run the test
final List<String> result = _externalViewReaderUnderTest.getLiveBrokers();
@@ -78,8 +77,7 @@ public class ExternalViewReaderTest {
throws IOException {
// Setup
final List<String> expectedResult = Arrays.asList();
- when(_mockZkClient.readData(Mockito.anyString(), Mockito.anyBoolean())).thenThrow(
- RuntimeException.class);
+ when(_mockZkClient.readData(Mockito.anyString(), Mockito.anyBoolean())).thenThrow(RuntimeException.class);
// Run the test
final List<String> result = _externalViewReaderUnderTest.getLiveBrokers();
@@ -93,8 +91,7 @@ public class ExternalViewReaderTest {
// Setup
final Map<String, List<String>> expectedResult = new HashMap<>();
expectedResult.put("field1", Arrays.asList("12.34.56.78:1234"));
- when(_mockZkClient.readData(Mockito.anyString(), Mockito.anyBoolean())).thenReturn(
- "json".getBytes());
+ when(_mockZkClient.readData(Mockito.anyString(), Mockito.anyBoolean())).thenReturn("json".getBytes());
// Run the test
final Map<String, List<String>> result = _externalViewReaderUnderTest.getTableToBrokersMap();
@@ -107,8 +104,7 @@ public class ExternalViewReaderTest {
public void testGetTableToBrokersMapExceptionState() {
// Setup
final Map<String, List<String>> expectedResult = new HashMap<>();
- when(_mockZkClient.readData(Mockito.anyString(), Mockito.anyBoolean())).thenThrow(
- RuntimeException.class);
+ when(_mockZkClient.readData(Mockito.anyString(), Mockito.anyBoolean())).thenThrow(RuntimeException.class);
// Run the test
final Map<String, List<String>> result = _externalViewReaderUnderTest.getTableToBrokersMap();
diff --git a/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ResultTableResultSetTest.java b/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ResultTableResultSetTest.java
index bed4164..6e05773 100644
--- a/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ResultTableResultSetTest.java
+++ b/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/ResultTableResultSetTest.java
@@ -39,8 +39,8 @@ public class ResultTableResultSetTest {
public void setUp()
throws Exception {
String json =
- "{ \"rows\" : [[\"r1c1\", \"r1c2\"], [\"r2c1\", \"r2c2\"]], \"dataSchema\" : {\"columnNames\":[\"column1\", \"column2\"], "
- + "\"columnDataTypes\":[\"column1DataType\", \"column2DataType\"]} } ";
+ "{ \"rows\" : [[\"r1c1\", \"r1c2\"], [\"r2c1\", \"r2c2\"]], \"dataSchema\" : {\"columnNames\":[\"column1\", "
+ + "\"column2\"], " + "\"columnDataTypes\":[\"column1DataType\", \"column2DataType\"]} } ";
ObjectMapper objectMapper = new ObjectMapper();
_jsonNode = objectMapper.readTree(json);
_resultTableResultSetUnderTest = new ResultTableResultSet(_jsonNode);
diff --git a/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/SelectionResultSetTest.java b/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/SelectionResultSetTest.java
index e36be08..6de0fcb 100644
--- a/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/SelectionResultSetTest.java
+++ b/pinot-clients/pinot-java-client/src/test/java/org/apache/pinot/client/SelectionResultSetTest.java
@@ -36,8 +36,7 @@ public class SelectionResultSetTest {
@BeforeMethod
public void setUp()
throws Exception {
- String jsonString =
- "{\"results\":[[\"r1c1\",\"r1c2\"]], \"columns\":[\"column1\", \"column2\"]}";
+ String jsonString = "{\"results\":[[\"r1c1\",\"r1c2\"]], \"columns\":[\"column1\", \"column2\"]}";
ObjectMapper objectMapper = new ObjectMapper();
_mockSelectionResults = objectMapper.readTree(jsonString);
_selectionResultSetUnderTest = new SelectionResultSet(_mockSelectionResults);
diff --git a/pinot-clients/pinot-jdbc-client/pom.xml b/pinot-clients/pinot-jdbc-client/pom.xml
index 9562491..0879a0b 100644
--- a/pinot-clients/pinot-jdbc-client/pom.xml
+++ b/pinot-clients/pinot-jdbc-client/pom.xml
@@ -130,7 +130,8 @@
</goals>
<configuration>
<transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
+ <transformer
+ implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
</transformers>
</configuration>
</execution>
diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotConnectionMetaData.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotConnectionMetaData.java
index 0b28557..97fa53c 100644
--- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotConnectionMetaData.java
+++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotConnectionMetaData.java
@@ -189,9 +189,10 @@ public class PinotConnectionMetaData extends AbstractBaseConnectionMetaData {
String columnDataType = columns.get("dataType").textValue();
Integer columnsSQLDataType = DriverUtils.getSQLDataType(columnDataType);
- Object[] row =
- new Object[]{null, null, tableName, columnName, columnsSQLDataType, columnDataType, -1, -1, -1, -1, 1, null, null, -1, -1, -1,
- ordinalPosition, "NO", null, null, null, -1, "NO", "NO"};
+ Object[] row = new Object[]{
+ null, null, tableName, columnName, columnsSQLDataType, columnDataType, -1, -1, -1, -1, 1, null, null, -1, -1,
+ -1, ordinalPosition, "NO", null, null, null, -1, "NO", "NO"
+ };
pinotMeta.addRow(Arrays.asList(row));
}
diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotDriver.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotDriver.java
index ba2c459..8f1abf2 100644
--- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotDriver.java
+++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotDriver.java
@@ -58,7 +58,8 @@ public class PinotDriver implements Driver {
Map<String, String> headers =
info.entrySet().stream().filter(entry -> entry.getKey().toString().startsWith(INFO_HEADERS + ".")).map(
- entry -> Pair.of(entry.getKey().toString().substring(INFO_HEADERS.length() + 1), entry.getValue().toString()))
+ entry -> Pair
+ .of(entry.getKey().toString().substring(INFO_HEADERS.length() + 1), entry.getValue().toString()))
.collect(Collectors.toMap(Pair::getKey, Pair::getValue));
if (!headers.isEmpty()) {
factory.setHeaders(headers);
@@ -88,7 +89,8 @@ public class PinotDriver implements Driver {
DriverPropertyInfo tenantPropertyInfo = new DriverPropertyInfo("tenant", null);
tenantPropertyInfo.required = true;
tenantPropertyInfo.description =
- "Name of the tenant for which to create the JDBC connection. You can only query the tables belonging to the specified tenant";
+ "Name of the tenant for which to create the JDBC connection. You can only query the tables belonging to the "
+ + "specified tenant";
propertyInfoList.add(tenantPropertyInfo);
return Iterables.toArray(propertyInfoList, DriverPropertyInfo.class);
}
diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotResultMetadata.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotResultMetadata.java
index 14ef6bd..3f7df21 100644
--- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotResultMetadata.java
+++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotResultMetadata.java
@@ -30,7 +30,8 @@ public class PinotResultMetadata extends AbstractBaseResultSetMetadata {
private Map<Integer, String> _columns = new HashMap<>();
private Map<Integer, String> _columnDataTypes = new HashMap<>();
- public PinotResultMetadata(int totalColumns, Map<String, Integer> columnsNameToIndex, Map<Integer, String> columnDataTypes) {
+ public PinotResultMetadata(int totalColumns, Map<String, Integer> columnsNameToIndex,
+ Map<Integer, String> columnDataTypes) {
_totalColumns = totalColumns;
_columnDataTypes = columnDataTypes;
for (Map.Entry<String, Integer> entry : columnsNameToIndex.entrySet()) {
diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/controller/response/ControllerTenantBrokerResponse.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/controller/response/ControllerTenantBrokerResponse.java
index 9de57be..5872219 100644
--- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/controller/response/ControllerTenantBrokerResponse.java
+++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/controller/response/ControllerTenantBrokerResponse.java
@@ -67,7 +67,8 @@ public class ControllerTenantBrokerResponse {
return brokerList;
}
- public static class ControllerTenantBrokerResponseFuture extends ControllerResponseFuture<ControllerTenantBrokerResponse> {
+ public static class ControllerTenantBrokerResponseFuture
+ extends ControllerResponseFuture<ControllerTenantBrokerResponse> {
private static final ObjectReader OBJECT_READER = new ObjectMapper().reader();
public ControllerTenantBrokerResponseFuture(Future<Response> response, String url) {
diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/utils/Constants.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/utils/Constants.java
index 6c7c8c5..bfbf5c7 100644
--- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/utils/Constants.java
+++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/utils/Constants.java
@@ -33,20 +33,23 @@ public class Constants {
public static final String[] SCHEMA_COLUMNS = {"TABLE_SCHEM", "TABLE_CATALOG"};
public static final String[] SCHEMA_COLUMNS_DTYPES = {"STRING", "STRING"};
- public static final String[] TABLE_COLUMNS =
- {"TABLE_SCHEM", "TABLE_CATALOG", "TABLE_NAME", "TABLE_TYPE", "REMARKS", "TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME",
- "SELF_REFERENCING_COL_NAME", "REF_GENERATION"};
+ public static final String[] TABLE_COLUMNS = {
+ "TABLE_SCHEM", "TABLE_CATALOG", "TABLE_NAME", "TABLE_TYPE", "REMARKS", "TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME",
+ "SELF_REFERENCING_COL_NAME", "REF_GENERATION"
+ };
public static final String[] TABLE_COLUMNS_DTYPES =
{"STRING", "STRING", "STRING", "STRING", "STRING", "STRING", "STRING", "STRING", "STRING", "STRING"};
- public static final String[] TABLE_SCHEMA_COLUMNS =
- {"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS",
- "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH",
- "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATALOG", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT",
- "IS_GENERATEDCOLUMN"};
- public static final String[] TABLE_SCHEMA_COLUMNS_DTYPES =
- {"STRING", "STRING", "STRING", "STRING", "INT", "STRING", "INT", "INT", "INT", "INT", "INT", "STRING", "STRING", "INT", "INT", "INT",
- "INT", "STRING", "STRING", "STRING", "STRING", "INT", "STRING", "STRING"};
+ public static final String[] TABLE_SCHEMA_COLUMNS = {
+ "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH",
+ "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB",
+ "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATALOG", "SCOPE_SCHEMA", "SCOPE_TABLE",
+ "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT", "IS_GENERATEDCOLUMN"
+ };
+ public static final String[] TABLE_SCHEMA_COLUMNS_DTYPES = {
+ "STRING", "STRING", "STRING", "STRING", "INT", "STRING", "INT", "INT", "INT", "INT", "INT", "STRING", "STRING",
+ "INT", "INT", "INT", "INT", "STRING", "STRING", "STRING", "STRING", "INT", "STRING", "STRING"
+ };
public static final String[] TABLE_TYPES_COLUMNS = {"TABLE_TYPE"};
public static final String[] TABLE_TYPES_COLUMNS_DTYPES = {"STRING"};
diff --git a/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotDriverTest.java b/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotDriverTest.java
index 960a5e3..36dccaa 100644
--- a/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotDriverTest.java
+++ b/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotDriverTest.java
@@ -37,7 +37,8 @@ public class PinotDriverTest {
Connection conn = DriverManager.getConnection(DB_URL);
Statement statement = conn.createStatement();
Integer limitResults = 10;
- ResultSet rs = statement.executeQuery(String.format("SELECT UPPER(playerName) AS name FROM baseballStats LIMIT %d", limitResults));
+ ResultSet rs = statement
+ .executeQuery(String.format("SELECT UPPER(playerName) AS name FROM baseballStats LIMIT %d", limitResults));
Set<String> results = new HashSet<>();
Integer resultCount = 0;
while (rs.next()) {
diff --git a/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotPreparedStatementTest.java b/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotPreparedStatementTest.java
index 6c290c4..67f92a2 100644
--- a/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotPreparedStatementTest.java
+++ b/pinot-clients/pinot-jdbc-client/src/test/java/org/apache/pinot/client/PinotPreparedStatementTest.java
@@ -40,7 +40,8 @@ public class PinotPreparedStatementTest {
@Test
public void testSetAndClearValues()
throws Exception {
- PinotConnection connection = new PinotConnection("dummy", _dummyPinotClientTransport, "dummy", _dummyPinotControllerTransport);
+ PinotConnection connection =
+ new PinotConnection("dummy", _dummyPinotClientTransport, "dummy", _dummyPinotControllerTransport);
PreparedStatement preparedStatement = connection.prepareStatement(QUERY);
preparedStatement.setString(1, "foo");
@@ -54,8 +55,8 @@ public class PinotPreparedStatementTest {
String lastExecutedQuery = _dummyPinotClientTransport.getLastQuery();
Assert.assertEquals(lastExecutedQuery.substring(0, lastExecutedQuery.indexOf("LIMIT")).trim(),
- "SELECT * FROM dummy WHERE name = 'foo' and age = 20 and score = 98.1 and ts = 123456789 and eligible = 'true' and sub_score = 1"
- + ".4");
+ "SELECT * FROM dummy WHERE name = 'foo' and age = 20 and score = 98.1 and ts = 123456789 and eligible = "
+ + "'true' and sub_score = 1" + ".4");
preparedStatement.clearParameters();
preparedStatement.setString(1, "");
@@ -69,13 +70,15 @@ public class PinotPreparedStatementTest {
lastExecutedQuery = _dummyPinotClientTransport.getLastQuery();
Assert.assertEquals(lastExecutedQuery.substring(0, lastExecutedQuery.indexOf("LIMIT")).trim(),
- "SELECT * FROM dummy WHERE name = '' and age = 0 and score = 0.0 and ts = 0 and eligible = 'false' and sub_score = 0.0");
+ "SELECT * FROM dummy WHERE name = '' and age = 0 and score = 0.0 and ts = 0 and eligible = 'false' and "
+ + "sub_score = 0.0");
}
@Test
public void testSetDateTime()
throws Exception {
- PinotConnection connection = new PinotConnection("dummy", _dummyPinotClientTransport, "dummy", _dummyPinotControllerTransport);
+ PinotConnection connection =
+ new PinotConnection("dummy", _dummyPinotClientTransport, "dummy", _dummyPinotControllerTransport);
PreparedStatement preparedStatement = connection.prepareStatement(DATE_QUERY);
Long currentTimestamp = System.currentTimeMillis();
@@ -96,7 +99,8 @@ public class PinotPreparedStatementTest {
@Test
public void testSetAdditionalDataTypes()
throws Exception {
- PinotConnection connection = new PinotConnection("dummy", _dummyPinotClientTransport, "dummy", _dummyPinotControllerTransport);
+ PinotConnection connection =
+ new PinotConnection("dummy", _dummyPinotClientTransport, "dummy", _dummyPinotControllerTransport);
PreparedStatement preparedStatement = connection.prepareStatement(SINGLE_STRING_QUERY);
String value = "1234567891011121314151617181920";
diff --git a/pinot-common/pom.xml b/pinot-common/pom.xml
index 32856d2..aae569f 100644
--- a/pinot-common/pom.xml
+++ b/pinot-common/pom.xml
@@ -357,31 +357,31 @@
<phase>generate-sources</phase>
<configuration>
<tasks>
- <delete dir="target/generated-sources/gen-javabean" />
- <mkdir dir="target/generated-sources" />
+ <delete dir="target/generated-sources/gen-javabean"/>
+ <mkdir dir="target/generated-sources"/>
<exec executable="/usr/local/bin/thrift">
- <arg value="--gen" />
- <arg value="java:beans" />
- <arg value="-o" />
- <arg value="target/generated-sources" />
- <arg value="src/thrift/query.thrift" />
+ <arg value="--gen"/>
+ <arg value="java:beans"/>
+ <arg value="-o"/>
+ <arg value="target/generated-sources"/>
+ <arg value="src/thrift/query.thrift"/>
</exec>
<exec executable="/usr/local/bin/thrift">
- <arg value="--gen" />
- <arg value="java:beans" />
- <arg value="-o" />
- <arg value="target/generated-sources" />
- <arg value="src/thrift/request.thrift" />
+ <arg value="--gen"/>
+ <arg value="java:beans"/>
+ <arg value="-o"/>
+ <arg value="target/generated-sources"/>
+ <arg value="src/thrift/request.thrift"/>
</exec>
<exec executable="/usr/local/bin/thrift">
- <arg value="--gen" />
- <arg value="java:beans" />
- <arg value="-o" />
- <arg value="target/generated-sources" />
- <arg value="src/thrift/response.thrift" />
+ <arg value="--gen"/>
+ <arg value="java:beans"/>
+ <arg value="-o"/>
+ <arg value="target/generated-sources"/>
+ <arg value="src/thrift/response.thrift"/>
</exec>
<copy todir="src/main/java/">
- <fileset dir="target/generated-sources/gen-javabean" />
+ <fileset dir="target/generated-sources/gen-javabean"/>
</copy>
</tasks>
</configuration>
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstanceAssignmentConfigUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstanceAssignmentConfigUtils.java
index f3d0dab..8a8b08b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstanceAssignmentConfigUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstanceAssignmentConfigUtils.java
@@ -43,25 +43,29 @@ public class InstanceAssignmentConfigUtils {
* backward-compatibility) COMPLETED server tag is overridden to be different from the CONSUMING server tag.
*/
public static boolean shouldRelocateCompletedSegments(TableConfig tableConfig) {
- Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap = tableConfig.getInstanceAssignmentConfigMap();
- return (instanceAssignmentConfigMap != null && instanceAssignmentConfigMap.get(InstancePartitionsType.COMPLETED) != null)
- || TagNameUtils.isRelocateCompletedSegments(tableConfig.getTenantConfig());
+ Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap =
+ tableConfig.getInstanceAssignmentConfigMap();
+ return (instanceAssignmentConfigMap != null
+ && instanceAssignmentConfigMap.get(InstancePartitionsType.COMPLETED) != null) || TagNameUtils
+ .isRelocateCompletedSegments(tableConfig.getTenantConfig());
}
/**
* Returns whether the instance assignment is allowed for the given table config and instance partitions type.
*/
- public static boolean allowInstanceAssignment(TableConfig tableConfig, InstancePartitionsType instancePartitionsType) {
+ public static boolean allowInstanceAssignment(TableConfig tableConfig,
+ InstancePartitionsType instancePartitionsType) {
TableType tableType = tableConfig.getTableType();
- Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap = tableConfig.getInstanceAssignmentConfigMap();
+ Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap =
+ tableConfig.getInstanceAssignmentConfigMap();
switch (instancePartitionsType) {
// Allow OFFLINE instance assignment if the offline table has it configured or (for backward-compatibility) is
// using replica-group segment assignment
case OFFLINE:
- return tableType == TableType.OFFLINE && (
- (instanceAssignmentConfigMap != null && instanceAssignmentConfigMap.get(InstancePartitionsType.OFFLINE) != null)
- || AssignmentStrategy.REPLICA_GROUP_SEGMENT_ASSIGNMENT_STRATEGY
- .equalsIgnoreCase(tableConfig.getValidationConfig().getSegmentAssignmentStrategy()));
+ return tableType == TableType.OFFLINE && ((instanceAssignmentConfigMap != null
+ && instanceAssignmentConfigMap.get(InstancePartitionsType.OFFLINE) != null)
+ || AssignmentStrategy.REPLICA_GROUP_SEGMENT_ASSIGNMENT_STRATEGY
+ .equalsIgnoreCase(tableConfig.getValidationConfig().getSegmentAssignmentStrategy()));
// Allow CONSUMING/COMPLETED instance assignment if the real-time table has it configured
case CONSUMING:
case COMPLETED:
@@ -81,7 +85,8 @@ public class InstanceAssignmentConfigUtils {
"Instance assignment is not allowed for the given table config");
// Use the instance assignment config from the table config if it exists
- Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap = tableConfig.getInstanceAssignmentConfigMap();
+ Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap =
+ tableConfig.getInstanceAssignmentConfigMap();
if (instanceAssignmentConfigMap != null) {
InstanceAssignmentConfig instanceAssignmentConfig = instanceAssignmentConfigMap.get(instancePartitionsType);
if (instanceAssignmentConfig != null) {
@@ -103,15 +108,15 @@ public class InstanceAssignmentConfigUtils {
String partitionColumn = replicaGroupStrategyConfig.getPartitionColumn();
if (partitionColumn != null) {
int numPartitions = tableConfig.getIndexingConfig().getSegmentPartitionConfig().getNumPartitions(partitionColumn);
- Preconditions.checkState(numPartitions > 0, "Number of partitions for column: %s is not properly configured", partitionColumn);
+ Preconditions.checkState(numPartitions > 0, "Number of partitions for column: %s is not properly configured",
+ partitionColumn);
replicaGroupPartitionConfig = new InstanceReplicaGroupPartitionConfig(true, 0, numReplicaGroups, 0, numPartitions,
replicaGroupStrategyConfig.getNumInstancesPerPartition());
} else {
// If partition column is not configured, use replicaGroupStrategyConfig.getNumInstancesPerPartition() as
// number of instances per replica-group for backward-compatibility
- replicaGroupPartitionConfig =
- new InstanceReplicaGroupPartitionConfig(true, 0, numReplicaGroups, replicaGroupStrategyConfig.getNumInstancesPerPartition(), 0,
- 0);
+ replicaGroupPartitionConfig = new InstanceReplicaGroupPartitionConfig(true, 0, numReplicaGroups,
+ replicaGroupStrategyConfig.getNumInstancesPerPartition(), 0, 0);
}
return new InstanceAssignmentConfig(tagPoolConfig, null, replicaGroupPartitionConfig);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstancePartitions.java b/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstancePartitions.java
index fd99e1a..c511077 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstancePartitions.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstancePartitions.java
@@ -70,8 +70,10 @@ public class InstancePartitions {
}
@JsonCreator
- private InstancePartitions(@JsonProperty(value = "instancePartitionsName", required = true) String instancePartitionsName,
- @JsonProperty(value = "partitionToInstancesMap", required = true) Map<String, List<String>> partitionToInstancesMap) {
+ private InstancePartitions(
+ @JsonProperty(value = "instancePartitionsName", required = true) String instancePartitionsName,
+ @JsonProperty(value = "partitionToInstancesMap", required = true)
+ Map<String, List<String>> partitionToInstancesMap) {
_instancePartitionsName = instancePartitionsName;
_partitionToInstancesMap = partitionToInstancesMap;
for (String key : partitionToInstancesMap.keySet()) {
@@ -104,7 +106,8 @@ public class InstancePartitions {
}
public List<String> getInstances(int partitionId, int replicaGroupId) {
- return _partitionToInstancesMap.get(Integer.toString(partitionId) + PARTITION_REPLICA_GROUP_SEPARATOR + replicaGroupId);
+ return _partitionToInstancesMap
+ .get(Integer.toString(partitionId) + PARTITION_REPLICA_GROUP_SEPARATOR + replicaGroupId);
}
public void setInstances(int partitionId, int replicaGroupId, List<String> instances) {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstancePartitionsUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstancePartitionsUtils.java
index f2b06d4..b6dd5a3 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstancePartitionsUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/assignment/InstancePartitionsUtils.java
@@ -63,8 +63,8 @@ public class InstancePartitionsUtils {
// Fetch the instance partitions from property store if it exists
ZkHelixPropertyStore<ZNRecord> propertyStore = helixManager.getHelixPropertyStore();
- InstancePartitions instancePartitions =
- fetchInstancePartitions(propertyStore, getInstancePartitionsName(tableNameWithType, instancePartitionsType.toString()));
+ InstancePartitions instancePartitions = fetchInstancePartitions(propertyStore,
+ getInstancePartitionsName(tableNameWithType, instancePartitionsType.toString()));
if (instancePartitions != null) {
return instancePartitions;
}
@@ -77,7 +77,8 @@ public class InstancePartitionsUtils {
* Fetches the instance partitions from Helix property store.
*/
@Nullable
- public static InstancePartitions fetchInstancePartitions(HelixPropertyStore<ZNRecord> propertyStore, String instancePartitionsName) {
+ public static InstancePartitions fetchInstancePartitions(HelixPropertyStore<ZNRecord> propertyStore,
+ String instancePartitionsName) {
String path = ZKMetadataProvider.constructPropertyStorePathForInstancePartitions(instancePartitionsName);
ZNRecord znRecord = propertyStore.get(path, null, AccessOption.PERSISTENT);
return znRecord != null ? InstancePartitions.fromZNRecord(znRecord) : null;
@@ -106,7 +107,8 @@ public class InstancePartitionsUtils {
default:
throw new IllegalStateException();
}
- return computeDefaultInstancePartitionsForTag(helixManager, tableConfig.getTableName(), instancePartitionsType.toString(), serverTag);
+ return computeDefaultInstancePartitionsForTag(helixManager, tableConfig.getTableName(),
+ instancePartitionsType.toString(), serverTag);
}
/**
@@ -115,8 +117,8 @@ public class InstancePartitionsUtils {
* <p>Choose both enabled and disabled instances with the server tag as the qualified instances to avoid unexpected
* data shuffling when instances get disabled.
*/
- public static InstancePartitions computeDefaultInstancePartitionsForTag(HelixManager helixManager, String tableNameWithType,
- String instancePartitionsType, String serverTag) {
+ public static InstancePartitions computeDefaultInstancePartitionsForTag(HelixManager helixManager,
+ String tableNameWithType, String instancePartitionsType, String serverTag) {
List<String> instances = HelixHelper.getInstancesWithTag(helixManager, serverTag);
int numInstances = instances.size();
Preconditions.checkState(numInstances > 0, "No instance found with tag: %s", serverTag);
@@ -124,7 +126,8 @@ public class InstancePartitionsUtils {
// Sort the instances and rotate the list based on the table name
instances.sort(null);
Collections.rotate(instances, -(Math.abs(tableNameWithType.hashCode()) % numInstances));
- InstancePartitions instancePartitions = new InstancePartitions(getInstancePartitionsName(tableNameWithType, instancePartitionsType));
+ InstancePartitions instancePartitions =
+ new InstancePartitions(getInstancePartitionsName(tableNameWithType, instancePartitionsType));
instancePartitions.setInstances(0, 0, instances);
return instancePartitions;
}
@@ -132,8 +135,10 @@ public class InstancePartitionsUtils {
/**
* Persists the instance partitions to Helix property store.
*/
- public static void persistInstancePartitions(HelixPropertyStore<ZNRecord> propertyStore, InstancePartitions instancePartitions) {
- String path = ZKMetadataProvider.constructPropertyStorePathForInstancePartitions(instancePartitions.getInstancePartitionsName());
+ public static void persistInstancePartitions(HelixPropertyStore<ZNRecord> propertyStore,
+ InstancePartitions instancePartitions) {
+ String path = ZKMetadataProvider
+ .constructPropertyStorePathForInstancePartitions(instancePartitions.getInstancePartitionsName());
if (!propertyStore.set(path, instancePartitions.toZNRecord(), AccessOption.PERSISTENT)) {
throw new ZkException("Failed to persist instance partitions: " + instancePartitions);
}
@@ -142,7 +147,8 @@ public class InstancePartitionsUtils {
/**
* Removes the instance partitions from Helix property store.
*/
- public static void removeInstancePartitions(HelixPropertyStore<ZNRecord> propertyStore, String instancePartitionsName) {
+ public static void removeInstancePartitions(HelixPropertyStore<ZNRecord> propertyStore,
+ String instancePartitionsName) {
String path = ZKMetadataProvider.constructPropertyStorePathForInstancePartitions(instancePartitionsName);
if (!propertyStore.remove(path, AccessOption.PERSISTENT)) {
throw new ZkException("Failed to remove instance partitions: " + instancePartitionsName);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java b/pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java
index 35ffa92..9080d2b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java
@@ -69,27 +69,38 @@ public class QueryException {
public static final ProcessingException JSON_COMPILATION_ERROR = new ProcessingException(JSON_COMPILATION_ERROR_CODE);
public static final ProcessingException PQL_PARSING_ERROR = new ProcessingException(PQL_PARSING_ERROR_CODE);
public static final ProcessingException ACCESS_DENIED_ERROR = new ProcessingException(ACCESS_DENIED_ERROR_CODE);
- public static final ProcessingException SEGMENT_PLAN_EXECUTION_ERROR = new ProcessingException(SEGMENT_PLAN_EXECUTION_ERROR_CODE);
+ public static final ProcessingException SEGMENT_PLAN_EXECUTION_ERROR =
+ new ProcessingException(SEGMENT_PLAN_EXECUTION_ERROR_CODE);
public static final ProcessingException COMBINE_SEGMENT_PLAN_TIMEOUT_ERROR =
new ProcessingException(COMBINE_SEGMENT_PLAN_TIMEOUT_ERROR_CODE);
- public static final ProcessingException TABLE_DOES_NOT_EXIST_ERROR = new ProcessingException(TABLE_DOES_NOT_EXIST_ERROR_CODE);
+ public static final ProcessingException TABLE_DOES_NOT_EXIST_ERROR =
+ new ProcessingException(TABLE_DOES_NOT_EXIST_ERROR_CODE);
public static final ProcessingException QUERY_EXECUTION_ERROR = new ProcessingException(QUERY_EXECUTION_ERROR_CODE);
- public static final ProcessingException SERVER_SCHEDULER_DOWN_ERROR = new ProcessingException(SERVER_SHUTTING_DOWN_ERROR_CODE);
- public static final ProcessingException SERVER_OUT_OF_CAPACITY_ERROR = new ProcessingException(SERVER_OUT_OF_CAPACITY_ERROR_CODE);
- public static final ProcessingException SERVER_TABLE_MISSING_ERROR = new ProcessingException(SERVER_TABLE_MISSING_ERROR_CODE);
- public static final ProcessingException QUERY_SCHEDULING_TIMEOUT_ERROR = new ProcessingException(QUERY_SCHEDULING_TIMEOUT_ERROR_CODE);
- public static final ProcessingException EXECUTION_TIMEOUT_ERROR = new ProcessingException(EXECUTION_TIMEOUT_ERROR_CODE);
+ public static final ProcessingException SERVER_SCHEDULER_DOWN_ERROR =
+ new ProcessingException(SERVER_SHUTTING_DOWN_ERROR_CODE);
+ public static final ProcessingException SERVER_OUT_OF_CAPACITY_ERROR =
+ new ProcessingException(SERVER_OUT_OF_CAPACITY_ERROR_CODE);
+ public static final ProcessingException SERVER_TABLE_MISSING_ERROR =
+ new ProcessingException(SERVER_TABLE_MISSING_ERROR_CODE);
+ public static final ProcessingException QUERY_SCHEDULING_TIMEOUT_ERROR =
+ new ProcessingException(QUERY_SCHEDULING_TIMEOUT_ERROR_CODE);
+ public static final ProcessingException EXECUTION_TIMEOUT_ERROR =
+ new ProcessingException(EXECUTION_TIMEOUT_ERROR_CODE);
public static final ProcessingException BROKER_GATHER_ERROR = new ProcessingException(BROKER_GATHER_ERROR_CODE);
- public static final ProcessingException DATA_TABLE_DESERIALIZATION_ERROR = new ProcessingException(DATA_TABLE_DESERIALIZATION_ERROR_CODE);
+ public static final ProcessingException DATA_TABLE_DESERIALIZATION_ERROR =
+ new ProcessingException(DATA_TABLE_DESERIALIZATION_ERROR_CODE);
public static final ProcessingException FUTURE_CALL_ERROR = new ProcessingException(FUTURE_CALL_ERROR_CODE);
public static final ProcessingException BROKER_TIMEOUT_ERROR = new ProcessingException(BROKER_TIMEOUT_ERROR_CODE);
- public static final ProcessingException BROKER_RESOURCE_MISSING_ERROR = new ProcessingException(BROKER_RESOURCE_MISSING_ERROR_CODE);
- public static final ProcessingException BROKER_INSTANCE_MISSING_ERROR = new ProcessingException(BROKER_INSTANCE_MISSING_ERROR_CODE);
+ public static final ProcessingException BROKER_RESOURCE_MISSING_ERROR =
+ new ProcessingException(BROKER_RESOURCE_MISSING_ERROR_CODE);
+ public static final ProcessingException BROKER_INSTANCE_MISSING_ERROR =
+ new ProcessingException(BROKER_INSTANCE_MISSING_ERROR_CODE);
public static final ProcessingException INTERNAL_ERROR = new ProcessingException(INTERNAL_ERROR_CODE);
public static final ProcessingException MERGE_RESPONSE_ERROR = new ProcessingException(MERGE_RESPONSE_ERROR_CODE);
public static final ProcessingException FEDERATED_BROKER_UNAVAILABLE_ERROR =
new ProcessingException(FEDERATED_BROKER_UNAVAILABLE_ERROR_CODE);
- public static final ProcessingException COMBINE_GROUP_BY_EXCEPTION_ERROR = new ProcessingException(COMBINE_GROUP_BY_EXCEPTION_ERROR_CODE);
+ public static final ProcessingException COMBINE_GROUP_BY_EXCEPTION_ERROR =
+ new ProcessingException(COMBINE_GROUP_BY_EXCEPTION_ERROR_CODE);
public static final ProcessingException QUERY_VALIDATION_ERROR = new ProcessingException(QUERY_VALIDATION_ERROR_CODE);
public static final ProcessingException UNKNOWN_ERROR = new ProcessingException(UNKNOWN_ERROR_CODE);
public static final ProcessingException QUOTA_EXCEEDED_ERROR = new ProcessingException(TOO_MANY_REQUESTS_ERROR_CODE);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/function/DateTimeUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/function/DateTimeUtils.java
index f1bdc25..b2a8ce9 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/function/DateTimeUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/function/DateTimeUtils.java
@@ -135,8 +135,8 @@ public class DateTimeUtils {
@Override
public DateTimeField getField(Chronology chronology) {
- return new OffsetDateTimeField(new DividedDateTimeField(new OffsetDateTimeField(chronology.monthOfYear(), -1), QUARTER_OF_YEAR, 3),
- 1);
+ return new OffsetDateTimeField(
+ new DividedDateTimeField(new OffsetDateTimeField(chronology.monthOfYear(), -1), QUARTER_OF_YEAR, 3), 1);
}
private static class QuarterOfYearDurationFieldType extends DurationFieldType {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionInvoker.java b/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionInvoker.java
index 92b02ad..b185d26 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionInvoker.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionInvoker.java
@@ -89,9 +89,8 @@ public class FunctionInvoker {
*/
public void convertTypes(Object[] arguments) {
int numParameters = _parameterClasses.length;
- Preconditions
- .checkArgument(arguments.length == numParameters, "Wrong number of arguments for method: %s, expected: %s, actual: %s", _method,
- numParameters, arguments.length);
+ Preconditions.checkArgument(arguments.length == numParameters,
+ "Wrong number of arguments for method: %s, expected: %s, actual: %s", _method, numParameters, arguments.length);
for (int i = 0; i < numParameters; i++) {
// Skip conversion for null
Object argument = arguments[i];
@@ -107,9 +106,8 @@ public class FunctionInvoker {
PinotDataType parameterType = _parameterTypes[i];
PinotDataType argumentType = FunctionUtils.getArgumentType(argumentClass);
- Preconditions
- .checkArgument(parameterType != null && argumentType != null, "Cannot convert value from class: %s to class: %s", argumentClass,
- parameterClass);
+ Preconditions.checkArgument(parameterType != null && argumentType != null,
+ "Cannot convert value from class: %s to class: %s", argumentClass, parameterClass);
arguments[i] = parameterType.convert(argument, argumentType);
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java b/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java
index 8cfbb88..2d71654 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java
@@ -53,8 +53,10 @@ public class FunctionRegistry {
*/
static {
long startTimeMs = System.currentTimeMillis();
- Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage("org.apache.pinot"))
- .filterInputsBy(new FilterBuilder.Include(".*\\.function\\..*")).setScanners(new MethodAnnotationsScanner()));
+ Reflections reflections = new Reflections(
+ new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage("org.apache.pinot"))
+ .filterInputsBy(new FilterBuilder.Include(".*\\.function\\..*"))
+ .setScanners(new MethodAnnotationsScanner()));
Set<Method> methodSet = reflections.getMethodsAnnotatedWith(ScalarFunction.class);
for (Method method : methodSet) {
ScalarFunction scalarFunction = method.getAnnotation(ScalarFunction.class);
@@ -66,8 +68,8 @@ public class FunctionRegistry {
}
}
}
- LOGGER.info("Initialized FunctionRegistry with {} functions: {} in {}ms", FUNCTION_INFO_MAP.size(), FUNCTION_INFO_MAP.keySet(),
- System.currentTimeMillis() - startTimeMs);
+ LOGGER.info("Initialized FunctionRegistry with {} functions: {} in {}ms", FUNCTION_INFO_MAP.size(),
+ FUNCTION_INFO_MAP.keySet(), System.currentTimeMillis() - startTimeMs);
}
/**
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/function/TimeZoneKey.java b/pinot-common/src/main/java/org/apache/pinot/common/function/TimeZoneKey.java
index b723b0b..ca91391 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/function/TimeZoneKey.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/function/TimeZoneKey.java
@@ -52,7 +52,8 @@ public final class TimeZoneKey {
private static final short OFFSET_TIME_ZONE_MIN = -14 * 60;
private static final short OFFSET_TIME_ZONE_MAX = 14 * 60;
- private static final TimeZoneKey[] OFFSET_TIME_ZONE_KEYS = new TimeZoneKey[OFFSET_TIME_ZONE_MAX - OFFSET_TIME_ZONE_MIN + 1];
+ private static final TimeZoneKey[] OFFSET_TIME_ZONE_KEYS =
+ new TimeZoneKey[OFFSET_TIME_ZONE_MAX - OFFSET_TIME_ZONE_MIN + 1];
static {
try (InputStream in = TimeZoneKey.class.getClassLoader().getResourceAsStream("zone-index.properties")) {
@@ -251,8 +252,9 @@ public final class TimeZoneKey {
}
private static boolean isUtcEquivalentName(String zoneId) {
- return zoneId.equals("utc") || zoneId.equals("z") || zoneId.equals("ut") || zoneId.equals("uct") || zoneId.equals("ut") || zoneId
- .equals("gmt") || zoneId.equals("gmt0") || zoneId.equals("greenwich") || zoneId.equals("universal") || zoneId.equals("zulu");
+ return zoneId.equals("utc") || zoneId.equals("z") || zoneId.equals("ut") || zoneId.equals("uct") || zoneId
+ .equals("ut") || zoneId.equals("gmt") || zoneId.equals("gmt0") || zoneId.equals("greenwich") || zoneId
+ .equals("universal") || zoneId.equals("zulu");
}
private static String zoneIdForOffset(long offset) {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/function/scalar/DateTimeFunctions.java b/pinot-common/src/main/java/org/apache/pinot/common/function/scalar/DateTimeFunctions.java
index e063367..f74b88d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/function/scalar/DateTimeFunctions.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/function/scalar/DateTimeFunctions.java
@@ -644,12 +644,14 @@ public class DateTimeFunctions {
*
*/
@ScalarFunction
- public static long dateTrunc(String unit, long timeValue, String inputTimeUnitStr, String timeZone, String outputTimeUnitStr) {
+ public static long dateTrunc(String unit, long timeValue, String inputTimeUnitStr, String timeZone,
+ String outputTimeUnitStr) {
TimeUnit inputTimeUnit = TimeUnit.valueOf(inputTimeUnitStr);
TimeUnit outputTimeUnit = TimeUnit.valueOf(outputTimeUnitStr);
TimeZoneKey timeZoneKey = TimeZoneKey.getTimeZoneKey(timeZone);
DateTimeField dateTimeField = DateTimeUtils.getTimestampField(DateTimeUtils.getChronology(timeZoneKey), unit);
- return outputTimeUnit.convert(dateTimeField.roundFloor(TimeUnit.MILLISECONDS.convert(timeValue, inputTimeUnit)), TimeUnit.MILLISECONDS);
+ return outputTimeUnit.convert(dateTimeField.roundFloor(TimeUnit.MILLISECONDS.convert(timeValue, inputTimeUnit)),
+ TimeUnit.MILLISECONDS);
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/lineage/LineageEntry.java b/pinot-common/src/main/java/org/apache/pinot/common/lineage/LineageEntry.java
index 4eed031..e008b49 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/lineage/LineageEntry.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/lineage/LineageEntry.java
@@ -64,8 +64,8 @@ public class LineageEntry {
return false;
}
LineageEntry that = (LineageEntry) o;
- return _timestamp == that._timestamp && _segmentsFrom.equals(that._segmentsFrom) && _segmentsTo.equals(that._segmentsTo)
- && _state == that._state;
+ return _timestamp == that._timestamp && _segmentsFrom.equals(that._segmentsFrom) && _segmentsTo
+ .equals(that._segmentsTo) && _state == that._state;
}
@Override
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentLineageAccessHelper.java b/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentLineageAccessHelper.java
index 35a7aa7..c6d1fe2 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentLineageAccessHelper.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentLineageAccessHelper.java
@@ -40,7 +40,8 @@ public class SegmentLineageAccessHelper {
* @param tableNameWithType a table name with type
* @return a ZNRecord of segment merge lineage, return null if znode does not exist
*/
- public static ZNRecord getSegmentLineageZNRecord(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableNameWithType) {
+ public static ZNRecord getSegmentLineageZNRecord(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ String tableNameWithType) {
String path = ZKMetadataProvider.constructPropertyStorePathForSegmentLineage(tableNameWithType);
Stat stat = new Stat();
ZNRecord segmentLineageZNRecord = propertyStore.get(path, stat, AccessOption.PERSISTENT);
@@ -57,7 +58,8 @@ public class SegmentLineageAccessHelper {
* @param tableNameWithType a table name with type
* @return a segment lineage, return null if znode does not exist
*/
- public static SegmentLineage getSegmentLineage(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableNameWithType) {
+ public static SegmentLineage getSegmentLineage(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ String tableNameWithType) {
ZNRecord znRecord = getSegmentLineageZNRecord(propertyStore, tableNameWithType);
SegmentLineage segmentMergeLineage = null;
if (znRecord != null) {
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 27076d5..1137ad6 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
@@ -59,23 +59,28 @@ public class ZKMetadataProvider {
private static final String PROPERTYSTORE_SEGMENT_LINEAGE = "/SEGMENT_LINEAGE";
private static final String PROPERTYSTORE_MINION_TASK_METADATA_PREFIX = "/MINION_TASK_METADATA";
- public static void setRealtimeTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, String realtimeTableName, ZNRecord znRecord) {
- propertyStore.set(constructPropertyStorePathForResourceConfig(realtimeTableName), znRecord, AccessOption.PERSISTENT);
+ public static void setRealtimeTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, String realtimeTableName,
+ ZNRecord znRecord) {
+ propertyStore
+ .set(constructPropertyStorePathForResourceConfig(realtimeTableName), znRecord, AccessOption.PERSISTENT);
}
- public static void setOfflineTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, String offlineTableName, ZNRecord znRecord) {
+ public static void setOfflineTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, String offlineTableName,
+ ZNRecord znRecord) {
propertyStore.set(constructPropertyStorePathForResourceConfig(offlineTableName), znRecord, AccessOption.PERSISTENT);
}
- public static void setInstanceZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore, InstanceZKMetadata instanceZKMetadata) {
+ public static void setInstanceZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ InstanceZKMetadata instanceZKMetadata) {
ZNRecord znRecord = instanceZKMetadata.toZNRecord();
- propertyStore
- .set(StringUtil.join("/", PROPERTYSTORE_INSTANCE_CONFIGS_PREFIX, instanceZKMetadata.getId()), znRecord, AccessOption.PERSISTENT);
+ propertyStore.set(StringUtil.join("/", PROPERTYSTORE_INSTANCE_CONFIGS_PREFIX, instanceZKMetadata.getId()), znRecord,
+ AccessOption.PERSISTENT);
}
- public static InstanceZKMetadata getInstanceZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore, String instanceId) {
- ZNRecord znRecord =
- propertyStore.get(StringUtil.join("/", PROPERTYSTORE_INSTANCE_CONFIGS_PREFIX, instanceId), null, AccessOption.PERSISTENT);
+ public static InstanceZKMetadata getInstanceZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ String instanceId) {
+ ZNRecord znRecord = propertyStore
+ .get(StringUtil.join("/", PROPERTYSTORE_INSTANCE_CONFIGS_PREFIX, instanceId), null, AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
@@ -114,18 +119,22 @@ public class ZKMetadataProvider {
return StringUtil.join("/", PROPERTYSTORE_MINION_TASK_METADATA_PREFIX, taskType, tableNameWithType);
}
- public static boolean isSegmentExisted(ZkHelixPropertyStore<ZNRecord> propertyStore, String resourceNameForResource, String segmentName) {
- return propertyStore.exists(constructPropertyStorePathForSegment(resourceNameForResource, segmentName), AccessOption.PERSISTENT);
+ public static boolean isSegmentExisted(ZkHelixPropertyStore<ZNRecord> propertyStore, String resourceNameForResource,
+ String segmentName) {
+ return propertyStore
+ .exists(constructPropertyStorePathForSegment(resourceNameForResource, segmentName), AccessOption.PERSISTENT);
}
- public static void removeResourceSegmentsFromPropertyStore(ZkHelixPropertyStore<ZNRecord> propertyStore, String resourceName) {
+ public static void removeResourceSegmentsFromPropertyStore(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ String resourceName) {
String propertyStorePath = constructPropertyStorePathForResource(resourceName);
if (propertyStore.exists(propertyStorePath, AccessOption.PERSISTENT)) {
propertyStore.remove(propertyStorePath, AccessOption.PERSISTENT);
}
}
- public static void removeResourceConfigFromPropertyStore(ZkHelixPropertyStore<ZNRecord> propertyStore, String resourceName) {
+ public static void removeResourceConfigFromPropertyStore(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ String resourceName) {
String propertyStorePath = constructPropertyStorePathForResourceConfig(resourceName);
if (propertyStore.exists(propertyStorePath, AccessOption.PERSISTENT)) {
propertyStore.remove(propertyStorePath, AccessOption.PERSISTENT);
@@ -137,8 +146,8 @@ public class ZKMetadataProvider {
// NOTE: Helix will throw ZkBadVersionException if version does not match
try {
return propertyStore
- .set(constructPropertyStorePathForSegment(tableNameWithType, segmentZKMetadata.getSegmentName()), segmentZKMetadata.toZNRecord(),
- expectedVersion, AccessOption.PERSISTENT);
+ .set(constructPropertyStorePathForSegment(tableNameWithType, segmentZKMetadata.getSegmentName()),
+ segmentZKMetadata.toZNRecord(), expectedVersion, AccessOption.PERSISTENT);
} catch (ZkBadVersionException e) {
return false;
}
@@ -162,16 +171,17 @@ public class ZKMetadataProvider {
}
@Nullable
- public static SegmentZKMetadata getSegmentZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableNameWithType,
- String segmentName) {
- ZNRecord znRecord =
- propertyStore.get(constructPropertyStorePathForSegment(tableNameWithType, segmentName), null, AccessOption.PERSISTENT);
+ public static SegmentZKMetadata getSegmentZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ String tableNameWithType, String segmentName) {
+ ZNRecord znRecord = propertyStore
+ .get(constructPropertyStorePathForSegment(tableNameWithType, segmentName), null, AccessOption.PERSISTENT);
return znRecord != null ? new SegmentZKMetadata(znRecord) : null;
}
@Nullable
public static TableConfig getTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, 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;
}
@@ -195,13 +205,15 @@ public class ZKMetadataProvider {
}
public static void setSchema(ZkHelixPropertyStore<ZNRecord> propertyStore, Schema schema) {
- propertyStore.set(constructPropertyStorePathForSchema(schema.getSchemaName()), SchemaUtils.toZNRecord(schema), AccessOption.PERSISTENT);
+ propertyStore.set(constructPropertyStorePathForSchema(schema.getSchemaName()), SchemaUtils.toZNRecord(schema),
+ AccessOption.PERSISTENT);
}
@Nullable
public static Schema getSchema(ZkHelixPropertyStore<ZNRecord> propertyStore, String schemaName) {
try {
- ZNRecord schemaZNRecord = propertyStore.get(constructPropertyStorePathForSchema(schemaName), null, AccessOption.PERSISTENT);
+ ZNRecord schemaZNRecord =
+ propertyStore.get(constructPropertyStorePathForSchema(schemaName), null, AccessOption.PERSISTENT);
if (schemaZNRecord == null) {
return null;
}
@@ -250,8 +262,8 @@ public class ZKMetadataProvider {
}
}
if (schema != null) {
- LOGGER.warn("Schema name does not match raw table name, schema name: {}, raw table name: {}", schema.getSchemaName(),
- TableNameBuilder.extractRawTableName(tableName));
+ LOGGER.warn("Schema name does not match raw table name, schema name: {}, raw table name: {}",
+ schema.getSchemaName(), TableNameBuilder.extractRawTableName(tableName));
}
return schema;
}
@@ -260,7 +272,8 @@ public class ZKMetadataProvider {
* NOTE: this method is very expensive, use {@link #getSegments(ZkHelixPropertyStore, String)} instead if only segment
* names are needed.
*/
- public static List<SegmentZKMetadata> getSegmentsZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableNameWithType) {
+ public static List<SegmentZKMetadata> getSegmentsZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ String tableNameWithType) {
String parentPath = constructPropertyStorePathForResource(tableNameWithType);
List<ZNRecord> znRecords = propertyStore
.getChildren(parentPath, null, AccessOption.PERSISTENT, CommonConstants.Helix.ZkClient.RETRY_COUNT,
@@ -276,7 +289,8 @@ public class ZKMetadataProvider {
}
int numNullZNRecords = numZNRecords - segmentsZKMetadata.size();
if (numNullZNRecords > 0) {
- LOGGER.warn("Failed to read {}/{} segment ZK metadata under path: {}", numNullZNRecords, numZNRecords, parentPath);
+ LOGGER.warn("Failed to read {}/{} segment ZK metadata under path: {}", numNullZNRecords, numZNRecords,
+ parentPath);
}
return segmentsZKMetadata;
} else {
@@ -308,7 +322,8 @@ public class ZKMetadataProvider {
* @param realtimeTableName Realtime table name
* @return List of LLC realtime segment names
*/
- public static List<String> getLLCRealtimeSegments(ZkHelixPropertyStore<ZNRecord> propertyStore, String realtimeTableName) {
+ public static List<String> getLLCRealtimeSegments(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ String realtimeTableName) {
List<String> llcRealtimeSegments = new ArrayList<>();
String segmentsPath = constructPropertyStorePathForResource(realtimeTableName);
if (propertyStore.exists(segmentsPath, AccessOption.PERSISTENT)) {
@@ -322,7 +337,8 @@ public class ZKMetadataProvider {
return llcRealtimeSegments;
}
- public static void setClusterTenantIsolationEnabled(ZkHelixPropertyStore<ZNRecord> propertyStore, boolean isSingleTenantCluster) {
+ public static void setClusterTenantIsolationEnabled(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ boolean isSingleTenantCluster) {
final ZNRecord znRecord;
final String path = constructPropertyStorePathForControllerConfig(CLUSTER_TENANT_ISOLATION_ENABLED_KEY);
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 2c2f592..8ab499a 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/SegmentPartitionMetadata.java b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentPartitionMetadata.java
index 640b7ea..22d4733 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentPartitionMetadata.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentPartitionMetadata.java
@@ -44,7 +44,8 @@ public class SegmentPartitionMetadata {
*
* @param columnPartitionMap Column name to ColumnPartitionMetadata map.
*/
- public SegmentPartitionMetadata(@Nonnull @JsonProperty("columnPartitionMap") Map<String, ColumnPartitionMetadata> columnPartitionMap) {
+ public SegmentPartitionMetadata(
+ @Nonnull @JsonProperty("columnPartitionMap") Map<String, ColumnPartitionMetadata> columnPartitionMap) {
Preconditions.checkNotNull(columnPartitionMap);
_columnPartitionMap = columnPartitionMap;
}
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 b827afb..a938cf8 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
@@ -413,7 +413,8 @@ public class SegmentZKMetadata implements ZKMetadata {
if (startTimeString != null) {
String endTimeString = _simpleFields.get(Segment.END_TIME);
TimeUnit timeUnit = TimeUnit.valueOf(_simpleFields.get(Segment.TIME_UNIT));
- return new Interval(timeUnit.toMillis(Long.parseLong(startTimeString)), timeUnit.toMillis(Long.parseLong(endTimeString)));
+ return new Interval(timeUnit.toMillis(Long.parseLong(startTimeString)),
+ timeUnit.toMillis(Long.parseLong(endTimeString)));
} else {
return null;
}
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 123751c..533bcf2 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
@@ -65,8 +65,8 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
this(metricPrefix, metricsRegistry, clazz, true, Collections.emptySet());
}
- public AbstractMetrics(String metricPrefix, PinotMetricsRegistry metricsRegistry, Class clazz, boolean isTableLevelMetricsEnabled,
- Collection<String> allowedTables) {
+ public AbstractMetrics(String metricPrefix, PinotMetricsRegistry metricsRegistry, Class clazz,
+ boolean isTableLevelMetricsEnabled, Collection<String> allowedTables) {
_metricPrefix = metricPrefix;
_metricsRegistry = metricsRegistry;
_clazz = clazz;
@@ -152,7 +152,8 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
*/
private void addValueToTimer(String fullTimerName, final long duration, final TimeUnit timeUnit) {
final PinotMetricName metricName = PinotMetricUtils.makePinotMetricName(_clazz, fullTimerName);
- PinotTimer timer = PinotMetricUtils.makePinotTimer(_metricsRegistry, metricName, TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
+ PinotTimer timer =
+ PinotMetricUtils.makePinotTimer(_metricsRegistry, metricName, TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
if (timer != null) {
timer.update(duration, timeUnit);
}
@@ -185,7 +186,8 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
fullMeterName = _metricPrefix + meterName;
final PinotMetricName metricName = PinotMetricUtils.makePinotMetricName(_clazz, fullMeterName);
- final PinotMeter newMeter = PinotMetricUtils.makePinotMeter(_metricsRegistry, metricName, meter.getUnit(), TimeUnit.SECONDS);
+ final PinotMeter newMeter =
+ PinotMetricUtils.makePinotMeter(_metricsRegistry, metricName, meter.getUnit(), TimeUnit.SECONDS);
newMeter.mark(unitCount);
return newMeter;
}
@@ -209,7 +211,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 PinotMeter addMeteredTableValue(final String tableName, final M meter, final long unitCount, PinotMeter reusedMeter) {
+ public PinotMeter addMeteredTableValue(final String tableName, final M meter, final long unitCount,
+ PinotMeter reusedMeter) {
if (reusedMeter != null) {
reusedMeter.mark(unitCount);
return reusedMeter;
@@ -219,7 +222,8 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
fullMeterName = _metricPrefix + getTableName(tableName) + "." + meterName;
final PinotMetricName metricName = PinotMetricUtils.makePinotMetricName(_clazz, fullMeterName);
- final PinotMeter newMeter = PinotMetricUtils.makePinotMeter(_metricsRegistry, metricName, meter.getUnit(), TimeUnit.SECONDS);
+ final PinotMeter newMeter =
+ PinotMetricUtils.makePinotMeter(_metricsRegistry, metricName, meter.getUnit(), TimeUnit.SECONDS);
newMeter.mark(unitCount);
return newMeter;
}
@@ -460,16 +464,17 @@ 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) {
- PinotMetricUtils.makeGauge(_metricsRegistry, PinotMetricUtils.makePinotMetricName(_clazz, _metricPrefix + metricName),
- PinotMetricUtils.makePinotGauge(avoid -> {
- try {
- return valueCallback.call();
- } catch (Exception e) {
- LOGGER.error("Caught exception", e);
- Utils.rethrowException(e);
- throw new AssertionError("Should not reach this");
- }
- }));
+ PinotMetricUtils
+ .makeGauge(_metricsRegistry, PinotMetricUtils.makePinotMetricName(_clazz, _metricPrefix + metricName),
+ PinotMetricUtils.makePinotGauge(avoid -> {
+ try {
+ return valueCallback.call();
+ } catch (Exception e) {
+ LOGGER.error("Caught exception", e);
+ Utils.rethrowException(e);
+ throw new AssertionError("Should not reach this");
+ }
+ }));
}
/**
@@ -500,7 +505,8 @@ public abstract class AbstractMetrics<QP extends AbstractMetrics.QueryPhase, M e
* @param metricName metric name
*/
private void removeCallbackGauge(String metricName) {
- PinotMetricUtils.removeMetric(_metricsRegistry, PinotMetricUtils.makePinotMetricName(_clazz, _metricPrefix + metricName));
+ PinotMetricUtils
+ .removeMetric(_metricsRegistry, PinotMetricUtils.makePinotMetricName(_clazz, _metricPrefix + metricName));
}
protected abstract QP[] getQueryPhases();
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerMetrics.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerMetrics.java
index b354765..850d7f3 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerMetrics.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/BrokerMetrics.java
@@ -41,7 +41,8 @@ public class BrokerMetrics extends AbstractMetrics<BrokerQueryPhase, BrokerMeter
this(metricsRegistry, DEFAULT_ENABLE_TABLE_LEVEL_METRICS, Collections.emptySet());
}
- public BrokerMetrics(PinotMetricsRegistry metricsRegistry, boolean isTableLevelMetricsEnabled, Collection<String> allowedTables) {
+ public BrokerMetrics(PinotMetricsRegistry metricsRegistry, boolean isTableLevelMetricsEnabled,
+ Collection<String> allowedTables) {
this(DEFAULT_METRICS_NAME_PREFIX, metricsRegistry, isTableLevelMetricsEnabled, allowedTables);
}
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 9150f06..2a6be87 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
@@ -26,7 +26,14 @@ import org.apache.pinot.common.Utils;
*
*/
public enum BrokerQueryPhase implements AbstractMetrics.QueryPhase {
- REQUEST_COMPILATION, QUERY_EXECUTION, QUERY_ROUTING, SCATTER_GATHER, DESERIALIZATION, REDUCE, REQUEST_CONNECTION_WAIT, AUTHORIZATION;
+ REQUEST_COMPILATION,
+ QUERY_EXECUTION,
+ QUERY_ROUTING,
+ SCATTER_GATHER,
+ DESERIALIZATION,
+ REDUCE,
+ REQUEST_CONNECTION_WAIT,
+ AUTHORIZATION;
private final String _queryPhaseName;
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 faa1043..8bc8410 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
@@ -26,14 +26,16 @@ import org.apache.pinot.common.Utils;
*
*/
public enum BrokerTimer implements AbstractMetrics.Timer {
- ROUTING_TABLE_UPDATE_TIME(true), CLUSTER_CHANGE_QUEUE_TIME(true), // metric tracking the freshness lag for consuming segments
+ ROUTING_TABLE_UPDATE_TIME(true),
+ CLUSTER_CHANGE_QUEUE_TIME(true), // metric tracking the freshness lag for consuming segments
FRESHNESS_LAG_MS(false),
// The latency of sending the request from broker to server
NETTY_CONNECTION_SEND_REQUEST_LATENCY(false),
// aggregated query processing cost (thread cpu time in nanoseconds) from offline servers
- OFFLINE_THREAD_CPU_TIME_NS(false), // aggregated query processing cost (thread cpu time in nanoseconds) from realtime servers
+ OFFLINE_THREAD_CPU_TIME_NS(
+ false), // aggregated query processing cost (thread cpu time in nanoseconds) from realtime servers
REALTIME_THREAD_CPU_TIME_NS(false);
private final String _timerName;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMetrics.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMetrics.java
index 6735de2..2843d74 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMetrics.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMetrics.java
@@ -26,7 +26,8 @@ import static org.apache.pinot.spi.utils.CommonConstants.Controller.DEFAULT_METR
/**
* Metrics for the controller.
*/
-public class ControllerMetrics extends AbstractMetrics<AbstractMetrics.QueryPhase, ControllerMeter, ControllerGauge, ControllerTimer> {
+public class ControllerMetrics
+ extends AbstractMetrics<AbstractMetrics.QueryPhase, ControllerMeter, ControllerGauge, ControllerTimer> {
public ControllerMetrics(PinotMetricsRegistry metricsRegistry) {
this(DEFAULT_METRICS_PREFIX, metricsRegistry);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/PinotMetricUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/PinotMetricUtils.java
index 3ef51cb..7c3cac0 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/PinotMetricUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/PinotMetricUtils.java
@@ -86,7 +86,8 @@ public class PinotMetricUtils {
}
}
Preconditions.checkState(_pinotMetricsFactory != null,
- "Failed to initialize PinotMetricsFactory. Please check if any pinot-metrics related jar is actually added to the classpath.");
+ "Failed to initialize PinotMetricsFactory. Please check if any pinot-metrics related jar is actually added to"
+ + " the classpath.");
}
private static Set<Class<?>> getPinotMetricsFactoryClasses() {
@@ -108,13 +109,15 @@ public class PinotMetricUtils {
try {
Class<? extends MetricsRegistryRegistrationListener> clazz =
(Class<? extends MetricsRegistryRegistrationListener>) Class.forName(listenerClassName);
- Constructor<? extends MetricsRegistryRegistrationListener> defaultConstructor = clazz.getDeclaredConstructor();
+ Constructor<? extends MetricsRegistryRegistrationListener> defaultConstructor =
+ clazz.getDeclaredConstructor();
MetricsRegistryRegistrationListener listener = defaultConstructor.newInstance();
LOGGER.info("Registering metricsRegistry to listener {}", listenerClassName);
addMetricsRegistryRegistrationListener(listener);
} catch (Exception e) {
- LOGGER.warn("Caught exception while initializing MetricsRegistryRegistrationListener " + listenerClassName, e);
+ LOGGER
+ .warn("Caught exception while initializing MetricsRegistryRegistrationListener " + listenerClassName, e);
}
}
}
@@ -151,8 +154,10 @@ public class PinotMetricUtils {
METRICS_REGISTRY_MAP.put(registry, Boolean.TRUE);
// Fire event to all registered listeners
- Set<MetricsRegistryRegistrationListener> metricsRegistryRegistrationListeners = METRICS_REGISTRY_REGISTRATION_LISTENERS_MAP.keySet();
- for (MetricsRegistryRegistrationListener metricsRegistryRegistrationListener : metricsRegistryRegistrationListeners) {
+ Set<MetricsRegistryRegistrationListener> metricsRegistryRegistrationListeners =
+ METRICS_REGISTRY_REGISTRATION_LISTENERS_MAP.keySet();
+ for (MetricsRegistryRegistrationListener metricsRegistryRegistrationListener
+ : metricsRegistryRegistrationListeners) {
metricsRegistryRegistrationListener.onMetricsRegistryRegistered(registry);
}
}
@@ -187,11 +192,13 @@ public class PinotMetricUtils {
return registry.newGauge(name, gauge);
}
- public static PinotTimer makePinotTimer(PinotMetricsRegistry registry, PinotMetricName name, TimeUnit durationUnit, TimeUnit rateUnit) {
+ public static PinotTimer makePinotTimer(PinotMetricsRegistry registry, PinotMetricName name, TimeUnit durationUnit,
+ TimeUnit rateUnit) {
return registry.newTimer(name, durationUnit, rateUnit);
}
- public static PinotMeter makePinotMeter(PinotMetricsRegistry registry, PinotMetricName name, String eventType, TimeUnit unit) {
+ public static PinotMeter makePinotMeter(PinotMetricsRegistry registry, PinotMetricName name, String eventType,
+ TimeUnit unit) {
return registry.newMeter(name, eventType, unit);
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerMetrics.java b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerMetrics.java
index ceb8fd6..2784c4f 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerMetrics.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ServerMetrics.java
@@ -36,7 +36,8 @@ public class ServerMetrics extends AbstractMetrics<ServerQueryPhase, ServerMeter
this(DEFAULT_METRICS_PREFIX, metricsRegistry, DEFAULT_ENABLE_TABLE_LEVEL_METRICS, Collections.emptySet());
}
- public ServerMetrics(PinotMetricsRegistry metricsRegistry, boolean isTableLevelMetricsEnabled, Collection<String> allowedTables) {
+ public ServerMetrics(PinotMetricsRegistry metricsRegistry, boolean isTableLevelMetricsEnabled,
+ Collection<String> allowedTables) {
this(DEFAULT_METRICS_PREFIX, metricsRegistry, isTableLevelMetricsEnabled, allowedTables);
}
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 43f401f..efe3c82 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
@@ -149,7 +149,8 @@ public class ValidationMetrics {
*/
public void updateOfflineSegmentDelayGauge(final String resource, final long lastOfflineSegmentTime) {
final String fullGaugeNameHours = makeGaugeName(resource, "offlineSegmentDelayHours");
- makeGauge(fullGaugeNameHours, makeMetricName(fullGaugeNameHours), _currentTimeMillisDeltaGaugeHoursFactory, lastOfflineSegmentTime);
+ makeGauge(fullGaugeNameHours, makeMetricName(fullGaugeNameHours), _currentTimeMillisDeltaGaugeHoursFactory,
+ lastOfflineSegmentTime);
}
/**
@@ -161,7 +162,8 @@ public class ValidationMetrics {
*/
public void updateLastPushTimeGauge(final String resource, final long lastPushTimeMillis) {
final String fullGaugeNameHours = makeGaugeName(resource, "lastPushTimeDelayHours");
- makeGauge(fullGaugeNameHours, makeMetricName(fullGaugeNameHours), _currentTimeMillisDeltaGaugeHoursFactory, lastPushTimeMillis);
+ makeGauge(fullGaugeNameHours, makeMetricName(fullGaugeNameHours), _currentTimeMillisDeltaGaugeHoursFactory,
+ lastPushTimeMillis);
}
/**
@@ -206,7 +208,8 @@ public class ValidationMetrics {
return PinotMetricUtils.makePinotMetricName(ValidationMetrics.class, gaugeName);
}
- private void makeGauge(final String gaugeName, final PinotMetricName metricName, final GaugeFactory<?> gaugeFactory, final long value) {
+ private void makeGauge(final String gaugeName, final PinotMetricName metricName, final GaugeFactory<?> gaugeFactory,
+ final long value) {
if (!_gaugeValues.containsKey(gaugeName)) {
_gaugeValues.put(gaugeName, value);
PinotMetricUtils.makeGauge(_metricsRegistry, metricName, gaugeFactory.buildGauge(gaugeName));
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/minion/MinionClient.java b/pinot-common/src/main/java/org/apache/pinot/common/minion/MinionClient.java
index ba47139..90b9902 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/minion/MinionClient.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/minion/MinionClient.java
@@ -67,14 +67,14 @@ public class MinionClient {
public Map<String, String> scheduleMinionTasks(@Nullable String taskType, @Nullable String tableNameWithType)
throws IOException {
- HttpPost httpPost =
- createHttpPostRequest(MinionRequestURLBuilder.baseUrl(getControllerUrl()).forTaskSchedule(taskType, tableNameWithType));
+ HttpPost httpPost = createHttpPostRequest(
+ MinionRequestURLBuilder.baseUrl(getControllerUrl()).forTaskSchedule(taskType, tableNameWithType));
HttpResponse response = HTTP_CLIENT.execute(httpPost);
int statusCode = response.getStatusLine().getStatusCode();
final String responseString = IOUtils.toString(response.getEntity().getContent());
if (statusCode >= 400) {
- throw new HttpException(
- String.format("Unable to schedule minion tasks. Error code %d, Error message: %s", statusCode, responseString));
+ throw new HttpException(String
+ .format("Unable to schedule minion tasks. Error code %d, Error message: %s", statusCode, responseString));
}
return JsonUtils.stringToObject(responseString, new TypeReference<Map<String, String>>() {
});
@@ -82,13 +82,14 @@ public class MinionClient {
public Map<String, String> getTasksStates(String taskType)
throws IOException {
- HttpGet httpGet = createHttpGetRequest(MinionRequestURLBuilder.baseUrl(getControllerUrl()).forTasksStates(taskType));
+ HttpGet httpGet =
+ createHttpGetRequest(MinionRequestURLBuilder.baseUrl(getControllerUrl()).forTasksStates(taskType));
HttpResponse response = HTTP_CLIENT.execute(httpGet);
int statusCode = response.getStatusLine().getStatusCode();
final String responseString = IOUtils.toString(response.getEntity().getContent());
if (statusCode >= 400) {
- throw new HttpException(
- String.format("Unable to get tasks states map. Error code %d, Error message: %s", statusCode, responseString));
+ throw new HttpException(String
+ .format("Unable to get tasks states map. Error code %d, Error message: %s", statusCode, responseString));
}
return JsonUtils.stringToObject(responseString, new TypeReference<Map<String, String>>() {
});
@@ -101,8 +102,9 @@ public class MinionClient {
int statusCode = response.getStatusLine().getStatusCode();
String responseString = IOUtils.toString(response.getEntity().getContent());
if (statusCode >= 400) {
- throw new HttpException(
- String.format("Unable to get state for task: %s. Error code %d, Error message: %s", taskName, statusCode, responseString));
+ throw new HttpException(String
+ .format("Unable to get state for task: %s. Error code %d, Error message: %s", taskName, statusCode,
+ responseString));
}
return responseString;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/minion/MinionTaskMetadataUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/minion/MinionTaskMetadataUtils.java
index f30484b..3174b5c 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/minion/MinionTaskMetadataUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/minion/MinionTaskMetadataUtils.java
@@ -69,8 +69,8 @@ public final class MinionTaskMetadataUtils {
*/
public static void persistMergeRollupTaskMetadata(HelixPropertyStore<ZNRecord> propertyStore, String taskType,
MergeRollupTaskMetadata mergeRollupTaskMetadata, int expectedVersion) {
- String path =
- ZKMetadataProvider.constructPropertyStorePathForMinionTaskMetadata(taskType, mergeRollupTaskMetadata.getTableNameWithType());
+ String path = ZKMetadataProvider
+ .constructPropertyStorePathForMinionTaskMetadata(taskType, mergeRollupTaskMetadata.getTableNameWithType());
if (!propertyStore.set(path, mergeRollupTaskMetadata.toZNRecord(), expectedVersion, AccessOption.PERSISTENT)) {
throw new ZkException("Failed to persist minion MergeRollupTask metadata: " + mergeRollupTaskMetadata);
}
@@ -82,12 +82,15 @@ public final class MinionTaskMetadataUtils {
* Will fail if expectedVersion does not match.
* Set expectedVersion -1 to override version check.
*/
- public static void persistRealtimeToOfflineSegmentsTaskMetadata(HelixPropertyStore<ZNRecord> propertyStore, String taskType,
- RealtimeToOfflineSegmentsTaskMetadata realtimeToOfflineSegmentsTaskMetadata, int expectedVersion) {
- String path = ZKMetadataProvider
- .constructPropertyStorePathForMinionTaskMetadata(taskType, realtimeToOfflineSegmentsTaskMetadata.getTableNameWithType());
- if (!propertyStore.set(path, realtimeToOfflineSegmentsTaskMetadata.toZNRecord(), expectedVersion, AccessOption.PERSISTENT)) {
- throw new ZkException("Failed to persist minion RealtimeToOfflineSegmentsTask metadata: " + realtimeToOfflineSegmentsTaskMetadata);
+ public static void persistRealtimeToOfflineSegmentsTaskMetadata(HelixPropertyStore<ZNRecord> propertyStore,
+ String taskType, RealtimeToOfflineSegmentsTaskMetadata realtimeToOfflineSegmentsTaskMetadata,
+ int expectedVersion) {
+ String path = ZKMetadataProvider.constructPropertyStorePathForMinionTaskMetadata(taskType,
+ realtimeToOfflineSegmentsTaskMetadata.getTableNameWithType());
+ if (!propertyStore
+ .set(path, realtimeToOfflineSegmentsTaskMetadata.toZNRecord(), expectedVersion, AccessOption.PERSISTENT)) {
+ throw new ZkException(
+ "Failed to persist minion RealtimeToOfflineSegmentsTask metadata: " + realtimeToOfflineSegmentsTaskMetadata);
}
}
}
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 4805105..790e242 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
@@ -66,7 +66,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 _maxSegmentCommitTimeMs = TimeUnit.MILLISECONDS.convert(DEFAULT_MAX_SEGMENT_COMMIT_TIME_SEC, TimeUnit.SECONDS);
+ private static long _maxSegmentCommitTimeMs =
+ 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 */
@@ -149,15 +150,20 @@ public class SegmentCompletionProtocol {
public static final String REASON_END_OF_PARTITION_GROUP = "endOfPartitionGroup";
// 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_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_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;
@@ -375,10 +381,11 @@ 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 + ",StreamPartitionMsgOffset: " + _streamPartitionMsgOffset;
+ 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
+ + ",StreamPartitionMsgOffset: " + _streamPartitionMsgOffset;
}
}
}
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 da1d80c..c6fc91c 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,14 +39,18 @@ import org.apache.pinot.spi.utils.JsonUtils;
*
* Supports serialization via JSON.
*/
-@JsonPropertyOrder({"selectionResults", "aggregationResults", "resultTable", "exceptions", "numServersQueried", "numServersResponded",
+@JsonPropertyOrder({
+ "selectionResults", "aggregationResults", "resultTable", "exceptions", "numServersQueried", "numServersResponded",
"numSegmentsQueried", "numSegmentsProcessed", "numSegmentsMatched", "numConsumingSegmentsQueried", "numDocsScanned",
"numEntriesScannedInFilter", "numEntriesScannedPostFilter", "numGroupsLimitReached", "totalDocs", "timeUsedMs",
- "offlineThreadCpuTimeNs", "realtimeThreadCpuTimeNs", "segmentStatistics", "traceInfo"})
+ "offlineThreadCpuTimeNs", "realtimeThreadCpuTimeNs", "segmentStatistics", "traceInfo"
+})
public class BrokerResponseNative implements BrokerResponse {
public static final BrokerResponseNative EMPTY_RESULT = BrokerResponseNative.empty();
- public static final BrokerResponseNative NO_TABLE_RESULT = new BrokerResponseNative(QueryException.BROKER_RESOURCE_MISSING_ERROR);
- public static final BrokerResponseNative TABLE_DOES_NOT_EXIST = new BrokerResponseNative(QueryException.TABLE_DOES_NOT_EXIST_ERROR);
+ public static final BrokerResponseNative NO_TABLE_RESULT =
+ new BrokerResponseNative(QueryException.BROKER_RESOURCE_MISSING_ERROR);
+ public static final BrokerResponseNative TABLE_DOES_NOT_EXIST =
+ new BrokerResponseNative(QueryException.TABLE_DOES_NOT_EXIST_ERROR);
private int _numServersQueried = 0;
private int _numServersResponded = 0;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/response/broker/SelectionResults.java b/pinot-common/src/main/java/org/apache/pinot/common/response/broker/SelectionResults.java
index e848f17..abffd5b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/response/broker/SelectionResults.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/response/broker/SelectionResults.java
@@ -31,7 +31,8 @@ public class SelectionResults {
private List<Serializable[]> _rows;
@JsonCreator
- public SelectionResults(@JsonProperty("columns") List<String> columns, @JsonProperty("results") List<Serializable[]> results) {
+ public SelectionResults(@JsonProperty("columns") List<String> columns,
+ @JsonProperty("results") List<Serializable[]> results) {
_columns = columns;
_rows = results;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentConsumerInfo.java b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentConsumerInfo.java
index 78adab8..83e0433 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentConsumerInfo.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentConsumerInfo.java
@@ -33,7 +33,8 @@ public class SegmentConsumerInfo {
private final long _lastConsumedTimestamp;
private final Map<String, String> _partitionToOffsetMap;
- public SegmentConsumerInfo(@JsonProperty("segmentName") String segmentName, @JsonProperty("consumerState") String consumerState,
+ public SegmentConsumerInfo(@JsonProperty("segmentName") String segmentName,
+ @JsonProperty("consumerState") String consumerState,
@JsonProperty("lastConsumedTimestamp") long lastConsumedTimestamp,
@JsonProperty("partitionToOffsetMap") Map<String, String> partitionToOffsetMap) {
_segmentName = segmentName;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentErrorInfo.java b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentErrorInfo.java
index 34a6347..29e7257 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentErrorInfo.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentErrorInfo.java
@@ -57,8 +57,8 @@ public class SegmentErrorInfo {
*
*/
@JsonCreator
- public SegmentErrorInfo(@JsonProperty("timestamp") String timestamp, @JsonProperty("errorMessage") String errorMessage,
- @JsonProperty("stackTrace") String stackTrace) {
+ public SegmentErrorInfo(@JsonProperty("timestamp") String timestamp,
+ @JsonProperty("errorMessage") String errorMessage, @JsonProperty("stackTrace") String stackTrace) {
_timestamp = timestamp;
_errorMessage = errorMessage;
_stackTrace = stackTrace;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentServerDebugInfo.java b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentServerDebugInfo.java
index 61a8efc..05015c9 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentServerDebugInfo.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentServerDebugInfo.java
@@ -40,8 +40,9 @@ public class SegmentServerDebugInfo {
private final SegmentErrorInfo _errorInfo;
@JsonCreator
- public SegmentServerDebugInfo(@JsonProperty("segmentName") String segmentName, @JsonProperty("segmentSize") String segmentSize,
- @JsonProperty("consumerInfo") SegmentConsumerInfo consumerInfo, @JsonProperty("errorInfo") SegmentErrorInfo errorInfo) {
+ public SegmentServerDebugInfo(@JsonProperty("segmentName") String segmentName,
+ @JsonProperty("segmentSize") String segmentSize, @JsonProperty("consumerInfo") SegmentConsumerInfo consumerInfo,
+ @JsonProperty("errorInfo") SegmentErrorInfo errorInfo) {
_segmentName = segmentName;
_segmentSize = segmentSize;
_consumerInfo = consumerInfo;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentSizeInfo.java b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentSizeInfo.java
index 3972143..6a9fdf5 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentSizeInfo.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/SegmentSizeInfo.java
@@ -29,7 +29,8 @@ public class SegmentSizeInfo {
private final long _diskSizeInBytes;
@JsonCreator
- public SegmentSizeInfo(@JsonProperty("segmentName") String segmentName, @JsonProperty("diskSizeInBytes") long sizeBytes) {
+ public SegmentSizeInfo(@JsonProperty("segmentName") String segmentName,
+ @JsonProperty("diskSizeInBytes") long sizeBytes) {
_segmentName = segmentName;
_diskSizeInBytes = sizeBytes;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/StartReplaceSegmentsRequest.java b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/StartReplaceSegmentsRequest.java
index 7210294..0547952 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/StartReplaceSegmentsRequest.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/StartReplaceSegmentsRequest.java
@@ -40,7 +40,8 @@ public class StartReplaceSegmentsRequest {
@JsonProperty("segmentsTo") List<String> segmentsTo) {
_segmentsFrom = (segmentsFrom == null) ? Collections.emptyList() : segmentsFrom;
_segmentsTo = segmentsTo;
- Preconditions.checkArgument(segmentsTo != null && !segmentsTo.isEmpty(), "'segmentsTo' should not be null or empty");
+ Preconditions
+ .checkArgument(segmentsTo != null && !segmentsTo.isEmpty(), "'segmentsTo' should not be null or empty");
}
public List<String> getSegmentsFrom() {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/TableMetadataInfo.java b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/TableMetadataInfo.java
index 558e848..c2c62d6 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/TableMetadataInfo.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/restlet/resources/TableMetadataInfo.java
@@ -43,9 +43,9 @@ public class TableMetadataInfo {
private final Map<String, Double> _columnCardinalityMap;
@JsonCreator
- public TableMetadataInfo(@JsonProperty("tableName") String tableName, @JsonProperty("diskSizeInBytes") long sizeInBytes,
- @JsonProperty("numSegments") long numSegments, @JsonProperty("numRows") long numRows,
- @JsonProperty("columnLengthMap") Map<String, Double> columnLengthMap,
+ public TableMetadataInfo(@JsonProperty("tableName") String tableName,
+ @JsonProperty("diskSizeInBytes") long sizeInBytes, @JsonProperty("numSegments") long numSegments,
+ @JsonProperty("numRows") long numRows, @JsonProperty("columnLengthMap") Map<String, Double> columnLengthMap,
@JsonProperty("columnCardinalityMap") Map<String, Double> columnCardinalityMap) {
_tableName = tableName;
_diskSizeInBytes = sizeInBytes;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/segment/generation/SegmentGenerationUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/segment/generation/SegmentGenerationUtils.java
index d45a876..2eaeeef 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/segment/generation/SegmentGenerationUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/segment/generation/SegmentGenerationUtils.java
@@ -122,7 +122,8 @@ public class SegmentGenerationUtils {
try {
tableConfigJson = fetchUrl(tableConfigURI.toURL(), authToken);
} catch (IOException e) {
- throw new RuntimeException("Failed to read from table config file data stream on Pinot fs - '" + tableConfigURI + "'", e);
+ throw new RuntimeException(
+ "Failed to read from table config file data stream on Pinot fs - '" + tableConfigURI + "'", e);
}
}
// Controller API returns a wrapper of table config.
@@ -155,7 +156,8 @@ public class SegmentGenerationUtils {
public static URI getRelativeOutputPath(URI baseInputDir, URI inputFile, URI outputDir) {
URI relativePath = baseInputDir.relativize(inputFile);
Preconditions.checkState(relativePath.getPath().length() > 0 && !relativePath.equals(inputFile),
- "Unable to extract out the relative path for input file '" + inputFile + "', based on base input path: " + baseInputDir);
+ "Unable to extract out the relative path for input file '" + inputFile + "', based on base input path: "
+ + baseInputDir);
String outputDirStr = outputDir.toString();
outputDir = !outputDirStr.endsWith("/") ? URI.create(outputDirStr.concat("/")) : outputDir;
URI relativeOutputURI = outputDir.resolve(relativePath).resolve(".");
@@ -189,8 +191,9 @@ public class SegmentGenerationUtils {
throws URISyntaxException {
URI fileURI = URI.create(uriStr);
if (fileURI.getScheme() == null) {
- return new URI(fullUriForPathOnlyUriStr.getScheme(), fullUriForPathOnlyUriStr.getUserInfo(), fullUriForPathOnlyUriStr.getHost(),
- fullUriForPathOnlyUriStr.getPort(), fileURI.getPath(), fileURI.getQuery(), fileURI.getFragment());
+ return new URI(fullUriForPathOnlyUriStr.getScheme(), fullUriForPathOnlyUriStr.getUserInfo(),
+ fullUriForPathOnlyUriStr.getHost(), fullUriForPathOnlyUriStr.getPort(), fileURI.getPath(), fileURI.getQuery(),
+ fileURI.getFragment());
}
return fileURI;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/tier/TimeBasedTierSegmentSelector.java b/pinot-common/src/main/java/org/apache/pinot/common/tier/TimeBasedTierSegmentSelector.java
index f526b87..dbe5547 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/tier/TimeBasedTierSegmentSelector.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/tier/TimeBasedTierSegmentSelector.java
@@ -54,12 +54,14 @@ public class TimeBasedTierSegmentSelector implements TierSegmentSelector {
SegmentZKMetadata segmentZKMetadata =
ZKMetadataProvider.getSegmentZKMetadata(_helixManager.getHelixPropertyStore(), tableNameWithType, segmentName);
Preconditions
- .checkNotNull(segmentZKMetadata, "Could not find zk metadata for segment: {} of table: {}", segmentName, tableNameWithType);
+ .checkNotNull(segmentZKMetadata, "Could not find zk metadata for segment: {} of table: {}", segmentName,
+ tableNameWithType);
// get segment end time to decide if segment gets selected
long endTimeMs = segmentZKMetadata.getEndTimeMs();
Preconditions
- .checkState(endTimeMs > 0, "Invalid endTimeMs: %s for segment: %s of table: %s", endTimeMs, segmentName, tableNameWithType);
+ .checkState(endTimeMs > 0, "Invalid endTimeMs: %s for segment: %s of table: %s", endTimeMs, segmentName,
+ tableNameWithType);
long now = System.currentTimeMillis();
return (now - endTimeMs) > _segmentAgeMillis;
}
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 32a41bc..eaf9978 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
@@ -101,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);
@@ -114,22 +115,23 @@ public class ClientSSLContextGenerator {
return tmf.getTrustManagers();
}
// Server verification disabled. Trust all servers
- TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
- @Override
- public void checkClientTrusted(X509Certificate[] x509Certificates, String s)
- throws CertificateException {
- }
+ TrustManager[] trustAllCerts = new TrustManager[]{
+ new X509TrustManager() {
+ @Override
+ public void checkClientTrusted(X509Certificate[] x509Certificates, String s)
+ throws CertificateException {
+ }
- @Override
- public void checkServerTrusted(X509Certificate[] x509Certificates, String s)
- throws CertificateException {
- }
+ @Override
+ public void checkServerTrusted(X509Certificate[] x509Certificates, String s)
+ throws CertificateException {
+ }
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return new X509Certificate[0];
- }
- }
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[0];
+ }
+ }
};
return trustAllCerts;
}
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 961bde6..b871c0e 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
@@ -46,7 +46,8 @@ public class DataSchema {
private ColumnDataType[] _storedColumnDataTypes;
@JsonCreator
- public DataSchema(@JsonProperty("columnNames") String[] columnNames, @JsonProperty("columnDataTypes") ColumnDataType[] columnDataTypes) {
+ public DataSchema(@JsonProperty("columnNames") String[] columnNames,
+ @JsonProperty("columnDataTypes") ColumnDataType[] columnDataTypes) {
_columnNames = columnNames;
_columnDataTypes = columnDataTypes;
}
@@ -276,7 +277,8 @@ public class DataSchema {
}
public boolean isArray() {
- return this == INT_ARRAY || this == LONG_ARRAY || this == FLOAT_ARRAY || this == DOUBLE_ARRAY || this == STRING_ARRAY;
+ return this == INT_ARRAY || this == LONG_ARRAY || this == FLOAT_ARRAY || this == DOUBLE_ARRAY
+ || this == STRING_ARRAY;
}
public boolean isNumberArray() {
@@ -289,8 +291,8 @@ public class DataSchema {
public boolean isCompatible(ColumnDataType anotherColumnDataType) {
// All numbers are compatible with each other
- return this == anotherColumnDataType || (this.isNumber() && anotherColumnDataType.isNumber()) || (this.isNumberArray()
- && anotherColumnDataType.isNumberArray());
+ return this == anotherColumnDataType || (this.isNumber() && anotherColumnDataType.isNumber()) || (
+ this.isNumberArray() && anotherColumnDataType.isNumberArray());
}
public DataType toDataType() {
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 b85144e..c39d752 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
@@ -181,7 +181,8 @@ public class FileUploadDownloadClient implements Closeable {
* This method calls the old segment endpoint. We will deprecate this behavior soon.
*/
@Deprecated
- public static URI getDeleteSegmentHttpUri(String host, int port, String rawTableName, String segmentName, String tableType)
+ public static URI getDeleteSegmentHttpUri(String host, int port, String rawTableName, String segmentName,
+ String tableType)
throws URISyntaxException {
return new URI(StringUtil.join("/", StringUtils.chomp(HTTP + "://" + host + ":" + port, "/"), OLD_SEGMENT_PATH,
rawTableName + "/" + URIUtils.encode(segmentName) + "?" + TYPE_DELIMITER + tableType));
@@ -193,7 +194,8 @@ public class FileUploadDownloadClient implements Closeable {
* This method calls the old segment endpoint. We will deprecate this behavior soon.
*/
@Deprecated
- public static URI getRetrieveAllSegmentWithTableTypeHttpUri(String host, int port, String rawTableName, String tableType)
+ public static URI getRetrieveAllSegmentWithTableTypeHttpUri(String host, int port, String rawTableName,
+ String tableType)
throws URISyntaxException {
return new URI(StringUtil.join("/", StringUtils.chomp(HTTP + "://" + host + ":" + port, "/"), OLD_SEGMENT_PATH,
rawTableName + "?" + TYPE_DELIMITER + tableType));
@@ -313,60 +315,64 @@ public class FileUploadDownloadClient implements Closeable {
OLD_SEGMENT_PATH + "/" + rawTableName + START_REPLACE_SEGMENTS_PATH, TYPE_DELIMITER + tableType);
}
- public static URI getEndReplaceSegmentsURI(URI controllerURI, String rawTableName, String tableType, String segmentLineageEntryId)
+ public static URI getEndReplaceSegmentsURI(URI controllerURI, String rawTableName, String tableType,
+ String segmentLineageEntryId)
throws URISyntaxException {
return getURI(controllerURI.getScheme(), controllerURI.getHost(), controllerURI.getPort(),
OLD_SEGMENT_PATH + "/" + rawTableName + END_REPLACE_SEGMENTS_PATH,
TYPE_DELIMITER + tableType + SEGMENT_LINEAGE_ENTRY_ID_PARAMETER + segmentLineageEntryId);
}
- private static HttpUriRequest getUploadFileRequest(String method, URI uri, ContentBody contentBody, @Nullable List<Header> headers,
- @Nullable List<NameValuePair> parameters, int socketTimeoutMs) {
+ 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 = RequestBuilder.create(method).setVersion(HttpVersion.HTTP_1_1).setUri(uri).setEntity(entity);
+ RequestBuilder requestBuilder =
+ RequestBuilder.create(method).setVersion(HttpVersion.HTTP_1_1).setUri(uri).setEntity(entity);
addHeadersAndParameters(requestBuilder, headers, parameters);
setTimeout(requestBuilder, socketTimeoutMs);
return requestBuilder.build();
}
- private static HttpUriRequest getDeleteFileRequest(String method, URI uri, ContentBody contentBody, @Nullable List<Header> headers,
- @Nullable List<NameValuePair> parameters, int socketTimeoutMs) {
+ private static HttpUriRequest getDeleteFileRequest(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 = RequestBuilder.create(method).setVersion(HttpVersion.HTTP_1_1).setUri(uri).setEntity(entity);
+ RequestBuilder requestBuilder =
+ RequestBuilder.create(method).setVersion(HttpVersion.HTTP_1_1).setUri(uri).setEntity(entity);
addHeadersAndParameters(requestBuilder, headers, parameters);
setTimeout(requestBuilder, socketTimeoutMs);
return requestBuilder.build();
}
- private static HttpUriRequest getAddSchemaRequest(URI uri, String schemaName, File schemaFile, @Nullable List<Header> headers,
- @Nullable List<NameValuePair> parameters) {
+ private static HttpUriRequest getAddSchemaRequest(URI uri, String schemaName, File schemaFile,
+ @Nullable List<Header> headers, @Nullable List<NameValuePair> parameters) {
return getUploadFileRequest(HttpPost.METHOD_NAME, uri, getContentBody(schemaName, schemaFile), headers, parameters,
DEFAULT_SOCKET_TIMEOUT_MS);
}
- private static HttpUriRequest getUploadSegmentRequest(URI uri, String segmentName, File segmentFile, @Nullable List<Header> headers,
- @Nullable List<NameValuePair> parameters, int socketTimeoutMs) {
- return getUploadFileRequest(HttpPost.METHOD_NAME, uri, getContentBody(segmentName, segmentFile), headers, parameters, socketTimeoutMs);
+ private static HttpUriRequest getUploadSegmentRequest(URI uri, String segmentName, File segmentFile,
+ @Nullable List<Header> headers, @Nullable List<NameValuePair> parameters, int socketTimeoutMs) {
+ return getUploadFileRequest(HttpPost.METHOD_NAME, uri, getContentBody(segmentName, segmentFile), headers,
+ parameters, socketTimeoutMs);
}
private static HttpUriRequest getUploadSegmentRequest(URI uri, String segmentName, InputStream inputStream,
@Nullable List<Header> headers, @Nullable List<NameValuePair> parameters, int socketTimeoutMs) {
- return getUploadFileRequest(HttpPost.METHOD_NAME, uri, getContentBody(segmentName, inputStream), headers, parameters, socketTimeoutMs);
+ return getUploadFileRequest(HttpPost.METHOD_NAME, uri, getContentBody(segmentName, inputStream), headers,
+ parameters, socketTimeoutMs);
}
private static HttpUriRequest getUploadSegmentMetadataRequest(URI uri, String segmentName, File segmentFile,
@Nullable List<Header> headers, @Nullable List<NameValuePair> parameters, int socketTimeoutMs) {
- return getUploadFileRequest(HttpPost.METHOD_NAME, uri, getContentBody(segmentName, segmentFile), headers, parameters, socketTimeoutMs);
+ return getUploadFileRequest(HttpPost.METHOD_NAME, uri, getContentBody(segmentName, segmentFile), headers,
+ parameters, socketTimeoutMs);
}
private static HttpUriRequest getUploadSegmentMetadataFilesRequest(URI uri, Map<String, File> metadataFiles,
@@ -388,9 +394,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).setHeader(CustomHeaders.UPLOAD_TYPE, FileUploadType.URI.toString())
- .setHeader(CustomHeaders.DOWNLOAD_URI, downloadUri).setHeader(HttpHeaders.CONTENT_TYPE, JSON_CONTENT_TYPE);
+ 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, JSON_CONTENT_TYPE);
addHeadersAndParameters(requestBuilder, headers, parameters);
setTimeout(requestBuilder, socketTimeoutMs);
return requestBuilder.build();
@@ -398,9 +404,9 @@ 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).setHeader(CustomHeaders.UPLOAD_TYPE, FileUploadType.JSON.toString())
- .setEntity(new StringEntity(jsonString, ContentType.APPLICATION_JSON));
+ 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);
setTimeout(requestBuilder, socketTimeoutMs);
return requestBuilder.build();
@@ -415,8 +421,8 @@ public class FileUploadDownloadClient implements Closeable {
}
private static HttpUriRequest getEndReplaceSegmentsRequest(URI uri, int socketTimeoutMs) {
- RequestBuilder requestBuilder =
- RequestBuilder.post(uri).setVersion(HttpVersion.HTTP_1_1).setHeader(HttpHeaders.CONTENT_TYPE, JSON_CONTENT_TYPE);
+ RequestBuilder requestBuilder = RequestBuilder.post(uri).setVersion(HttpVersion.HTTP_1_1)
+ .setHeader(HttpHeaders.CONTENT_TYPE, JSON_CONTENT_TYPE);
setTimeout(requestBuilder, socketTimeoutMs);
return requestBuilder.build();
}
@@ -481,8 +487,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) {
@@ -506,11 +513,11 @@ public class FileUploadDownloadClient implements Closeable {
} catch (Exception e) {
reason = "Failed to get reason";
}
- String errorMessage = String
- .format("Got error status code: %d (%s) with reason: \"%s\" while sending request: %s", statusLine.getStatusCode(),
- statusLine.getReasonPhrase(), reason, request.getURI());
+ String errorMessage = String.format("Got error status code: %d (%s) with reason: \"%s\" while sending request: %s",
+ statusLine.getStatusCode(), statusLine.getReasonPhrase(), reason, request.getURI());
if (controllerHost != null) {
- errorMessage = String.format("%s to controller: %s, version: %s", errorMessage, controllerHost, controllerVersion);
+ errorMessage =
+ String.format("%s to controller: %s, version: %s", errorMessage, controllerHost, controllerVersion);
}
return errorMessage;
}
@@ -613,7 +620,8 @@ public class FileUploadDownloadClient implements Closeable {
public SimpleHttpResponse updateSchema(URI uri, String schemaName, File schemaFile)
throws IOException, HttpErrorStatusException {
return sendRequest(
- getUploadFileRequest(HttpPut.METHOD_NAME, uri, getContentBody(schemaName, schemaFile), null, null, DEFAULT_SOCKET_TIMEOUT_MS));
+ getUploadFileRequest(HttpPut.METHOD_NAME, uri, getContentBody(schemaName, schemaFile), null, null,
+ DEFAULT_SOCKET_TIMEOUT_MS));
}
/**
@@ -631,8 +639,9 @@ public class FileUploadDownloadClient implements Closeable {
public SimpleHttpResponse updateSchema(URI uri, String schemaName, File schemaFile, @Nullable List<Header> headers,
@Nullable List<NameValuePair> parameters)
throws IOException, HttpErrorStatusException {
- return sendRequest(getUploadFileRequest(HttpPut.METHOD_NAME, uri, getContentBody(schemaName, schemaFile), headers, parameters,
- DEFAULT_SOCKET_TIMEOUT_MS));
+ return sendRequest(
+ getUploadFileRequest(HttpPut.METHOD_NAME, uri, getContentBody(schemaName, schemaFile), headers, parameters,
+ DEFAULT_SOCKET_TIMEOUT_MS));
}
/**
@@ -648,10 +657,11 @@ 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)
+ 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));
+ return sendRequest(
+ getUploadSegmentMetadataRequest(uri, segmentName, segmentMetadataFile, headers, parameters, socketTimeoutMs));
}
/**
@@ -661,16 +671,19 @@ public class FileUploadDownloadClient implements Closeable {
*/
@Deprecated
// Upload a set of segment metadata files (e.g., meta.properties and creation.meta) to controllers.
- public SimpleHttpResponse uploadSegmentMetadataFiles(URI uri, Map<String, File> metadataFiles, int segmentUploadRequestTimeoutMs)
+ public SimpleHttpResponse uploadSegmentMetadataFiles(URI uri, Map<String, File> metadataFiles,
+ int segmentUploadRequestTimeoutMs)
throws IOException, HttpErrorStatusException {
- return uploadSegmentMetadataFiles(uri, metadataFiles, Collections.emptyList(), Collections.emptyList(), segmentUploadRequestTimeoutMs);
+ return uploadSegmentMetadataFiles(uri, metadataFiles, Collections.emptyList(), Collections.emptyList(),
+ segmentUploadRequestTimeoutMs);
}
// Upload a set of segment metadata files (e.g., meta.properties and creation.meta) to controllers.
- public SimpleHttpResponse uploadSegmentMetadataFiles(URI uri, Map<String, File> metadataFiles, @Nullable List<Header> headers,
- @Nullable List<NameValuePair> parameters, int segmentUploadRequestTimeoutMs)
+ public SimpleHttpResponse uploadSegmentMetadataFiles(URI uri, Map<String, File> metadataFiles,
+ @Nullable List<Header> headers, @Nullable List<NameValuePair> parameters, int segmentUploadRequestTimeoutMs)
throws IOException, HttpErrorStatusException {
- return sendRequest(getUploadSegmentMetadataFilesRequest(uri, metadataFiles, headers, parameters, segmentUploadRequestTimeoutMs));
+ return sendRequest(
+ getUploadSegmentMetadataFilesRequest(uri, metadataFiles, headers, parameters, segmentUploadRequestTimeoutMs));
}
/**
@@ -733,7 +746,8 @@ public class FileUploadDownloadClient implements Closeable {
* @throws IOException
* @throws HttpErrorStatusException
*/
- public SimpleHttpResponse uploadSegment(URI uri, String segmentName, File segmentFile, String tableName, TableType tableType)
+ public SimpleHttpResponse uploadSegment(URI uri, String segmentName, File segmentFile, String tableName,
+ TableType tableType)
throws IOException, HttpErrorStatusException {
// Add table name and type request parameters
NameValuePair tableNameValuePair = new BasicNameValuePair(QueryParameters.TABLE_NAME, tableName);
@@ -757,8 +771,8 @@ public class FileUploadDownloadClient implements Closeable {
* @throws IOException
* @throws HttpErrorStatusException
*/
- public SimpleHttpResponse uploadSegment(URI uri, String segmentName, InputStream inputStream, @Nullable List<Header> headers,
- @Nullable List<NameValuePair> parameters, int socketTimeoutMs)
+ public SimpleHttpResponse uploadSegment(URI uri, String segmentName, InputStream inputStream,
+ @Nullable List<Header> headers, @Nullable List<NameValuePair> parameters, int socketTimeoutMs)
throws IOException, HttpErrorStatusException {
return sendRequest(getUploadSegmentRequest(uri, segmentName, inputStream, headers, parameters, socketTimeoutMs));
}
@@ -873,8 +887,8 @@ public class FileUploadDownloadClient implements Closeable {
*/
public SimpleHttpResponse startReplaceSegments(URI uri, StartReplaceSegmentsRequest startReplaceSegmentsRequest)
throws IOException, HttpErrorStatusException {
- return sendRequest(
- getStartReplaceSegmentsRequest(uri, JsonUtils.objectToString(startReplaceSegmentsRequest), DEFAULT_SOCKET_TIMEOUT_MS));
+ return sendRequest(getStartReplaceSegmentsRequest(uri, JsonUtils.objectToString(startReplaceSegmentsRequest),
+ DEFAULT_SOCKET_TIMEOUT_MS));
}
/**
@@ -978,8 +992,8 @@ public class FileUploadDownloadClient implements Closeable {
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, fileLength,
- contentLength));
+ .format("While downloading file with uri: %s, file length: %d does not match content length: %d", uri,
+ fileLength, contentLength));
}
return statusCode;
@@ -1055,6 +1069,7 @@ public class FileUploadDownloadClient implements Closeable {
* @return param list
*/
public static List<NameValuePair> makeTableParam(String tableName) {
- return Collections.singletonList(new BasicNameValuePair(FileUploadDownloadClient.QueryParameters.TABLE_NAME, tableName));
+ return Collections
+ .singletonList(new BasicNameValuePair(FileUploadDownloadClient.QueryParameters.TABLE_NAME, tableName));
}
}
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 59f444b..e3b70af 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
@@ -100,7 +100,8 @@ public class HLCSegmentName extends SegmentName {
_segmentType = RealtimeSegmentType.HLC_SHORT;
} else {
throw new IllegalArgumentException(
- "Invalid group id (" + groupId + "), partition range (" + partitionRange + ") or sequence number (" + sequenceNumber + ")");
+ "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 2156fa3..9c8d227 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
@@ -78,9 +78,10 @@ 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 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);
k *= m;
k ^= k >>> r;
@@ -136,7 +137,9 @@ public class HashUtil {
for (int i = 0; i < length4; i++) {
final int i4 = i * 4;
- int k = (data[i4 + 0] & 0xff) + ((data[i4 + 1] & 0xff) << 8) + ((data[i4 + 2] & 0xff) << 16) + ((data[i4 + 3] & 0xff) << 24);
+ int k =
+ (data[i4 + 0] & 0xff) + ((data[i4 + 1] & 0xff) << 8) + ((data[i4 + 2] & 0xff) << 16) + ((data[i4 + 3] & 0xff)
+ << 24);
k *= m;
k ^= k >>> r;
k *= m;
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 86305fd..a66bb3c 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
@@ -107,7 +107,8 @@ public class LLCSegmentName extends SegmentName implements Comparable {
public int compareTo(Object 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.getPartitionGroupId() > other.getPartitionGroupId()) {
return 1;
@@ -121,7 +122,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/NamedThreadFactory.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/NamedThreadFactory.java
index aa52971..5b332a8 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
@@ -62,7 +62,8 @@ public class NamedThreadFactory implements ThreadFactory {
public NamedThreadFactory(String threadNamePrefix) {
final SecurityManager s = System.getSecurityManager();
_group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
- _threadNamePrefix = String.format(NAME_PATTERN, checkPrefix(threadNamePrefix), THREAD_POOL_NUMBER.getAndIncrement());
+ _threadNamePrefix =
+ String.format(NAME_PATTERN, checkPrefix(threadNamePrefix), THREAD_POOL_NUMBER.getAndIncrement());
}
private static String checkPrefix(String prefix) {
@@ -75,7 +76,8 @@ public class NamedThreadFactory implements ThreadFactory {
* @see java.util.concurrent.ThreadFactory#newThread(java.lang.Runnable)
*/
public Thread newThread(Runnable r) {
- final Thread t = new Thread(_group, r, String.format("%s-%d", _threadNamePrefix, _threadNumber.getAndIncrement()), 0);
+ final Thread t =
+ new Thread(_group, r, String.format("%s-%d", _threadNamePrefix, _threadNumber.getAndIncrement()), 0);
t.setDaemon(false);
t.setPriority(Thread.NORM_PRIORITY);
return t;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/PinotAppConfigs.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/PinotAppConfigs.java
index 517828f..986f482 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/PinotAppConfigs.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/PinotAppConfigs.java
@@ -105,15 +105,14 @@ public class PinotAppConfigs {
// Not all platforms may implement this, and so we may not have access to some of the api's.
if (osMXBean instanceof com.sun.management.OperatingSystemMXBean) {
com.sun.management.OperatingSystemMXBean sunOsMXBean = (com.sun.management.OperatingSystemMXBean) osMXBean;
- systemConfig = new SystemConfig(osMXBean.getArch(), osMXBean.getName(), osMXBean.getVersion(), osMXBean.getAvailableProcessors(),
- FileUtils.byteCountToDisplaySize(sunOsMXBean.getTotalPhysicalMemorySize()),
+ systemConfig = new SystemConfig(osMXBean.getArch(), osMXBean.getName(), osMXBean.getVersion(),
+ osMXBean.getAvailableProcessors(), FileUtils.byteCountToDisplaySize(sunOsMXBean.getTotalPhysicalMemorySize()),
FileUtils.byteCountToDisplaySize(sunOsMXBean.getFreePhysicalMemorySize()),
FileUtils.byteCountToDisplaySize(sunOsMXBean.getTotalSwapSpaceSize()),
FileUtils.byteCountToDisplaySize(sunOsMXBean.getFreeSwapSpaceSize()));
} else {
- systemConfig =
- new SystemConfig(osMXBean.getArch(), osMXBean.getName(), osMXBean.getVersion(), osMXBean.getAvailableProcessors(), UNKNOWN_VALUE,
- UNKNOWN_VALUE, UNKNOWN_VALUE, UNKNOWN_VALUE);
+ systemConfig = new SystemConfig(osMXBean.getArch(), osMXBean.getName(), osMXBean.getVersion(),
+ osMXBean.getAvailableProcessors(), UNKNOWN_VALUE, UNKNOWN_VALUE, UNKNOWN_VALUE, UNKNOWN_VALUE);
}
return systemConfig;
}
@@ -133,7 +132,8 @@ public class PinotAppConfigs {
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
return new RuntimeConfig(threadMXBean.getTotalStartedThreadCount(), threadMXBean.getThreadCount(),
- FileUtils.byteCountToDisplaySize(heapMemoryUsage.getMax()), FileUtils.byteCountToDisplaySize(heapMemoryUsage.getUsed()));
+ FileUtils.byteCountToDisplaySize(heapMemoryUsage.getMax()),
+ FileUtils.byteCountToDisplaySize(heapMemoryUsage.getUsed()));
}
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -148,10 +148,11 @@ public class PinotAppConfigs {
private final String _freeSwapSpace;
@JsonCreator
- public SystemConfig(@JsonProperty("arch") String arch, @JsonProperty("name") String name, @JsonProperty("version") String version,
- @JsonProperty("availableProcessors") int availableProcessors, @JsonProperty("totalPhysicalMemory") String totalPhysicalMemory,
- @JsonProperty("freePhysicalMemory") String freePhysicalMemory, @JsonProperty("totalSwapSpace") String totalSwapSpace,
- @JsonProperty("freeSwapSpace") String freeSwapSpace) {
+ public SystemConfig(@JsonProperty("arch") String arch, @JsonProperty("name") String name,
+ @JsonProperty("version") String version, @JsonProperty("availableProcessors") int availableProcessors,
+ @JsonProperty("totalPhysicalMemory") String totalPhysicalMemory,
+ @JsonProperty("freePhysicalMemory") String freePhysicalMemory,
+ @JsonProperty("totalSwapSpace") String totalSwapSpace, @JsonProperty("freeSwapSpace") String freeSwapSpace) {
_arch = arch;
_name = name;
_version = version;
@@ -203,16 +204,17 @@ public class PinotAppConfigs {
return false;
}
SystemConfig that = (SystemConfig) o;
- return _availableProcessors == that._availableProcessors && Objects.equals(_arch, that._arch) && Objects.equals(_name, that._name)
- && Objects.equals(_version, that._version) && Objects.equals(_totalPhysicalMemory, that._totalPhysicalMemory) && Objects
- .equals(_freePhysicalMemory, that._freePhysicalMemory) && Objects.equals(_totalSwapSpace, that._totalSwapSpace) && Objects
- .equals(_freeSwapSpace, that._freeSwapSpace);
+ return _availableProcessors == that._availableProcessors && Objects.equals(_arch, that._arch) && Objects
+ .equals(_name, that._name) && Objects.equals(_version, that._version) && Objects
+ .equals(_totalPhysicalMemory, that._totalPhysicalMemory) && Objects
+ .equals(_freePhysicalMemory, that._freePhysicalMemory) && Objects
+ .equals(_totalSwapSpace, that._totalSwapSpace) && Objects.equals(_freeSwapSpace, that._freeSwapSpace);
}
@Override
public int hashCode() {
- return Objects
- .hash(_arch, _name, _version, _availableProcessors, _totalPhysicalMemory, _freePhysicalMemory, _totalSwapSpace, _freeSwapSpace);
+ return Objects.hash(_arch, _name, _version, _availableProcessors, _totalPhysicalMemory, _freePhysicalMemory,
+ _totalSwapSpace, _freeSwapSpace);
}
}
@@ -224,8 +226,9 @@ public class PinotAppConfigs {
private final String _currentHeapSize;
@JsonCreator
- public RuntimeConfig(@JsonProperty("numTotalThreads") long numTotalThreads, @JsonProperty("numCurrentThreads") int numCurrentThreads,
- @JsonProperty("maxHeapSize") String maxHeapSize, @JsonProperty("currentHeapSize") String currentHeapSize) {
+ public RuntimeConfig(@JsonProperty("numTotalThreads") long numTotalThreads,
+ @JsonProperty("numCurrentThreads") int numCurrentThreads, @JsonProperty("maxHeapSize") String maxHeapSize,
+ @JsonProperty("currentHeapSize") String currentHeapSize) {
_numTotalThreads = numTotalThreads;
_numCurrentThreads = numCurrentThreads;
_maxHeapSize = maxHeapSize;
@@ -287,8 +290,9 @@ public class PinotAppConfigs {
}
JVMConfig jvmConfig = (JVMConfig) o;
return Objects.equals(_args, jvmConfig._args) && Objects.equals(_libraryPath, jvmConfig._libraryPath) && Objects
- .equals(_bootClassPath, jvmConfig._bootClassPath) && Objects.equals(_envVariables, jvmConfig._envVariables) && Objects
- .equals(_systemProperties, jvmConfig._systemProperties) && Objects.equals(_garbageCollectors, jvmConfig._garbageCollectors);
+ .equals(_bootClassPath, jvmConfig._bootClassPath) && Objects.equals(_envVariables, jvmConfig._envVariables)
+ && Objects.equals(_systemProperties, jvmConfig._systemProperties) && Objects
+ .equals(_garbageCollectors, jvmConfig._garbageCollectors);
}
@Override
@@ -298,8 +302,10 @@ public class PinotAppConfigs {
@JsonCreator
public JVMConfig(@JsonProperty("args") List<String> args, @JsonProperty("libraryPath") String libraryPath,
- @JsonProperty("bootClassPath") String bootClassPath, @JsonProperty("systemProperties") Map<String, String> systemProperties,
- @JsonProperty("envVariables") Map<String, String> envVariables, @JsonProperty("garbageCollectors") List<String> garbageCollectors) {
+ @JsonProperty("bootClassPath") String bootClassPath,
+ @JsonProperty("systemProperties") Map<String, String> systemProperties,
+ @JsonProperty("envVariables") Map<String, String> envVariables,
+ @JsonProperty("garbageCollectors") List<String> garbageCollectors) {
_args = args;
_libraryPath = libraryPath;
_bootClassPath = bootClassPath;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java
index 2f258c3..cb4b5fa 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/PinotDataType.java
@@ -585,7 +585,8 @@ public enum PinotDataType {
try {
return Base64.getDecoder().decode(value.toString());
} catch (Exception e) {
- throw new RuntimeException("Unable to convert JSON base64 encoded string value to BYTES. Input value: " + value, e);
+ throw new RuntimeException("Unable to convert JSON base64 encoded string value to BYTES. Input value: " + value,
+ e);
}
}
@@ -844,7 +845,8 @@ public enum PinotDataType {
try {
return JsonUtils.objectToString(value);
} catch (Exception e) {
- throw new RuntimeException("Unable to convert " + value.getClass().getCanonicalName() + " to JSON. Input value: " + value, e);
+ throw new RuntimeException(
+ "Unable to convert " + value.getClass().getCanonicalName() + " to JSON. Input value: " + value, e);
}
}
}
@@ -1185,7 +1187,8 @@ public enum PinotDataType {
throw new IllegalStateException("There is no multi-value type for BYTES");
}
default:
- throw new UnsupportedOperationException("Unsupported data type: " + dataType + " in field: " + fieldSpec.getName());
+ throw new UnsupportedOperationException(
+ "Unsupported data type: " + dataType + " in field: " + fieldSpec.getName());
}
}
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 c6bfa3c..5791f76 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
@@ -35,8 +35,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 10b8f8c..c7f3c99 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
@@ -134,7 +134,8 @@ public class SchemaUtils {
httpPost.releaseConnection();
}
} catch (Exception e) {
- LOGGER.error("Caught exception while posting the schema: {} to host: {}, port: {}", schema.getSchemaName(), host, port, e);
+ LOGGER.error("Caught exception while posting the schema: {} to host: {}, port: {}", schema.getSchemaName(), host,
+ port, e);
return false;
}
}
@@ -179,16 +180,17 @@ 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());
}
/**
* An example on how to use this utility class.
*/
public static void main(String[] args) {
- Schema schema = new Schema.SchemaBuilder().setSchemaName("testSchema").addSingleValueDimension("dimension", FieldSpec.DataType.DOUBLE)
- .addMetric("metric", FieldSpec.DataType.INT).addTime(new TimeGranularitySpec(FieldSpec.DataType.INT, TimeUnit.DAYS, "time"), null)
- .build();
+ Schema schema = new Schema.SchemaBuilder().setSchemaName("testSchema")
+ .addSingleValueDimension("dimension", FieldSpec.DataType.DOUBLE).addMetric("metric", FieldSpec.DataType.INT)
+ .addTime(new TimeGranularitySpec(FieldSpec.DataType.INT, TimeUnit.DAYS, "time"), null).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/SegmentUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/SegmentUtils.java
index 04f2985..21b3fb4 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/SegmentUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/SegmentUtils.java
@@ -35,8 +35,8 @@ public class SegmentUtils {
// Returns the partition id of a realtime segment based segment name and segment metadata info retrieved via Helix.
// Important: The method is costly because it may read data from zookeeper. Do not use it in any query execution
// path.
- public static int getRealtimeSegmentPartitionId(String segmentName, String realtimeTableName, HelixManager helixManager,
- String partitionColumn) {
+ public static int getRealtimeSegmentPartitionId(String segmentName, String realtimeTableName,
+ HelixManager helixManager, String partitionColumn) {
// A fast path if the segmentName is a LLC segment name and we can get the partition id from the name directly.
if (LLCSegmentName.isLowLevelConsumerSegmentName(segmentName)) {
return new LLCSegmentName(segmentName).getPartitionGroupId();
@@ -45,19 +45,22 @@ public class SegmentUtils {
// enabled tables have partition ids in their segment metadata.
SegmentZKMetadata segmentZKMetadata =
ZKMetadataProvider.getSegmentZKMetadata(helixManager.getHelixPropertyStore(), realtimeTableName, segmentName);
- Preconditions.checkState(segmentZKMetadata != null, "Failed to find segment ZK metadata for segment: %s of table: %s", segmentName,
- realtimeTableName);
+ Preconditions
+ .checkState(segmentZKMetadata != null, "Failed to find segment ZK metadata for segment: %s of table: %s",
+ segmentName, realtimeTableName);
SegmentPartitionMetadata segmentPartitionMetadata = segmentZKMetadata.getPartitionMetadata();
Preconditions.checkState(segmentPartitionMetadata != null,
- "Segment ZK metadata for segment: %s of table: %s does not contain partition metadata", segmentName, realtimeTableName);
- ColumnPartitionMetadata columnPartitionMetadata = segmentPartitionMetadata.getColumnPartitionMap().get(partitionColumn);
+ "Segment ZK metadata for segment: %s of table: %s does not contain partition metadata", segmentName,
+ realtimeTableName);
+ ColumnPartitionMetadata columnPartitionMetadata =
+ segmentPartitionMetadata.getColumnPartitionMap().get(partitionColumn);
Preconditions.checkState(columnPartitionMetadata != null,
"Segment ZK metadata for segment: %s of table: %s does not contain partition metadata for column: %s. Check "
+ "if the table is an upsert table.", segmentName, realtimeTableName, partitionColumn);
Set<Integer> partitions = columnPartitionMetadata.getPartitions();
Preconditions.checkState(partitions.size() == 1,
- "Segment ZK metadata for segment: %s of table: %s contains multiple partitions for column: %s with %s", segmentName,
- realtimeTableName, partitionColumn, partitions);
+ "Segment ZK metadata for segment: %s of table: %s contains multiple partitions for column: %s with %s",
+ segmentName, realtimeTableName, partitionColumn, partitions);
return partitions.iterator().next();
}
}
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 5df3a6b..06ee990 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
@@ -157,8 +157,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();
}
@@ -195,8 +195,8 @@ public class ServiceStatus {
}
StringBuilder statusDescription = new StringBuilder();
for (ServiceStatusCallback statusCallback : _statusCallbacks.values()) {
- statusDescription.append(statusCallback.getClass().getSimpleName()).append(":").append(statusCallback.getStatusDescription())
- .append(";");
+ statusDescription.append(statusCallback.getClass().getSimpleName()).append(":")
+ .append(statusCallback.getStatusDescription()).append(";");
}
return statusDescription.toString();
}
@@ -219,14 +219,15 @@ public class ServiceStatus {
/**
* Realtime consumption catchup service which adds a static wait time for consuming segments to catchup
*/
- public RealtimeConsumptionCatchupServiceStatusCallback(HelixManager helixManager, String clusterName, String instanceName,
- long realtimeConsumptionCatchupWaitMs) {
+ public RealtimeConsumptionCatchupServiceStatusCallback(HelixManager helixManager, String clusterName,
+ String instanceName, long realtimeConsumptionCatchupWaitMs) {
// A consuming segment will actually be ready to serve queries after (time of creation of partition consumer) +
// (configured max time to catchup)
// We are approximating it to (time of server startup) + (configured max time to catch up)
_endWaitTime = System.currentTimeMillis() + realtimeConsumptionCatchupWaitMs;
- LOGGER.info("Monitoring realtime consumption catchup. Will allow {} ms before marking status GOOD", realtimeConsumptionCatchupWaitMs);
+ LOGGER.info("Monitoring realtime consumption catchup. Will allow {} ms before marking status GOOD",
+ realtimeConsumptionCatchupWaitMs);
}
@Override
@@ -236,7 +237,8 @@ public class ServiceStatus {
}
long now = System.currentTimeMillis();
if (now < _endWaitTime) {
- _statusDescription = String.format("Waiting for consuming segments to catchup, timeRemaining=%dms", _endWaitTime - now);
+ _statusDescription =
+ String.format("Waiting for consuming segments to catchup, timeRemaining=%dms", _endWaitTime - now);
return Status.STARTING;
}
_statusDescription = String.format("Consuming segments status GOOD since %dms", _endWaitTime);
@@ -253,7 +255,8 @@ public class ServiceStatus {
* Service status callback that compares ideal state with another Helix state. Used to share most of the logic between
* the ideal state/external view comparison and ideal state/current state comparison.
*/
- private static abstract class IdealStateMatchServiceStatusCallback<T extends HelixProperty> implements ServiceStatusCallback {
+ private static abstract class IdealStateMatchServiceStatusCallback<T extends HelixProperty>
+ implements ServiceStatusCallback {
final String _clusterName;
final String _instanceName;
@@ -278,8 +281,8 @@ public class ServiceStatus {
_numTotalResourcesToMonitor = _resourcesToMonitor.size();
_minResourcesStartCount = (int) Math.ceil(minResourcesStartPercent * _numTotalResourcesToMonitor / 100);
- LOGGER.info("Monitoring {} resources: {} for start up of instance {}", _numTotalResourcesToMonitor, getResourceListAsString(),
- _instanceName);
+ LOGGER.info("Monitoring {} resources: {} for start up of instance {}", _numTotalResourcesToMonitor,
+ getResourceListAsString(), _instanceName);
}
@Nullable
@@ -327,9 +330,10 @@ public class ServiceStatus {
// Resource is done starting up, remove it from the set
_resourceIterator.remove();
} else {
- _statusDescription = String.format("%s, waitingFor=%s, resource=%s, numResourcesLeft=%d, numTotalResources=%d, minStartCount=%d,",
- statusDescriptionPair._description, getMatchName(), resourceName, _resourcesToMonitor.size(), _numTotalResourcesToMonitor,
- _minResourcesStartCount);
+ _statusDescription = String
+ .format("%s, waitingFor=%s, resource=%s, numResourcesLeft=%d, numTotalResources=%d, minStartCount=%d,",
+ statusDescriptionPair._description, getMatchName(), resourceName, _resourcesToMonitor.size(),
+ _numTotalResourcesToMonitor, _minResourcesStartCount);
return statusDescriptionPair._status;
}
@@ -367,8 +371,9 @@ public class ServiceStatus {
_statusDescription = STATUS_DESCRIPTION_NONE;
} else {
_statusDescription = String
- .format("waitingFor=%s, numResourcesLeft=%d, numTotalResources=%d, minStartCount=%d, resourceList=%s", getMatchName(),
- _resourcesToMonitor.size(), _numTotalResourcesToMonitor, _minResourcesStartCount, getResourceListAsString());
+ .format("waitingFor=%s, numResourcesLeft=%d, numTotalResources=%d, minStartCount=%d, resourceList=%s",
+ getMatchName(), _resourcesToMonitor.size(), _numTotalResourcesToMonitor, _minResourcesStartCount,
+ getResourceListAsString());
LOGGER.info("Instance {} returning GOOD because {}", _instanceName, _statusDescription);
}
@@ -408,8 +413,8 @@ public class ServiceStatus {
} else {
HelixProperty.Stat stat = helixState.getStat();
String description = String
- .format("partition=%s, expected=%s, found=%s, creationTime=%d, modifiedTime=%d, version=%d", partitionName,
- idealStateStatus, currentStateStatus, stat != null ? stat.getCreationTime() : -1,
+ .format("partition=%s, expected=%s, found=%s, creationTime=%d, modifiedTime=%d, version=%d",
+ partitionName, idealStateStatus, currentStateStatus, stat != null ? stat.getCreationTime() : -1,
stat != null ? stat.getModifiedTime() : -1, stat != null ? stat.getVersion() : -1);
return new StatusDescriptionPair(Status.STARTING, description);
}
@@ -445,11 +450,12 @@ 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> {
private static final String MATCH_NAME = "CurrentStateMatch";
- public IdealStateAndCurrentStateMatchServiceStatusCallback(HelixManager helixManager, String clusterName, String instanceName,
- List<String> resourcesToMonitor, double minResourcesStartPercent) {
+ public IdealStateAndCurrentStateMatchServiceStatusCallback(HelixManager helixManager, String clusterName,
+ String instanceName, List<String> resourcesToMonitor, double minResourcesStartPercent) {
super(helixManager, clusterName, instanceName, resourcesToMonitor, minResourcesStartPercent);
}
@@ -486,11 +492,12 @@ 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> {
private static final String MATCH_NAME = "ExternalViewMatch";
- public IdealStateAndExternalViewMatchServiceStatusCallback(HelixManager helixManager, String clusterName, String instanceName,
- List<String> resourcesToMonitor, double minResourcesStartPercent) {
+ public IdealStateAndExternalViewMatchServiceStatusCallback(HelixManager helixManager, String clusterName,
+ String instanceName, List<String> resourcesToMonitor, double minResourcesStartPercent) {
super(helixManager, clusterName, instanceName, resourcesToMonitor, minResourcesStartPercent);
}
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 da7d5e9..b209044 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
@@ -56,9 +56,8 @@ public class TarGzCompressionUtils {
*/
public static void createTarGzFile(File inputFile, File outputFile)
throws IOException {
- Preconditions
- .checkArgument(outputFile.getName().endsWith(TAR_GZ_FILE_EXTENSION), "Output file: %s does not have '.tar.gz' file extension",
- outputFile);
+ Preconditions.checkArgument(outputFile.getName().endsWith(TAR_GZ_FILE_EXTENSION),
+ "Output file: %s does not have '.tar.gz' file extension", outputFile);
try (OutputStream fileOut = Files.newOutputStream(outputFile.toPath());
BufferedOutputStream bufferedOut = new BufferedOutputStream(fileOut);
OutputStream gzipOut = new GzipCompressorOutputStream(bufferedOut);
@@ -114,7 +113,8 @@ public class TarGzCompressionUtils {
throws IOException {
String outputDirCanonicalPath = outputDir.getCanonicalPath();
List<File> untarredFiles = new ArrayList<>();
- try (InputStream bufferedIn = new BufferedInputStream(inputStream); InputStream gzipIn = new GzipCompressorInputStream(bufferedIn);
+ try (InputStream bufferedIn = new BufferedInputStream(inputStream);
+ InputStream gzipIn = new GzipCompressorInputStream(bufferedIn);
ArchiveInputStream tarGzIn = new TarArchiveInputStream(gzipIn)) {
ArchiveEntry entry;
while ((entry = tarGzIn.getNextEntry()) != null) {
@@ -126,8 +126,8 @@ public class TarGzCompressionUtils {
}
if (entry.isDirectory()) {
if (!outputFile.getCanonicalPath().startsWith(outputDirCanonicalPath)) {
- throw new IOException(
- String.format("Trying to create directory: %s outside of the output directory: %s", outputFile, outputDir));
+ throw new IOException(String
+ .format("Trying to create directory: %s outside of the output directory: %s", outputFile, outputDir));
}
if (!outputFile.isDirectory() && !outputFile.mkdirs()) {
throw new IOException(String.format("Failed to create directory: %s", outputFile));
@@ -135,8 +135,8 @@ public class TarGzCompressionUtils {
} else {
File parentFile = outputFile.getParentFile();
if (!parentFile.getCanonicalPath().startsWith(outputDirCanonicalPath)) {
- throw new IOException(
- String.format("Trying to create directory: %s outside of the output directory: %s", parentFile, outputDir));
+ throw new IOException(String
+ .format("Trying to create directory: %s outside of the output directory: %s", parentFile, outputDir));
}
if (!parentFile.isDirectory() && !parentFile.mkdirs()) {
throw new IOException(String.format("Failed to create directory: %s", parentFile));
@@ -156,8 +156,10 @@ public class TarGzCompressionUtils {
*/
public static void untarOneFile(File inputFile, String fileName, File outputFile)
throws IOException {
- try (InputStream fileIn = Files.newInputStream(inputFile.toPath()); InputStream bufferedIn = new BufferedInputStream(fileIn);
- InputStream gzipIn = new GzipCompressorInputStream(bufferedIn); ArchiveInputStream tarGzIn = new TarArchiveInputStream(gzipIn)) {
+ try (InputStream fileIn = Files.newInputStream(inputFile.toPath());
+ InputStream bufferedIn = new BufferedInputStream(fileIn);
+ InputStream gzipIn = new GzipCompressorInputStream(bufferedIn);
+ ArchiveInputStream tarGzIn = new TarArchiveInputStream(gzipIn)) {
ArchiveEntry entry;
while ((entry = tarGzIn.getNextEntry()) != null) {
if (!entry.isDirectory()) {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/config/TableConfigUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/config/TableConfigUtils.java
index 96ec65d..dac88a9 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/config/TableConfigUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/config/TableConfigUtils.java
@@ -66,7 +66,8 @@ public class TableConfigUtils {
Preconditions.checkState(tableType != null, FIELD_MISSING_MESSAGE_TEMPLATE, TableConfig.TABLE_TYPE_KEY);
String validationConfigString = simpleFields.get(TableConfig.VALIDATION_CONFIG_KEY);
- Preconditions.checkState(validationConfigString != null, FIELD_MISSING_MESSAGE_TEMPLATE, TableConfig.VALIDATION_CONFIG_KEY);
+ Preconditions
+ .checkState(validationConfigString != null, FIELD_MISSING_MESSAGE_TEMPLATE, TableConfig.VALIDATION_CONFIG_KEY);
SegmentsValidationAndRetentionConfig validationConfig =
JsonUtils.stringToObject(validationConfigString, SegmentsValidationAndRetentionConfig.class);
@@ -75,7 +76,8 @@ public class TableConfigUtils {
TenantConfig tenantConfig = JsonUtils.stringToObject(tenantConfigString, TenantConfig.class);
String indexingConfigString = simpleFields.get(TableConfig.INDEXING_CONFIG_KEY);
- Preconditions.checkState(indexingConfigString != null, FIELD_MISSING_MESSAGE_TEMPLATE, TableConfig.INDEXING_CONFIG_KEY);
+ Preconditions
+ .checkState(indexingConfigString != null, FIELD_MISSING_MESSAGE_TEMPLATE, TableConfig.INDEXING_CONFIG_KEY);
IndexingConfig indexingConfig = JsonUtils.stringToObject(indexingConfigString, IndexingConfig.class);
String customConfigString = simpleFields.get(TableConfig.CUSTOM_CONFIG_KEY);
@@ -110,8 +112,8 @@ public class TableConfigUtils {
Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap = null;
String instanceAssignmentConfigMapString = simpleFields.get(TableConfig.INSTANCE_ASSIGNMENT_CONFIG_MAP_KEY);
if (instanceAssignmentConfigMapString != null) {
- instanceAssignmentConfigMap = JsonUtils
- .stringToObject(instanceAssignmentConfigMapString, new TypeReference<Map<InstancePartitionsType, InstanceAssignmentConfig>>() {
+ instanceAssignmentConfigMap = JsonUtils.stringToObject(instanceAssignmentConfigMapString,
+ new TypeReference<Map<InstancePartitionsType, InstanceAssignmentConfig>>() {
});
}
@@ -147,9 +149,9 @@ public class TableConfigUtils {
tunerConfig = JsonUtils.stringToObject(tunerConfigString, TunerConfig.class);
}
- return new TableConfig(tableName, tableType, validationConfig, tenantConfig, indexingConfig, customConfig, quotaConfig, taskConfig,
- routingConfig, queryConfig, instanceAssignmentConfigMap, fieldConfigList, upsertConfig, ingestionConfig, tierConfigList, isDimTable,
- tunerConfig);
+ return new TableConfig(tableName, tableType, validationConfig, tenantConfig, indexingConfig, customConfig,
+ quotaConfig, taskConfig, routingConfig, queryConfig, instanceAssignmentConfigMap, fieldConfigList, upsertConfig,
+ ingestionConfig, tierConfigList, isDimTable, tunerConfig);
}
public static ZNRecord toZNRecord(TableConfig tableConfig)
@@ -182,9 +184,11 @@ public class TableConfigUtils {
if (queryConfig != null) {
simpleFields.put(TableConfig.QUERY_CONFIG_KEY, queryConfig.toJsonString());
}
- Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap = tableConfig.getInstanceAssignmentConfigMap();
+ Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap =
+ tableConfig.getInstanceAssignmentConfigMap();
if (instanceAssignmentConfigMap != null) {
- simpleFields.put(TableConfig.INSTANCE_ASSIGNMENT_CONFIG_MAP_KEY, JsonUtils.objectToString(instanceAssignmentConfigMap));
+ simpleFields
+ .put(TableConfig.INSTANCE_ASSIGNMENT_CONFIG_MAP_KEY, JsonUtils.objectToString(instanceAssignmentConfigMap));
}
List<FieldConfig> fieldConfigList = tableConfig.getFieldConfigList();
if (fieldConfigList != null) {
@@ -225,7 +229,8 @@ public class TableConfigUtils {
public static void convertFromLegacyTableConfig(TableConfig tableConfig) {
// It is possible that indexing as well as ingestion configs exist, in which case we always honor ingestion config.
IngestionConfig ingestionConfig = tableConfig.getIngestionConfig();
- BatchIngestionConfig batchIngestionConfig = (ingestionConfig != null) ? ingestionConfig.getBatchIngestionConfig() : null;
+ BatchIngestionConfig batchIngestionConfig =
+ (ingestionConfig != null) ? ingestionConfig.getBatchIngestionConfig() : null;
SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig();
String segmentPushType = validationConfig.getSegmentPushType();
@@ -247,7 +252,8 @@ public class TableConfigUtils {
}
}
- StreamIngestionConfig streamIngestionConfig = (ingestionConfig != null) ? ingestionConfig.getStreamIngestionConfig() : null;
+ StreamIngestionConfig streamIngestionConfig =
+ (ingestionConfig != null) ? ingestionConfig.getStreamIngestionConfig() : null;
IndexingConfig indexingConfig = tableConfig.getIndexingConfig();
if (streamIngestionConfig == null) {
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/config/TierConfigUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/config/TierConfigUtils.java
index 1f03b02..dc52dc6 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/config/TierConfigUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/config/TierConfigUtils.java
@@ -51,7 +51,8 @@ public final class TierConfigUtils {
/**
* Gets sorted list of tiers for given storage type from provided list of TierConfig
*/
- public static List<Tier> getSortedTiersForStorageType(List<TierConfig> tierConfigList, String storageType, HelixManager helixManager) {
+ public static List<Tier> getSortedTiersForStorageType(List<TierConfig> tierConfigList, String storageType,
+ HelixManager helixManager) {
List<Tier> sortedTiers = new ArrayList<>();
for (TierConfig tierConfig : tierConfigList) {
if (storageType.equalsIgnoreCase(tierConfig.getStorageType())) {
@@ -73,12 +74,10 @@ public final class TierConfigUtils {
return (o1, o2) -> {
TierSegmentSelector s1 = o1.getSegmentSelector();
TierSegmentSelector s2 = o2.getSegmentSelector();
- Preconditions
- .checkState(TierFactory.TIME_SEGMENT_SELECTOR_TYPE.equalsIgnoreCase(s1.getType()), "Unsupported segmentSelectorType class %s",
- s1.getClass());
- Preconditions
- .checkState(TierFactory.TIME_SEGMENT_SELECTOR_TYPE.equalsIgnoreCase(s2.getType()), "Unsupported segmentSelectorType class %s",
- s2.getClass());
+ Preconditions.checkState(TierFactory.TIME_SEGMENT_SELECTOR_TYPE.equalsIgnoreCase(s1.getType()),
+ "Unsupported segmentSelectorType class %s", s1.getClass());
+ Preconditions.checkState(TierFactory.TIME_SEGMENT_SELECTOR_TYPE.equalsIgnoreCase(s2.getType()),
+ "Unsupported segmentSelectorType class %s", s2.getClass());
Long period1 = ((TimeBasedTierSegmentSelector) s1).getSegmentAgeMillis();
Long period2 = ((TimeBasedTierSegmentSelector) s2).getSegmentAgeMillis();
return period2.compareTo(period1);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/BaseSegmentFetcher.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/BaseSegmentFetcher.java
index b3db39a..bc1a975 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/BaseSegmentFetcher.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/BaseSegmentFetcher.java
@@ -55,8 +55,9 @@ public abstract class BaseSegmentFetcher implements SegmentFetcher {
_retryDelayScaleFactor = config.getProperty(RETRY_DELAY_SCALE_FACTOR_CONFIG_KEY, DEFAULT_RETRY_DELAY_SCALE_FACTOR);
_authToken = config.getProperty(AUTH_TOKEN);
doInit(config);
- _logger.info("Initialized with retryCount: {}, retryWaitMs: {}, retryDelayScaleFactor: {}", _retryCount, _retryWaitMs,
- _retryDelayScaleFactor);
+ _logger
+ .info("Initialized with retryCount: {}, retryWaitMs: {}, retryDelayScaleFactor: {}", _retryCount, _retryWaitMs,
+ _retryDelayScaleFactor);
}
/**
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/HttpSegmentFetcher.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/HttpSegmentFetcher.java
index 85832c0..7356e7b 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/HttpSegmentFetcher.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/HttpSegmentFetcher.java
@@ -40,18 +40,21 @@ public class HttpSegmentFetcher extends BaseSegmentFetcher {
RetryPolicies.exponentialBackoffRetryPolicy(_retryCount, _retryWaitMs, _retryDelayScaleFactor).attempt(() -> {
try {
int statusCode = _httpClient.downloadFile(uri, dest, _authToken);
- _logger.info("Downloaded segment from: {} to: {} of size: {}; Response status code: {}", uri, dest, dest.length(), statusCode);
+ _logger
+ .info("Downloaded segment from: {} to: {} of size: {}; Response status code: {}", uri, dest, dest.length(),
+ statusCode);
return true;
} catch (HttpErrorStatusException e) {
int statusCode = e.getStatusCode();
if (statusCode >= 500) {
// Temporary exception
- _logger.warn("Got temporary error status code: {} while downloading segment from: {} to: {}", statusCode, uri, dest, e);
+ _logger.warn("Got temporary error status code: {} while downloading segment from: {} to: {}", statusCode, uri,
+ dest, e);
return false;
} else {
// Permanent exception
- _logger.error("Got permanent error status code: {} while downloading segment from: {} to: {}, won't retry", statusCode, uri, dest,
- e);
+ _logger.error("Got permanent error status code: {} while downloading segment from: {} to: {}, won't retry",
+ statusCode, uri, dest, e);
throw e;
}
} catch (Exception e) {
@@ -66,7 +69,8 @@ public class HttpSegmentFetcher extends BaseSegmentFetcher {
throws Exception {
try {
int statusCode = _httpClient.downloadFile(uri, dest, _authToken);
- _logger.info("Downloaded segment from: {} to: {} of size: {}; Response status code: {}", uri, dest, dest.length(), statusCode);
+ _logger.info("Downloaded segment from: {} to: {} of size: {}; Response status code: {}", uri, dest, dest.length(),
+ statusCode);
} catch (Exception e) {
_logger.warn("Caught exception while downloading segment from: {} to: {}", uri, dest, e);
throw e;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/grpc/GrpcQueryClient.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/grpc/GrpcQueryClient.java
index 8485ced..68c03b8 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/grpc/GrpcQueryClient.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/grpc/GrpcQueryClient.java
@@ -30,7 +30,8 @@ public class GrpcQueryClient {
public GrpcQueryClient(String host, int port) {
// Set max message size to 128MB
- Channel channel = ManagedChannelBuilder.forAddress(host, port).maxInboundMessageSize(128 * 1024 * 1024).usePlaintext().build();
+ Channel channel =
+ ManagedChannelBuilder.forAddress(host, port).maxInboundMessageSize(128 * 1024 * 1024).usePlaintext().build();
_blockingStub = PinotQueryServerGrpc.newBlockingStub(channel);
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/grpc/GrpcRequestBuilder.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/grpc/GrpcRequestBuilder.java
index 8cb4a21..51280be 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/grpc/GrpcRequestBuilder.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/grpc/GrpcRequestBuilder.java
@@ -80,7 +80,8 @@ public class GrpcRequestBuilder {
}
public Server.ServerRequest build() {
- Preconditions.checkState(_payloadType != null && CollectionUtils.isNotEmpty(_segments), "Query and segmentsToQuery must be set");
+ Preconditions.checkState(_payloadType != null && CollectionUtils.isNotEmpty(_segments),
+ "Query and segmentsToQuery must be set");
Map<String, String> metadata = new HashMap<>();
metadata.put(Request.MetadataKeys.REQUEST_ID, Integer.toString(_requestId));
@@ -98,8 +99,8 @@ public class GrpcRequestBuilder {
} catch (TException e) {
throw new RuntimeException("Caught exception while serializing broker request: " + _brokerRequest, e);
}
- return Server.ServerRequest.newBuilder().putAllMetadata(metadata).setPayload(ByteString.copyFrom(payLoad)).addAllSegments(_segments)
- .build();
+ return Server.ServerRequest.newBuilder().putAllMetadata(metadata).setPayload(ByteString.copyFrom(payLoad))
+ .addAllSegments(_segments).build();
}
}
}
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 719c679..36490d4 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
@@ -61,7 +61,8 @@ public class HelixHelper {
private static final String ENABLE_COMPRESSIONS_KEY = "enableCompression";
private static final RetryPolicy DEFAULT_RETRY_POLICY = RetryPolicies.exponentialBackoffRetryPolicy(5, 1000L, 2.0f);
- private static final RetryPolicy DEFAULT_TABLE_IDEALSTATES_UPDATE_RETRY_POLICY = RetryPolicies.randomDelayRetryPolicy(20, 100L, 200L);
+ private static final RetryPolicy DEFAULT_TABLE_IDEALSTATES_UPDATE_RETRY_POLICY =
+ RetryPolicies.randomDelayRetryPolicy(20, 100L, 200L);
private static final Logger LOGGER = LoggerFactory.getLogger(HelixHelper.class);
private static final ZNRecordSerializer ZN_RECORD_SERIALIZER = new ZNRecordSerializer();
@@ -71,7 +72,8 @@ public class HelixHelper {
public static final String BROKER_RESOURCE = CommonConstants.Helix.BROKER_RESOURCE_INSTANCE;
public static IdealState cloneIdealState(IdealState idealState) {
- return new IdealState((ZNRecord) ZN_RECORD_SERIALIZER.deserialize(ZN_RECORD_SERIALIZER.serialize(idealState.getRecord())));
+ return new IdealState(
+ (ZNRecord) ZN_RECORD_SERIALIZER.deserialize(ZN_RECORD_SERIALIZER.serialize(idealState.getRecord())));
}
/**
@@ -128,7 +130,8 @@ public class HelixHelper {
// Check version and set ideal state
try {
if (dataAccessor.getBaseDataAccessor()
- .set(idealStateKey.getPath(), updatedZNRecord, idealState.getRecord().getVersion(), AccessOption.PERSISTENT)) {
+ .set(idealStateKey.getPath(), updatedZNRecord, idealState.getRecord().getVersion(),
+ AccessOption.PERSISTENT)) {
return true;
} else {
LOGGER.warn("Failed to update ideal state for resource: {}", resourceName);
@@ -138,8 +141,8 @@ public class HelixHelper {
LOGGER.warn("Version changed while updating ideal state for resource: {}", resourceName);
return false;
} catch (Exception e) {
- LOGGER
- .warn("Caught exception while updating ideal state for resource: {} (compressed={})", resourceName, enableCompression, e);
+ LOGGER.warn("Caught exception while updating ideal state for resource: {} (compressed={})", resourceName,
+ enableCompression, e);
return false;
}
} else {
@@ -171,7 +174,8 @@ public class HelixHelper {
}
}
- public static void updateIdealState(HelixManager helixManager, String resourceName, Function<IdealState, IdealState> updater) {
+ public static void updateIdealState(HelixManager helixManager, String resourceName,
+ Function<IdealState, IdealState> updater) {
updateIdealState(helixManager, resourceName, updater, DEFAULT_TABLE_IDEALSTATES_UPDATE_RETRY_POLICY, false);
}
@@ -220,26 +224,30 @@ public class HelixHelper {
admin.enableInstance(clusterName, instanceName, enable);
}
- public static void setStateForInstanceList(List<String> instances, String clusterName, HelixAdmin admin, boolean enable) {
+ public static void setStateForInstanceList(List<String> instances, String clusterName, HelixAdmin admin,
+ boolean enable) {
for (final String instance : instances) {
setInstanceState(instance, clusterName, admin, enable);
}
}
- public static void setStateForInstanceSet(Set<String> instances, String clusterName, HelixAdmin admin, boolean enable) {
+ public static void setStateForInstanceSet(Set<String> instances, String clusterName, HelixAdmin admin,
+ boolean enable) {
for (final String instanceName : instances) {
setInstanceState(instanceName, clusterName, admin, enable);
}
}
- public static Map<String, String> getInstanceConfigsMapFor(String instanceName, String clusterName, HelixAdmin admin) {
+ public static Map<String, String> getInstanceConfigsMapFor(String instanceName, String clusterName,
+ HelixAdmin admin) {
final HelixConfigScope scope = getInstanceScopefor(clusterName, instanceName);
final List<String> keys = admin.getConfigKeys(scope);
return admin.getConfig(scope, keys);
}
public static HelixConfigScope getInstanceScopefor(String clusterName, String instanceName) {
- return new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT, clusterName).forParticipant(instanceName).build();
+ return new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT, clusterName).forParticipant(instanceName)
+ .build();
}
public static HelixConfigScope getResourceScopeFor(String clusterName, String resourceName) {
@@ -252,12 +260,14 @@ public class HelixHelper {
return admin.getConfig(scope, keys);
}
- public static void updateResourceConfigsFor(Map<String, String> newConfigs, String resourceName, String clusterName, HelixAdmin admin) {
+ public static void updateResourceConfigsFor(Map<String, String> newConfigs, String resourceName, String clusterName,
+ HelixAdmin admin) {
final HelixConfigScope scope = getResourceScopeFor(clusterName, resourceName);
admin.setConfig(scope, newConfigs);
}
- public static void deleteResourcePropertyFromHelix(HelixAdmin admin, String clusterName, String resourceName, String configKey) {
+ public static void deleteResourcePropertyFromHelix(HelixAdmin admin, String clusterName, String resourceName,
+ String configKey) {
final List<String> keys = new ArrayList<String>();
keys.add(configKey);
@@ -279,7 +289,8 @@ public class HelixHelper {
return HelixHelper.getResourceConfigsFor(clusterName, BROKER_RESOURCE, admin);
}
- public static void updateBrokerConfig(Map<String, String> brokerResourceConfig, HelixAdmin admin, String clusterName) {
+ public static void updateBrokerConfig(Map<String, String> brokerResourceConfig, HelixAdmin admin,
+ String clusterName) {
HelixHelper.updateResourceConfigsFor(brokerResourceConfig, BROKER_RESOURCE, clusterName, admin);
}
@@ -308,7 +319,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);
}
/**
@@ -358,7 +370,8 @@ public class HelixHelper {
* @param tableName Name of the table to which the new segment is to be added.
* @param segmentName Name of the new segment to be added
*/
- public static void removeSegmentFromIdealState(HelixManager helixManager, String tableName, final String segmentName) {
+ public static void removeSegmentFromIdealState(HelixManager helixManager, String tableName,
+ final String segmentName) {
Function<IdealState, IdealState> updater = new Function<IdealState, IdealState>() {
@Override
public IdealState apply(IdealState idealState) {
@@ -377,7 +390,8 @@ public class HelixHelper {
updateIdealState(helixManager, tableName, updater, DEFAULT_RETRY_POLICY);
}
- public static void removeSegmentsFromIdealState(HelixManager helixManager, String tableName, final List<String> segments) {
+ public static void removeSegmentsFromIdealState(HelixManager helixManager, String tableName,
+ final List<String> segments) {
Function<IdealState, IdealState> updater = new Function<IdealState, IdealState>() {
@Nullable
@Override
@@ -469,8 +483,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;
}
@@ -483,7 +499,8 @@ public class HelixHelper {
return new HashSet<>(getInstancesWithTag(instanceConfigs, TagNameUtils.getBrokerTagForTenant(tenant)));
}
- public static Set<InstanceConfig> getBrokerInstanceConfigsForTenant(List<InstanceConfig> instanceConfigs, String tenant) {
+ public static Set<InstanceConfig> getBrokerInstanceConfigsForTenant(List<InstanceConfig> instanceConfigs,
+ String tenant) {
return new HashSet<>(getInstancesConfigsWithTag(instanceConfigs, TagNameUtils.getBrokerTagForTenant(tenant)));
}
@@ -503,9 +520,9 @@ public class HelixHelper {
// NOTE: Use HelixDataAccessor.setProperty() instead of HelixAdmin.setInstanceConfig() because the latter explicitly
// forbids instance host/port modification
HelixDataAccessor helixDataAccessor = helixManager.getHelixDataAccessor();
- Preconditions
- .checkState(helixDataAccessor.setProperty(helixDataAccessor.keyBuilder().instanceConfig(instanceConfig.getId()), instanceConfig),
- "Failed to update instance config for instance: " + instanceConfig.getId());
+ Preconditions.checkState(helixDataAccessor
+ .setProperty(helixDataAccessor.keyBuilder().instanceConfig(instanceConfig.getId()), instanceConfig),
+ "Failed to update instance config for instance: " + instanceConfig.getId());
}
/**
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/LeadControllerUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/LeadControllerUtils.java
index 075489c..79860b6 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/LeadControllerUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/LeadControllerUtils.java
@@ -79,7 +79,8 @@ public class LeadControllerUtils {
*/
public static boolean isLeadControllerResourceEnabled(HelixManager helixManager) {
ConfigAccessor configAccessor = helixManager.getConfigAccessor();
- ResourceConfig resourceConfig = configAccessor.getResourceConfig(helixManager.getClusterName(), Helix.LEAD_CONTROLLER_RESOURCE_NAME);
+ ResourceConfig resourceConfig =
+ configAccessor.getResourceConfig(helixManager.getClusterName(), Helix.LEAD_CONTROLLER_RESOURCE_NAME);
String resourceEnabled = resourceConfig.getSimpleConfig(Helix.LEAD_CONTROLLER_RESOURCE_ENABLED_KEY);
return Boolean.parseBoolean(resourceEnabled);
}
@@ -100,7 +101,8 @@ public class LeadControllerUtils {
String helixLeaderInstanceId = liveInstance.getInstanceName();
String helixVersion = liveInstance.getHelixVersion();
long modifiedTime = liveInstance.getModifiedTime();
- LOGGER.info("Getting Helix leader: {}, Helix version: {}, mtime: {}", helixLeaderInstanceId, helixVersion, modifiedTime);
+ LOGGER.info("Getting Helix leader: {}, Helix version: {}, mtime: {}", helixLeaderInstanceId, helixVersion,
+ modifiedTime);
return helixLeaderInstanceId;
}
}
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 60d3da4..f2ab9f0 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 {
_propertyStore = null;
}
- private PinotHelixPropertyStoreZnRecordProvider(ZkHelixPropertyStore<ZNRecord> propertyStore, String relativePathName) {
+ private PinotHelixPropertyStoreZnRecordProvider(ZkHelixPropertyStore<ZNRecord> propertyStore,
+ String relativePathName) {
_propertyStore = propertyStore;
_pathPrefix = relativePathName;
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java
index 92fa4f7..bcb853a 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java
@@ -180,8 +180,8 @@ public class RequestUtils {
return expression;
}
- private static FilterQuery traverseFilterQueryAndPopulateMap(FilterQueryTree tree, Map<Integer, FilterQuery> filterQueryMap,
- MutableInt currentId) {
+ private static FilterQuery traverseFilterQueryAndPopulateMap(FilterQueryTree tree,
+ Map<Integer, FilterQuery> filterQueryMap, MutableInt currentId) {
int currentNodeId = currentId.intValue();
currentId.increment();
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 b1320a6..598d603 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
@@ -39,7 +39,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";
@@ -69,7 +70,8 @@ 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);
@@ -81,7 +83,8 @@ public class WebHdfsV1Client {
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();
@@ -104,7 +107,10 @@ public class WebHdfsV1Client {
}
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/parsers/utils/BrokerRequestComparisonUtils.java b/pinot-common/src/main/java/org/apache/pinot/parsers/utils/BrokerRequestComparisonUtils.java
index 163851d..a8149b2 100644
--- a/pinot-common/src/main/java/org/apache/pinot/parsers/utils/BrokerRequestComparisonUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/parsers/utils/BrokerRequestComparisonUtils.java
@@ -54,20 +54,21 @@ public class BrokerRequestComparisonUtils {
if (br1.getFilterQuery() != null) {
if (!validateFilterQuery(br1.getFilterQuery(), br2.getFilterQuery())) {
- sb.append("br1.getFilterQuery() = ").append(br1.getFilterQuery()).append("\n").append("br2.getFilterQuery() = ")
- .append(br2.getFilterQuery());
+ sb.append("br1.getFilterQuery() = ").append(br1.getFilterQuery()).append("\n")
+ .append("br2.getFilterQuery() = ").append(br2.getFilterQuery());
LOGGER.error("Filter did not match after conversion.{}", sb);
return false;
}
if (!validateFilterSubQueryMap(br1.getFilterSubQueryMap(), br2.getFilterSubQueryMap())) {
- sb.append("br1.getFilterSubQueryMap() = ").append(br1.getFilterSubQueryMap()).append("\n").append("br2.getFilterSubQueryMap() = ")
- .append(br2.getFilterSubQueryMap());
+ sb.append("br1.getFilterSubQueryMap() = ").append(br1.getFilterSubQueryMap()).append("\n")
+ .append("br2.getFilterSubQueryMap() = ").append(br2.getFilterSubQueryMap());
LOGGER.error("FilterSubQueryMap did not match after conversion. {}", sb);
return false;
}
} else if (br2.getFilterQuery() != null) {
- LOGGER.error("Filter did not match, br1.getFilterQuery() = null, br2.getFilterQuery() = {}", br2.getFilterQuery());
+ LOGGER.error("Filter did not match, br1.getFilterQuery() = null, br2.getFilterQuery() = {}",
+ br2.getFilterQuery());
return false;
}
if (br1.getSelections() != null) {
@@ -78,12 +79,14 @@ public class BrokerRequestComparisonUtils {
return false;
}
} else if (br2.getSelections() != null) {
- LOGGER.error("Selection did not match, br1.getSelections() = null, br2.getSelections() = {}", br2.getSelections());
+ LOGGER.error("Selection did not match, br1.getSelections() = null, br2.getSelections() = {}",
+ br2.getSelections());
return false;
}
if (br1.getGroupBy() != null) {
if (!validateGroupBy(br1.getGroupBy(), br2.getGroupBy())) {
- sb.append("br1.getGroupBy() = ").append(br1.getGroupBy()).append("\n").append("br2.getGroupBy() = ").append(br2.getGroupBy());
+ sb.append("br1.getGroupBy() = ").append(br1.getGroupBy()).append("\n").append("br2.getGroupBy() = ")
+ .append(br2.getGroupBy());
LOGGER.error("Group By did not match conversion:{}", sb);
return false;
}
@@ -93,7 +96,8 @@ public class BrokerRequestComparisonUtils {
}
if (br1.getAggregationsInfo() != null) {
if (!validateAggregations(br1.getAggregationsInfo(), br2.getAggregationsInfo())) {
- sb.append("br1.getGroupBy() = ").append(br1.getGroupBy()).append("\n").append("br2.getGroupBy() = ").append(br2.getGroupBy());
+ sb.append("br1.getGroupBy() = ").append(br1.getGroupBy()).append("\n").append("br2.getGroupBy() = ")
+ .append(br2.getGroupBy());
LOGGER.error("Group By did not match conversion:{}", sb);
return false;
}
@@ -105,7 +109,8 @@ public class BrokerRequestComparisonUtils {
if (!ignoreOrderBy) {
if (br1.getOrderBy() != null) {
if (!validateOrderBys(br1.getOrderBy(), br2.getOrderBy())) {
- sb.append("br1.getOrderBy() = ").append(br1.getOrderBy()).append("\n").append("br2.getOrderBy() = ").append(br2.getOrderBy());
+ sb.append("br1.getOrderBy() = ").append(br1.getOrderBy()).append("\n").append("br2.getOrderBy() = ")
+ .append(br2.getOrderBy());
LOGGER.error("Order By did not match conversion:{}", sb);
return false;
}
@@ -132,7 +137,8 @@ public class BrokerRequestComparisonUtils {
}
for (int i = 0; i < orderBy1.size(); i++) {
if (!validateOrderBy(orderBy1.get(i), orderBy2.get(i))) {
- LOGGER.error("Failed to validate OrderBys at idx {} doesn't match.\n\t{}\n\t{}", i, orderBy1.get(i), orderBy2.get(i));
+ LOGGER.error("Failed to validate OrderBys at idx {} doesn't match.\n\t{}\n\t{}", i, orderBy1.get(i),
+ orderBy2.get(i));
return false;
}
}
@@ -141,12 +147,13 @@ public class BrokerRequestComparisonUtils {
private static boolean validateOrderBy(SelectionSort orderBy1, SelectionSort orderBy2) {
if (orderBy1.isIsAsc() != orderBy2.isIsAsc()) {
- LOGGER.error("Failed to validate OrderBy at field: `isAsc` {} doesn't match.\n\t{}\n\t{}", orderBy1.isIsAsc(), orderBy2.isIsAsc());
+ LOGGER.error("Failed to validate OrderBy at field: `isAsc` {} doesn't match.\n\t{}\n\t{}", orderBy1.isIsAsc(),
+ orderBy2.isIsAsc());
return false;
}
if (!orderBy1.getColumn().equalsIgnoreCase(orderBy2.getColumn())) {
- LOGGER
- .error("Failed to validate OrderBy at field: `column` {} doesn't match.\n\t{}\n\t{}", orderBy1.getColumn(), orderBy2.getColumn());
+ LOGGER.error("Failed to validate OrderBy at field: `column` {} doesn't match.\n\t{}\n\t{}", orderBy1.getColumn(),
+ orderBy2.getColumn());
return false;
}
return true;
@@ -177,8 +184,8 @@ public class BrokerRequestComparisonUtils {
}
for (int i = 0; i < agg1.getExpressionsSize(); i++) {
if (!agg1.getExpressions().get(i).equals(agg2.getExpressions().get(i))) {
- LOGGER.error("Failed to validate AggregationInfo: Expressions mis-match.\n\t{}\n\t{}", agg1.getExpressions().get(i),
- agg1.getExpressions().get(i));
+ LOGGER.error("Failed to validate AggregationInfo: Expressions mis-match.\n\t{}\n\t{}",
+ agg1.getExpressions().get(i), agg1.getExpressions().get(i));
return false;
}
}
@@ -218,12 +225,17 @@ public class BrokerRequestComparisonUtils {
}
if (s1.getSelectionSortSequence() != null) {
for (int i = 0; i < s1.getSelectionSortSequence().size(); i++) {
- if (!s1.getSelectionSortSequence().get(i).getColumn().equals(s2.getSelectionSortSequence().get(i).getColumn())) {
- LOGGER.error("Failed to validate Selections: SelectionSortSequence Column at idx {} doesn't match.\n\t{}\n\t{}", i, s1, s2);
+ if (!s1.getSelectionSortSequence().get(i).getColumn()
+ .equals(s2.getSelectionSortSequence().get(i).getColumn())) {
+ LOGGER
+ .error("Failed to validate Selections: SelectionSortSequence Column at idx {} doesn't match.\n\t{}\n\t{}",
+ i, s1, s2);
return false;
}
if (s1.getSelectionSortSequence().get(i).isIsAsc() != s2.getSelectionSortSequence().get(i).isIsAsc()) {
- LOGGER.error("Failed to validate Selections: SelectionSortSequence isAsc at idx {} doesn't match.\n\t{}\n\t{}", i, s1, s2);
+ LOGGER
+ .error("Failed to validate Selections: SelectionSortSequence isAsc at idx {} doesn't match.\n\t{}\n\t{}",
+ i, s1, s2);
return false;
}
}
@@ -267,7 +279,8 @@ public class BrokerRequestComparisonUtils {
final String s1 = fq1.getValue().get(i);
final String s2 = fq2.getValue().get(i);
if (!s1.equals(s2)) {
- LOGGER.error("Failed to validate FilterQuery: value at idx {} doesn't match.\n\t{}\n\t{}\n\t{}\n\t{}", i, fq1, fq2, s1, s2);
+ LOGGER.error("Failed to validate FilterQuery: value at idx {} doesn't match.\n\t{}\n\t{}\n\t{}\n\t{}", i, fq1,
+ fq2, s1, s2);
return false;
}
}
@@ -279,7 +292,8 @@ public class BrokerRequestComparisonUtils {
}
for (int i = 0; i < fq1.getNestedFilterQueryIds().size(); i++) {
if (fq1.getNestedFilterQueryIds().get(i) != fq2.getNestedFilterQueryIds().get(i)) {
- LOGGER.error("Failed to validate FilterQuery: nestedFilterQueryIds at idx {} doesn't match.\n\t{}\n\t{}", i, fq1, fq2);
+ LOGGER.error("Failed to validate FilterQuery: nestedFilterQueryIds at idx {} doesn't match.\n\t{}\n\t{}", i,
+ fq1, fq2);
return false;
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java
index 86e13c0..87a122c 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java
@@ -123,7 +123,8 @@ public class PinotQuery2BrokerRequestConverter {
for (Expression selectExpression : pinotQuery.getSelectList()) {
ExpressionType type = selectExpression.getType();
Expression expression;
- if (type == ExpressionType.FUNCTION && selectExpression.getFunctionCall().getOperator().equalsIgnoreCase(SqlKind.AS.toString())) {
+ if (type == ExpressionType.FUNCTION && selectExpression.getFunctionCall().getOperator()
+ .equalsIgnoreCase(SqlKind.AS.toString())) {
expression = selectExpression.getFunctionCall().getOperands().get(0);
type = expression.getType();
} else {
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/Pql2CompilationException.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/Pql2CompilationException.java
index fb6b163..98b2976 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/Pql2CompilationException.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/Pql2CompilationException.java
@@ -29,7 +29,8 @@ public class Pql2CompilationException extends RuntimeException {
super(message);
}
- public Pql2CompilationException(String msg, Object offendingSymbol, int line, int charPositionInLine, RecognitionException e) {
+ public Pql2CompilationException(String msg, Object offendingSymbol, int line, int charPositionInLine,
+ RecognitionException e) {
super(line + ":" + charPositionInLine + ": '" + offendingSymbol + "' " + msg, e);
}
}
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 ae1860b..99d4367 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
@@ -54,9 +54,12 @@ public class Pql2Compiler implements QueryCompiler {
private static final Logger LOGGER = LoggerFactory.getLogger(Pql2Compiler.class);
- private static boolean _enablePinotQuery = Boolean.valueOf(System.getProperty("pinot.query.converter.enabled", "false"));
- private static boolean _validateConverter = Boolean.valueOf(System.getProperty("pinot.query.converter.validate", "false"));
- private static boolean _failOnConversionError = Boolean.valueOf(System.getProperty("pinot.query.converter.fail_on_error", "false"));
+ private static boolean _enablePinotQuery =
+ Boolean.valueOf(System.getProperty("pinot.query.converter.enabled", "false"));
+ private static boolean _validateConverter =
+ Boolean.valueOf(System.getProperty("pinot.query.converter.validate", "false"));
+ private static boolean _failOnConversionError =
+ Boolean.valueOf(System.getProperty("pinot.query.converter.fail_on_error", "false"));
@VisibleForTesting
public static void setEnablePinotQuery(boolean enablePinotQuery) {
@@ -76,8 +79,8 @@ public class Pql2Compiler implements QueryCompiler {
private static class ErrorListener extends BaseErrorListener {
@Override
- public void syntaxError(@Nonnull Recognizer<?, ?> recognizer, @Nullable Object offendingSymbol, int line, int charPositionInLine,
- @Nonnull String msg, @Nullable RecognitionException e) {
+ public void syntaxError(@Nonnull Recognizer<?, ?> recognizer, @Nullable Object offendingSymbol, int line,
+ int charPositionInLine, @Nonnull String msg, @Nullable RecognitionException e) {
throw new Pql2CompilationException(msg, offendingSymbol, line, charPositionInLine, e);
}
}
@@ -127,7 +130,8 @@ public class Pql2Compiler implements QueryCompiler {
if (!result) {
LOGGER.error("Pinot query to broker request conversion failed. PQL:{}", expression);
if (_failOnConversionError) {
- throw new Pql2CompilationException("Pinot query to broker request conversion failed. PQL:" + expression);
+ throw new Pql2CompilationException(
+ "Pinot query to broker request conversion failed. PQL:" + expression);
}
}
}
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 967c89c..0e793a8 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
@@ -61,11 +61,12 @@ public class BetweenPredicateAstNode extends PredicateAstNode {
LiteralAstNode left = (LiteralAstNode) getChildren().get(0);
LiteralAstNode right = (LiteralAstNode) getChildren().get(1);
return new FilterQueryTree(_identifier, Collections.singletonList(
- Range.LOWER_INCLUSIVE + left.getValueAsString() + Range.DELIMITER + right.getValueAsString() + Range.UPPER_INCLUSIVE),
- FilterOperator.RANGE, null);
+ Range.LOWER_INCLUSIVE + left.getValueAsString() + Range.DELIMITER + right.getValueAsString()
+ + Range.UPPER_INCLUSIVE), 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/ComparisonPredicateAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/ComparisonPredicateAstNode.java
index f3e715b..b5116e8 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
@@ -123,13 +123,15 @@ public class ComparisonPredicateAstNode extends PredicateAstNode {
if ("=".equals(_operand)) {
if (_identifier != null && _literal != null) {
- return new FilterQueryTree(_identifier, Collections.singletonList(_literal.getValueAsString()), FilterOperator.EQUALITY, null);
+ return new FilterQueryTree(_identifier, Collections.singletonList(_literal.getValueAsString()),
+ FilterOperator.EQUALITY, null);
} else {
throw new Pql2CompilationException("Comparison is not between a column and a constant");
}
} else if ("<>".equals(_operand) || "!=".equals(_operand)) {
if (_identifier != null && _literal != null) {
- return new FilterQueryTree(_identifier, Collections.singletonList(_literal.getValueAsString()), FilterOperator.NOT, null);
+ return new FilterQueryTree(_identifier, Collections.singletonList(_literal.getValueAsString()),
+ FilterOperator.NOT, null);
} else {
throw new Pql2CompilationException("Comparison is not between a column and a constant");
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FilterKind.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FilterKind.java
index 5b75b8f..ff49eb3 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FilterKind.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FilterKind.java
@@ -44,7 +44,7 @@ public enum FilterKind {
* @return True if the enum is of Range type, false otherwise.
*/
public boolean isRange() {
- return this == GREATER_THAN || this == GREATER_THAN_OR_EQUAL || this == LESS_THAN || this == LESS_THAN_OR_EQUAL || this == BETWEEN
- || this == RANGE;
+ return this == GREATER_THAN || this == GREATER_THAN_OR_EQUAL || this == LESS_THAN || this == LESS_THAN_OR_EQUAL
+ || this == BETWEEN || this == RANGE;
}
}
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/OrderByAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/OrderByAstNode.java
index 3571e42..e341960 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/OrderByAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/OrderByAstNode.java
@@ -42,7 +42,8 @@ public class OrderByAstNode extends BaseAstNode {
for (AstNode astNode : getChildren()) {
if (astNode instanceof OrderByExpressionAstNode) {
OrderByExpressionAstNode orderByExpressionAstNode = (OrderByExpressionAstNode) astNode;
- TransformExpressionTree orderByExpression = TransformExpressionTree.compileToExpressionTree(orderByExpressionAstNode.getColumn());
+ TransformExpressionTree orderByExpression =
+ TransformExpressionTree.compileToExpressionTree(orderByExpressionAstNode.getColumn());
// Deduplicate the order-by expressions
if (orderByExpressions.add(orderByExpression)) {
@@ -69,14 +70,17 @@ public class OrderByAstNode extends BaseAstNode {
for (AstNode astNode : getChildren()) {
if (astNode instanceof OrderByExpressionAstNode) {
OrderByExpressionAstNode orderByExpressionAstNode = (OrderByExpressionAstNode) astNode;
- TransformExpressionTree orderByExpression = TransformExpressionTree.compileToExpressionTree(orderByExpressionAstNode.getColumn());
+ TransformExpressionTree orderByExpression =
+ TransformExpressionTree.compileToExpressionTree(orderByExpressionAstNode.getColumn());
// Deduplicate the order-by expressions
if (orderByExpressions.add(orderByExpression)) {
- String ordering = ASCENDING_ORDER.equalsIgnoreCase(orderByExpressionAstNode.getOrdering()) ? ASCENDING_ORDER : DESCENDING_ORDER;
+ String ordering = ASCENDING_ORDER.equalsIgnoreCase(orderByExpressionAstNode.getOrdering()) ? ASCENDING_ORDER
+ : DESCENDING_ORDER;
Expression orderByFunctionExpression = RequestUtils.getFunctionExpression(ordering);
// TODO: Support order-by transform expressions, which should be converted to another FUNCTION expression
- orderByFunctionExpression.getFunctionCall().addToOperands(RequestUtils.createIdentifierExpression(orderByExpression.toString()));
+ orderByFunctionExpression.getFunctionCall()
+ .addToOperands(RequestUtils.createIdentifierExpression(orderByExpression.toString()));
pinotQuery.addToOrderByList(orderByFunctionExpression);
}
} else {
diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/PredicateListAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/PredicateListAstNode.java
index 6789730..7697070 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/PredicateListAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/PredicateListAstNode.java
@@ -31,7 +31,8 @@ import org.apache.pinot.common.utils.request.RequestUtils;
*/
public class PredicateListAstNode extends PredicateAstNode {
- public void buildQueryTreePredicates(List<FilterQueryTree> filterQueryOrPredicates, List<FilterQueryTree> filterQueryAndPredicates) {
+ public void buildQueryTreePredicates(List<FilterQueryTree> filterQueryOrPredicates,
+ List<FilterQueryTree> filterQueryAndPredicates) {
int childrenCount = getChildren().size();
for (int i = 0; i < childrenCount; i += 2) {
PredicateAstNode predicate = (PredicateAstNode) getChildren().get(i);
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 6edbe78..e5151f4 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
@@ -98,8 +98,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/TableNameAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/TableNameAstNode.java
index 330a73c..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,7 +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/pql/parsers/pql2/ast/TextMatchPredicateAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/TextMatchPredicateAstNode.java
index b9f6f46..3e47b05 100644
--- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/TextMatchPredicateAstNode.java
+++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/TextMatchPredicateAstNode.java
@@ -52,7 +52,8 @@ public class TextMatchPredicateAstNode extends PredicateAstNode {
}
List<? extends AstNode> children = getChildren();
- Preconditions.checkState(children != null && children.size() == 1, "TEXT_MATCH predicate should have exactly one query string");
+ Preconditions.checkState(children != null && children.size() == 1,
+ "TEXT_MATCH predicate should have exactly one query string");
AstNode child = children.get(0);
Preconditions.checkState(child instanceof StringLiteralAstNode);
String expr = ((StringLiteralAstNode) child).getValueAsString();
diff --git a/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java b/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
index c8ef59e..6cb881d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
+++ b/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
@@ -83,8 +83,8 @@ public class CalciteSqlParser {
// BABEL is a very liberal conformance value that allows anything supported by any dialect
private static final SqlParser.Config PARSER_CONFIG =
- SqlParser.configBuilder().setLex(PINOT_LEX).setConformance(SqlConformanceEnum.BABEL).setParserFactory(SqlBabelParserImpl.FACTORY)
- .build();
+ SqlParser.configBuilder().setLex(PINOT_LEX).setConformance(SqlConformanceEnum.BABEL)
+ .setParserFactory(SqlBabelParserImpl.FACTORY).build();
// To Keep the backward compatibility with 'OPTION' Functionality in PQL, which is used to
// provide more hints for query processing.
@@ -96,7 +96,8 @@ public class CalciteSqlParser {
// `OPTION (<k1> = <v1>, <k2> = <v2>, <k3> = <v3>)`
// or
// `OPTION (<k1> = <v1>) OPTION (<k2> = <v2>) OPTION (<k3> = <v3>)`
- private static final Pattern OPTIONS_REGEX_PATTEN = Pattern.compile("option\\s*\\(([^\\)]+)\\)", Pattern.CASE_INSENSITIVE);
+ private static final Pattern OPTIONS_REGEX_PATTEN =
+ Pattern.compile("option\\s*\\(([^\\)]+)\\)", Pattern.CASE_INSENSITIVE);
public static PinotQuery compileToPinotQuery(String sql)
throws SqlCompilationException {
@@ -151,7 +152,8 @@ public class CalciteSqlParser {
}
if (selectExpr.getIdentifier() != null) {
if (aliasKeys.contains(selectExpr.getIdentifier().getName().toLowerCase())) {
- throw new SqlCompilationException("Alias " + selectExpr.getIdentifier().getName() + " cannot be referred in SELECT Clause");
+ throw new SqlCompilationException(
+ "Alias " + selectExpr.getIdentifier().getName() + " cannot be referred in SELECT Clause");
}
}
}
@@ -166,14 +168,15 @@ public class CalciteSqlParser {
Set<Expression> groupByExprs = new HashSet<>(pinotQuery.getGroupByList());
for (Expression selectExpression : pinotQuery.getSelectList()) {
if (!isAggregateExpression(selectExpression) && expressionOutsideGroupByList(selectExpression, groupByExprs)) {
- throw new SqlCompilationException("'" + RequestUtils.prettyPrint(selectExpression) + "' should appear in GROUP BY clause.");
+ throw new SqlCompilationException(
+ "'" + RequestUtils.prettyPrint(selectExpression) + "' should appear in GROUP BY clause.");
}
}
// Sanity check on group by clause shouldn't contain aggregate expression.
for (Expression groupByExpression : pinotQuery.getGroupByList()) {
if (isAggregateExpression(groupByExpression)) {
- throw new SqlCompilationException(
- "Aggregate expression '" + RequestUtils.prettyPrint(groupByExpression) + "' is not allowed in GROUP BY clause.");
+ throw new SqlCompilationException("Aggregate expression '" + RequestUtils.prettyPrint(groupByExpression)
+ + "' is not allowed in GROUP BY clause.");
}
}
}
@@ -268,7 +271,8 @@ public class CalciteSqlParser {
identifiers.add(expression.getIdentifier().getName());
} else if (expression.getFunctionCall() != null) {
if (excludeAs && expression.getFunctionCall().getOperator().equalsIgnoreCase("AS")) {
- identifiers.addAll(extractIdentifiers(Arrays.asList(expression.getFunctionCall().getOperands().get(0)), true));
+ identifiers
+ .addAll(extractIdentifiers(Arrays.asList(expression.getFunctionCall().getOperands().get(0)), true));
continue;
} else {
identifiers.addAll(extractIdentifiers(expression.getFunctionCall().getOperands(), excludeAs));
@@ -450,7 +454,8 @@ public class CalciteSqlParser {
}
return expression;
} else {
- throw new SqlCompilationException(String.format("Expected Ordinal value to be between 1 and %d.", selectList.size()));
+ throw new SqlCompilationException(
+ String.format("Expected Ordinal value to be between 1 and %d.", selectList.size()));
}
}
@@ -563,8 +568,8 @@ public class CalciteSqlParser {
} else {
selectIdentifiers.removeAll(groupByIdentifiers);
throw new SqlCompilationException(String.format(
- "For non-aggregation group by query, all the identifiers in select clause should be in groupBys. Found " + "identifier: %s",
- Arrays.toString(selectIdentifiers.toArray(new String[0]))));
+ "For non-aggregation group by query, all the identifiers in select clause should be in groupBys. Found "
+ + "identifier: %s", Arrays.toString(selectIdentifiers.toArray(new String[0]))));
}
}
}
@@ -645,7 +650,8 @@ public class CalciteSqlParser {
for (int i = 1; i < numOperands; i++) {
if (!operands.get(i).isSetLiteral()) {
throw new SqlCompilationException(String
- .format("For %s predicate, the operands except for the first one must be literal, got: %s", filterKind, expression));
+ .format("For %s predicate, the operands except for the first one must be literal, got: %s",
+ filterKind, expression));
}
}
break;
@@ -808,14 +814,17 @@ public class CalciteSqlParser {
Expression functionExpression = RequestUtils.getFunctionExpression(functionName);
for (SqlNode node : selectList) {
Expression columnExpression = toExpression(node);
- if (columnExpression.getType() == ExpressionType.IDENTIFIER && columnExpression.getIdentifier().getName().equals("*")) {
+ if (columnExpression.getType() == ExpressionType.IDENTIFIER && columnExpression.getIdentifier().getName()
+ .equals("*")) {
throw new SqlCompilationException(
- "Syntax error: Pinot currently does not support DISTINCT with *. Please specify each column name after " + "DISTINCT keyword");
+ "Syntax error: Pinot currently does not support DISTINCT with *. Please specify each column name after "
+ + "DISTINCT keyword");
} else if (columnExpression.getType() == ExpressionType.FUNCTION) {
Function functionCall = columnExpression.getFunctionCall();
String function = functionCall.getOperator();
if (FunctionDefinitionRegistry.isAggFunc(function)) {
- throw new SqlCompilationException("Syntax error: Use of DISTINCT with aggregation functions is not supported");
+ throw new SqlCompilationException(
+ "Syntax error: Use of DISTINCT with aggregation functions is not supported");
}
}
functionExpression.getFunctionCall().addToOperands(columnExpression);
@@ -876,20 +885,23 @@ public class CalciteSqlParser {
for (SqlNode whenSqlNode : whenOperands.getList()) {
Expression whenExpression = toExpression(whenSqlNode);
if (isAggregateExpression(whenExpression)) {
- throw new SqlCompilationException("Aggregation functions inside WHEN Clause is not supported - " + whenSqlNode);
+ throw new SqlCompilationException(
+ "Aggregation functions inside WHEN Clause is not supported - " + whenSqlNode);
}
caseFuncExpr.getFunctionCall().addToOperands(whenExpression);
}
for (SqlNode thenSqlNode : thenOperands.getList()) {
Expression thenExpression = toExpression(thenSqlNode);
if (isAggregateExpression(thenExpression)) {
- throw new SqlCompilationException("Aggregation functions inside THEN Clause is not supported - " + thenSqlNode);
+ throw new SqlCompilationException(
+ "Aggregation functions inside THEN Clause is not supported - " + thenSqlNode);
}
caseFuncExpr.getFunctionCall().addToOperands(thenExpression);
}
Expression elseExpression = toExpression(elseOperand);
if (isAggregateExpression(elseExpression)) {
- throw new SqlCompilationException("Aggregation functions inside ELSE Clause is not supported - " + elseExpression);
+ throw new SqlCompilationException(
+ "Aggregation functions inside ELSE Clause is not supported - " + elseExpression);
}
caseFuncExpr.getFunctionCall().addToOperands(elseExpression);
return caseFuncExpr;
@@ -1021,10 +1033,12 @@ public class CalciteSqlParser {
// Check that there are exactly 3 or 4 arguments
if (numOperands != 3 && numOperands != 4) {
- throw new SqlCompilationException("Expect 3 or 4 arguments for transform function: jsonExtractScalar(jsonFieldName, 'jsonPath', "
- + "'resultsType', ['defaultValue'])");
+ throw new SqlCompilationException(
+ "Expect 3 or 4 arguments for transform function: jsonExtractScalar(jsonFieldName, 'jsonPath', "
+ + "'resultsType', ['defaultValue'])");
}
- if (!operands.get(1).isSetLiteral() || !operands.get(2).isSetLiteral() || (numOperands == 4 && !operands.get(3).isSetLiteral())) {
+ if (!operands.get(1).isSetLiteral() || !operands.get(2).isSetLiteral() || (numOperands == 4 && !operands.get(3)
+ .isSetLiteral())) {
throw new SqlCompilationException(
"Expect the 2nd/3rd/4th argument of transform function: jsonExtractScalar(jsonFieldName, 'jsonPath',"
+ " 'resultsType', ['defaultValue']) to be a single-quoted literal value.");
@@ -1038,8 +1052,9 @@ public class CalciteSqlParser {
"Expect 2 arguments are required for transform function: jsonExtractKey(jsonFieldName, 'jsonPath')");
}
if (!operands.get(1).isSetLiteral()) {
- throw new SqlCompilationException("Expect the 2nd argument for transform function: jsonExtractKey(jsonFieldName, 'jsonPath') to be a "
- + "single-quoted literal value.");
+ throw new SqlCompilationException(
+ "Expect the 2nd argument for transform function: jsonExtractKey(jsonFieldName, 'jsonPath') to be a "
+ + "single-quoted literal value.");
}
}
@@ -1109,7 +1124,8 @@ public class CalciteSqlParser {
return RequestUtils.getLiteralExpression(result);
} catch (Exception e) {
throw new SqlCompilationException(
- "Caught exception while invoking method: " + functionInfo.getMethod() + " with arguments: " + Arrays.toString(arguments), e);
+ "Caught exception while invoking method: " + functionInfo.getMethod() + " with arguments: " + Arrays
+ .toString(arguments), e);
}
}
}
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 2b50378..9daa4a9 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
@@ -53,20 +53,24 @@ public class DateTimeFormatSpecTest {
entries.add(new Object[]{"1:MILLISECONDS:EPOCH", "1498892400000", 1498892400000L});
entries.add(new Object[]{"1:HOURS:EPOCH", "0", 0L});
entries.add(new Object[]{"5:MINUTES:EPOCH", "4996308", 1498892400000L});
- entries.add(new Object[]{"1:MILLISECONDS:TIMESTAMP", "2017-07-01 00:00:00", Timestamp.valueOf("2017-07-01 00:00:00").getTime()
+ entries.add(new Object[]{
+ "1:MILLISECONDS:TIMESTAMP", "2017-07-01 00:00:00", Timestamp.valueOf("2017-07-01 00:00:00").getTime()
});
entries.add(new Object[]{"1:MILLISECONDS:TIMESTAMP", "1498892400000", 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")
+ 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", "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")
+ 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});
@@ -88,45 +92,51 @@ public class DateTimeFormatSpecTest {
entries.add(new Object[]{"1:MILLISECONDS:EPOCH", 1498892400000L, "1498892400000"});
entries.add(new Object[]{"1:HOURS:EPOCH", 0L, "0"});
entries.add(new Object[]{"5:MINUTES:EPOCH", 1498892400000L, "4996308"});
- entries.add(new Object[]{"1:MILLISECONDS:TIMESTAMP", Timestamp.valueOf("2017-07-01 00:00:00").getTime(), "2017-07-01 00:00:00.0"
+ entries.add(new Object[]{
+ "1:MILLISECONDS:TIMESTAMP", Timestamp.valueOf("2017-07-01 00:00:00").getTime(), "2017-07-01 00:00:00.0"
});
- entries.add(
- new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", 1498892400000L, DateTimeFormat.forPattern("yyyyMMdd").withZoneUTC().print(
- 1498892400000L)
- });
- entries.add(
- new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(America/New_York)", 1498892400000L, 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, DateTimeFormat.forPattern("yyyyMMdd HH").withZoneUTC().print(
+ entries.add(new Object[]{
+ "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", 1498892400000L,
+ DateTimeFormat.forPattern("yyyyMMdd").withZoneUTC().print(1498892400000L)
+ });
+ entries.add(new Object[]{
+ "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(America/New_York)", 1498892400000L, 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,
+ DateTimeFormat.forPattern("yyyyMMdd HH").withZoneUTC().print(1498892400000L)
+ });
+ entries.add(new Object[]{
+ "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH tz(IST)", 1498892400000L,
+ DateTimeFormat.forPattern("yyyyMMdd HH").withZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone("IST"))).print(
1498892400000L)
- });
- entries.add(new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH tz(IST)", 1498892400000L, 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, DateTimeFormat.forPattern("yyyyMMdd HH Z")
- .withZoneUTC().print(1498892400000L)
+ entries.add(new Object[]{
+ "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH Z", 1498892400000L,
+ DateTimeFormat.forPattern("yyyyMMdd HH Z").withZoneUTC().print(1498892400000L)
});
- entries.add(
- new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH Z tz(GMT+0500)", 1498892400000L, DateTimeFormat.forPattern("yyyyMMdd HH Z")
+ entries.add(new Object[]{
+ "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH Z tz(GMT+0500)", 1498892400000L,
+ 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, DateTimeFormat.forPattern("M/d/yyyy h:mm:ss a")
- .withZoneUTC().withLocale(Locale.ENGLISH).print(1498892400000L)
- });
- entries.add(
- new Object[]{"1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h a", 1502066750000L, DateTimeFormat.forPattern("M/d/yyyy h a").withZoneUTC()
- .withLocale(Locale.ENGLISH).print(1502066750000L)
- });
+ });
+ entries.add(new Object[]{
+ "1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a", 1498892400000L,
+ DateTimeFormat.forPattern("M/d/yyyy h:mm:ss a").withZoneUTC().withLocale(Locale.ENGLISH).print(1498892400000L)
+ });
+ entries.add(new Object[]{
+ "1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h a", 1502066750000L,
+ DateTimeFormat.forPattern("M/d/yyyy h a").withZoneUTC().withLocale(Locale.ENGLISH).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) {
+ TimeFormat timeFormatFromFormatExpected, String sdfPatternFromFormatExpected,
+ DateTimeZone dateTimeZoneFromFormatExpected) {
DateTimeFormatSpec dateTimeFormatSpec = new DateTimeFormatSpec(format);
@@ -156,49 +166,55 @@ public class DateTimeFormatSpecTest {
List<Object[]> entries = new ArrayList<>();
- entries.add(new Object[]{"1:HOURS:EPOCH", 1, TimeUnit.HOURS, DateTimeFieldSpec.TimeFormat.EPOCH, null, DateTimeZone.UTC});
+ entries.add(
+ new Object[]{"1:HOURS:EPOCH", 1, TimeUnit.HOURS, DateTimeFieldSpec.TimeFormat.EPOCH, null, DateTimeZone.UTC});
- entries.add(new Object[]{"5:MINUTES:EPOCH", 5, TimeUnit.MINUTES, DateTimeFieldSpec.TimeFormat.EPOCH, null, DateTimeZone.UTC});
+ entries.add(new Object[]{
+ "5:MINUTES:EPOCH", 5, TimeUnit.MINUTES, DateTimeFieldSpec.TimeFormat.EPOCH, null, DateTimeZone.UTC
+ });
- entries.add(
- new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", 1, TimeUnit.DAYS, DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "yyyyMMdd",
- DateTimeZone.UTC});
+ entries.add(new Object[]{
+ "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", 1, TimeUnit.DAYS, DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT,
+ "yyyyMMdd", DateTimeZone.UTC
+ });
- entries.add(
- new Object[]{"1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd tz(IST)", 1, TimeUnit.DAYS, 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, 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,
- 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,
+ 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,
- 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,
+ 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, DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT,
- "yyyyMMdd HH", DateTimeZone.UTC});
+ entries.add(new Object[]{
+ "1:HOURS:SIMPLE_DATE_FORMAT:yyyyMMdd HH", 1, TimeUnit.HOURS, 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,
- 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,
+ 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, 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", 1, TimeUnit.HOURS,
+ 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,
- DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT, "M/d/yyyy h:mm:ss a", DateTimeZone.forTimeZone(
- TimeZone.getTimeZone("Asia/Tokyo"))
- });
+ entries.add(new Object[]{
+ "1:HOURS:SIMPLE_DATE_FORMAT:M/d/yyyy h:mm:ss a tz(Asia/Tokyo)", 1, TimeUnit.HOURS,
+ 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()][]);
}
@@ -235,16 +251,19 @@ public class DateTimeFormatSpecTest {
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", 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", "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, "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/FieldSpecTest.java b/pinot-common/src/test/java/org/apache/pinot/common/data/FieldSpecTest.java
index 151605c..6eb3d31 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
@@ -184,11 +184,13 @@ public class FieldSpecTest {
String incomingName = "incoming";
TimeUnit incomingTimeUnit = TimeUnit.HOURS;
int incomingTimeUnitSize = 1;
- TimeGranularitySpec incomingTimeGranularitySpec = new TimeGranularitySpec(LONG, incomingTimeUnitSize, incomingTimeUnit, incomingName);
+ TimeGranularitySpec incomingTimeGranularitySpec =
+ new TimeGranularitySpec(LONG, incomingTimeUnitSize, incomingTimeUnit, incomingName);
String outgoingName = "outgoing";
TimeUnit outgoingTimeUnit = TimeUnit.DAYS;
int outgoingTimeUnitSize = 1;
- TimeGranularitySpec outgoingTimeGranularitySpec = new TimeGranularitySpec(INT, outgoingTimeUnitSize, outgoingTimeUnit, outgoingName);
+ TimeGranularitySpec outgoingTimeGranularitySpec =
+ new TimeGranularitySpec(INT, outgoingTimeUnitSize, outgoingTimeUnit, outgoingName);
TimeFieldSpec timeFieldSpec1 = new TimeFieldSpec(incomingTimeGranularitySpec);
TimeFieldSpec timeFieldSpec2 = new TimeFieldSpec(incomingTimeGranularitySpec, outgoingTimeGranularitySpec);
Assert.assertNotEquals(timeFieldSpec1, timeFieldSpec2);
@@ -214,7 +216,8 @@ public class FieldSpecTest {
Assert.assertEquals(dateTimeFieldSpec1, dateTimeFieldSpec3);
DateTimeFieldSpec dateTimeFieldSpec4 = new DateTimeFieldSpec(name, LONG, format, granularity, 100000000L, null);
- DateTimeFieldSpec dateTimeFieldSpec5 = new DateTimeFieldSpec(name, INT, format, granularity, null, "toEpochHours(millis)");
+ DateTimeFieldSpec dateTimeFieldSpec5 =
+ new DateTimeFieldSpec(name, INT, format, granularity, null, "toEpochHours(millis)");
Assert.assertNotEquals(dateTimeFieldSpec5, dateTimeFieldSpec4);
DateTimeFieldSpec dateTimeFieldSpec6 = new DateTimeFieldSpec(name, LONG, format, granularity, 100000000L, null);
@@ -222,8 +225,8 @@ public class FieldSpecTest {
}
@Test(dataProvider = "testFormatDataProvider")
- public void testDateTimeFormat(String name, FieldSpec.DataType dataType, String format, String granularity, boolean exceptionExpected,
- DateTimeFieldSpec dateTimeFieldExpected) {
+ public void testDateTimeFormat(String name, FieldSpec.DataType dataType, String format, String granularity,
+ boolean exceptionExpected, DateTimeFieldSpec dateTimeFieldExpected) {
DateTimeFieldSpec dateTimeFieldActual = null;
boolean exceptionActual = false;
@@ -252,11 +255,13 @@ public class FieldSpecTest {
entries.add(new Object[]{name, dataType, "0:HOURS:EPOCH", granularity, true, null});
entries.add(new Object[]{name, dataType, "-1:HOURS:EPOCH", granularity, true, null});
entries.add(new Object[]{name, dataType, "0.1:HOURS:EPOCH", granularity, true, null});
- entries.add(new Object[]{name, dataType, "1:HOURS:EPOCH", granularity, false, new DateTimeFieldSpec(name, dataType, "1:HOURS:EPOCH",
- granularity)
+ entries.add(new Object[]{
+ name, dataType, "1:HOURS:EPOCH", granularity, false,
+ new DateTimeFieldSpec(name, dataType, "1:HOURS:EPOCH", granularity)
});
- entries.add(new Object[]{name, dataType, "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", granularity, false, new DateTimeFieldSpec(name, dataType,
- "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", granularity)
+ entries.add(new Object[]{
+ name, dataType, "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", granularity, false,
+ new DateTimeFieldSpec(name, dataType, "1:DAYS:SIMPLE_DATE_FORMAT:yyyyMMdd", granularity)
});
return entries.toArray(new Object[entries.size()][]);
@@ -270,31 +275,37 @@ public class FieldSpecTest {
throws Exception {
// Metric field with default null value.
String[] metricFields = {"\"name\":\"metric\"", "\"dataType\":\"INT\"", "\"defaultNullValue\":-1"};
- MetricFieldSpec metricFieldSpec1 = JsonUtils.stringToObject(getRandomOrderJsonString(metricFields), MetricFieldSpec.class);
+ MetricFieldSpec metricFieldSpec1 =
+ JsonUtils.stringToObject(getRandomOrderJsonString(metricFields), MetricFieldSpec.class);
MetricFieldSpec metricFieldSpec2 = new MetricFieldSpec("metric", INT, -1);
Assert.assertEquals(metricFieldSpec1, metricFieldSpec2, ERROR_MESSAGE);
Assert.assertEquals(metricFieldSpec1.getDefaultNullValue(), -1, ERROR_MESSAGE);
// Single-value boolean type dimension field with default null value.
String[] dimensionFields = {"\"name\":\"dimension\"", "\"dataType\":\"BOOLEAN\"", "\"defaultNullValue\":false"};
- DimensionFieldSpec dimensionFieldSpec1 = JsonUtils.stringToObject(getRandomOrderJsonString(dimensionFields), DimensionFieldSpec.class);
+ DimensionFieldSpec dimensionFieldSpec1 =
+ JsonUtils.stringToObject(getRandomOrderJsonString(dimensionFields), DimensionFieldSpec.class);
DimensionFieldSpec dimensionFieldSpec2 = new DimensionFieldSpec("dimension", BOOLEAN, true, false);
Assert.assertEquals(dimensionFieldSpec1, dimensionFieldSpec2, ERROR_MESSAGE);
Assert.assertEquals(dimensionFieldSpec1.getDefaultNullValue(), 0, ERROR_MESSAGE);
// Multi-value dimension field with default null value.
- dimensionFields =
- new String[]{"\"name\":\"dimension\"", "\"dataType\":\"STRING\"", "\"singleValueField\":false", "\"defaultNullValue\":\"default\""};
+ dimensionFields = new String[]{
+ "\"name\":\"dimension\"", "\"dataType\":\"STRING\"", "\"singleValueField\":false",
+ "\"defaultNullValue\":\"default\""
+ };
dimensionFieldSpec1 = JsonUtils.stringToObject(getRandomOrderJsonString(dimensionFields), DimensionFieldSpec.class);
dimensionFieldSpec2 = new DimensionFieldSpec("dimension", STRING, false, "default");
Assert.assertEquals(dimensionFieldSpec1, dimensionFieldSpec2, ERROR_MESSAGE);
Assert.assertEquals(dimensionFieldSpec1.getDefaultNullValue(), "default", ERROR_MESSAGE);
// Date time field with default null value.
- String[] dateTimeFields = {"\"name\":\"Date\"", "\"dataType\":\"LONG\"", "\"format\":\"1:MILLISECONDS:EPOCH\"",
+ String[] dateTimeFields = {
+ "\"name\":\"Date\"", "\"dataType\":\"LONG\"", "\"format\":\"1:MILLISECONDS:EPOCH\"",
"\"granularity\":\"5" + ":MINUTES\"", "\"dateTimeType\":\"PRIMARY\""
};
- DateTimeFieldSpec dateTimeFieldSpec1 = JsonUtils.stringToObject(getRandomOrderJsonString(dateTimeFields), DateTimeFieldSpec.class);
+ DateTimeFieldSpec dateTimeFieldSpec1 =
+ JsonUtils.stringToObject(getRandomOrderJsonString(dateTimeFields), DateTimeFieldSpec.class);
DateTimeFieldSpec dateTimeFieldSpec2 = new DateTimeFieldSpec("Date", LONG, "1:MILLISECONDS:EPOCH", "5:MINUTES");
Assert.assertEquals(dateTimeFieldSpec1, dateTimeFieldSpec2, ERROR_MESSAGE);
}
@@ -309,31 +320,37 @@ public class FieldSpecTest {
FieldSpec second;
// Single-value boolean type dimension field with default null value.
- String[] dimensionFields =
- {"\"name\":\"dimension\"", "\"dataType\":\"BOOLEAN\"", "\"defaultNullValue\":false", "\"transformFunction" + "\":\"trim(foo)\""
- };
+ String[] dimensionFields = {
+ "\"name\":\"dimension\"", "\"dataType\":\"BOOLEAN\"", "\"defaultNullValue\":false",
+ "\"transformFunction" + "\":\"trim(foo)\""
+ };
first = JsonUtils.stringToObject(getRandomOrderJsonString(dimensionFields), DimensionFieldSpec.class);
second = JsonUtils.stringToObject(first.toJsonObject().toString(), DimensionFieldSpec.class);
Assert.assertEquals(first, second, ERROR_MESSAGE);
// Multi-value dimension field with default null value.
- dimensionFields =
- new String[]{"\"name\":\"dimension\"", "\"dataType\":\"STRING\"", "\"singleValueField\":false", "\"defaultNullValue\":\"default\""};
+ dimensionFields = new String[]{
+ "\"name\":\"dimension\"", "\"dataType\":\"STRING\"", "\"singleValueField\":false",
+ "\"defaultNullValue\":\"default\""
+ };
first = JsonUtils.stringToObject(getRandomOrderJsonString(dimensionFields), DimensionFieldSpec.class);
second = JsonUtils.stringToObject(first.toJsonObject().toString(), DimensionFieldSpec.class);
Assert.assertEquals(first, second, ERROR_MESSAGE);
// Time field with default value.
- String[] timeFields = {"\"incomingGranularitySpec\":{\"timeUnitSize\":1, \"timeType\":\"MILLISECONDS\",\"dataType\":\"LONG\","
- + "\"name\":\"incomingTime\"}", "\"outgoingGranularitySpec\":{\"timeType\":\"SECONDS\",\"dataType\":\"INT\","
- + "\"name\":\"outgoingTime\"}", "\"defaultNullValue\":-1", "\"transformFunction\":\"toEpochDays" + "(millis)\""
+ String[] timeFields = {
+ "\"incomingGranularitySpec\":{\"timeUnitSize\":1, \"timeType\":\"MILLISECONDS\",\"dataType\":\"LONG\","
+ + "\"name\":\"incomingTime\"}",
+ "\"outgoingGranularitySpec\":{\"timeType\":\"SECONDS\",\"dataType\":\"INT\"," + "\"name\":\"outgoingTime\"}",
+ "\"defaultNullValue\":-1", "\"transformFunction\":\"toEpochDays" + "(millis)\""
};
first = JsonUtils.stringToObject(getRandomOrderJsonString(timeFields), TimeFieldSpec.class);
second = JsonUtils.stringToObject(first.toJsonObject().toString(), TimeFieldSpec.class);
Assert.assertEquals(first, second, ERROR_MESSAGE);
// DateTime field
- String[] dateTimeFields = {"\"name\":\"Date\"", "\"dataType\":\"LONG\"", "\"format\":\"1:MILLISECONDS:EPOCH\"",
+ String[] dateTimeFields = {
+ "\"name\":\"Date\"", "\"dataType\":\"LONG\"", "\"format\":\"1:MILLISECONDS:EPOCH\"",
"\"granularity\":\"5" + ":MINUTES\"", "\"transformFunction\":\"fromEpochDays(daysSinceEpoch)\""
};
first = JsonUtils.stringToObject(getRandomOrderJsonString(dateTimeFields), DateTimeFieldSpec.class);
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 3d204c8..47b536f 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
@@ -196,7 +196,8 @@ public class SchemaTest {
@Test
public void testFetchFieldSpecForTime() {
Schema schema = new Schema.SchemaBuilder().addSingleValueDimension("svDimension", FieldSpec.DataType.INT)
- .addMetric("metric", FieldSpec.DataType.INT).addTime(new TimeGranularitySpec(FieldSpec.DataType.LONG, TimeUnit.DAYS, "time"), null)
+ .addMetric("metric", FieldSpec.DataType.INT)
+ .addTime(new TimeGranularitySpec(FieldSpec.DataType.LONG, TimeUnit.DAYS, "time"), null)
.addDateTime("dateTime", FieldSpec.DataType.LONG, "1:HOURS:EPOCH", "1:HOURS").build();
// Test method which fetches the DateTimeFieldSpec given the timeColumnName
@@ -238,7 +239,8 @@ public class SchemaTest {
TimeGranularitySpec outgoingTimeGranularitySpec =
new TimeGranularitySpec(outgoingDataType, outgoingTimeUnitSize, outgoingTimeUnit, outgoingName);
- Schema schema11 = new Schema.SchemaBuilder().setSchemaName("testSchema").addTime(incomingTimeGranularitySpec, null).build();
+ Schema schema11 =
+ new Schema.SchemaBuilder().setSchemaName("testSchema").addTime(incomingTimeGranularitySpec, null).build();
Schema schema12 = new Schema.SchemaBuilder().setSchemaName("testSchema").build();
schema12.addField(new TimeFieldSpec(incomingTimeGranularitySpec, outgoingTimeGranularitySpec));
Assert.assertNotNull(schema11.getTimeFieldSpec());
@@ -246,8 +248,8 @@ public class SchemaTest {
Assert.assertNotEquals(schema12, schema11);
- schema11 =
- new Schema.SchemaBuilder().setSchemaName("testSchema").addTime(incomingTimeGranularitySpec, outgoingTimeGranularitySpec).build();
+ schema11 = new Schema.SchemaBuilder().setSchemaName("testSchema")
+ .addTime(incomingTimeGranularitySpec, outgoingTimeGranularitySpec).build();
Assert.assertEquals(schema11, schema12);
}
@@ -281,11 +283,13 @@ public class SchemaTest {
public void testSimpleDateFormat()
throws Exception {
TimeGranularitySpec incomingTimeGranularitySpec =
- new TimeGranularitySpec(FieldSpec.DataType.STRING, 1, TimeUnit.DAYS, TimeFormat.SIMPLE_DATE_FORMAT + ":yyyyMMdd", "Date");
+ new TimeGranularitySpec(FieldSpec.DataType.STRING, 1, TimeUnit.DAYS,
+ TimeFormat.SIMPLE_DATE_FORMAT + ":yyyyMMdd", "Date");
TimeGranularitySpec outgoingTimeGranularitySpec =
- 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();
+ 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();
String jsonSchema = schema.toSingleLineJsonString();
Schema schemaFromJson = Schema.fromString(jsonSchema);
Assert.assertEquals(schemaFromJson, schema);
@@ -321,8 +325,8 @@ public class SchemaTest {
Schema oldSchema = new Schema.SchemaBuilder().addSingleValueDimension("svDimension", FieldSpec.DataType.INT)
.addSingleValueDimension("svDimensionWithDefault", FieldSpec.DataType.INT, 10)
.addMultiValueDimension("mvDimension", FieldSpec.DataType.STRING)
- .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default").addMetric("metric", FieldSpec.DataType.INT)
- .addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
+ .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default")
+ .addMetric("metric", FieldSpec.DataType.INT).addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
.addTime(new TimeGranularitySpec(FieldSpec.DataType.LONG, TimeUnit.DAYS, "time"), null)
.addDateTime("dateTime", FieldSpec.DataType.LONG, "1:HOURS:EPOCH", "1:HOURS").build();
@@ -332,8 +336,8 @@ public class SchemaTest {
Schema schema1 = new Schema.SchemaBuilder().addSingleValueDimension("svDimension", FieldSpec.DataType.INT)
// Remove column svDimensionWithDefault
.addMultiValueDimension("mvDimension", FieldSpec.DataType.STRING)
- .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default").addMetric("metric", FieldSpec.DataType.INT)
- .addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
+ .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default")
+ .addMetric("metric", FieldSpec.DataType.INT).addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
.addTime(new TimeGranularitySpec(FieldSpec.DataType.LONG, TimeUnit.DAYS, "time"), null)
.addDateTime("dateTime", FieldSpec.DataType.LONG, "1:HOURS:EPOCH", "1:HOURS").build();
Assert.assertFalse(schema1.isBackwardCompatibleWith(oldSchema));
@@ -342,8 +346,8 @@ public class SchemaTest {
Schema schema2 = new Schema.SchemaBuilder().addSingleValueDimension("svDimension", FieldSpec.DataType.INT)
.addSingleValueDimension("svDimensionWithDefault", FieldSpec.DataType.LONG, 10) // INT -> LONG
.addMultiValueDimension("mvDimension", FieldSpec.DataType.STRING)
- .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default").addMetric("metric", FieldSpec.DataType.INT)
- .addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
+ .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default")
+ .addMetric("metric", FieldSpec.DataType.INT).addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
.addTime(new TimeGranularitySpec(FieldSpec.DataType.LONG, TimeUnit.DAYS, "time"), null)
.addDateTime("dateTime", FieldSpec.DataType.LONG, "1:HOURS:EPOCH", "1:HOURS").build();
Assert.assertFalse(schema2.isBackwardCompatibleWith(oldSchema));
@@ -352,8 +356,8 @@ public class SchemaTest {
Schema schema3 = new Schema.SchemaBuilder().addSingleValueDimension("svDimension", FieldSpec.DataType.INT)
.addSingleValueDimension("svDimensionWithDefault", FieldSpec.DataType.INT, 10)
.addMultiValueDimension("mvDimension", FieldSpec.DataType.STRING)
- .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default").addMetric("metric", FieldSpec.DataType.INT)
- .addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
+ .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default")
+ .addMetric("metric", FieldSpec.DataType.INT).addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
.addTime(new TimeGranularitySpec(FieldSpec.DataType.LONG, TimeUnit.HOURS, "time"), null)
.addDateTime("dateTime", FieldSpec.DataType.LONG, "1:HOURS:EPOCH", "1:HOURS").build();
Assert.assertFalse(schema3.isBackwardCompatibleWith(oldSchema));
@@ -362,8 +366,8 @@ public class SchemaTest {
Schema schema4 = new Schema.SchemaBuilder().addSingleValueDimension("svDimension", FieldSpec.DataType.INT)
.addSingleValueDimension("svDimensionWithDefault", FieldSpec.DataType.INT, 10)
.addMultiValueDimension("mvDimension", FieldSpec.DataType.STRING)
- .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default").addMetric("metric", FieldSpec.DataType.INT)
- .addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
+ .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default")
+ .addMetric("metric", FieldSpec.DataType.INT).addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
.addTime(new TimeGranularitySpec(FieldSpec.DataType.LONG, TimeUnit.DAYS, "time"), null)
.addDateTime("dateTime", FieldSpec.DataType.LONG, "2:HOURS:EPOCH", "1:HOURS").build(); // timeUnit 1 -> 2
Assert.assertFalse(schema4.isBackwardCompatibleWith(oldSchema));
@@ -372,8 +376,8 @@ public class SchemaTest {
Schema schema5 = new Schema.SchemaBuilder().addSingleValueDimension("svDimension", FieldSpec.DataType.INT)
.addSingleValueDimension("svDimensionWithDefault", FieldSpec.DataType.INT, 100) // default value 10 -> 100
.addMultiValueDimension("mvDimension", FieldSpec.DataType.STRING)
- .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default").addMetric("metric", FieldSpec.DataType.INT)
- .addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
+ .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default")
+ .addMetric("metric", FieldSpec.DataType.INT).addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
.addTime(new TimeGranularitySpec(FieldSpec.DataType.LONG, TimeUnit.DAYS, "time"), null)
.addDateTime("dateTime", FieldSpec.DataType.LONG, "1:HOURS:EPOCH", "1:HOURS").build();
Assert.assertFalse(schema5.isBackwardCompatibleWith(oldSchema));
@@ -383,8 +387,8 @@ public class SchemaTest {
.addSingleValueDimension("svDimensionWithDefault", FieldSpec.DataType.INT, 10)
.addSingleValueDimension("svDimensionWithDefault1", FieldSpec.DataType.INT, 10)
.addMultiValueDimension("mvDimension", FieldSpec.DataType.STRING)
- .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default").addMetric("metric", FieldSpec.DataType.INT)
- .addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
+ .addMultiValueDimension("mvDimensionWithDefault", FieldSpec.DataType.STRING, "default")
+ .addMetric("metric", FieldSpec.DataType.INT).addMetric("metricWithDefault", FieldSpec.DataType.INT, 5)
.addTime(new TimeGranularitySpec(FieldSpec.DataType.LONG, TimeUnit.DAYS, "time"), null)
.addDateTime("dateTime", FieldSpec.DataType.LONG, "1:HOURS:EPOCH", "1:HOURS").build();
Assert.assertTrue(schema6.isBackwardCompatibleWith(oldSchema));
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/function/AggregationFunctionTypeTest.java b/pinot-common/src/test/java/org/apache/pinot/common/function/AggregationFunctionTypeTest.java
index e325b0a..5b1d640 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/function/AggregationFunctionTypeTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/function/AggregationFunctionTypeTest.java
@@ -33,29 +33,38 @@ public class AggregationFunctionTypeTest {
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("SuM"), AggregationFunctionType.SUM);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("AvG"), AggregationFunctionType.AVG);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("MoDe"), AggregationFunctionType.MODE);
- Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("MiNmAxRaNgE"), AggregationFunctionType.MINMAXRANGE);
- Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("DiStInCtCoUnT"), AggregationFunctionType.DISTINCTCOUNT);
- Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("DiStInCtCoUnThLl"), AggregationFunctionType.DISTINCTCOUNTHLL);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("MiNmAxRaNgE"),
+ AggregationFunctionType.MINMAXRANGE);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("DiStInCtCoUnT"),
+ AggregationFunctionType.DISTINCTCOUNT);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("DiStInCtCoUnThLl"),
+ AggregationFunctionType.DISTINCTCOUNTHLL);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("DiStInCtCoUnTrAwHlL"),
AggregationFunctionType.DISTINCTCOUNTRAWHLL);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("FaStHlL"), AggregationFunctionType.FASTHLL);
- Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLe5"), AggregationFunctionType.PERCENTILE);
- Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLeEsT50"), AggregationFunctionType.PERCENTILEEST);
- Assert
- .assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLeTdIgEsT99"), AggregationFunctionType.PERCENTILETDIGEST);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLe5"),
+ AggregationFunctionType.PERCENTILE);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLeEsT50"),
+ AggregationFunctionType.PERCENTILEEST);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLeTdIgEsT99"),
+ AggregationFunctionType.PERCENTILETDIGEST);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("CoUnTMv"), AggregationFunctionType.COUNTMV);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("MiNmV"), AggregationFunctionType.MINMV);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("MaXmV"), AggregationFunctionType.MAXMV);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("SuMmV"), AggregationFunctionType.SUMMV);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("AvGmV"), AggregationFunctionType.AVGMV);
- Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("MiNmAxRaNgEmV"), AggregationFunctionType.MINMAXRANGEMV);
- Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("DiStInCtCoUnTmV"), AggregationFunctionType.DISTINCTCOUNTMV);
- Assert
- .assertEquals(AggregationFunctionType.getAggregationFunctionType("DiStInCtCoUnThLlMv"), AggregationFunctionType.DISTINCTCOUNTHLLMV);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("MiNmAxRaNgEmV"),
+ AggregationFunctionType.MINMAXRANGEMV);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("DiStInCtCoUnTmV"),
+ AggregationFunctionType.DISTINCTCOUNTMV);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("DiStInCtCoUnThLlMv"),
+ AggregationFunctionType.DISTINCTCOUNTHLLMV);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("DiStInCtCoUnTrAwHlLmV"),
AggregationFunctionType.DISTINCTCOUNTRAWHLLMV);
- Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLe10Mv"), AggregationFunctionType.PERCENTILEMV);
- Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLeEsT90mV"), AggregationFunctionType.PERCENTILEESTMV);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLe10Mv"),
+ AggregationFunctionType.PERCENTILEMV);
+ Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLeEsT90mV"),
+ AggregationFunctionType.PERCENTILEESTMV);
Assert.assertEquals(AggregationFunctionType.getAggregationFunctionType("PeRcEnTiLeTdIgEsT95mV"),
AggregationFunctionType.PERCENTILETDIGESTMV);
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/function/JsonFunctionsTest.java b/pinot-common/src/test/java/org/apache/pinot/common/function/JsonFunctionsTest.java
index a47529d..de1fb24 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/function/JsonFunctionsTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/function/JsonFunctionsTest.java
@@ -142,7 +142,8 @@ public class JsonFunctionsTest {
"}";
// @formatter:on
// CHECKSTYLE:ON
- assertEquals(JsonFunctions.jsonPathArrayDefaultEmpty(jsonString, "$.subjects[*].name"), new String[]{"maths", "english"});
+ assertEquals(JsonFunctions.jsonPathArrayDefaultEmpty(jsonString, "$.subjects[*].name"),
+ new String[]{"maths", "english"});
assertEquals(JsonFunctions.jsonPathArrayDefaultEmpty(jsonString, "$.subjects[*].grade"), new String[]{"A", "B"});
assertEquals(JsonFunctions.jsonPathArrayDefaultEmpty(jsonString, "$.subjects[*].homework_grades"),
new Object[]{Arrays.asList(80, 85, 90, 95, 100), Arrays.asList(60, 65, 70, 85, 90)});
@@ -156,13 +157,14 @@ public class JsonFunctionsTest {
// Object[] doesn't work with default JsonPath, where "$.commits[*].sha" would return empty,
// and "$.commits[1].sha" led to exception `Filter: [1]['sha'] can only be applied to arrays`.
// Those failure could be reproduced by using the default JacksonJsonProvider for JsonPath.
- Map<String, Object> rawData =
- ImmutableMap.of("commits", ImmutableList.of(ImmutableMap.of("sha", 123, "name", "k"), ImmutableMap.of("sha", 456, "name", "j")));
+ Map<String, Object> rawData = ImmutableMap.of("commits",
+ ImmutableList.of(ImmutableMap.of("sha", 123, "name", "k"), ImmutableMap.of("sha", 456, "name", "j")));
assertEquals(JsonFunctions.jsonPathArray(rawData, "$.commits[*].sha"), new Integer[]{123, 456});
assertEquals(JsonFunctions.jsonPathArray(rawData, "$.commits[1].sha"), new Integer[]{456});
// ArrayAwareJacksonJsonProvider should fix this issue.
- rawData = ImmutableMap.of("commits", new Object[]{ImmutableMap.of("sha", 123, "name", "k"), ImmutableMap.of("sha", 456, "name", "j")});
+ rawData = ImmutableMap.of("commits",
+ new Object[]{ImmutableMap.of("sha", 123, "name", "k"), ImmutableMap.of("sha", 456, "name", "j")});
assertEquals(JsonFunctions.jsonPathArray(rawData, "$.commits[*].sha"), new Integer[]{123, 456});
assertEquals(JsonFunctions.jsonPathArray(rawData, "$.commits[1].sha"), new Integer[]{456});
}
@@ -178,7 +180,8 @@ public class JsonFunctionsTest {
// ArrayAwareJacksonJsonProvider can work with Array directly, thus no need to serialize
// Object[] any more.
- Object[] rawDataInAry = new Object[]{ImmutableMap.of("sha", 123, "name", "kk"), ImmutableMap.of("sha", 456, "name", "jj")};
+ Object[] rawDataInAry =
+ new Object[]{ImmutableMap.of("sha", 123, "name", "kk"), ImmutableMap.of("sha", 456, "name", "jj")};
assertEquals(JsonFunctions.jsonPathArray(rawDataInAry, "$.[*].sha"), new Integer[]{123, 456});
assertEquals(JsonFunctions.jsonPathArray(rawDataInAry, "$.[1].sha"), new Integer[]{456});
}
@@ -216,8 +219,10 @@ public class JsonFunctionsTest {
public void testJsonFunctionOnList()
throws JsonProcessingException {
List<Map<String, Object>> rawData = new ArrayList<Map<String, Object>>();
- rawData.add(ImmutableMap.of("name", "maths", "grade", "A", "score", 90, "homework_grades", Arrays.asList(80, 85, 90, 95, 100)));
- rawData.add(ImmutableMap.of("name", "english", "grade", "B", "score", 50, "homework_grades", Arrays.asList(60, 65, 70, 85, 90)));
+ rawData.add(ImmutableMap
+ .of("name", "maths", "grade", "A", "score", 90, "homework_grades", Arrays.asList(80, 85, 90, 95, 100)));
+ rawData.add(ImmutableMap
+ .of("name", "english", "grade", "B", "score", 50, "homework_grades", Arrays.asList(60, 65, 70, 85, 90)));
assertEquals(JsonFunctions.jsonPathArray(rawData, "$.[*].name"), new String[]{"maths", "english"});
assertEquals(JsonFunctions.jsonPathArray(rawData, "$.[*].grade"), new String[]{"A", "B"});
assertEquals(JsonFunctions.jsonPathArray(rawData, "$.[*].homework_grades"),
@@ -228,9 +233,11 @@ public class JsonFunctionsTest {
@Test
public void testJsonFunctionOnObjectArray()
throws JsonProcessingException {
- Object[] rawData = new Object[]{ImmutableMap.of("name", "maths", "grade", "A", "score", 90, "homework_grades",
- Arrays.asList(80, 85, 90, 95, 100)), ImmutableMap.of("name", "english", "grade", "B", "score", 50, "homework_grades",
- Arrays.asList(60, 65, 70, 85, 90))
+ Object[] rawData = new Object[]{
+ ImmutableMap.of("name", "maths", "grade", "A", "score", 90, "homework_grades",
+ Arrays.asList(80, 85, 90, 95, 100)),
+ ImmutableMap.of("name", "english", "grade", "B", "score", 50, "homework_grades",
+ Arrays.asList(60, 65, 70, 85, 90))
};
assertEquals(JsonFunctions.jsonPathArray(rawData, "$.[*].name"), new String[]{"maths", "english"});
assertEquals(JsonFunctions.jsonPathArray(rawData, "$.[*].grade"), new String[]{"A", "B"});
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/function/TransformFunctionTypeTest.java b/pinot-common/src/test/java/org/apache/pinot/common/function/TransformFunctionTypeTest.java
index 28b3d16..b38b3ca 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/function/TransformFunctionTypeTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/function/TransformFunctionTypeTest.java
@@ -44,7 +44,8 @@ public class TransformFunctionTypeTest {
@Test
public void testSnakeCaseLookupFunction() {
- assertEquals(TransformFunctionType.getTransformFunctionType("json_extract_scalar"), TransformFunctionType.JSONEXTRACTSCALAR);
+ assertEquals(TransformFunctionType.getTransformFunctionType("json_extract_scalar"),
+ TransformFunctionType.JSONEXTRACTSCALAR);
}
@Test(expectedExceptions = IllegalArgumentException.class)
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 d43a8b2..9c25ed9 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
@@ -106,9 +106,11 @@ public class MultiGetRequestTest {
@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,
+ "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);
// timeout value needs to be less than 5000ms set above for
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentLineageTest.java b/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentLineageTest.java
index d027f6f..666dfd5 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentLineageTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/lineage/SegmentLineageTest.java
@@ -33,7 +33,8 @@ public class SegmentLineageTest {
SegmentLineage segmentLineage = new SegmentLineage("test_OFFLINE");
String id = SegmentLineageUtils.generateLineageEntryId();
segmentLineage.addLineageEntry(id,
- new LineageEntry(Arrays.asList("s1", "s2", "s3"), Arrays.asList("s4", "s5"), LineageEntryState.COMPLETED, 11111L));
+ new LineageEntry(Arrays.asList("s1", "s2", "s3"), Arrays.asList("s4", "s5"), LineageEntryState.COMPLETED,
+ 11111L));
LineageEntry lineageEntry = segmentLineage.getLineageEntry(id);
Assert.assertEquals(lineageEntry.getSegmentsFrom(), Arrays.asList("s1", "s2", "s3"));
Assert.assertEquals(lineageEntry.getSegmentsTo(), Arrays.asList("s4", "s5"));
@@ -42,7 +43,8 @@ public class SegmentLineageTest {
String id2 = SegmentLineageUtils.generateLineageEntryId();
segmentLineage.addLineageEntry(id2,
- new LineageEntry(Arrays.asList("s6", "s6", "s8"), Arrays.asList("s9", "s10"), LineageEntryState.COMPLETED, 22222L));
+ new LineageEntry(Arrays.asList("s6", "s6", "s8"), Arrays.asList("s9", "s10"), LineageEntryState.COMPLETED,
+ 22222L));
LineageEntry lineageEntry2 = segmentLineage.getLineageEntry(id2);
Assert.assertEquals(lineageEntry2.getSegmentsFrom(), Arrays.asList("s6", "s6", "s8"));
Assert.assertEquals(lineageEntry2.getSegmentsTo(), Arrays.asList("s9", "s10"));
@@ -50,8 +52,8 @@ public class SegmentLineageTest {
Assert.assertEquals(lineageEntry2.getTimestamp(), 22222L);
String id3 = SegmentLineageUtils.generateLineageEntryId();
- segmentLineage
- .addLineageEntry(id3, new LineageEntry(Arrays.asList("s5", "s9"), Arrays.asList("s11"), LineageEntryState.IN_PROGRESS, 33333L));
+ segmentLineage.addLineageEntry(id3,
+ new LineageEntry(Arrays.asList("s5", "s9"), Arrays.asList("s11"), LineageEntryState.IN_PROGRESS, 33333L));
LineageEntry lineageEntry3 = segmentLineage.getLineageEntry(id3);
Assert.assertEquals(lineageEntry3.getSegmentsFrom(), Arrays.asList("s5", "s9"));
Assert.assertEquals(lineageEntry3.getSegmentsTo(), Arrays.asList("s11"));
@@ -59,7 +61,8 @@ public class SegmentLineageTest {
Assert.assertEquals(lineageEntry3.getTimestamp(), 33333L);
String id4 = SegmentLineageUtils.generateLineageEntryId();
- segmentLineage.addLineageEntry(id4, new LineageEntry(new ArrayList<>(), Arrays.asList("s12"), LineageEntryState.IN_PROGRESS, 44444L));
+ segmentLineage.addLineageEntry(id4,
+ new LineageEntry(new ArrayList<>(), Arrays.asList("s12"), LineageEntryState.IN_PROGRESS, 44444L));
LineageEntry lineageEntry4 = segmentLineage.getLineageEntry(id4);
Assert.assertEquals(lineageEntry4.getSegmentsFrom(), new ArrayList<>());
Assert.assertEquals(lineageEntry4.getSegmentsTo(), Arrays.asList("s12"));
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 2ed98ff..c7dfcca 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
@@ -37,15 +37,17 @@ public class MetadataEqualsHashCodeTest {
@Test
public void testEqualsAndHashCode() {
- EqualsVerifier.forClass(InstanceZKMetadata.class).suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS).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)
- .usingGetClass().verify();
- 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)
- .usingGetClass().verify();
- EqualsVerifier.forClass(DateTimeFieldSpec.class).suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS, Warning.TRANSIENT_FIELDS)
+ EqualsVerifier.forClass(InstanceZKMetadata.class).suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS)
.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).usingGetClass().verify();
+ 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).usingGetClass().verify();
+ 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/RealtimeToOfflineSegmentsTaskMetadataTest.java b/pinot-common/src/test/java/org/apache/pinot/common/metadata/RealtimeToOfflineSegmentsTaskMetadataTest.java
index bf8ce98..23ab243 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/metadata/RealtimeToOfflineSegmentsTaskMetadataTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/metadata/RealtimeToOfflineSegmentsTaskMetadataTest.java
@@ -32,7 +32,8 @@ public class RealtimeToOfflineSegmentsTaskMetadataTest {
@Test
public void testToFromZNRecord() {
- RealtimeToOfflineSegmentsTaskMetadata metadata = new RealtimeToOfflineSegmentsTaskMetadata("testTable_REALTIME", 1000);
+ RealtimeToOfflineSegmentsTaskMetadata metadata =
+ new RealtimeToOfflineSegmentsTaskMetadata("testTable_REALTIME", 1000);
ZNRecord znRecord = metadata.toZNRecord();
assertEquals(znRecord.getId(), "testTable_REALTIME");
assertEquals(znRecord.getSimpleField("watermarkMs"), "1000");
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 2322ccd..3643119 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
@@ -57,11 +57,14 @@ public class SegmentZKMetadataTest {
assertEquals(doneSegmentMetadata, new SegmentZKMetadata(doneZnRecord));
assertEquals(doneSegmentMetadata.hashCode(), new SegmentZKMetadata(doneZnRecord).hashCode());
- Assert.assertTrue(MetadataUtils.comparisonZNRecords(inProgressZnRecord, new SegmentZKMetadata(inProgressZnRecord).toZNRecord()));
- Assert.assertTrue(MetadataUtils.comparisonZNRecords(doneZnRecord, new SegmentZKMetadata(doneZnRecord).toZNRecord()));
+ Assert.assertTrue(
+ MetadataUtils.comparisonZNRecords(inProgressZnRecord, new SegmentZKMetadata(inProgressZnRecord).toZNRecord()));
+ Assert
+ .assertTrue(MetadataUtils.comparisonZNRecords(doneZnRecord, new SegmentZKMetadata(doneZnRecord).toZNRecord()));
assertEquals(inProgressSegmentMetadata, new SegmentZKMetadata(inProgressSegmentMetadata.toZNRecord()));
- assertEquals(inProgressSegmentMetadata.hashCode(), new SegmentZKMetadata(inProgressSegmentMetadata.toZNRecord()).hashCode());
+ assertEquals(inProgressSegmentMetadata.hashCode(),
+ new SegmentZKMetadata(inProgressSegmentMetadata.toZNRecord()).hashCode());
assertEquals(doneSegmentMetadata, new SegmentZKMetadata(doneSegmentMetadata.toZNRecord()));
assertEquals(doneSegmentMetadata.hashCode(), new SegmentZKMetadata(doneSegmentMetadata.toZNRecord()).hashCode());
}
@@ -73,31 +76,37 @@ public class SegmentZKMetadataTest {
Assert.assertTrue(MetadataUtils.comparisonZNRecords(offlineZNRecord, offlineSegmentMetadata.toZNRecord()));
assertEquals(offlineSegmentMetadata, new SegmentZKMetadata(offlineZNRecord));
assertEquals(offlineSegmentMetadata.hashCode(), new SegmentZKMetadata(offlineZNRecord).hashCode());
- Assert.assertTrue(MetadataUtils.comparisonZNRecords(offlineZNRecord, new SegmentZKMetadata(offlineZNRecord).toZNRecord()));
+ Assert.assertTrue(
+ MetadataUtils.comparisonZNRecords(offlineZNRecord, new SegmentZKMetadata(offlineZNRecord).toZNRecord()));
assertEquals(offlineSegmentMetadata, new SegmentZKMetadata(offlineSegmentMetadata.toZNRecord()));
- assertEquals(offlineSegmentMetadata.hashCode(), new SegmentZKMetadata(offlineSegmentMetadata.toZNRecord()).hashCode());
+ assertEquals(offlineSegmentMetadata.hashCode(),
+ new SegmentZKMetadata(offlineSegmentMetadata.toZNRecord()).hashCode());
}
@Test
public void segmentPartitionMetadataTest()
throws IOException {
// Test for partition metadata serialization/de-serialization.
- String legacyMetadataString =
- "{\"columnPartitionMap\":{" + "\"column1\":{\"functionName\":\"func1\",\"numPartitions\":8,\"partitionRanges\":\"[5 5],[7 7]\"},"
- + "\"column2\":{\"functionName\":\"func2\",\"numPartitions\":12,\"partitionRanges\":\"[9 11]\"}}}";
- String metadataString =
- "{\"columnPartitionMap\":{" + "\"column1\":{\"functionName\":\"func1\",\"numPartitions\":8,\"partitions\":[5,7]},"
- + "\"column2\":{\"functionName\":\"func2\",\"numPartitions\":12,\"partitions\":[9,10,11]}}}";
+ String legacyMetadataString = "{\"columnPartitionMap\":{"
+ + "\"column1\":{\"functionName\":\"func1\",\"numPartitions\":8,\"partitionRanges\":\"[5 5],[7 7]\"},"
+ + "\"column2\":{\"functionName\":\"func2\",\"numPartitions\":12,\"partitionRanges\":\"[9 11]\"}}}";
+ String metadataString = "{\"columnPartitionMap\":{"
+ + "\"column1\":{\"functionName\":\"func1\",\"numPartitions\":8,\"partitions\":[5,7]},"
+ + "\"column2\":{\"functionName\":\"func2\",\"numPartitions\":12,\"partitions\":[9,10,11]}}}";
Map<String, ColumnPartitionMetadata> columnPartitionMetadataMap = new HashMap<>();
- columnPartitionMetadataMap.put("column1", new ColumnPartitionMetadata("func1", 8, new HashSet<>(Arrays.asList(5, 7))));
- columnPartitionMetadataMap.put("column2", new ColumnPartitionMetadata("func2", 12, new HashSet<>(Arrays.asList(9, 10, 11))));
+ columnPartitionMetadataMap
+ .put("column1", new ColumnPartitionMetadata("func1", 8, new HashSet<>(Arrays.asList(5, 7))));
+ columnPartitionMetadataMap
+ .put("column2", new ColumnPartitionMetadata("func2", 12, new HashSet<>(Arrays.asList(9, 10, 11))));
SegmentPartitionMetadata expectedPartitionMetadata = new SegmentPartitionMetadata(columnPartitionMetadataMap);
assertEquals(SegmentPartitionMetadata.fromJsonString(legacyMetadataString), expectedPartitionMetadata);
assertEquals(SegmentPartitionMetadata.fromJsonString(metadataString), expectedPartitionMetadata);
- assertEquals(SegmentPartitionMetadata.fromJsonString(legacyMetadataString).hashCode(), expectedPartitionMetadata.hashCode());
- assertEquals(SegmentPartitionMetadata.fromJsonString(metadataString).hashCode(), expectedPartitionMetadata.hashCode());
+ assertEquals(SegmentPartitionMetadata.fromJsonString(legacyMetadataString).hashCode(),
+ expectedPartitionMetadata.hashCode());
+ assertEquals(SegmentPartitionMetadata.fromJsonString(metadataString).hashCode(),
+ expectedPartitionMetadata.hashCode());
// Test partition metadata in OfflineSegmentZkMetadata
ZNRecord znRecord = getTestOfflineSegmentZNRecord();
@@ -107,7 +116,8 @@ public class SegmentZKMetadataTest {
assertEquals(actualPartitionMetadata, expectedPartitionMetadata);
assertEquals(actualSegmentZKMetadata, new SegmentZKMetadata(actualSegmentZKMetadata.toZNRecord()));
assertEquals(actualPartitionMetadata.hashCode(), expectedPartitionMetadata.hashCode());
- assertEquals(actualSegmentZKMetadata.hashCode(), new SegmentZKMetadata(actualSegmentZKMetadata.toZNRecord()).hashCode());
+ assertEquals(actualSegmentZKMetadata.hashCode(),
+ new SegmentZKMetadata(actualSegmentZKMetadata.toZNRecord()).hashCode());
// Test partition metadata in RealtimeSegmentZkMetadata
znRecord = getTestDoneRealtimeSegmentZNRecord();
@@ -117,7 +127,8 @@ public class SegmentZKMetadataTest {
assertEquals(actualPartitionMetadata, expectedPartitionMetadata);
assertEquals(actualSegmentZKMetadata, new SegmentZKMetadata(actualSegmentZKMetadata.toZNRecord()));
assertEquals(actualPartitionMetadata.hashCode(), expectedPartitionMetadata.hashCode());
- assertEquals(actualSegmentZKMetadata.hashCode(), new SegmentZKMetadata(actualSegmentZKMetadata.toZNRecord()).hashCode());
+ assertEquals(actualSegmentZKMetadata.hashCode(),
+ new SegmentZKMetadata(actualSegmentZKMetadata.toZNRecord()).hashCode());
}
private ZNRecord getTestDoneRealtimeSegmentZNRecord() {
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/metadata/segment/ColumnPartitionMetadataTest.java b/pinot-common/src/test/java/org/apache/pinot/common/metadata/segment/ColumnPartitionMetadataTest.java
index 34fc41a..887770d 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/metadata/segment/ColumnPartitionMetadataTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/metadata/segment/ColumnPartitionMetadataTest.java
@@ -41,7 +41,8 @@ public class ColumnPartitionMetadataTest {
public void testSerDe()
throws Exception {
ColumnPartitionMetadata expected = new ColumnPartitionMetadata(FUNCTION_NAME, NUM_PARTITIONS, PARTITIONS);
- ColumnPartitionMetadata actual = JsonUtils.stringToObject(JsonUtils.objectToString(expected), ColumnPartitionMetadata.class);
+ ColumnPartitionMetadata actual =
+ JsonUtils.stringToObject(JsonUtils.objectToString(expected), ColumnPartitionMetadata.class);
assertEquals(actual, expected);
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/metrics/PinotMetricUtilsTest.java b/pinot-common/src/test/java/org/apache/pinot/common/metrics/PinotMetricUtilsTest.java
index fcd3cdd..9683491 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/metrics/PinotMetricUtilsTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/metrics/PinotMetricUtilsTest.java
@@ -75,9 +75,8 @@ public class PinotMetricUtilsTest {
PinotConfiguration configuration = new PinotConfiguration(properties);
PinotMetricUtils.init(configuration.subset("pinot.broker.metrics"));
PinotMetricsRegistry registry = PinotMetricUtils.getPinotMetricsRegistry();
- PinotMetricUtils
- .makePinotTimer(registry, PinotMetricUtils.makePinotMetricName(PinotMetricUtilsTest.class, "dummy"), TimeUnit.MILLISECONDS,
- TimeUnit.MILLISECONDS);
+ PinotMetricUtils.makePinotTimer(registry, PinotMetricUtils.makePinotMetricName(PinotMetricUtilsTest.class, "dummy"),
+ TimeUnit.MILLISECONDS, TimeUnit.MILLISECONDS);
// Check that the two listeners fired
Assert.assertTrue(_listenerOneOkay);
@@ -88,8 +87,8 @@ public class PinotMetricUtilsTest {
public void testMetricValue() {
PinotMetricsRegistry registry = PinotMetricUtils.getPinotMetricsRegistry();
PinotMeter pinotMeter = PinotMetricUtils
- .makePinotMeter(registry, PinotMetricUtils.makePinotMetricName(PinotMetricUtilsTest.class, "testMeter"), "dummyEventType",
- TimeUnit.MILLISECONDS);
+ .makePinotMeter(registry, PinotMetricUtils.makePinotMetricName(PinotMetricUtilsTest.class, "testMeter"),
+ "dummyEventType", TimeUnit.MILLISECONDS);
pinotMeter.mark();
Assert.assertEquals(pinotMeter.count(), 1L);
@@ -99,8 +98,10 @@ public class PinotMetricUtilsTest {
@Test
public void testPinotMetricName() {
- PinotMetricName testMetricName1 = PinotMetricUtils.makePinotMetricName(PinotMetricUtilsTest.class, "testMetricName");
- PinotMetricName testMetricName2 = PinotMetricUtils.makePinotMetricName(PinotMetricUtilsTest.class, "testMetricName");
+ PinotMetricName testMetricName1 =
+ PinotMetricUtils.makePinotMetricName(PinotMetricUtilsTest.class, "testMetricName");
+ PinotMetricName testMetricName2 =
+ PinotMetricUtils.makePinotMetricName(PinotMetricUtilsTest.class, "testMetricName");
Assert.assertNotNull(testMetricName1);
Assert.assertNotNull(testMetricName2);
Assert.assertEquals(testMetricName1, testMetricName2);
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/minion/MinionClientTest.java b/pinot-common/src/test/java/org/apache/pinot/common/minion/MinionClientTest.java
index 2c62722..eddb888 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/minion/MinionClientTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/minion/MinionClientTest.java
@@ -60,7 +60,8 @@ public class MinionClientTest {
public void testTaskSchedule()
throws IOException {
HttpServer httpServer = startServer(14202, "/tasks/schedule",
- createHandler(200, "{\"SegmentGenerationAndPushTask\":\"Task_SegmentGenerationAndPushTask_1607470525615\"}", 0));
+ createHandler(200, "{\"SegmentGenerationAndPushTask\":\"Task_SegmentGenerationAndPushTask_1607470525615\"}",
+ 0));
MinionClient minionClient = new MinionClient("localhost", "14202");
Assert.assertEquals(minionClient.scheduleMinionTasks(null, null).get("SegmentGenerationAndPushTask"),
"Task_SegmentGenerationAndPushTask_1607470525615");
@@ -73,16 +74,16 @@ public class MinionClientTest {
HttpServer httpServer = startServer(14203, "/tasks/SegmentGenerationAndPushTask/taskstates",
createHandler(200, "{\"Task_SegmentGenerationAndPushTask_1607470525615\":\"IN_PROGRESS\"}", 0));
MinionClient minionClient = new MinionClient("http", "localhost", "14203");
- Assert.assertEquals(minionClient.getTasksStates("SegmentGenerationAndPushTask").get("Task_SegmentGenerationAndPushTask_1607470525615"),
- "IN_PROGRESS");
+ Assert.assertEquals(minionClient.getTasksStates("SegmentGenerationAndPushTask")
+ .get("Task_SegmentGenerationAndPushTask_1607470525615"), "IN_PROGRESS");
httpServer.stop(0);
}
@Test
public void testTaskState()
throws IOException {
- HttpServer httpServer =
- startServer(14204, "/tasks/task/Task_SegmentGenerationAndPushTask_1607470525615/state", createHandler(200, "\"COMPLETED\"", 0));
+ HttpServer httpServer = startServer(14204, "/tasks/task/Task_SegmentGenerationAndPushTask_1607470525615/state",
+ createHandler(200, "\"COMPLETED\"", 0));
MinionClient minionClient = new MinionClient("http://localhost:14204");
Assert.assertEquals(minionClient.getTaskState("Task_SegmentGenerationAndPushTask_1607470525615"), "\"COMPLETED\"");
httpServer.stop(0);
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/protocols/SegmentCompletionProtocolTest.java b/pinot-common/src/test/java/org/apache/pinot/common/protocols/SegmentCompletionProtocolTest.java
index d72c105..2f5edb8 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/protocols/SegmentCompletionProtocolTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/protocols/SegmentCompletionProtocolTest.java
@@ -35,7 +35,8 @@ public class SegmentCompletionProtocolTest {
// test default params
SegmentCompletionProtocol.Request.Params params = new SegmentCompletionProtocol.Request.Params();
- SegmentCompletionProtocol.ExtendBuildTimeRequest extendBuildTimeRequest = new SegmentCompletionProtocol.ExtendBuildTimeRequest(params);
+ SegmentCompletionProtocol.ExtendBuildTimeRequest extendBuildTimeRequest =
+ new SegmentCompletionProtocol.ExtendBuildTimeRequest(params);
URI uri = new URI(extendBuildTimeRequest.getUrl("localhost:8080", "http"));
Assert.assertEquals(uri.getScheme(), "http");
Assert.assertEquals(uri.getHost(), "localhost");
@@ -57,12 +58,15 @@ public class SegmentCompletionProtocolTest {
Assert.assertNull(paramsMap.get(SegmentCompletionProtocol.PARAM_STREAM_PARTITION_MSG_OFFSET));
// test that params set only if valid values
- params = new SegmentCompletionProtocol.Request.Params().withSegmentName("foo__0__0__12345Z").withInstanceId("Server_localhost_8099")
- .withReason(null).withBuildTimeMillis(-100).withWaitTimeMillis(0).withExtraTimeSec(-1).withMemoryUsedBytes(0)
- .withSegmentSizeBytes(-12345).withNumRows(0).withSegmentLocation(null).withStreamPartitionMsgOffset(null);
- SegmentCompletionProtocol.SegmentConsumedRequest segmentConsumedRequest = new SegmentCompletionProtocol.SegmentConsumedRequest(params);
+ params = new SegmentCompletionProtocol.Request.Params().withSegmentName("foo__0__0__12345Z")
+ .withInstanceId("Server_localhost_8099").withReason(null).withBuildTimeMillis(-100).withWaitTimeMillis(0)
+ .withExtraTimeSec(-1).withMemoryUsedBytes(0).withSegmentSizeBytes(-12345).withNumRows(0)
+ .withSegmentLocation(null).withStreamPartitionMsgOffset(null);
+ SegmentCompletionProtocol.SegmentConsumedRequest segmentConsumedRequest =
+ new SegmentCompletionProtocol.SegmentConsumedRequest(params);
uri = new URI(segmentConsumedRequest.getUrl("localhost:8080", "http"));
- paramsMap = Arrays.stream(uri.getQuery().split("&")).collect(Collectors.toMap(e -> e.split("=")[0], e -> e.split("=")[1]));
+ paramsMap =
+ Arrays.stream(uri.getQuery().split("&")).collect(Collectors.toMap(e -> e.split("=")[0], e -> e.split("=")[1]));
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_SEGMENT_NAME), "foo__0__0__12345Z");
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_OFFSET), "-1");
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_INSTANCE_ID), "Server_localhost_8099");
@@ -76,12 +80,15 @@ public class SegmentCompletionProtocolTest {
Assert.assertNull(paramsMap.get(SegmentCompletionProtocol.PARAM_SEGMENT_LOCATION));
Assert.assertNull(paramsMap.get(SegmentCompletionProtocol.PARAM_STREAM_PARTITION_MSG_OFFSET));
- params = new SegmentCompletionProtocol.Request.Params().withSegmentName("foo__0__0__12345Z").withInstanceId("Server_localhost_8099")
- .withReason("ROW_LIMIT").withBuildTimeMillis(1000).withWaitTimeMillis(2000).withExtraTimeSec(3000).withMemoryUsedBytes(4000)
- .withSegmentSizeBytes(5000).withNumRows(6000).withSegmentLocation("/tmp/segment").withStreamPartitionMsgOffset("7000");
- SegmentCompletionProtocol.SegmentCommitRequest segmentCommitRequest = new SegmentCompletionProtocol.SegmentCommitRequest(params);
+ params = new SegmentCompletionProtocol.Request.Params().withSegmentName("foo__0__0__12345Z")
+ .withInstanceId("Server_localhost_8099").withReason("ROW_LIMIT").withBuildTimeMillis(1000)
+ .withWaitTimeMillis(2000).withExtraTimeSec(3000).withMemoryUsedBytes(4000).withSegmentSizeBytes(5000)
+ .withNumRows(6000).withSegmentLocation("/tmp/segment").withStreamPartitionMsgOffset("7000");
+ SegmentCompletionProtocol.SegmentCommitRequest segmentCommitRequest =
+ new SegmentCompletionProtocol.SegmentCommitRequest(params);
uri = new URI(segmentCommitRequest.getUrl("localhost:8080", "http"));
- paramsMap = Arrays.stream(uri.getQuery().split("&")).collect(Collectors.toMap(e -> e.split("=")[0], e -> e.split("=")[1]));
+ paramsMap =
+ Arrays.stream(uri.getQuery().split("&")).collect(Collectors.toMap(e -> e.split("=")[0], e -> e.split("=")[1]));
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_SEGMENT_NAME), "foo__0__0__12345Z");
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_OFFSET), "-1");
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_INSTANCE_ID), "Server_localhost_8099");
@@ -96,25 +103,32 @@ public class SegmentCompletionProtocolTest {
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_STREAM_PARTITION_MSG_OFFSET), "7000");
// test param encoding
- params = new SegmentCompletionProtocol.Request.Params().withSegmentName("foo%%__0__0__12345Z").withInstanceId("Server_localhost_8099")
- .withReason("{\"type\":\"ROW_LIMIT\", \"value\":1000}").withBuildTimeMillis(1000).withWaitTimeMillis(2000).withExtraTimeSec(3000)
- .withMemoryUsedBytes(4000).withSegmentSizeBytes(5000).withNumRows(6000).withSegmentLocation("s3://my.bucket/segment")
- .withStreamPartitionMsgOffset("{\"shardId-000000000001\":\"49615238429973311938200772279310862572716999467690098706\"}");
+ params = new SegmentCompletionProtocol.Request.Params().withSegmentName("foo%%__0__0__12345Z")
+ .withInstanceId("Server_localhost_8099").withReason("{\"type\":\"ROW_LIMIT\", \"value\":1000}")
+ .withBuildTimeMillis(1000).withWaitTimeMillis(2000).withExtraTimeSec(3000).withMemoryUsedBytes(4000)
+ .withSegmentSizeBytes(5000).withNumRows(6000).withSegmentLocation("s3://my.bucket/segment")
+ .withStreamPartitionMsgOffset(
+ "{\"shardId-000000000001\":\"49615238429973311938200772279310862572716999467690098706\"}");
SegmentCompletionProtocol.SegmentCommitStartRequest segmentCommitStartRequest =
new SegmentCompletionProtocol.SegmentCommitStartRequest(params);
String url = segmentCommitStartRequest.getUrl("localhost:8080", "http");
- paramsMap = Arrays.stream(url.split("\\?")[1].split("&")).collect(Collectors.toMap(e -> e.split("=")[0], e -> e.split("=")[1]));
- Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_SEGMENT_NAME), URIUtils.encode("foo%%__0__0__12345Z"));
+ paramsMap = Arrays.stream(url.split("\\?")[1].split("&"))
+ .collect(Collectors.toMap(e -> e.split("=")[0], e -> e.split("=")[1]));
+ Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_SEGMENT_NAME),
+ URIUtils.encode("foo%%__0__0__12345Z"));
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_OFFSET), "-1");
- Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_INSTANCE_ID), URIUtils.encode("Server_localhost_8099"));
- Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_REASON), URIUtils.encode("{\"type\":\"ROW_LIMIT\", \"value\":1000}"));
+ Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_INSTANCE_ID),
+ URIUtils.encode("Server_localhost_8099"));
+ Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_REASON),
+ URIUtils.encode("{\"type\":\"ROW_LIMIT\", \"value\":1000}"));
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_BUILD_TIME_MILLIS), "1000");
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_WAIT_TIME_MILLIS), "2000");
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_EXTRA_TIME_SEC), "3000");
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_MEMORY_USED_BYTES), "4000");
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_SEGMENT_SIZE_BYTES), "5000");
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_ROW_COUNT), "6000");
- Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_SEGMENT_LOCATION), URIUtils.encode("s3://my.bucket/segment"));
+ Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_SEGMENT_LOCATION),
+ URIUtils.encode("s3://my.bucket/segment"));
Assert.assertEquals(paramsMap.get(SegmentCompletionProtocol.PARAM_STREAM_PARTITION_MSG_OFFSET),
URIUtils.encode("{\"shardId-000000000001\":\"49615238429973311938200772279310862572716999467690098706\"}"));
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/request/transform/TransformExpressionTreeTest.java b/pinot-common/src/test/java/org/apache/pinot/common/request/transform/TransformExpressionTreeTest.java
index 00514e9..f1d7511 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/request/transform/TransformExpressionTreeTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/request/transform/TransformExpressionTreeTest.java
@@ -118,7 +118,7 @@ public class TransformExpressionTreeTest {
}
private static boolean equalsWithStandardExpressionTree(TransformExpressionTree expressionTree) {
- return expressionTree.hashCode() == STANDARD_EXPRESSION_TREE.hashCode() && expressionTree.equals(STANDARD_EXPRESSION_TREE)
- && expressionTree.toString().equals(STANDARD_EXPRESSION);
+ return expressionTree.hashCode() == STANDARD_EXPRESSION_TREE.hashCode() && expressionTree
+ .equals(STANDARD_EXPRESSION_TREE) && expressionTree.toString().equals(STANDARD_EXPRESSION);
}
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/segment/generation/SegmentGenerationUtilsTest.java b/pinot-common/src/test/java/org/apache/pinot/common/segment/generation/SegmentGenerationUtilsTest.java
index ce9b5ff..9229021 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/segment/generation/SegmentGenerationUtilsTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/segment/generation/SegmentGenerationUtilsTest.java
@@ -31,12 +31,15 @@ public class SegmentGenerationUtilsTest {
@Test
public void testExtractFileNameFromURI() {
- Assert.assertEquals(SegmentGenerationUtils.getFileName(URI.create("file:/var/data/myTable/2020/04/06/input.data")), "input.data");
- Assert.assertEquals(SegmentGenerationUtils.getFileName(URI.create("/var/data/myTable/2020/04/06/input.data")), "input.data");
- Assert.assertEquals(
- SegmentGenerationUtils.getFileName(URI.create("dbfs:/mnt/mydb/mytable/pt_year=2020/pt_month=4/pt_date=2020-04-01/input.data")),
+ Assert.assertEquals(SegmentGenerationUtils.getFileName(URI.create("file:/var/data/myTable/2020/04/06/input.data")),
+ "input.data");
+ Assert.assertEquals(SegmentGenerationUtils.getFileName(URI.create("/var/data/myTable/2020/04/06/input.data")),
+ "input.data");
+ Assert.assertEquals(SegmentGenerationUtils
+ .getFileName(URI.create("dbfs:/mnt/mydb/mytable/pt_year=2020/pt_month=4/pt_date=2020-04-01/input.data")),
+ "input.data");
+ Assert.assertEquals(SegmentGenerationUtils.getFileName(URI.create("hdfs://var/data/myTable/2020/04/06/input.data")),
"input.data");
- Assert.assertEquals(SegmentGenerationUtils.getFileName(URI.create("hdfs://var/data/myTable/2020/04/06/input.data")), "input.data");
}
// Confirm output path generation works with URIs that have authority/userInfo.
@@ -47,8 +50,8 @@ public class SegmentGenerationUtilsTest {
URI inputFileURI = new URI("hdfs://namenode1:9999/path/to/subdir/file");
URI outputDirURI = new URI("hdfs://namenode2/output/dir/");
URI segmentTarFileName = new URI("file.tar.gz");
- URI outputSegmentTarURI =
- SegmentGenerationUtils.getRelativeOutputPath(inputDirURI, inputFileURI, outputDirURI).resolve(segmentTarFileName);
+ URI outputSegmentTarURI = SegmentGenerationUtils.getRelativeOutputPath(inputDirURI, inputFileURI, outputDirURI)
+ .resolve(segmentTarFileName);
Assert.assertEquals(outputSegmentTarURI.toString(), "hdfs://namenode2/output/dir/subdir/file.tar.gz");
}
@@ -67,9 +70,11 @@ public class SegmentGenerationUtilsTest {
Assert.assertTrue(e instanceof URISyntaxException);
}
URI outputSegmentTarURI = SegmentGenerationUtils.getRelativeOutputPath(inputDirURI, inputFileURI, outputDirURI)
- .resolve(new URI(URLEncoder.encode("table_OFFLINE_2021-02-01_09:39:00.000_2021-02-01_11:59:00.000_2.tar.gz", "UTF-8")));
+ .resolve(new URI(
+ URLEncoder.encode("table_OFFLINE_2021-02-01_09:39:00.000_2021-02-01_11:59:00.000_2.tar.gz", "UTF-8")));
Assert.assertEquals(outputSegmentTarURI.toString(),
- "hdfs://namenode2/output/dir/subdir/table_OFFLINE_2021-02-01_09%3A39%3A00.000_2021-02-01_11%3A59%3A00.000_2" + ".tar.gz");
+ "hdfs://namenode2/output/dir/subdir/table_OFFLINE_2021-02-01_09%3A39%3A00.000_2021-02-01_11%3A59%3A00.000_2"
+ + ".tar.gz");
}
// Don't lose authority portion of inputDirURI when creating output files
@@ -79,10 +84,13 @@ public class SegmentGenerationUtilsTest {
public void testGetFileURI()
throws Exception {
// Raw path without scheme
- Assert.assertEquals(SegmentGenerationUtils.getFileURI("/path/to/file", new URI("file:/path/to")).toString(), "file:/path/to/file");
- Assert.assertEquals(SegmentGenerationUtils.getFileURI("/path/to/file", new URI("hdfs://namenode/path/to")).toString(),
- "hdfs://namenode/path/to/file");
- Assert.assertEquals(SegmentGenerationUtils.getFileURI("/path/to/file", new URI("hdfs:///path/to")).toString(), "hdfs:/path/to/file");
+ Assert.assertEquals(SegmentGenerationUtils.getFileURI("/path/to/file", new URI("file:/path/to")).toString(),
+ "file:/path/to/file");
+ Assert
+ .assertEquals(SegmentGenerationUtils.getFileURI("/path/to/file", new URI("hdfs://namenode/path/to")).toString(),
+ "hdfs://namenode/path/to/file");
+ Assert.assertEquals(SegmentGenerationUtils.getFileURI("/path/to/file", new URI("hdfs:///path/to")).toString(),
+ "hdfs:/path/to/file");
// Typical local file URI
validateFileURI(new URI("file:/path/to/"));
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/tier/TierConfigUtilsTest.java b/pinot-common/src/test/java/org/apache/pinot/common/tier/TierConfigUtilsTest.java
index 6117bc1..0b9f0a9 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/tier/TierConfigUtilsTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/tier/TierConfigUtilsTest.java
@@ -43,12 +43,14 @@ public class TierConfigUtilsTest {
tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName("myTable").setTierConfigList(null).build();
Assert.assertFalse(TierConfigUtils.shouldRelocateToTiers(tableConfig));
- tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName("myTable").setTierConfigList(Collections.emptyList()).build();
+ tableConfig =
+ new TableConfigBuilder(TableType.OFFLINE).setTableName("myTable").setTierConfigList(Collections.emptyList())
+ .build();
Assert.assertFalse(TierConfigUtils.shouldRelocateToTiers(tableConfig));
- tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName("myTable").setTierConfigList(Lists.newArrayList(
- new TierConfig("myTier", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "10d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tag_OFFLINE")))
- .build();
+ tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName("myTable").setTierConfigList(Lists
+ .newArrayList(new TierConfig("myTier", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "10d",
+ TierFactory.PINOT_SERVER_STORAGE_TYPE, "tag_OFFLINE"))).build();
Assert.assertTrue(TierConfigUtils.shouldRelocateToTiers(tableConfig));
tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName("myTable").build();
@@ -57,12 +59,14 @@ public class TierConfigUtilsTest {
tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName("myTable").setTierConfigList(null).build();
Assert.assertFalse(TierConfigUtils.shouldRelocateToTiers(tableConfig));
- tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName("myTable").setTierConfigList(Collections.emptyList()).build();
+ tableConfig =
+ new TableConfigBuilder(TableType.REALTIME).setTableName("myTable").setTierConfigList(Collections.emptyList())
+ .build();
Assert.assertFalse(TierConfigUtils.shouldRelocateToTiers(tableConfig));
- tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName("myTable").setTierConfigList(Lists.newArrayList(
- new TierConfig("myTier", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "10d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tag_OFFLINE")))
- .build();
+ tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName("myTable").setTierConfigList(Lists
+ .newArrayList(new TierConfig("myTier", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "10d",
+ TierFactory.PINOT_SERVER_STORAGE_TYPE, "tag_OFFLINE"))).build();
Assert.assertTrue(TierConfigUtils.shouldRelocateToTiers(tableConfig));
}
@@ -72,12 +76,14 @@ public class TierConfigUtilsTest {
@Test
public void testGetTier() {
TierConfig tierConfig =
- new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE, "tier1_tag_OFFLINE");
+ new TierConfig("tier1", TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "30d", TierFactory.PINOT_SERVER_STORAGE_TYPE,
+ "tier1_tag_OFFLINE");
Tier tier = TierFactory.getTier(tierConfig, null);
Assert.assertEquals(tier.getName(), "tier1");
Assert.assertTrue(tier.getSegmentSelector() instanceof TimeBasedTierSegmentSelector);
Assert.assertEquals(tier.getSegmentSelector().getType(), TierFactory.TIME_SEGMENT_SELECTOR_TYPE);
- Assert.assertEquals(((TimeBasedTierSegmentSelector) tier.getSegmentSelector()).getSegmentAgeMillis(), 30 * 24 * 60 * 60 * 1000L);
+ Assert.assertEquals(((TimeBasedTierSegmentSelector) tier.getSegmentSelector()).getSegmentAgeMillis(),
+ 30 * 24 * 60 * 60 * 1000L);
Assert.assertTrue(tier.getStorage() instanceof PinotServerTierStorage);
Assert.assertEquals(tier.getStorage().getType(), TierFactory.PINOT_SERVER_STORAGE_TYPE);
Assert.assertEquals(((PinotServerTierStorage) tier.getStorage()).getTag(), "tier1_tag_OFFLINE");
@@ -106,11 +112,16 @@ public class TierConfigUtilsTest {
public void testTierComparator() {
Comparator<Tier> tierComparator = TierConfigUtils.getTierComparator();
- Tier tier1 = new Tier("tier1", new TimeBasedTierSegmentSelector(null, "30d"), new PinotServerTierStorage("tag_OFFLINE"));
- Tier tier2 = new Tier("tier2", new TimeBasedTierSegmentSelector(null, "1000d"), new PinotServerTierStorage("tag_OFFLINE"));
- Tier tier3 = new Tier("tier3", new TimeBasedTierSegmentSelector(null, "24h"), new PinotServerTierStorage("tag_OFFLINE"));
- Tier tier4 = new Tier("tier4", new TimeBasedTierSegmentSelector(null, "10m"), new PinotServerTierStorage("tag_OFFLINE"));
- Tier tier5 = new Tier("tier5", new TimeBasedTierSegmentSelector(null, "1d"), new PinotServerTierStorage("tag_OFFLINE"));
+ Tier tier1 =
+ new Tier("tier1", new TimeBasedTierSegmentSelector(null, "30d"), new PinotServerTierStorage("tag_OFFLINE"));
+ Tier tier2 =
+ new Tier("tier2", new TimeBasedTierSegmentSelector(null, "1000d"), new PinotServerTierStorage("tag_OFFLINE"));
+ Tier tier3 =
+ new Tier("tier3", new TimeBasedTierSegmentSelector(null, "24h"), new PinotServerTierStorage("tag_OFFLINE"));
+ Tier tier4 =
+ new Tier("tier4", new TimeBasedTierSegmentSelector(null, "10m"), new PinotServerTierStorage("tag_OFFLINE"));
+ Tier tier5 =
+ new Tier("tier5", new TimeBasedTierSegmentSelector(null, "1d"), new PinotServerTierStorage("tag_OFFLINE"));
Assert.assertEquals(tierComparator.compare(tier1, tier2), 1);
Assert.assertEquals(tierComparator.compare(tier1, tier3), -1);
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/tier/TierSegmentSelectorTest.java b/pinot-common/src/test/java/org/apache/pinot/common/tier/TierSegmentSelectorTest.java
index f1b1517..0052ab9 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/tier/TierSegmentSelectorTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/tier/TierSegmentSelectorTest.java
@@ -53,8 +53,9 @@ public class TierSegmentSelectorTest {
ZNRecord segmentZKMetadataZNRecord = offlineSegmentZKMetadata.toZNRecord();
ZkHelixPropertyStore<ZNRecord> propertyStore = mock(ZkHelixPropertyStore.class);
- when(propertyStore.get(eq(ZKMetadataProvider.constructPropertyStorePathForSegment(tableNameWithType, segmentName)), any(), anyInt()))
- .thenReturn(segmentZKMetadataZNRecord);
+ when(propertyStore
+ .get(eq(ZKMetadataProvider.constructPropertyStorePathForSegment(tableNameWithType, segmentName)), any(),
+ anyInt())).thenReturn(segmentZKMetadataZNRecord);
HelixManager helixManager = mock(HelixManager.class);
when(helixManager.getHelixPropertyStore()).thenReturn(propertyStore);
@@ -89,8 +90,9 @@ public class TierSegmentSelectorTest {
realtimeSegmentZKMetadata.setNumReplicas(1);
segmentZKMetadataZNRecord = realtimeSegmentZKMetadata.toZNRecord();
- when(propertyStore.get(eq(ZKMetadataProvider.constructPropertyStorePathForSegment(tableNameWithType, segmentName)), any(), anyInt()))
- .thenReturn(segmentZKMetadataZNRecord);
+ when(propertyStore
+ .get(eq(ZKMetadataProvider.constructPropertyStorePathForSegment(tableNameWithType, segmentName)), any(),
+ anyInt())).thenReturn(segmentZKMetadataZNRecord);
helixManager = mock(HelixManager.class);
when(helixManager.getHelixPropertyStore()).thenReturn(propertyStore);
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/DataSchemaTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/DataSchemaTest.java
index 407b2e0..d84f41d 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/DataSchemaTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/DataSchemaTest.java
@@ -27,15 +27,18 @@ import static org.apache.pinot.common.utils.DataSchema.ColumnDataType.*;
public class DataSchemaTest {
- private static final String[] COLUMN_NAMES =
- {"int", "long", "float", "double", "string", "object", "int_array", "long_array", "float_array", "double_array", "string_array"};
+ private static final String[] COLUMN_NAMES = {
+ "int", "long", "float", "double", "string", "object", "int_array", "long_array", "float_array", "double_array",
+ "string_array"
+ };
private static final int NUM_COLUMNS = COLUMN_NAMES.length;
private static final DataSchema.ColumnDataType[] COLUMN_DATA_TYPES =
{INT, LONG, FLOAT, DOUBLE, STRING, OBJECT, INT_ARRAY, LONG_ARRAY, FLOAT_ARRAY, DOUBLE_ARRAY, STRING_ARRAY};
private static final DataSchema.ColumnDataType[] COMPATIBLE_COLUMN_DATA_TYPES =
{LONG, FLOAT, DOUBLE, INT, STRING, OBJECT, LONG_ARRAY, FLOAT_ARRAY, DOUBLE_ARRAY, INT_ARRAY, STRING_ARRAY};
- private static final DataSchema.ColumnDataType[] UPGRADED_COLUMN_DATA_TYPES =
- {LONG, DOUBLE, DOUBLE, DOUBLE, STRING, OBJECT, LONG_ARRAY, DOUBLE_ARRAY, DOUBLE_ARRAY, DOUBLE_ARRAY, STRING_ARRAY};
+ private static final DataSchema.ColumnDataType[] UPGRADED_COLUMN_DATA_TYPES = {
+ LONG, DOUBLE, DOUBLE, DOUBLE, STRING, OBJECT, LONG_ARRAY, DOUBLE_ARRAY, DOUBLE_ARRAY, DOUBLE_ARRAY, STRING_ARRAY
+ };
@Test
public void testGetters() {
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/FileUploadDownloadClientTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/FileUploadDownloadClientTest.java
index 0e24e09..01a08ab 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/FileUploadDownloadClientTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/FileUploadDownloadClientTest.java
@@ -74,8 +74,8 @@ public class FileUploadDownloadClientTest {
if (uploadType == FileUploadType.JSON) {
InputStream bodyStream = httpExchange.getRequestBody();
- downloadUri =
- JsonUtils.stringToJsonNode(IOUtils.toString(bodyStream, "UTF-8")).get(CommonConstants.Segment.Offline.DOWNLOAD_URL).asText();
+ downloadUri = JsonUtils.stringToJsonNode(IOUtils.toString(bodyStream, "UTF-8"))
+ .get(CommonConstants.Segment.Offline.DOWNLOAD_URL).asText();
} else if (uploadType == FileUploadType.URI) {
downloadUri = requestHeaders.getFirst(FileUploadDownloadClient.CustomHeaders.DOWNLOAD_URI);
String crypter = requestHeaders.getFirst(FileUploadDownloadClient.CustomHeaders.CRYPTER);
@@ -106,8 +106,8 @@ public class FileUploadDownloadClientTest {
List<NameValuePair> params = null;
SimpleHttpResponse response = fileUploadDownloadClient
- .sendSegmentUri(FileUploadDownloadClient.getUploadSegmentHttpURI(TEST_HOST, TEST_PORT), TEST_URI, headers, params,
- FileUploadDownloadClient.DEFAULT_SOCKET_TIMEOUT_MS);
+ .sendSegmentUri(FileUploadDownloadClient.getUploadSegmentHttpURI(TEST_HOST, TEST_PORT), TEST_URI, headers,
+ params, FileUploadDownloadClient.DEFAULT_SOCKET_TIMEOUT_MS);
Assert.assertEquals(response.getStatusCode(), HttpStatus.SC_OK);
Assert.assertEquals(response.getResponse(), "OK");
}
@@ -120,8 +120,8 @@ public class FileUploadDownloadClientTest {
segmentJson.put(CommonConstants.Segment.Offline.DOWNLOAD_URL, TEST_URI);
String jsonString = segmentJson.toString();
try (FileUploadDownloadClient fileUploadDownloadClient = new FileUploadDownloadClient()) {
- SimpleHttpResponse response =
- fileUploadDownloadClient.sendSegmentJson(FileUploadDownloadClient.getUploadSegmentHttpURI(TEST_HOST, TEST_PORT), jsonString);
+ SimpleHttpResponse response = fileUploadDownloadClient
+ .sendSegmentJson(FileUploadDownloadClient.getUploadSegmentHttpURI(TEST_HOST, TEST_PORT), jsonString);
Assert.assertEquals(response.getStatusCode(), HttpStatus.SC_OK);
Assert.assertEquals(response.getResponse(), "OK");
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/PinotDataTypeTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/PinotDataTypeTest.java
index 160d567..5906d3c 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/PinotDataTypeTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/PinotDataTypeTest.java
@@ -32,36 +32,45 @@ import static org.testng.Assert.fail;
public class PinotDataTypeTest {
- private static final PinotDataType[] SOURCE_TYPES =
- {BYTE, CHARACTER, SHORT, INTEGER, LONG, FLOAT, DOUBLE, STRING, JSON, BYTE_ARRAY, CHARACTER_ARRAY, SHORT_ARRAY, INTEGER_ARRAY,
- LONG_ARRAY, FLOAT_ARRAY, DOUBLE_ARRAY, STRING_ARRAY};
- private static final Object[] SOURCE_VALUES =
- {(byte) 123, (char) 123, (short) 123, 123, 123L, 123f, 123d, " 123", "123 ", new Object[]{(byte) 123}, new Object[]{(char) 123},
- new Object[]{(short) 123}, new Object[]{123}, new Object[]{123L}, new Object[]{123f}, new Object[]{123d}, new Object[]{" 123"}};
- private static final PinotDataType[] DEST_TYPES = {INTEGER, LONG, FLOAT, DOUBLE, INTEGER_ARRAY, LONG_ARRAY, FLOAT_ARRAY, DOUBLE_ARRAY};
+ private static final PinotDataType[] SOURCE_TYPES = {
+ BYTE, CHARACTER, SHORT, INTEGER, LONG, FLOAT, DOUBLE, STRING, JSON, BYTE_ARRAY, CHARACTER_ARRAY, SHORT_ARRAY,
+ INTEGER_ARRAY, LONG_ARRAY, FLOAT_ARRAY, DOUBLE_ARRAY, STRING_ARRAY
+ };
+ private static final Object[] SOURCE_VALUES = {
+ (byte) 123, (char) 123, (short) 123, 123, 123L, 123f, 123d, " 123", "123 ", new Object[]{(byte) 123},
+ new Object[]{(char) 123}, new Object[]{(short) 123}, new Object[]{123}, new Object[]{123L}, new Object[]{123f},
+ new Object[]{123d}, new Object[]{" 123"}
+ };
+ private static final PinotDataType[] DEST_TYPES =
+ {INTEGER, LONG, FLOAT, DOUBLE, INTEGER_ARRAY, LONG_ARRAY, FLOAT_ARRAY, DOUBLE_ARRAY};
private static final Object[] EXPECTED_DEST_VALUES =
{123, 123L, 123f, 123d, new Object[]{123}, new Object[]{123L}, new Object[]{123f}, new Object[]{123d}};
- private static final String[] EXPECTED_STRING_VALUES =
- {Byte.toString((byte) 123), Character.toString((char) 123), Short.toString((short) 123), Integer.toString(123), Long.toString(
- 123L), Float.toString(123f), Double.toString(123d), " 123", "123 ", Byte.toString((byte) 123), Character.toString(
- (char) 123), Short.toString((short) 123), Integer.toString(123), Long.toString(123L), Float.toString(123f), Double.toString(
- 123d), " 123"
- };
+ private static final String[] EXPECTED_STRING_VALUES = {
+ Byte.toString((byte) 123), Character.toString((char) 123), Short.toString((short) 123), Integer.toString(123),
+ Long.toString(123L), Float.toString(123f), Double.toString(123d), " 123", "123 ", Byte.toString((byte) 123),
+ Character.toString((char) 123), Short.toString((short) 123), Integer.toString(123), Long.toString(123L),
+ Float.toString(123f), Double.toString(123d), " 123"
+ };
// Test cases where array for MV column contains values of mixing types.
- private static final PinotDataType[] SOURCE_ARRAY_TYPES = {SHORT_ARRAY, INTEGER_ARRAY, LONG_ARRAY, FLOAT_ARRAY, DOUBLE_ARRAY};
+ private static final PinotDataType[] SOURCE_ARRAY_TYPES =
+ {SHORT_ARRAY, INTEGER_ARRAY, LONG_ARRAY, FLOAT_ARRAY, DOUBLE_ARRAY};
private static final Object[] SOURCE_ARRAY_VALUES = new Object[]{(short) 123, 4, 5L, 6f, 7d, "8"};
private static final PinotDataType[] DEST_ARRAY_TYPES = {INTEGER_ARRAY, LONG_ARRAY, FLOAT_ARRAY, DOUBLE_ARRAY};
- private static final Object[] EXPECTED_DEST_ARRAY_VALUES =
- {new Object[]{123, 4, 5, 6, 7, 8}, new Object[]{123L, 4L, 5L, 6L, 7L, 8L}, new Object[]{123f, 4f, 5f, 6f, 7f, 8f},
- new Object[]{123d, 4d, 5d, 6d, 7d, 8d}};
+ private static final Object[] EXPECTED_DEST_ARRAY_VALUES = {
+ new Object[]{123, 4, 5, 6, 7, 8}, new Object[]{123L, 4L, 5L, 6L, 7L, 8L}, new Object[]{123f, 4f, 5f, 6f, 7f, 8f},
+ new Object[]{123d, 4d, 5d, 6d, 7d, 8d}
+ };
private static final PinotDataType[] DEST_PRIMITIVE_ARRAY_TYPES =
{PRIMITIVE_INT_ARRAY, PRIMITIVE_LONG_ARRAY, PRIMITIVE_FLOAT_ARRAY, PRIMITIVE_DOUBLE_ARRAY};
- private static final Object[] EXPECTED_DEST_PRIMITIVE_ARRAY_VALUES =
- {new int[]{123, 4, 5, 6, 7, 8}, new long[]{123L, 4L, 5L, 6L, 7L, 8L}, new float[]{123f, 4f, 5f, 6f, 7f, 8f}, new double[]{123d, 4d,
- 5d, 6d, 7d, 8d}};
+ private static final Object[] EXPECTED_DEST_PRIMITIVE_ARRAY_VALUES = {
+ new int[]{123, 4, 5, 6, 7, 8}, new long[]{123L, 4L, 5L, 6L, 7L, 8L}, new float[]{123f, 4f, 5f, 6f, 7f, 8f},
+ new double[]{
+ 123d, 4d, 5d, 6d, 7d, 8d
+ }
+ };
@Test
public void testNumberConversion() {
@@ -163,10 +172,10 @@ public class PinotDataTypeTest {
assertEquals(JSON.convert(false, BOOLEAN), "false");
assertEquals(JSON.convert(true, BOOLEAN), "true");
assertEquals(JSON.convert(new byte[]{0, 1}, BYTES), "\"AAE=\""); // Base64 encoding.
- assertEquals(JSON.convert(
- "{\"bytes\":\"AAE=\",\"map\":{\"key1\":\"value\",\"key2\":null,\"array\":[-5.4,4,\"2\"]}," + "\"timestamp\":1620324238610}",
- STRING),
- "{\"bytes\":\"AAE=\",\"map\":{\"key1\":\"value\",\"key2\":null,\"array\":[-5.4,4,\"2\"]}," + "\"timestamp\":1620324238610}");
+ assertEquals(JSON.convert("{\"bytes\":\"AAE=\",\"map\":{\"key1\":\"value\",\"key2\":null,\"array\":[-5.4,4,\"2\"]},"
+ + "\"timestamp\":1620324238610}", STRING),
+ "{\"bytes\":\"AAE=\",\"map\":{\"key1\":\"value\",\"key2\":null,\"array\":[-5.4,4,\"2\"]},"
+ + "\"timestamp\":1620324238610}");
assertEquals(JSON.convert(new Timestamp(1620324238610L), TIMESTAMP), "1620324238610");
}
@@ -180,7 +189,8 @@ public class PinotDataTypeTest {
assertEquals(OBJECT.toTimestamp(new NumberObject("123")).getTime(), 123L);
assertEquals(OBJECT.toString(new NumberObject("123")), "123");
assertEquals(OBJECT.toJson(getGenericTestObject()),
- "{\"bytes\":\"AAE=\",\"map\":{\"key1\":\"value\",\"key2\":null,\"array\":[-5.4,4,\"2\"]}," + "\"timestamp\":1620324238610}");
+ "{\"bytes\":\"AAE=\",\"map\":{\"key1\":\"value\",\"key2\":null,\"array\":[-5.4,4,\"2\"]},"
+ + "\"timestamp\":1620324238610}");
assertEquals(OBJECT_ARRAY.getSingleValueType(), OBJECT);
// Non-zero value is treated as true.
assertTrue(OBJECT.toBoolean(1.1d));
@@ -275,7 +285,8 @@ public class PinotDataTypeTest {
assertInvalidConversion("xyz", STRING, JSON, RuntimeException.class);
}
- private void assertInvalidConversion(Object value, PinotDataType sourceType, PinotDataType destType, Class expectedExceptionType) {
+ private void assertInvalidConversion(Object value, PinotDataType sourceType, PinotDataType destType,
+ Class expectedExceptionType) {
try {
destType.convert(value, sourceType);
} catch (Exception e) {
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/SegmentNameBuilderTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/SegmentNameBuilderTest.java
index bf7b63e..12dcf84 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/SegmentNameBuilderTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/SegmentNameBuilderTest.java
@@ -82,12 +82,16 @@ public class SegmentNameBuilderTest {
assertEquals(shortNameSegment.getSegmentType(), SegmentName.RealtimeSegmentType.HLC_SHORT);
assertEquals(SegmentName.getSegmentType(llcSegment.getSegmentName()), SegmentName.RealtimeSegmentType.LLC);
- assertEquals(SegmentName.getSegmentType(longNameSegment.getSegmentName()), SegmentName.RealtimeSegmentType.HLC_LONG);
- assertEquals(SegmentName.getSegmentType(shortNameSegment.getSegmentName()), SegmentName.RealtimeSegmentType.HLC_SHORT);
+ assertEquals(SegmentName.getSegmentType(longNameSegment.getSegmentName()),
+ SegmentName.RealtimeSegmentType.HLC_LONG);
+ assertEquals(SegmentName.getSegmentType(shortNameSegment.getSegmentName()),
+ SegmentName.RealtimeSegmentType.HLC_SHORT);
// Invalid segment names
- assertEquals(SegmentName.getSegmentType(longNameSegment.getSegmentName() + "__"), SegmentName.RealtimeSegmentType.UNSUPPORTED);
- assertEquals(SegmentName.getSegmentType("a__abc__1__3__4__54__g__gg___h"), SegmentName.RealtimeSegmentType.UNSUPPORTED);
+ assertEquals(SegmentName.getSegmentType(longNameSegment.getSegmentName() + "__"),
+ SegmentName.RealtimeSegmentType.UNSUPPORTED);
+ assertEquals(SegmentName.getSegmentType("a__abc__1__3__4__54__g__gg___h"),
+ SegmentName.RealtimeSegmentType.UNSUPPORTED);
}
@Test
@@ -146,7 +150,8 @@ public class SegmentNameBuilderTest {
LLCSegmentName segName6 = new LLCSegmentName(tableName, partitionGroupId, sequenceNumber + 1, msSinceEpoch);
Assert.assertTrue(segName1.compareTo(segName6) < 0);
- LLCSegmentName segName7 = new LLCSegmentName(tableName + "NotGood", partitionGroupId, sequenceNumber + 1, msSinceEpoch);
+ LLCSegmentName segName7 =
+ new LLCSegmentName(tableName + "NotGood", partitionGroupId, sequenceNumber + 1, msSinceEpoch);
try {
segName1.compareTo(segName7);
Assert.fail("Not failing when comparing " + segName1.getSegmentName() + " and " + segName7.getSegmentName());
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/ServiceStatusTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/ServiceStatusTest.java
index 4f03980..a214f17 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/ServiceStatusTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/ServiceStatusTest.java
@@ -79,7 +79,8 @@ public class ServiceStatusTest {
public static final String TABLE_NAME = "myTable_OFFLINE";
public static final String INSTANCE_NAME = "Server_1.2.3.4_1234";
- private static final String CHARS_IN_RANDOM_TABLE_NAME = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+ private static final String CHARS_IN_RANDOM_TABLE_NAME =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
private static Random _random;
@BeforeClass
@@ -118,7 +119,8 @@ public class ServiceStatusTest {
// Good + starting + bad = starting (check for left-to-right evaluation)
ServiceStatus.MultipleCallbackServiceStatusCallback goodStartingAndBad =
- new ServiceStatus.MultipleCallbackServiceStatusCallback(ImmutableList.of(ALWAYS_GOOD, ALWAYS_STARTING, ALWAYS_BAD));
+ new ServiceStatus.MultipleCallbackServiceStatusCallback(
+ ImmutableList.of(ALWAYS_GOOD, ALWAYS_STARTING, ALWAYS_BAD));
assertEquals(goodStartingAndBad.getServiceStatus(), ServiceStatus.Status.STARTING);
}
@@ -200,7 +202,8 @@ public class ServiceStatusTest {
}
private TestIdealStateAndExternalViewMatchServiceStatusCallback buildTestISEVCallback() {
- return new TestIdealStateAndExternalViewMatchServiceStatusCallback("potato", INSTANCE_NAME, Collections.singletonList(TABLE_NAME));
+ return new TestIdealStateAndExternalViewMatchServiceStatusCallback("potato", INSTANCE_NAME,
+ Collections.singletonList(TABLE_NAME));
}
private String generateRandomString(int len) {
@@ -262,7 +265,8 @@ public class ServiceStatusTest {
// Call getServiceStatus() enough number of times so that we are only left with the tables
// that are not ready yet. We need to call getServiceStatus() at most tableCount times.
for (double minReadyPercent = lowestReadyPercent; minReadyPercent <= 100; minReadyPercent += 0.1) {
- TestMultiResourceISAndEVMatchCB callback = new TestMultiResourceISAndEVMatchCB(clusterName, INSTANCE_NAME, tables, minReadyPercent);
+ TestMultiResourceISAndEVMatchCB callback =
+ new TestMultiResourceISAndEVMatchCB(clusterName, INSTANCE_NAME, tables, minReadyPercent);
callback.setIdealStates(idealStates);
callback.setExternalViews(externalViews);
@@ -275,24 +279,24 @@ public class ServiceStatusTest {
status = callback.getServiceStatus();
}
- ServiceStatus.Status expected = minReadyPercent > actualReadyPercent ? ServiceStatus.Status.STARTING : ServiceStatus.Status.GOOD;
- String errorMsg =
- "Mismatch at " + minReadyPercent + "%, tableCount=" + tableCount + ", percentTablesReady=" + actualReadyPercent + ":" + callback
- .getStatusDescription();
+ ServiceStatus.Status expected =
+ minReadyPercent > actualReadyPercent ? ServiceStatus.Status.STARTING : ServiceStatus.Status.GOOD;
+ String errorMsg = "Mismatch at " + minReadyPercent + "%, tableCount=" + tableCount + ", percentTablesReady="
+ + actualReadyPercent + ":" + callback.getStatusDescription();
Assert.assertEquals(status, expected, errorMsg);
// The status should never change going forward from here.
for (int i = nBadTables + 1; i < tableCount; i++) {
ServiceStatus.Status laterStatus = callback.getServiceStatus();
- String msg =
- "Mismatch at " + minReadyPercent + "%, tableCount=" + tableCount + ", percentTablesReady=" + actualReadyPercent + ", i=" + i
- + ":" + callback.getStatusDescription();
+ String msg = "Mismatch at " + minReadyPercent + "%, tableCount=" + tableCount + ", percentTablesReady="
+ + actualReadyPercent + ", i=" + i + ":" + callback.getStatusDescription();
Assert.assertEquals(laterStatus, status, msg);
}
}
}
- private static class TestIdealStateAndExternalViewMatchServiceStatusCallback extends ServiceStatus.IdealStateAndExternalViewMatchServiceStatusCallback {
+ private static class TestIdealStateAndExternalViewMatchServiceStatusCallback
+ extends ServiceStatus.IdealStateAndExternalViewMatchServiceStatusCallback {
private IdealState _idealState;
private ExternalView _externalView;
@@ -320,7 +324,8 @@ public class ServiceStatusTest {
}
}
- private static class TestMultiResourceISAndEVMatchCB extends ServiceStatus.IdealStateAndExternalViewMatchServiceStatusCallback {
+ private static class TestMultiResourceISAndEVMatchCB
+ extends ServiceStatus.IdealStateAndExternalViewMatchServiceStatusCallback {
public Map<String, IdealState> _idealStates = new HashMap<>();
public Map<String, ExternalView> _externalViews = new HashMap<>();
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/URIUtilsTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/URIUtilsTest.java
index d4cc432..403793a 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/URIUtilsTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/URIUtilsTest.java
@@ -36,9 +36,11 @@ public class URIUtilsTest {
public void testGetUri() {
assertEquals(URIUtils.getUri("http://foo/bar").toString(), "http://foo/bar");
assertEquals(URIUtils.getUri("http://foo/bar", "table").toString(), "http://foo/bar/table");
- assertEquals(URIUtils.getUri("http://foo/bar", "table", "segment+%25").toString(), "http://foo/bar/table/segment+%25");
+ assertEquals(URIUtils.getUri("http://foo/bar", "table", "segment+%25").toString(),
+ "http://foo/bar/table/segment+%25");
assertEquals(URIUtils.getUri("/foo/bar", "table", "segment+%25").toString(), "file:/foo/bar/table/segment+%25");
- assertEquals(URIUtils.getUri("file:/foo/bar", "table", "segment+%25").toString(), "file:/foo/bar/table/segment+%25");
+ assertEquals(URIUtils.getUri("file:/foo/bar", "table", "segment+%25").toString(),
+ "file:/foo/bar/table/segment+%25");
}
@Test
@@ -52,8 +54,10 @@ public class URIUtilsTest {
@Test
public void testConstructDownloadUrl() {
- assertEquals(URIUtils.constructDownloadUrl("http://foo/bar", "table", "segment"), "http://foo/bar/segments/table/segment");
- assertEquals(URIUtils.constructDownloadUrl("http://foo/bar", "table", "segment %"), "http://foo/bar/segments/table/segment+%25");
+ assertEquals(URIUtils.constructDownloadUrl("http://foo/bar", "table", "segment"),
+ "http://foo/bar/segments/table/segment");
+ assertEquals(URIUtils.constructDownloadUrl("http://foo/bar", "table", "segment %"),
+ "http://foo/bar/segments/table/segment+%25");
}
@Test
@@ -82,8 +86,8 @@ public class URIUtilsTest {
params.put("stringParam", "aString");
params.put("stringParamNeedsEncoding", "{\"format\":\"JSON\",\"timeout\":1000}");
uri = URIUtils.buildURI("http", "foo", "bar", params);
- Assert.assertEquals(uri.toString(),
- "http://foo/bar?stringParam=aString&stringParamNeedsEncoding=" + URIUtils.encode("{\"format\":\"JSON\",\"timeout\":1000}"));
+ Assert.assertEquals(uri.toString(), "http://foo/bar?stringParam=aString&stringParamNeedsEncoding=" + URIUtils
+ .encode("{\"format\":\"JSON\",\"timeout\":1000}"));
// test that path gets encoded
uri = URIUtils.buildURI("http", "foo", "bar%moo{}", Collections.emptyMap());
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/config/InstanceUtilsTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/config/InstanceUtilsTest.java
index 8301e36..09cc182 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/config/InstanceUtilsTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/config/InstanceUtilsTest.java
@@ -104,7 +104,8 @@ public class InstanceUtilsTest {
@Test
public void testUpdateHelixInstanceConfig() {
Instance instance =
- new Instance("localhost", 1234, InstanceType.SERVER, Collections.singletonList("DefaultTenant_OFFLINE"), null, 0, 123, false);
+ new Instance("localhost", 1234, InstanceType.SERVER, Collections.singletonList("DefaultTenant_OFFLINE"), null,
+ 0, 123, false);
InstanceConfig instanceConfig = InstanceUtils.toHelixInstanceConfig(instance);
// Put some custom fields, which should not be updated
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TableConfigSerDeTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TableConfigSerDeTest.java
index ca2a2db..b777801 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TableConfigSerDeTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TableConfigSerDeTest.java
@@ -108,7 +108,8 @@ public class TableConfigSerDeTest {
}
{
// With tenant config
- TableConfig tableConfig = tableConfigBuilder.setServerTenant("aServerTenant").setBrokerTenant("aBrokerTenant").build();
+ TableConfig tableConfig =
+ tableConfigBuilder.setServerTenant("aServerTenant").setBrokerTenant("aBrokerTenant").build();
checkTenantConfigWithoutTagOverride(tableConfig);
@@ -171,7 +172,8 @@ public class TableConfigSerDeTest {
}
{
// With routing config
- RoutingConfig routingConfig = new RoutingConfig("builder", Arrays.asList("pruner0", "pruner1", "pruner2"), "selector");
+ RoutingConfig routingConfig =
+ new RoutingConfig("builder", Arrays.asList("pruner0", "pruner1", "pruner2"), "selector");
TableConfig tableConfig = tableConfigBuilder.setRoutingConfig(routingConfig).build();
checkRoutingConfig(tableConfig);
@@ -207,8 +209,8 @@ public class TableConfigSerDeTest {
new InstanceAssignmentConfig(new InstanceTagPoolConfig("tenant_OFFLINE", true, 3, null),
new InstanceConstraintConfig(Arrays.asList("constraint1", "constraint2")),
new InstanceReplicaGroupPartitionConfig(true, 0, 3, 5, 0, 0));
- TableConfig tableConfig = tableConfigBuilder
- .setInstanceAssignmentConfigMap(Collections.singletonMap(InstancePartitionsType.OFFLINE, instanceAssignmentConfig)).build();
+ TableConfig tableConfig = tableConfigBuilder.setInstanceAssignmentConfigMap(
+ Collections.singletonMap(InstancePartitionsType.OFFLINE, instanceAssignmentConfig)).build();
checkInstanceAssignmentConfig(tableConfig);
@@ -226,9 +228,9 @@ public class TableConfigSerDeTest {
Map<String, String> properties = new HashMap<>();
properties.put("foo", "bar");
properties.put("foobar", "potato");
- List<FieldConfig> fieldConfigList = Arrays
- .asList(new FieldConfig("column1", FieldConfig.EncodingType.DICTIONARY, FieldConfig.IndexType.INVERTED, null, properties),
- new FieldConfig("column2", null, null, null, null));
+ List<FieldConfig> fieldConfigList = Arrays.asList(
+ new FieldConfig("column1", FieldConfig.EncodingType.DICTIONARY, FieldConfig.IndexType.INVERTED, null,
+ properties), new FieldConfig("column2", null, null, null, null));
TableConfig tableConfig = tableConfigBuilder.setFieldConfigList(fieldConfigList).build();
checkFieldConfig(tableConfig);
@@ -244,7 +246,8 @@ public class TableConfigSerDeTest {
}
{
// with upsert config
- UpsertConfig upsertConfig = new UpsertConfig(UpsertConfig.Mode.FULL, null, "comparison", UpsertConfig.HashFunction.NONE);
+ UpsertConfig upsertConfig =
+ new UpsertConfig(UpsertConfig.Mode.FULL, null, "comparison", UpsertConfig.HashFunction.NONE);
TableConfig tableConfig = tableConfigBuilder.setUpsertConfig(upsertConfig).build();
@@ -255,8 +258,10 @@ public class TableConfigSerDeTest {
{
// with SegmentsValidationAndRetentionConfig
TableConfig tableConfig = tableConfigBuilder.setPeerSegmentDownloadScheme(CommonConstants.HTTP_PROTOCOL).build();
- checkSegmentsValidationAndRetentionConfig(JsonUtils.stringToObject(tableConfig.toJsonString(), TableConfig.class));
- checkSegmentsValidationAndRetentionConfig(TableConfigUtils.fromZNRecord(TableConfigUtils.toZNRecord(tableConfig)));
+ checkSegmentsValidationAndRetentionConfig(
+ JsonUtils.stringToObject(tableConfig.toJsonString(), TableConfig.class));
+ checkSegmentsValidationAndRetentionConfig(
+ TableConfigUtils.fromZNRecord(TableConfigUtils.toZNRecord(tableConfig)));
}
{
// With ingestion config
@@ -272,8 +277,8 @@ public class TableConfigSerDeTest {
batchConfigMaps.add(batchConfigMap);
List<String> fieldsToUnnest = Arrays.asList("c1, c2");
IngestionConfig ingestionConfig =
- new IngestionConfig(new BatchIngestionConfig(batchConfigMaps, "APPEND", "HOURLY"), new StreamIngestionConfig(streamConfigMaps),
- new FilterConfig("filterFunc(foo)"), transformConfigs,
+ new IngestionConfig(new BatchIngestionConfig(batchConfigMaps, "APPEND", "HOURLY"),
+ new StreamIngestionConfig(streamConfigMaps), new FilterConfig("filterFunc(foo)"), transformConfigs,
new ComplexTypeConfig(fieldsToUnnest, ".", ComplexTypeConfig.CollectionNotUnnestedToJson.NON_PRIMITIVE));
TableConfig tableConfig = tableConfigBuilder.setIngestionConfig(ingestionConfig).build();
@@ -332,17 +337,13 @@ public class TableConfigSerDeTest {
{
// disable handling null value in time column
TableConfig tableConfig = tableConfigBuilder.setTimeColumnName("timeColumn").build();
- checkNullTimeValueHandling(
- JsonUtils.stringToObject(tableConfig.toJsonString(), TableConfig.class), false);
- checkNullTimeValueHandling(
- TableConfigUtils.fromZNRecord(TableConfigUtils.toZNRecord(tableConfig)), false);
+ checkNullTimeValueHandling(JsonUtils.stringToObject(tableConfig.toJsonString(), TableConfig.class), false);
+ checkNullTimeValueHandling(TableConfigUtils.fromZNRecord(TableConfigUtils.toZNRecord(tableConfig)), false);
// enable handling null value in time column
tableConfig = tableConfigBuilder.setAllowNullTimeValue(true).setTimeColumnName("timeColumn").build();
- checkNullTimeValueHandling(
- JsonUtils.stringToObject(tableConfig.toJsonString(), TableConfig.class), true);
- checkNullTimeValueHandling(
- TableConfigUtils.fromZNRecord(TableConfigUtils.toZNRecord(tableConfig)), true);
+ checkNullTimeValueHandling(JsonUtils.stringToObject(tableConfig.toJsonString(), TableConfig.class), true);
+ checkNullTimeValueHandling(TableConfigUtils.fromZNRecord(TableConfigUtils.toZNRecord(tableConfig)), true);
}
}
@@ -482,7 +483,8 @@ public class TableConfigSerDeTest {
}
private void checkInstanceAssignmentConfig(TableConfig tableConfig) {
- Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap = tableConfig.getInstanceAssignmentConfigMap();
+ Map<InstancePartitionsType, InstanceAssignmentConfig> instanceAssignmentConfigMap =
+ tableConfig.getInstanceAssignmentConfigMap();
assertNotNull(instanceAssignmentConfigMap);
assertEquals(instanceAssignmentConfigMap.size(), 1);
assertTrue(instanceAssignmentConfigMap.containsKey(InstancePartitionsType.OFFLINE));
@@ -498,7 +500,8 @@ public class TableConfigSerDeTest {
assertNotNull(constraintConfig);
assertEquals(constraintConfig.getConstraints(), Arrays.asList("constraint1", "constraint2"));
- InstanceReplicaGroupPartitionConfig replicaGroupPartitionConfig = instanceAssignmentConfig.getReplicaGroupPartitionConfig();
+ InstanceReplicaGroupPartitionConfig replicaGroupPartitionConfig =
+ instanceAssignmentConfig.getReplicaGroupPartitionConfig();
assertTrue(replicaGroupPartitionConfig.isReplicaGroupBased());
assertEquals(replicaGroupPartitionConfig.getNumInstances(), 0);
assertEquals(replicaGroupPartitionConfig.getNumReplicaGroups(), 3);
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TableConfigUtilsTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TableConfigUtilsTest.java
index 0205935..0a769a5 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TableConfigUtilsTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TableConfigUtilsTest.java
@@ -58,9 +58,9 @@ public class TableConfigUtilsTest {
String expectedPushType = "APPEND";
Map<String, String> expectedStreamConfigsMap = getTestStreamConfigs();
- TableConfig tableConfig =
- new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setSegmentPushFrequency(expectedPushFrequency)
- .setSegmentPushType(expectedPushType).setStreamConfigs(expectedStreamConfigsMap).build();
+ TableConfig tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME)
+ .setSegmentPushFrequency(expectedPushFrequency).setSegmentPushType(expectedPushType)
+ .setStreamConfigs(expectedStreamConfigsMap).build();
// Before conversion, the ingestion config should be null.
Assert.assertNull(tableConfig.getIngestionConfig());
@@ -73,7 +73,8 @@ public class TableConfigUtilsTest {
Assert.assertEquals(batchIngestionConfig.getSegmentIngestionFrequency(), expectedPushFrequency);
Assert.assertEquals(batchIngestionConfig.getSegmentIngestionType(), expectedPushType);
- Map<String, String> actualStreamConfigsMap = tableConfig.getIngestionConfig().getStreamIngestionConfig().getStreamConfigMaps().get(0);
+ Map<String, String> actualStreamConfigsMap =
+ tableConfig.getIngestionConfig().getStreamIngestionConfig().getStreamConfigMaps().get(0);
Assert.assertEquals(actualStreamConfigsMap, expectedStreamConfigsMap);
// Assert that the deprecated fields are cleared.
@@ -98,13 +99,18 @@ public class TableConfigUtilsTest {
// All mandatory properties set
Map<String, String> streamConfigMap = new HashMap<>();
streamConfigMap.put(StreamConfigProperties.STREAM_TYPE, "streamType");
- streamConfigMap.put(StreamConfigProperties.constructStreamProperty(streamType, StreamConfigProperties.STREAM_TOPIC_NAME), topic);
streamConfigMap
- .put(StreamConfigProperties.constructStreamProperty(streamType, StreamConfigProperties.STREAM_CONSUMER_TYPES), consumerType);
- streamConfigMap.put(StreamConfigProperties.constructStreamProperty(streamType, StreamConfigProperties.STREAM_CONSUMER_FACTORY_CLASS),
+ .put(StreamConfigProperties.constructStreamProperty(streamType, StreamConfigProperties.STREAM_TOPIC_NAME),
+ topic);
+ streamConfigMap
+ .put(StreamConfigProperties.constructStreamProperty(streamType, StreamConfigProperties.STREAM_CONSUMER_TYPES),
+ consumerType);
+ streamConfigMap.put(StreamConfigProperties
+ .constructStreamProperty(streamType, StreamConfigProperties.STREAM_CONSUMER_FACTORY_CLASS),
consumerFactoryClass);
streamConfigMap
- .put(StreamConfigProperties.constructStreamProperty(streamType, StreamConfigProperties.STREAM_DECODER_CLASS), decoderClass);
+ .put(StreamConfigProperties.constructStreamProperty(streamType, StreamConfigProperties.STREAM_DECODER_CLASS),
+ decoderClass);
return streamConfigMap;
}
@@ -134,7 +140,8 @@ public class TableConfigUtilsTest {
}
@Override
- public StreamLevelConsumer createStreamLevelConsumer(String clientId, String tableName, Set<String> fieldsToRead, String groupId) {
+ public StreamLevelConsumer createStreamLevelConsumer(String clientId, String tableName, Set<String> fieldsToRead,
+ String groupId) {
return null;
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TagNameUtilsTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TagNameUtilsTest.java
index e46601a..341d66a 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TagNameUtilsTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/config/TagNameUtilsTest.java
@@ -50,15 +50,16 @@ public class TagNameUtilsTest {
inputs.add(new Object[]{tenantConfig, "aServerTenant_OFFLINE", "aServerTenant_REALTIME", "overriddenTag_OFFLINE"});
// defined both overrides
- tenantConfig = new TenantConfig(null, "aServerTenant", new TagOverrideConfig("overriddenTag_REALTIME", "overriddenTag_OFFLINE"));
+ tenantConfig = new TenantConfig(null, "aServerTenant",
+ new TagOverrideConfig("overriddenTag_REALTIME", "overriddenTag_OFFLINE"));
inputs.add(new Object[]{tenantConfig, "aServerTenant_OFFLINE", "overriddenTag_REALTIME", "overriddenTag_OFFLINE"});
return inputs.toArray(new Object[inputs.size()][]);
}
@Test(dataProvider = "tagOverrideConfigTestDataProvider")
- public void testTagOverrideConfig(TenantConfig tenantConfig, String expectedOfflineServerTag, String expectedConsumingServerTag,
- String expectedCompletedServerTag) {
+ public void testTagOverrideConfig(TenantConfig tenantConfig, String expectedOfflineServerTag,
+ String expectedConsumingServerTag, String expectedCompletedServerTag) {
assertEquals(TagNameUtils.extractOfflineServerTag(tenantConfig), expectedOfflineServerTag);
assertEquals(TagNameUtils.extractConsumingServerTag(tenantConfig), expectedConsumingServerTag);
assertEquals(TagNameUtils.extractCompletedServerTag(tenantConfig), expectedCompletedServerTag);
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/utils/fetcher/SegmentFetcherFactoryTest.java b/pinot-common/src/test/java/org/apache/pinot/common/utils/fetcher/SegmentFetcherFactoryTest.java
index b7ddf17..54679a3 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/utils/fetcher/SegmentFetcherFactoryTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/utils/fetcher/SegmentFetcherFactoryTest.java
@@ -54,7 +54,8 @@ public class SegmentFetcherFactoryTest {
properties.put("foo", "bar");
properties.put("protocols", Arrays.asList(HTTP_PROTOCOL, HTTPS_PROTOCOL, TEST_PROTOCOL, "foo"));
properties.put("http.foo", "bar");
- properties.put(TEST_PROTOCOL + SegmentFetcherFactory.SEGMENT_FETCHER_CLASS_KEY_SUFFIX, FakeSegmentFetcher.class.getName());
+ properties.put(TEST_PROTOCOL + SegmentFetcherFactory.SEGMENT_FETCHER_CLASS_KEY_SUFFIX,
+ FakeSegmentFetcher.class.getName());
SegmentFetcherFactory.init(new PinotConfiguration(properties));
assertEquals(SegmentFetcherFactory.getSegmentFetcher(HTTP_PROTOCOL).getClass(), HttpSegmentFetcher.class);
diff --git a/pinot-common/src/test/java/org/apache/pinot/pql/parsers/Pql2CompilerTest.java b/pinot-common/src/test/java/org/apache/pinot/pql/parsers/Pql2CompilerTest.java
index 447ea5e..f96096b 100644
--- a/pinot-common/src/test/java/org/apache/pinot/pql/parsers/Pql2CompilerTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/pql/parsers/Pql2CompilerTest.java
@@ -66,33 +66,34 @@ public class Pql2CompilerTest {
@Test
public void testQuotedStrings() {
- BrokerRequest brokerRequest = COMPILER.compileToBrokerRequest("select * from vegetables where origin = 'Martha''s Vineyard'");
+ BrokerRequest brokerRequest =
+ COMPILER.compileToBrokerRequest("select * from vegetables where origin = 'Martha''s Vineyard'");
Assert.assertEquals(brokerRequest.getFilterQuery().getValue().get(0), "Martha's Vineyard");
// Test PinotQuery
Assert.assertEquals(
- brokerRequest.getPinotQuery().getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(),
- "Martha's Vineyard");
+ brokerRequest.getPinotQuery().getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral()
+ .getStringValue(), "Martha's Vineyard");
brokerRequest = COMPILER.compileToBrokerRequest("select * from vegetables where origin = 'Martha\"\"s Vineyard'");
Assert.assertEquals(brokerRequest.getFilterQuery().getValue().get(0), "Martha\"\"s Vineyard");
// Test PinotQuery
Assert.assertEquals(
- brokerRequest.getPinotQuery().getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(),
- "Martha\"\"s Vineyard");
+ brokerRequest.getPinotQuery().getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral()
+ .getStringValue(), "Martha\"\"s Vineyard");
brokerRequest = COMPILER.compileToBrokerRequest("select * from vegetables where origin = \"Martha\"\"s Vineyard\"");
Assert.assertEquals(brokerRequest.getFilterQuery().getValue().get(0), "Martha\"s Vineyard");
// Test PinotQuery
Assert.assertEquals(
- brokerRequest.getPinotQuery().getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(),
- "Martha\"s Vineyard");
+ brokerRequest.getPinotQuery().getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral()
+ .getStringValue(), "Martha\"s Vineyard");
brokerRequest = COMPILER.compileToBrokerRequest("select * from vegetables where origin = \"Martha''s Vineyard\"");
Assert.assertEquals(brokerRequest.getFilterQuery().getValue().get(0), "Martha''s Vineyard");
// Test PinotQuery
Assert.assertEquals(
- brokerRequest.getPinotQuery().getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(),
- "Martha''s Vineyard");
+ brokerRequest.getPinotQuery().getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral()
+ .getStringValue(), "Martha''s Vineyard");
}
@Test
@@ -220,8 +221,8 @@ public class Pql2CompilerTest {
Assert.assertEquals(brokerRequest.getPinotQuery().getGroupByList().get(0).getIdentifier().getName(), "group_city");
Assert.assertEquals(brokerRequest.getOrderBy().get(0).getColumn(), "sum(rsvp_count)");
Assert.assertEquals(
- brokerRequest.getPinotQuery().getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
- "sum(rsvp_count)");
+ brokerRequest.getPinotQuery().getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
+ .getName(), "sum(rsvp_count)");
}
@Test
@@ -245,7 +246,8 @@ public class Pql2CompilerTest {
} catch (Pql2CompilationException e) {
// Expected
Assert.assertTrue(e.getMessage().startsWith("1:30: "),
- "Compilation exception should contain line and character for error message. Error message is " + e.getMessage());
+ "Compilation exception should contain line and character for error message. Error message is " + e
+ .getMessage());
return;
}
@@ -254,20 +256,23 @@ public class Pql2CompilerTest {
@Test
public void testCStyleInequalityOperator() {
- BrokerRequest brokerRequest = COMPILER.compileToBrokerRequest("select * from vegetables where name != 'Brussels sprouts'");
+ BrokerRequest brokerRequest =
+ COMPILER.compileToBrokerRequest("select * from vegetables where name != 'Brussels sprouts'");
Assert.assertEquals(brokerRequest.getFilterQuery().getOperator(), FilterOperator.NOT);
}
@Test
public void testQueryOptions() {
- BrokerRequest brokerRequest = COMPILER.compileToBrokerRequest("select * from vegetables where name != 'Brussels sprouts'");
+ BrokerRequest brokerRequest =
+ COMPILER.compileToBrokerRequest("select * from vegetables where name != 'Brussels sprouts'");
Assert.assertEquals(brokerRequest.getQueryOptionsSize(), 0);
Assert.assertNull(brokerRequest.getQueryOptions());
// Test PinotQuery
Assert.assertEquals(brokerRequest.getPinotQuery().getQueryOptionsSize(), 0);
Assert.assertNull(brokerRequest.getPinotQuery().getQueryOptions());
- brokerRequest = COMPILER.compileToBrokerRequest("select * from vegetables where name != 'Brussels sprouts' OPTION (delicious=yes)");
+ brokerRequest = COMPILER
+ .compileToBrokerRequest("select * from vegetables where name != 'Brussels sprouts' OPTION (delicious=yes)");
Assert.assertEquals(brokerRequest.getQueryOptionsSize(), 1);
Assert.assertTrue(brokerRequest.getQueryOptions().containsKey("delicious"));
Assert.assertEquals(brokerRequest.getQueryOptions().get("delicious"), "yes");
@@ -276,8 +281,8 @@ public class Pql2CompilerTest {
Assert.assertTrue(brokerRequest.getPinotQuery().getQueryOptions().containsKey("delicious"));
Assert.assertEquals(brokerRequest.getPinotQuery().getQueryOptions().get("delicious"), "yes");
- brokerRequest = COMPILER
- .compileToBrokerRequest("select * from vegetables where name != 'Brussels sprouts' OPTION (delicious=yes, foo=1234, bar='potato')");
+ brokerRequest = COMPILER.compileToBrokerRequest(
+ "select * from vegetables where name != 'Brussels sprouts' OPTION (delicious=yes, foo=1234, bar='potato')");
Assert.assertEquals(brokerRequest.getQueryOptionsSize(), 3);
Assert.assertTrue(brokerRequest.getQueryOptions().containsKey("delicious"));
Assert.assertEquals(brokerRequest.getQueryOptions().get("delicious"), "yes");
@@ -291,7 +296,8 @@ public class Pql2CompilerTest {
Assert.assertEquals(brokerRequest.getPinotQuery().getQueryOptions().get("bar"), "potato");
brokerRequest = COMPILER.compileToBrokerRequest(
- "select * from vegetables where name != 'Brussels sprouts' OPTION (delicious=yes) option(foo=1234) option" + "(bar='potato')");
+ "select * from vegetables where name != 'Brussels sprouts' OPTION (delicious=yes) option(foo=1234) option"
+ + "(bar='potato')");
Assert.assertEquals(brokerRequest.getQueryOptionsSize(), 3);
Assert.assertTrue(brokerRequest.getQueryOptions().containsKey("delicious"));
Assert.assertEquals(brokerRequest.getQueryOptions().get("delicious"), "yes");
@@ -311,17 +317,19 @@ public class Pql2CompilerTest {
Assert.assertEquals(expTree.getExpressionType(), TransformExpressionTree.ExpressionType.IDENTIFIER);
Assert.assertEquals(expTree.getValue(), "a.b.c");
- BrokerRequest brokerRequest =
- COMPILER.compileToBrokerRequest("select avg(`attributes.age`) as `avg_age` from `person` group by `attributes.address_city`");
+ BrokerRequest brokerRequest = COMPILER.compileToBrokerRequest(
+ "select avg(`attributes.age`) as `avg_age` from `person` group by `attributes.address_city`");
Assert.assertEquals(brokerRequest.getAggregationsInfo().get(0).getExpressions().get(0), "attributes.age");
- Assert.assertEquals(brokerRequest.getGroupBy().getExpressions(), Collections.singletonList("attributes.address_city"));
+ Assert.assertEquals(brokerRequest.getGroupBy().getExpressions(),
+ Collections.singletonList("attributes.address_city"));
// Test PinotQuery
- Assert
- .assertEquals(brokerRequest.getPinotQuery().getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
- "attributes.age");
- Assert.assertEquals(brokerRequest.getPinotQuery().getGroupByList().get(0).getIdentifier().getName(), "attributes.address_city");
+ Assert.assertEquals(
+ brokerRequest.getPinotQuery().getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
+ .getName(), "attributes.age");
+ Assert.assertEquals(brokerRequest.getPinotQuery().getGroupByList().get(0).getIdentifier().getName(),
+ "attributes.address_city");
}
@Test
@@ -330,7 +338,8 @@ public class Pql2CompilerTest {
assertCompilationFails("SELECT 'foo' FROM table");
// Allow string literal column in aggregation and group-by query
- BrokerRequest brokerRequest = COMPILER.compileToBrokerRequest("SELECT SUM('foo'), MAX(\"bar\") FROM table GROUP BY 'foo', \"bar\"");
+ BrokerRequest brokerRequest =
+ COMPILER.compileToBrokerRequest("SELECT SUM('foo'), MAX(\"bar\") FROM table GROUP BY 'foo', \"bar\"");
List<AggregationInfo> aggregationInfos = brokerRequest.getAggregationsInfo();
Assert.assertEquals(aggregationInfos.size(), 2);
Assert.assertEquals(aggregationInfos.get(0).getExpressions().get(0), "foo");
@@ -343,15 +352,18 @@ public class Pql2CompilerTest {
// Test PinotQuery
List<Expression> selectFunctionList = brokerRequest.getPinotQuery().getSelectList();
Assert.assertEquals(selectFunctionList.size(), 2);
- Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getLiteral().getStringValue(), "foo");
- Assert.assertEquals(selectFunctionList.get(1).getFunctionCall().getOperands().get(0).getLiteral().getStringValue(), "bar");
+ Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getLiteral().getStringValue(),
+ "foo");
+ Assert.assertEquals(selectFunctionList.get(1).getFunctionCall().getOperands().get(0).getLiteral().getStringValue(),
+ "bar");
List<Expression> groupbyList = brokerRequest.getPinotQuery().getGroupByList();
Assert.assertEquals(groupbyList.size(), 2);
Assert.assertEquals(groupbyList.get(0).getLiteral().getStringValue(), "foo");
Assert.assertEquals(groupbyList.get(1).getLiteral().getStringValue(), "bar");
// For UDF, string literal won't be treated as column but as LITERAL
- brokerRequest = COMPILER.compileToBrokerRequest("SELECT SUM(ADD(foo, 'bar')) FROM table GROUP BY SUB(\"foo\", bar)");
+ brokerRequest =
+ COMPILER.compileToBrokerRequest("SELECT SUM(ADD(foo, 'bar')) FROM table GROUP BY SUB(\"foo\", bar)");
aggregationInfos = brokerRequest.getAggregationsInfo();
Assert.assertEquals(aggregationInfos.size(), 1);
Assert.assertEquals(aggregationInfos.get(0).getExpressions().get(0), "add(foo,'bar')");
@@ -365,13 +377,17 @@ public class Pql2CompilerTest {
Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperator(), "SUM");
Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().size(), 1);
- Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "ADD");
- Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().size(), 2);
+ Assert
+ .assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "ADD");
Assert.assertEquals(
- selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
- "foo");
- Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getLiteral()
- .getStringValue(), "bar");
+ selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().size(), 2);
+ Assert.assertEquals(
+ selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "foo");
+ Assert.assertEquals(
+ selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getLiteral().getStringValue(), "bar");
groupbyList = brokerRequest.getPinotQuery().getGroupByList();
Assert.assertEquals(groupbyList.size(), 1);
Assert.assertEquals(groupbyList.get(0).getFunctionCall().getOperator(), "SUB");
@@ -386,16 +402,20 @@ public class Pql2CompilerTest {
COMPILER.compileToBrokerRequest("Select * from T where a IN (1,2,2,3,4)");
COMPILER.compileToBrokerRequest("SELECT MIN(div(DaysSinceEpoch,2)) FROM mytable");
- COMPILER.compileToBrokerRequest("SELECT SUM(DepDelayMinutes), SUM(ArrDel15), SUM(DepDelay), SUM(DepDel15) FROM myStarTable"
- + " WHERE Carrier IN ('UA', 'WN', 'FL', 'F9') AND Carrier NOT IN ('EV', 'AS', 'FL') AND"
- + " DayofMonth > 5 AND DayofMonth <= 17 AND Diverted > 0 AND OriginCityName > 'Detroit, MI'" + " GROUP BY CRSDepTime");
+ COMPILER.compileToBrokerRequest(
+ "SELECT SUM(DepDelayMinutes), SUM(ArrDel15), SUM(DepDelay), SUM(DepDel15) FROM myStarTable"
+ + " WHERE Carrier IN ('UA', 'WN', 'FL', 'F9') AND Carrier NOT IN ('EV', 'AS', 'FL') AND"
+ + " DayofMonth > 5 AND DayofMonth <= 17 AND Diverted > 0 AND OriginCityName > 'Detroit, MI'"
+ + " GROUP BY CRSDepTime");
COMPILER.compileToBrokerRequest("Select * from T where a > 1 and a < 10");
COMPILER.compileToBrokerRequest("Select * from T where a between 1 and 10");
- BrokerRequest brokerRequest = COMPILER.compileToBrokerRequest("select * from vegetables where name != 'Brussels sprouts'");
- Assert.assertEquals(brokerRequest.getPinotQuery().getFilterExpression().getFunctionCall().getOperator(), FilterKind.NOT_EQUALS.name());
- final BufferedReader br =
- new BufferedReader(new InputStreamReader(Pql2CompilerTest.class.getClassLoader().getResourceAsStream("pql_queries.list")));
+ BrokerRequest brokerRequest =
+ COMPILER.compileToBrokerRequest("select * from vegetables where name != 'Brussels sprouts'");
+ Assert.assertEquals(brokerRequest.getPinotQuery().getFilterExpression().getFunctionCall().getOperator(),
+ FilterKind.NOT_EQUALS.name());
+ final BufferedReader br = new BufferedReader(
+ new InputStreamReader(Pql2CompilerTest.class.getClassLoader().getResourceAsStream("pql_queries.list")));
String pql;
int seqId = 0;
while ((pql = br.readLine()) != null) {
@@ -418,22 +438,26 @@ public class Pql2CompilerTest {
testOrderBy("select * from table order by d2, d3 desc", Arrays.asList("d2", "d3"), Arrays.asList(true, false));
- testOrderBy("select * from table order by d2 asc, d2 desc", Collections.singletonList("d2"), Collections.singletonList(true));
+ testOrderBy("select * from table order by d2 asc, d2 desc", Collections.singletonList("d2"),
+ Collections.singletonList(true));
- testOrderBy("select * from table order by d2, d2 desc", Collections.singletonList("d2"), Collections.singletonList(true));
+ testOrderBy("select * from table order by d2, d2 desc", Collections.singletonList("d2"),
+ Collections.singletonList(true));
testOrderBy("select * from table order by d2, add(d3, 1) desc, add(d3, 1)", Arrays.asList("d2", "add(d3,'1')"),
Arrays.asList(true, false));
- testOrderBy("select sum(m1) from table group by d2, d3 order by d2 desc, d3", Arrays.asList("d2", "d3"), Arrays.asList(false, true));
+ testOrderBy("select sum(m1) from table group by d2, d3 order by d2 desc, d3", Arrays.asList("d2", "d3"),
+ Arrays.asList(false, true));
testOrderBy("select sum(m1) from table group by d2, d3 order by sum(m1), d3 desc", Arrays.asList("sum(m1)", "d3"),
Arrays.asList(true, false));
- testOrderBy("select sum(m1), sum(m2) from table group by d1 order by sum(m1) desc, sum(m2) asc", Arrays.asList("sum(m1)", "sum(m2)"),
- Arrays.asList(false, true));
+ testOrderBy("select sum(m1), sum(m2) from table group by d1 order by sum(m1) desc, sum(m2) asc",
+ Arrays.asList("sum(m1)", "sum(m2)"), Arrays.asList(false, true));
- testOrderBy("select sum(m1), max(foo(bar(x, y), z)) from table group by d1 order by sum(m1) desc, max(foo(bar(x, y), z))",
+ testOrderBy(
+ "select sum(m1), max(foo(bar(x, y), z)) from table group by d1 order by sum(m1) desc, max(foo(bar(x, y), z))",
Arrays.asList("sum(m1)", "max(foo(bar(x,y),z))"), Arrays.asList(false, true));
testOrderBy("select sum(m1) from table group by foo(bar(x, y), z) order by sum(m1) desc, foo(bar(x, y), z) asc",
diff --git a/pinot-common/src/test/java/org/apache/pinot/request/BrokerRequestSerializationTest.java b/pinot-common/src/test/java/org/apache/pinot/request/BrokerRequestSerializationTest.java
index b90ebe6..d6ca537 100644
--- a/pinot-common/src/test/java/org/apache/pinot/request/BrokerRequestSerializationTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/request/BrokerRequestSerializationTest.java
@@ -170,12 +170,14 @@ public class BrokerRequestSerializationTest {
Expression filterExpr1 = RequestUtils.getFunctionExpression(FilterOperator.EQUALITY.name());
filterExpr1.getFunctionCall().addToOperands(RequestUtils.createIdentifierExpression("dummy1"));
- filterExpr1.getFunctionCall().addToOperands(RequestUtils.createLiteralExpression(new StringLiteralAstNode("dummy1")));
+ filterExpr1.getFunctionCall()
+ .addToOperands(RequestUtils.createLiteralExpression(new StringLiteralAstNode("dummy1")));
filter.getFunctionCall().addToOperands(filterExpr1);
Expression filterExpr2 = RequestUtils.getFunctionExpression(FilterOperator.EQUALITY.name());
filterExpr2.getFunctionCall().addToOperands(RequestUtils.createIdentifierExpression("dummy2"));
- filterExpr2.getFunctionCall().addToOperands(RequestUtils.createLiteralExpression(new StringLiteralAstNode("dummy2")));
+ filterExpr2.getFunctionCall()
+ .addToOperands(RequestUtils.createLiteralExpression(new StringLiteralAstNode("dummy2")));
filter.getFunctionCall().addToOperands(filterExpr2);
pinotQuery.setFilterExpression(filter);
diff --git a/pinot-common/src/test/java/org/apache/pinot/request/BrokerResponseNativeTest.java b/pinot-common/src/test/java/org/apache/pinot/request/BrokerResponseNativeTest.java
index 5548b1d..1b4946f 100644
--- a/pinot-common/src/test/java/org/apache/pinot/request/BrokerResponseNativeTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/request/BrokerResponseNativeTest.java
@@ -46,9 +46,10 @@ public class BrokerResponseNativeTest {
BrokerResponseNative expected = BrokerResponseNative.NO_TABLE_RESULT;
String brokerString = expected.toJsonString();
BrokerResponseNative actual = BrokerResponseNative.fromJsonString(brokerString);
- Assert
- .assertEquals(actual.getProcessingExceptions().get(0).getErrorCode(), QueryException.BROKER_RESOURCE_MISSING_ERROR.getErrorCode());
- Assert.assertEquals(actual.getProcessingExceptions().get(0).getMessage(), QueryException.BROKER_RESOURCE_MISSING_ERROR.getMessage());
+ Assert.assertEquals(actual.getProcessingExceptions().get(0).getErrorCode(),
+ QueryException.BROKER_RESOURCE_MISSING_ERROR.getErrorCode());
+ Assert.assertEquals(actual.getProcessingExceptions().get(0).getMessage(),
+ QueryException.BROKER_RESOURCE_MISSING_ERROR.getMessage());
}
@Test
diff --git a/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java b/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
index 205e4b4..73d898a 100644
--- a/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
@@ -48,15 +48,16 @@ import org.testng.annotations.Test;
* Some tests for the SQL compiler.
*/
public class CalciteSqlCompilerTest {
- private static final PinotQuery2BrokerRequestConverter BROKER_REQUEST_CONVERTER = new PinotQuery2BrokerRequestConverter();
+ private static final PinotQuery2BrokerRequestConverter BROKER_REQUEST_CONVERTER =
+ new PinotQuery2BrokerRequestConverter();
private static final long ONE_HOUR_IN_MS = TimeUnit.HOURS.toMillis(1);
@Test
public void testCaseWhenStatements() {
PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(
"SELECT OrderID, Quantity,\n" + "CASE\n" + " WHEN Quantity > 30 THEN 'The quantity is greater than 30'\n"
- + " WHEN Quantity = 30 THEN 'The quantity is 30'\n" + " ELSE 'The quantity is under 30'\n" + "END AS QuantityText\n"
- + "FROM OrderDetails");
+ + " WHEN Quantity = 30 THEN 'The quantity is 30'\n" + " ELSE 'The quantity is under 30'\n"
+ + "END AS QuantityText\n" + "FROM OrderDetails");
Assert.assertEquals(pinotQuery.getSelectList().get(0).getIdentifier().getName(), "OrderID");
Assert.assertEquals(pinotQuery.getSelectList().get(1).getIdentifier().getName(), "Quantity");
Function asFunc = pinotQuery.getSelectList().get(2).getFunctionCall();
@@ -109,35 +110,40 @@ public class CalciteSqlCompilerTest {
public void testInvalidCaseWhenStatements() {
// Not support Aggregation functions in case statements.
try {
- CalciteSqlParser.compileToPinotQuery(
- "SELECT OrderID, Quantity,\n" + "CASE\n" + " WHEN sum(Quantity) > 30 THEN 'The quantity is greater than 30'\n"
- + " WHEN sum(Quantity) = 30 THEN 'The quantity is 30'\n" + " ELSE 'The quantity is under 30'\n"
- + "END AS QuantityText\n" + "FROM OrderDetails");
+ CalciteSqlParser.compileToPinotQuery("SELECT OrderID, Quantity,\n" + "CASE\n"
+ + " WHEN sum(Quantity) > 30 THEN 'The quantity is greater than 30'\n"
+ + " WHEN sum(Quantity) = 30 THEN 'The quantity is 30'\n" + " ELSE 'The quantity is under 30'\n"
+ + "END AS QuantityText\n" + "FROM OrderDetails");
} catch (SqlCompilationException e) {
- Assert.assertEquals(e.getMessage(), "Aggregation functions inside WHEN Clause is not supported - SUM(`Quantity`) > 30");
+ Assert.assertEquals(e.getMessage(),
+ "Aggregation functions inside WHEN Clause is not supported - SUM(`Quantity`) > 30");
throw e;
}
}
@Test
public void testQuotedStrings() {
- PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where origin = 'Martha''s Vineyard'");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(),
+ PinotQuery pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("select * from vegetables where origin = 'Martha''s Vineyard'");
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(),
"Martha's Vineyard");
pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where origin = 'Martha\"\"s Vineyard'");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(),
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(),
"Martha\"\"s Vineyard");
- pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where origin = \"Martha\"\"s Vineyard\"");
+ pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("select * from vegetables where origin = \"Martha\"\"s Vineyard\"");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier()
- .getName(), "Martha\"s Vineyard");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getIdentifier().getName(), "Martha\"s Vineyard");
pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where origin = \"Martha''s Vineyard\"");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier()
- .getName(), "Martha''s Vineyard");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getIdentifier().getName(), "Martha''s Vineyard");
}
@Test
@@ -189,105 +195,133 @@ public class CalciteSqlCompilerTest {
Function func = pinotQuery.getFilterExpression().getFunctionCall();
Assert.assertEquals(func.getOperator(), SqlKind.GREATER_THAN.name());
Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperator(), "MINUS");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "b");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "b");
Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 0L);
pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where 0 < a-b");
func = pinotQuery.getFilterExpression().getFunctionCall();
Assert.assertEquals(func.getOperator(), SqlKind.GREATER_THAN.name());
Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperator(), "MINUS");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "b");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "b");
Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 0L);
pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where b < 100 + c");
func = pinotQuery.getFilterExpression().getFunctionCall();
Assert.assertEquals(func.getOperator(), SqlKind.LESS_THAN.name());
Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperator(), "MINUS");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "b");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperator(), "PLUS");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "b");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperator(),
+ "PLUS");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getLiteral().getLongValue(),
- 100L);
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getLiteral().getLongValue(), 100L);
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(1).getIdentifier().getName(),
- "c");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(1)
+ .getIdentifier().getName(), "c");
Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 0L);
pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where b -(100+c)< 0");
func = pinotQuery.getFilterExpression().getFunctionCall();
Assert.assertEquals(func.getOperator(), SqlKind.LESS_THAN.name());
Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperator(), "MINUS");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "b");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperator(), "PLUS");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "b");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperator(),
+ "PLUS");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getLiteral().getLongValue(),
- 100L);
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getLiteral().getLongValue(), 100L);
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(1).getIdentifier().getName(),
- "c");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(1)
+ .getIdentifier().getName(), "c");
Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 0L);
- pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where foo1(bar1(a-b)) <= foo2(bar2(c+d))");
+ pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("select * from vegetables where foo1(bar1(a-b)) <= foo2(bar2(c+d))");
func = pinotQuery.getFilterExpression().getFunctionCall();
Assert.assertEquals(func.getOperator(), SqlKind.LESS_THAN_OR_EQUAL.name());
Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperator(), "MINUS");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "FOO1");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperator(), "FOO2");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "FOO1");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperator(),
+ "FOO2");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperator(), "BAR1");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperator(), "BAR1");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperator(), "BAR2");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperator(), "BAR2");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperator(), "MINUS");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "MINUS");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperator(), "PLUS");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "PLUS");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ "a");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "b");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(),
+ "b");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "c");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ "c");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "d");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(),
+ "d");
Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 0L);
- pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where foo1(bar1(a-b)) - foo2(bar2(c+d)) <= 0");
+ pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("select * from vegetables where foo1(bar1(a-b)) - foo2(bar2(c+d)) <= 0");
func = pinotQuery.getFilterExpression().getFunctionCall();
Assert.assertEquals(func.getOperator(), SqlKind.LESS_THAN_OR_EQUAL.name());
Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperator(), "MINUS");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "FOO1");
- Assert.assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperator(), "FOO2");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "FOO1");
+ Assert
+ .assertEquals(func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperator(),
+ "FOO2");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperator(), "BAR1");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperator(), "BAR1");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperator(), "BAR2");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperator(), "BAR2");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperator(), "MINUS");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "MINUS");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperator(), "PLUS");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "PLUS");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ "a");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "b");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(),
+ "b");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "c");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ "c");
Assert.assertEquals(
- func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "d");
+ func.getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(),
+ "d");
Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 0L);
pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where c >= 10");
@@ -328,7 +362,8 @@ public class CalciteSqlCompilerTest {
@Test
public void testBrokerConverter() {
- PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where g IN (12, 13, 15.2, 17)");
+ PinotQuery pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("select * from vegetables where g IN (12, 13, 15.2, 17)");
Function func = pinotQuery.getFilterExpression().getFunctionCall();
Assert.assertEquals(func.getOperator(), SqlKind.IN.name());
Assert.assertEquals(func.getOperands().get(0).getIdentifier().getName(), "g");
@@ -376,8 +411,8 @@ public class CalciteSqlCompilerTest {
@Test
public void testSelectAs() {
- PinotQuery pinotQuery =
- CalciteSqlParser.compileToPinotQuery("select sum(A) as sum_A, count(B) as count_B from vegetables where g IN (12, 13, 15.2, 17)");
+ PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(
+ "select sum(A) as sum_A, count(B) as count_B from vegetables where g IN (12, 13, 15.2, 17)");
Function func = pinotQuery.getFilterExpression().getFunctionCall();
Assert.assertEquals(func.getOperator(), SqlKind.IN.name());
Assert.assertEquals(func.getOperands().get(0).getIdentifier().getName(), "g");
@@ -421,7 +456,8 @@ public class CalciteSqlCompilerTest {
public void testLimitOffsets() {
PinotQuery pinotQuery;
try {
- pinotQuery = CalciteSqlParser.compileToPinotQuery("select a, b, c from meetupRsvp order by a, b, c limit 100 offset 200");
+ pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("select a, b, c from meetupRsvp order by a, b, c limit 100 offset 200");
} catch (SqlCompilationException e) {
throw e;
}
@@ -432,7 +468,8 @@ public class CalciteSqlCompilerTest {
Assert.assertEquals(200, pinotQuery.getOffset());
try {
- pinotQuery = CalciteSqlParser.compileToPinotQuery("select a, b, c from meetupRsvp order by a, b, c limit 200,100");
+ pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("select a, b, c from meetupRsvp order by a, b, c limit 200,100");
} catch (SqlCompilationException e) {
throw e;
}
@@ -449,7 +486,8 @@ public class CalciteSqlCompilerTest {
PinotQuery pinotQuery;
try {
pinotQuery = CalciteSqlParser.compileToPinotQuery(
- "select sum(rsvp_count), count(*), group_city from meetupRsvp group by group_city order by sum(rsvp_count) " + "limit 10");
+ "select sum(rsvp_count), count(*), group_city from meetupRsvp group by group_city order by sum(rsvp_count) "
+ + "limit 10");
} catch (SqlCompilationException e) {
throw e;
}
@@ -458,12 +496,14 @@ public class CalciteSqlCompilerTest {
Assert.assertTrue(pinotQuery.isSetLimit());
Assert.assertTrue(pinotQuery.isSetOrderByList());
Assert.assertEquals(pinotQuery.getOrderByList().get(0).getType(), ExpressionType.FUNCTION);
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "SUM");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "SUM");
Assert.assertEquals(10, pinotQuery.getLimit());
try {
- pinotQuery = CalciteSqlParser
- .compileToPinotQuery("select sum(rsvp_count), count(*) from meetupRsvp group by group_city order by sum(rsvp_count) limit 10");
+ pinotQuery = CalciteSqlParser.compileToPinotQuery(
+ "select sum(rsvp_count), count(*) from meetupRsvp group by group_city order by sum(rsvp_count) limit 10");
} catch (SqlCompilationException e) {
throw e;
}
@@ -472,7 +512,9 @@ public class CalciteSqlCompilerTest {
Assert.assertTrue(pinotQuery.isSetLimit());
Assert.assertTrue(pinotQuery.isSetOrderByList());
Assert.assertEquals(pinotQuery.getOrderByList().get(0).getType(), ExpressionType.FUNCTION);
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "SUM");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "SUM");
Assert.assertEquals(10, pinotQuery.getLimit());
try {
@@ -487,21 +529,26 @@ public class CalciteSqlCompilerTest {
Assert.assertTrue(pinotQuery.isSetLimit());
Assert.assertTrue(pinotQuery.isSetOrderByList());
Assert.assertEquals(pinotQuery.getOrderByList().get(0).getType(), ExpressionType.FUNCTION);
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "SUM");
Assert.assertEquals(
- pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "rsvp_count");
- Assert.assertEquals(pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "COUNT");
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "SUM");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "rsvp_count");
Assert.assertEquals(
- pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "*");
+ pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "COUNT");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "*");
Assert.assertEquals(10, pinotQuery.getLimit());
// nested functions in group by
try {
- pinotQuery = CalciteSqlParser.compileToPinotQuery("select concat(upper(playerName), lower(teamID), '-') playerTeam, "
- + "upper(league) leagueUpper, count(playerName) cnt from baseballStats group by playerTeam, lower" + "(teamID), leagueUpper "
- + "having cnt > 1 order by cnt desc limit 10");
+ pinotQuery = CalciteSqlParser.compileToPinotQuery(
+ "select concat(upper(playerName), lower(teamID), '-') playerTeam, "
+ + "upper(league) leagueUpper, count(playerName) cnt from baseballStats group by playerTeam, lower"
+ + "(teamID), leagueUpper " + "having cnt > 1 order by cnt desc limit 10");
} catch (SqlCompilationException e) {
throw e;
}
@@ -510,7 +557,9 @@ public class CalciteSqlCompilerTest {
Assert.assertTrue(pinotQuery.isSetLimit());
Assert.assertTrue(pinotQuery.isSetOrderByList());
Assert.assertEquals(pinotQuery.getOrderByList().get(0).getType(), ExpressionType.FUNCTION);
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "COUNT");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "COUNT");
Assert.assertEquals(10, pinotQuery.getLimit());
}
@@ -563,7 +612,8 @@ public class CalciteSqlCompilerTest {
} catch (SqlCompilationException e) {
// Expected
Assert.assertTrue(e.getCause().getMessage().contains("at line 1, column 31."),
- "Compilation exception should contain line and character for error message. Error message is " + e.getMessage());
+ "Compilation exception should contain line and character for error message. Error message is " + e
+ .getMessage());
return;
}
@@ -572,7 +622,8 @@ public class CalciteSqlCompilerTest {
@Test
public void testCStyleInequalityOperator() {
- PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where name <> 'Brussels sprouts'");
+ PinotQuery pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("select * from vegetables where name <> 'Brussels sprouts'");
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "NOT_EQUALS");
pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where name != 'Brussels sprouts'");
@@ -581,17 +632,19 @@ public class CalciteSqlCompilerTest {
@Test
public void testQueryOptions() {
- PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where name <> 'Brussels sprouts'");
+ PinotQuery pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("select * from vegetables where name <> 'Brussels sprouts'");
Assert.assertEquals(pinotQuery.getQueryOptionsSize(), 0);
Assert.assertNull(pinotQuery.getQueryOptions());
- pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where name <> 'Brussels sprouts' OPTION (delicious=yes)");
+ pinotQuery = CalciteSqlParser
+ .compileToPinotQuery("select * from vegetables where name <> 'Brussels sprouts' OPTION (delicious=yes)");
Assert.assertEquals(pinotQuery.getQueryOptionsSize(), 1);
Assert.assertTrue(pinotQuery.getQueryOptions().containsKey("delicious"));
Assert.assertEquals(pinotQuery.getQueryOptions().get("delicious"), "yes");
- pinotQuery = CalciteSqlParser
- .compileToPinotQuery("select * from vegetables where name <> 'Brussels sprouts' OPTION (delicious=yes, foo=1234, bar='potato')");
+ pinotQuery = CalciteSqlParser.compileToPinotQuery(
+ "select * from vegetables where name <> 'Brussels sprouts' OPTION (delicious=yes, foo=1234, bar='potato')");
Assert.assertEquals(pinotQuery.getQueryOptionsSize(), 3);
Assert.assertTrue(pinotQuery.getQueryOptions().containsKey("delicious"));
Assert.assertEquals(pinotQuery.getQueryOptions().get("delicious"), "yes");
@@ -599,7 +652,8 @@ public class CalciteSqlCompilerTest {
Assert.assertEquals(pinotQuery.getQueryOptions().get("bar"), "'potato'");
pinotQuery = CalciteSqlParser.compileToPinotQuery(
- "select * from vegetables where name <> 'Brussels sprouts' OPTION (delicious=yes) option(foo=1234) option" + "(bar='potato')");
+ "select * from vegetables where name <> 'Brussels sprouts' OPTION (delicious=yes) option(foo=1234) option"
+ + "(bar='potato')");
Assert.assertEquals(pinotQuery.getQueryOptionsSize(), 3);
Assert.assertTrue(pinotQuery.getQueryOptions().containsKey("delicious"));
Assert.assertEquals(pinotQuery.getQueryOptions().get("delicious"), "yes");
@@ -609,11 +663,11 @@ public class CalciteSqlCompilerTest {
@Test
public void testIdentifierQuoteCharacter() {
- PinotQuery pinotQuery =
- CalciteSqlParser.compileToPinotQuery("select avg(attributes.age) as avg_age from person group by attributes.address_city");
+ PinotQuery pinotQuery = CalciteSqlParser
+ .compileToPinotQuery("select avg(attributes.age) as avg_age from person group by attributes.address_city");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "attributes.age");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "attributes.age");
Assert.assertEquals(pinotQuery.getGroupByList().get(0).getIdentifier().getName(), "attributes.address_city");
}
@@ -623,29 +677,37 @@ public class CalciteSqlCompilerTest {
assertCompilationFails("SELECT 'foo' FROM table");
// Allow string literal column in aggregation and group-by query
- PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery("SELECT SUM('foo'), MAX(bar) FROM myTable GROUP BY 'foo', bar");
+ PinotQuery pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("SELECT SUM('foo'), MAX(bar) FROM myTable GROUP BY 'foo', bar");
List<Expression> selectFunctionList = pinotQuery.getSelectList();
Assert.assertEquals(selectFunctionList.size(), 2);
- Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getLiteral().getStringValue(), "foo");
- Assert.assertEquals(selectFunctionList.get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
+ Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getLiteral().getStringValue(),
+ "foo");
+ Assert.assertEquals(selectFunctionList.get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ "bar");
List<Expression> groupbyList = pinotQuery.getGroupByList();
Assert.assertEquals(groupbyList.size(), 2);
Assert.assertEquals(groupbyList.get(0).getLiteral().getStringValue(), "foo");
Assert.assertEquals(groupbyList.get(1).getIdentifier().getName(), "bar");
// For UDF, string literal won't be treated as column but as LITERAL
- pinotQuery = CalciteSqlParser.compileToPinotQuery("SELECT SUM(ADD(foo, 'bar')) FROM myTable GROUP BY sub(foo, bar), SUB(BAR, FOO)");
+ pinotQuery = CalciteSqlParser
+ .compileToPinotQuery("SELECT SUM(ADD(foo, 'bar')) FROM myTable GROUP BY sub(foo, bar), SUB(BAR, FOO)");
selectFunctionList = pinotQuery.getSelectList();
Assert.assertEquals(selectFunctionList.size(), 1);
Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperator(), "SUM");
Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().size(), 1);
- Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "ADD");
- Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().size(), 2);
+ Assert
+ .assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "ADD");
Assert.assertEquals(
- selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
- "foo");
- Assert.assertEquals(selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getLiteral()
- .getStringValue(), "bar");
+ selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().size(), 2);
+ Assert.assertEquals(
+ selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "foo");
+ Assert.assertEquals(
+ selectFunctionList.get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getLiteral().getStringValue(), "bar");
groupbyList = pinotQuery.getGroupByList();
Assert.assertEquals(groupbyList.size(), 2);
Assert.assertEquals(groupbyList.get(0).getFunctionCall().getOperator(), "SUB");
@@ -661,66 +723,82 @@ public class CalciteSqlCompilerTest {
@Test
public void testFilterUdf() {
- PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery("select count(*) from baseballStats where DIV(numberOfGames,10) = 100");
+ PinotQuery pinotQuery =
+ CalciteSqlParser.compileToPinotQuery("select count(*) from baseballStats where DIV(numberOfGames,10) = 100");
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "COUNT");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "*");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "*");
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "EQUALS");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "DIV");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "numberOfGames");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "DIV");
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "numberOfGames");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getLiteral()
- .getLongValue(), 10);
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 100);
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getLiteral().getLongValue(), 10);
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 100);
- pinotQuery = CalciteSqlParser
- .compileToPinotQuery("SELECT count(*) FROM mytable WHERE timeConvert(DaysSinceEpoch,'DAYS','SECONDS') = 1394323200");
+ pinotQuery = CalciteSqlParser.compileToPinotQuery(
+ "SELECT count(*) FROM mytable WHERE timeConvert(DaysSinceEpoch,'DAYS','SECONDS') = 1394323200");
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "COUNT");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "*");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "*");
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "EQUALS");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
"TIMECONVERT");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "DaysSinceEpoch");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "DaysSinceEpoch");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getLiteral()
- .getStringValue(), "DAYS");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getLiteral().getStringValue(), "DAYS");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(2).getLiteral()
- .getStringValue(), "SECONDS");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 1394323200);
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(2)
+ .getLiteral().getStringValue(), "SECONDS");
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getLongValue(),
+ 1394323200);
}
@Test
public void testSelectionTransformFunction() {
- PinotQuery pinotQuery =
- CalciteSqlParser.compileToPinotQuery(" select mapKey(mapField,k1) from baseballStats where mapKey(mapField,k1) = 'v1'");
+ PinotQuery pinotQuery = CalciteSqlParser
+ .compileToPinotQuery(" select mapKey(mapField,k1) from baseballStats where mapKey(mapField,k1) = 'v1'");
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "MAPKEY");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "mapField");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "k1");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "mapField");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "k1");
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "EQUALS");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "MAPKEY");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "mapField");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "MAPKEY");
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "mapField");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getIdentifier()
- .getName(), "k1");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(), "v1");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getIdentifier().getName(), "k1");
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(), "v1");
}
@Test
public void testTimeTransformFunction() {
- PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(" select hour(ts), d1, sum(m1) from baseballStats group by hour(ts), d1");
+ PinotQuery pinotQuery =
+ CalciteSqlParser.compileToPinotQuery(" select hour(ts), d1, sum(m1) from baseballStats group by hour(ts), d1");
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "HOUR");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "ts");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "ts");
Assert.assertEquals(pinotQuery.getSelectList().get(1).getIdentifier().getName(), "d1");
Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperator(), "SUM");
Assert.assertEquals(pinotQuery.getGroupByList().get(0).getFunctionCall().getOperator(), "HOUR");
- Assert.assertEquals(pinotQuery.getGroupByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "ts");
+ Assert.assertEquals(
+ pinotQuery.getGroupByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "ts");
Assert.assertEquals(pinotQuery.getGroupByList().get(1).getIdentifier().getName(), "d1");
}
@@ -855,7 +933,8 @@ public class CalciteSqlCompilerTest {
Assert.fail("Query should have failed compilation");
} catch (Exception e) {
Assert.assertTrue(e instanceof SqlCompilationException);
- Assert.assertTrue(e.getMessage().contains("Syntax error: Use of DISTINCT with aggregation functions is not supported"));
+ Assert.assertTrue(
+ e.getMessage().contains("Syntax error: Use of DISTINCT with aggregation functions is not supported"));
}
// same reason as above
@@ -865,7 +944,8 @@ public class CalciteSqlCompilerTest {
Assert.fail("Query should have failed compilation");
} catch (Exception e) {
Assert.assertTrue(e instanceof SqlCompilationException);
- Assert.assertTrue(e.getMessage().contains("Syntax error: Use of DISTINCT with aggregation functions is not supported"));
+ Assert.assertTrue(
+ e.getMessage().contains("Syntax error: Use of DISTINCT with aggregation functions is not supported"));
}
// Pinot currently does not support DISTINCT * syntax
@@ -876,7 +956,8 @@ public class CalciteSqlCompilerTest {
} catch (Exception e) {
Assert.assertTrue(e instanceof SqlCompilationException);
Assert.assertTrue(e.getMessage().contains(
- "Syntax error: Pinot currently does not support DISTINCT with *. Please specify each column name after " + "DISTINCT keyword"));
+ "Syntax error: Pinot currently does not support DISTINCT with *. Please specify each column name after "
+ + "DISTINCT keyword"));
}
// Pinot currently does not support DISTINCT * syntax
@@ -887,7 +968,8 @@ public class CalciteSqlCompilerTest {
} catch (Exception e) {
Assert.assertTrue(e instanceof SqlCompilationException);
Assert.assertTrue(e.getMessage().contains(
- "Syntax error: Pinot currently does not support DISTINCT with *. Please specify each column name after " + "DISTINCT keyword"));
+ "Syntax error: Pinot currently does not support DISTINCT with *. Please specify each column name after "
+ + "DISTINCT keyword"));
}
// Pinot currently does not support GROUP BY with DISTINCT
@@ -982,7 +1064,8 @@ public class CalciteSqlCompilerTest {
Assert.assertEquals(aggregationInfos.size(), 1);
aggregationInfo = aggregationInfos.get(0);
Assert.assertEquals(aggregationInfo.getAggregationType(), AggregationFunctionType.DISTINCT.getName());
- Assert.assertEquals(aggregationInfo.getExpressions(), Arrays.asList("add(div(col1,col2),mul(col3,col4))", "sub(col3,col4)"));
+ Assert.assertEquals(aggregationInfo.getExpressions(),
+ Arrays.asList("add(div(col1,col2),mul(col3,col4))", "sub(col3,col4)"));
// multi-column distinct with multiple transform columns and additional identifiers
sql = "SELECT DISTINCT add(div(col1, col2), mul(col3, col4)), sub(col3, col4), col5, col6 FROM foo";
@@ -1049,8 +1132,9 @@ public class CalciteSqlCompilerTest {
@Test
public void testQueryValidation() {
// Valid: Selection fields are part of group by identifiers.
- String sql = "select group_country, sum(rsvp_count), count(*) from meetupRsvp group by group_city, group_country ORDER BY "
- + "sum(rsvp_count), count(*) limit 50";
+ String sql =
+ "select group_country, sum(rsvp_count), count(*) from meetupRsvp group by group_city, group_country ORDER BY "
+ + "sum(rsvp_count), count(*) limit 50";
PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(sql);
Assert.assertEquals(pinotQuery.getGroupByListSize(), 2);
Assert.assertEquals(pinotQuery.getSelectListSize(), 3);
@@ -1086,7 +1170,8 @@ public class CalciteSqlCompilerTest {
// Invalid groupBy clause shouldn't contain aggregate expression, like sum(rsvp_count), count(*).
try {
- sql = "select sum(rsvp_count), count(*) from meetupRsvp group by group_country, sum(rsvp_count), count(*) limit " + "50";
+ sql = "select sum(rsvp_count), count(*) from meetupRsvp group by group_country, sum(rsvp_count), count(*) limit "
+ + "50";
CalciteSqlParser.compileToPinotQuery(sql);
Assert.fail("Query should have failed compilation");
} catch (Exception e) {
@@ -1107,15 +1192,19 @@ public class CalciteSqlCompilerTest {
Assert.assertEquals(pinotQuery.getGroupByListSize(), 1);
Assert.assertEquals(pinotQuery.getOrderByListSize(), 2);
Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperator(), "ASC");
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "COUNT");
Assert.assertEquals(
- pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "*");
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "COUNT");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "*");
Assert.assertEquals(pinotQuery.getOrderByList().get(1).getFunctionCall().getOperator(), "DESC");
- Assert.assertEquals(pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "SUM");
Assert.assertEquals(
- pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "rsvp_count");
+ pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "SUM");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "rsvp_count");
// Valid mixed alias expressions in query.
sql = "select secondsSinceEpoch, sum(rsvp_count), count(*) as cnt from meetupRsvp group by secondsSinceEpoch"
@@ -1125,34 +1214,44 @@ public class CalciteSqlCompilerTest {
Assert.assertEquals(pinotQuery.getGroupByListSize(), 1);
Assert.assertEquals(pinotQuery.getOrderByListSize(), 2);
Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperator(), "ASC");
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "COUNT");
Assert.assertEquals(
- pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "*");
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "COUNT");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "*");
Assert.assertEquals(pinotQuery.getOrderByList().get(1).getFunctionCall().getOperator(), "DESC");
- Assert.assertEquals(pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "SUM");
Assert.assertEquals(
- pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "rsvp_count");
+ pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "SUM");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "rsvp_count");
sql = "select secondsSinceEpoch/86400 AS daysSinceEpoch, sum(rsvp_count) as sum_rsvp_count, count(*) as cnt"
- + " from meetupRsvp where daysSinceEpoch = 18523 group by daysSinceEpoch order by cnt, sum_rsvp_count DESC" + " limit 50";
+ + " from meetupRsvp where daysSinceEpoch = 18523 group by daysSinceEpoch order by cnt, sum_rsvp_count DESC"
+ + " limit 50";
pinotQuery = CalciteSqlParser.compileToPinotQuery(sql);
Assert.assertEquals(pinotQuery.getSelectListSize(), 3);
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "EQUALS");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "DIVIDE");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "secondsSinceEpoch");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "DIVIDE");
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "secondsSinceEpoch");
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getLiteral().getLongValue(), 86400);
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getLiteral()
- .getLongValue(), 86400);
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 18523);
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 18523);
Assert.assertEquals(pinotQuery.getGroupByListSize(), 1);
Assert.assertEquals(pinotQuery.getGroupByList().get(0).getFunctionCall().getOperator(), "DIVIDE");
- Assert.assertEquals(pinotQuery.getGroupByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ Assert.assertEquals(
+ pinotQuery.getGroupByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
"secondsSinceEpoch");
- Assert.assertEquals(pinotQuery.getGroupByList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 86400);
+ Assert.assertEquals(
+ pinotQuery.getGroupByList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 86400);
Assert.assertEquals(pinotQuery.getOrderByListSize(), 2);
// Invalid groupBy clause shouldn't contain aggregate expression, like sum(rsvp_count), count(*).
@@ -1174,16 +1273,22 @@ public class CalciteSqlCompilerTest {
pinotQuery = CalciteSqlParser.compileToPinotQuery(sql);
Assert.assertEquals(pinotQuery.getSelectListSize(), 3);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), SqlKind.AS.toString());
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "C1");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "ALIAS_C1");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "C1");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "ALIAS_C1");
Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperator(), SqlKind.AS.toString());
- Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "C2");
- Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "ALIAS_C2");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "C2");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "ALIAS_C2");
Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperator(), "ADD");
- Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "C1");
- Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "C2");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "C1");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "C2");
// Invalid groupBy clause shouldn't contain aggregate expression, like sum(rsvp_count), count(*).
try {
@@ -1212,38 +1317,49 @@ public class CalciteSqlCompilerTest {
PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery("select a,b+2,c*5,(d+5)*2 from myTable");
Assert.assertEquals(pinotQuery.getSelectListSize(), 4);
Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperator(), "PLUS");
- Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "b");
- Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 2);
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "b");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 2);
Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperator(), "TIMES");
- Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "c");
- Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 5);
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "c");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 5);
Assert.assertEquals(pinotQuery.getSelectList().get(3).getFunctionCall().getOperator(), "TIMES");
- Assert.assertEquals(pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "PLUS");
Assert.assertEquals(
- pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "d");
+ pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "PLUS");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "d");
Assert.assertEquals(
- pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getLiteral()
- .getLongValue(), 5);
- Assert.assertEquals(pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 2);
+ pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getLiteral().getLongValue(), 5);
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 2);
pinotQuery = CalciteSqlParser.compileToPinotQuery("select a % 200 + b * 5 from myTable");
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "PLUS");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "MOD");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "a");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "MOD");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "a");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getLiteral()
- .getLongValue(), 200);
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperator(), "TIMES");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getLiteral().getLongValue(), 200);
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "b");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperator(),
+ "TIMES");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(1).getLiteral()
- .getLongValue(), 5);
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "b");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(1)
+ .getLiteral().getLongValue(), 5);
}
/**
@@ -1259,38 +1375,56 @@ public class CalciteSqlCompilerTest {
+ "myTable where groups = 'foo'");
Assert.assertEquals(pinotQuery.getSelectListSize(), 5);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "AS");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "MAX");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "value");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "max");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "MAX");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "value");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "max");
Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperator(), "AS");
- Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "MIN");
Assert.assertEquals(
- pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "value");
- Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "min");
+ pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "MIN");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "value");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "min");
Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperator(), "AS");
- Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "SUM");
Assert.assertEquals(
- pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "value");
- Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "sum");
+ pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "SUM");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "value");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(2).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "sum");
Assert.assertEquals(pinotQuery.getSelectList().get(3).getFunctionCall().getOperator(), "AS");
- Assert.assertEquals(pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "COUNT");
Assert.assertEquals(
- pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "*");
- Assert.assertEquals(pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "count");
+ pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "COUNT");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "*");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(3).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "count");
Assert.assertEquals(pinotQuery.getSelectList().get(4).getFunctionCall().getOperator(), "AS");
- Assert.assertEquals(pinotQuery.getSelectList().get(4).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "AVG");
Assert.assertEquals(
- pinotQuery.getSelectList().get(4).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "value");
- Assert.assertEquals(pinotQuery.getSelectList().get(4).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "avg");
+ pinotQuery.getSelectList().get(4).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "AVG");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(4).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "value");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(4).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "avg");
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "EQUALS");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getIdentifier().getName(), "groups");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(), "foo");
+ Assert
+ .assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ "groups");
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getLiteral().getStringValue(), "foo");
// language, module, return, position, system
pinotQuery = CalciteSqlParser.compileToPinotQuery(
@@ -1298,16 +1432,18 @@ public class CalciteSqlCompilerTest {
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "AND");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "position");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "position");
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getIdentifier().getName(), "language");
+ Assert.assertEquals(
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getFunctionCall().getOperands().get(0).getIdentifier().getName(), "return");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getIdentifier().getName(), "language");
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "module");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall()
- .getOperands().get(0).getIdentifier().getName(), "return");
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "module");
- Assert.assertEquals(pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "system");
+ pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "system");
// table - need to escape
try {
@@ -1365,18 +1501,19 @@ public class CalciteSqlCompilerTest {
// escaping the above works
pinotQuery = CalciteSqlParser.compileToPinotQuery(
- "select sum(foo) from \"table\" where \"Date\" = 2019 and (\"timestamp\" < 100 or \"time\" > 200) group by " + "\"group\"");
+ "select sum(foo) from \"table\" where \"Date\" = 2019 and (\"timestamp\" < 100 or \"time\" > 200) group by "
+ + "\"group\"");
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getDataSource().getTableName(), "table");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "Date");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "Date");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperands().get(0).getIdentifier().getName(), "timestamp");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperands().get(0).getIdentifier().getName(), "timestamp");
Assert.assertEquals(
- pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(1).getFunctionCall()
- .getOperands().get(0).getIdentifier().getName(), "time");
+ pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(1).getFunctionCall().getOperands().get(1)
+ .getFunctionCall().getOperands().get(0).getIdentifier().getName(), "time");
Assert.assertEquals(pinotQuery.getGroupByList().get(0).getIdentifier().getName(), "group");
}
@@ -1385,47 +1522,61 @@ public class CalciteSqlCompilerTest {
PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery("select CAST(25.65 AS int) from myTable");
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals("CAST", pinotQuery.getSelectList().get(0).getFunctionCall().getOperator());
- Assert.assertEquals(25.65, pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getLiteral().getDoubleValue());
- Assert.assertEquals("INTEGER", pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
+ Assert.assertEquals(25.65,
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getLiteral().getDoubleValue());
+ Assert.assertEquals("INTEGER",
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
pinotQuery = CalciteSqlParser.compileToPinotQuery("SELECT CAST('20170825' AS LONG) from myTable");
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals("CAST", pinotQuery.getSelectList().get(0).getFunctionCall().getOperator());
- Assert.assertEquals("20170825", pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getLiteral().getStringValue());
- Assert.assertEquals("LONG", pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
+ Assert.assertEquals("20170825",
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getLiteral().getStringValue());
+ Assert.assertEquals("LONG",
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
pinotQuery = CalciteSqlParser.compileToPinotQuery("SELECT CAST(20170825.0 AS Float) from myTable");
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals("CAST", pinotQuery.getSelectList().get(0).getFunctionCall().getOperator());
- Assert.assertEquals(20170825.0, pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getLiteral().getDoubleValue());
- Assert.assertEquals("FLOAT", pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
+ Assert.assertEquals(20170825.0,
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getLiteral().getDoubleValue());
+ Assert.assertEquals("FLOAT",
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
pinotQuery = CalciteSqlParser.compileToPinotQuery("SELECT CAST(20170825.0 AS dOuble) from myTable");
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals("CAST", pinotQuery.getSelectList().get(0).getFunctionCall().getOperator());
- Assert.assertEquals(20170825.0, pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getLiteral().getDoubleValue());
- Assert.assertEquals("DOUBLE", pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
+ Assert.assertEquals(20170825.0,
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getLiteral().getDoubleValue());
+ Assert.assertEquals("DOUBLE",
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
pinotQuery = CalciteSqlParser.compileToPinotQuery("SELECT CAST(column1 AS STRING) from myTable");
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals("CAST", pinotQuery.getSelectList().get(0).getFunctionCall().getOperator());
- Assert.assertEquals("column1", pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName());
- Assert.assertEquals("STRING", pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
+ Assert.assertEquals("column1",
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName());
+ Assert.assertEquals("STRING",
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
pinotQuery = CalciteSqlParser.compileToPinotQuery("SELECT CAST(column1 AS varchar) from myTable");
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals("CAST", pinotQuery.getSelectList().get(0).getFunctionCall().getOperator());
- Assert.assertEquals("column1", pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName());
- Assert.assertEquals("VARCHAR", pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
+ Assert.assertEquals("column1",
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName());
+ Assert.assertEquals("VARCHAR",
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue());
pinotQuery = CalciteSqlParser.compileToPinotQuery(
- "SELECT SUM(CAST(CAST(ArrTime AS STRING) AS LONG)) FROM mytable WHERE DaysSinceEpoch <> 16312 AND Carrier = " + "'DL'");
+ "SELECT SUM(CAST(CAST(ArrTime AS STRING) AS LONG)) FROM mytable WHERE DaysSinceEpoch <> 16312 AND Carrier = "
+ + "'DL'");
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals("SUM", pinotQuery.getSelectList().get(0).getFunctionCall().getOperator());
- Assert.assertEquals("CAST", pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator());
Assert.assertEquals("CAST",
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getFunctionCall()
- .getOperator());
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator());
+ Assert.assertEquals("CAST",
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getFunctionCall().getOperator());
}
@Test
@@ -1434,39 +1585,47 @@ public class CalciteSqlCompilerTest {
PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
Assert.assertEquals(pinotQuery.getSelectList().size(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "DISTINCTCOUNT");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
query = "SELECT count(distinct bar) FROM foo GROUP BY city";
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
Assert.assertEquals(pinotQuery.getSelectList().size(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "DISTINCTCOUNT");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
query = "SELECT count(distinct bar), distinctCount(bar) FROM foo GROUP BY city";
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
Assert.assertEquals(pinotQuery.getSelectList().size(), 2);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "DISTINCTCOUNT");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperator(), "DISTINCTCOUNT");
- Assert.assertEquals(pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
query = "SELECT count(distinct bar), count(*), sum(a),min(a),max(b) FROM foo GROUP BY city";
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
Assert.assertEquals(pinotQuery.getSelectList().size(), 5);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "DISTINCTCOUNT");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
query = "SELECT count(distinct bar) AS distinct_bar, count(*), sum(a),min(a),max(b) FROM foo GROUP BY city";
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
Assert.assertEquals(pinotQuery.getSelectList().size(), 5);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "AS");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
"DISTINCTCOUNT");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "bar");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "distinct_bar");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "bar");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(),
+ "distinct_bar");
}
@Test
@@ -1477,8 +1636,10 @@ public class CalciteSqlCompilerTest {
Assert.assertEquals(pinotQuery.getSelectList().get(1).getIdentifier().getName(), "bar");
Assert.assertEquals(pinotQuery.getGroupByList().get(0).getIdentifier().getName(), "foo");
Assert.assertEquals(pinotQuery.getGroupByList().get(1).getIdentifier().getName(), "bar");
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "foo");
- Assert.assertEquals(pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "foo");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
query = "SELECT foo, bar, count(*) FROM t GROUP BY 2, 1 ORDER BY 2, 1 DESC";
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
@@ -1486,24 +1647,31 @@ public class CalciteSqlCompilerTest {
Assert.assertEquals(pinotQuery.getSelectList().get(1).getIdentifier().getName(), "bar");
Assert.assertEquals(pinotQuery.getGroupByList().get(0).getIdentifier().getName(), "bar");
Assert.assertEquals(pinotQuery.getGroupByList().get(1).getIdentifier().getName(), "foo");
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
- Assert.assertEquals(pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "foo");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "foo");
query = "SELECT foo as f, bar as b, count(*) FROM t GROUP BY 2, 1 ORDER BY 2, 1 DESC";
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
Assert.assertEquals(pinotQuery.getGroupByList().get(0).getIdentifier().getName(), "bar");
Assert.assertEquals(pinotQuery.getGroupByList().get(1).getIdentifier().getName(), "foo");
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
- Assert.assertEquals(pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "foo");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "bar");
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "foo");
query = "select a, b + 2, array_sum(c) as array_sum_c, count(*) from data group by a, 2, array_sum_c";
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
Assert.assertEquals(pinotQuery.getGroupByList().get(0).getIdentifier().getName(), "a");
Assert.assertEquals(pinotQuery.getGroupByList().get(1).getFunctionCall().getOperator(), "PLUS");
- Assert.assertEquals(pinotQuery.getGroupByList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "b");
- Assert.assertEquals(pinotQuery.getGroupByList().get(1).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 2L);
+ Assert.assertEquals(
+ pinotQuery.getGroupByList().get(1).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "b");
+ Assert.assertEquals(
+ pinotQuery.getGroupByList().get(1).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 2L);
Assert.assertEquals(pinotQuery.getGroupByList().get(2).getFunctionCall().getOperator(), "ARRAY_SUM");
- Assert.assertEquals(pinotQuery.getGroupByList().get(2).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "c");
+ Assert.assertEquals(
+ pinotQuery.getGroupByList().get(2).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "c");
Assert.expectThrows(SqlCompilationException.class,
() -> CalciteSqlParser.compileToPinotQuery("SELECT foo, bar, count(*) FROM t GROUP BY 0"));
@@ -1513,12 +1681,16 @@ public class CalciteSqlCompilerTest {
@Test
public void testOrdinalsQueryRewriteWithDistinctOrderby() {
- String query = "SELECT baseballStats.playerName AS playerName FROM baseballStats GROUP BY baseballStats.playerName ORDER BY " + "1 ASC";
+ String query =
+ "SELECT baseballStats.playerName AS playerName FROM baseballStats GROUP BY baseballStats.playerName ORDER BY "
+ + "1 ASC";
PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
"baseballStats.playerName");
Assert.assertTrue(pinotQuery.getGroupByList().isEmpty());
- Assert.assertEquals(pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ Assert.assertEquals(
+ pinotQuery.getOrderByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
"baseballStats.playerName");
}
@@ -1588,7 +1760,8 @@ public class CalciteSqlCompilerTest {
PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
Function greaterThan = pinotQuery.getFilterExpression().getFunctionCall();
String today = greaterThan.getOperands().get(1).getLiteral().getStringValue();
- String expectedTodayStr = Instant.now().atZone(ZoneId.of("UTC")).format(DateTimeFormatter.ofPattern("yyyy-MM-dd z"));
+ String expectedTodayStr =
+ Instant.now().atZone(ZoneId.of("UTC")).format(DateTimeFormatter.ofPattern("yyyy-MM-dd z"));
Assert.assertEquals(today, expectedTodayStr);
}
@@ -1635,7 +1808,8 @@ public class CalciteSqlCompilerTest {
expression = CalciteSqlParser.invokeCompileTimeFunctionExpression(expression);
Assert.assertNotNull(expression.getFunctionCall());
Assert.assertEquals(expression.getFunctionCall().getOperator(), "TODATETIME");
- Assert.assertEquals(expression.getFunctionCall().getOperands().get(0).getIdentifier().getName(), "millisSinceEpoch");
+ Assert
+ .assertEquals(expression.getFunctionCall().getOperands().get(0).getIdentifier().getName(), "millisSinceEpoch");
expression = CalciteSqlParser.compileToExpression("reverse(playerName)");
Assert.assertNotNull(expression.getFunctionCall());
@@ -1668,8 +1842,10 @@ public class CalciteSqlCompilerTest {
public void testLiteralExpressionCheck() {
Assert.assertTrue(CalciteSqlParser.isLiteralOnlyExpression(CalciteSqlParser.compileToExpression("1123")));
Assert.assertTrue(CalciteSqlParser.isLiteralOnlyExpression(CalciteSqlParser.compileToExpression("'ab'")));
- Assert.assertTrue(CalciteSqlParser.isLiteralOnlyExpression(CalciteSqlParser.compileToExpression("AS('ab', randomStr)")));
- Assert.assertTrue(CalciteSqlParser.isLiteralOnlyExpression(CalciteSqlParser.compileToExpression("AS(123, randomTime)")));
+ Assert.assertTrue(
+ CalciteSqlParser.isLiteralOnlyExpression(CalciteSqlParser.compileToExpression("AS('ab', randomStr)")));
+ Assert.assertTrue(
+ CalciteSqlParser.isLiteralOnlyExpression(CalciteSqlParser.compileToExpression("AS(123, randomTime)")));
Assert.assertFalse(CalciteSqlParser.isLiteralOnlyExpression(CalciteSqlParser.compileToExpression("sum(abc)")));
Assert.assertFalse(CalciteSqlParser.isLiteralOnlyExpression(CalciteSqlParser.compileToExpression("count(*)")));
Assert.assertFalse(CalciteSqlParser.isLiteralOnlyExpression(CalciteSqlParser.compileToExpression("a+B")));
@@ -1707,7 +1883,9 @@ public class CalciteSqlCompilerTest {
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
brokerRequest = converter.convert(pinotQuery);
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "IS_NOT_NULL");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getIdentifier().getName(), "col");
+ Assert
+ .assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ "col");
Assert.assertEquals(brokerRequest.getFilterQuery().getOperator(), FilterOperator.IS_NOT_NULL);
Assert.assertEquals(brokerRequest.getFilterQuery().getColumn(), "col");
@@ -1715,7 +1893,9 @@ public class CalciteSqlCompilerTest {
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
brokerRequest = converter.convert(pinotQuery);
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "IS_NOT_NULL");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getIdentifier().getName(), "col");
+ Assert
+ .assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ "col");
Assert.assertEquals(brokerRequest.getFilterQuery().getOperator(), FilterOperator.IS_NOT_NULL);
Assert.assertEquals(brokerRequest.getFilterQuery().getColumn(), "col");
@@ -1723,7 +1903,9 @@ public class CalciteSqlCompilerTest {
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
brokerRequest = converter.convert(pinotQuery);
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "IS_NULL");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getIdentifier().getName(), "col");
+ Assert
+ .assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ "col");
Assert.assertEquals(brokerRequest.getFilterQuery().getOperator(), FilterOperator.IS_NULL);
Assert.assertEquals(brokerRequest.getFilterQuery().getColumn(), "col");
@@ -1731,7 +1913,9 @@ public class CalciteSqlCompilerTest {
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
brokerRequest = converter.convert(pinotQuery);
Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperator(), "IS_NULL");
- Assert.assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getIdentifier().getName(), "col");
+ Assert
+ .assertEquals(pinotQuery.getFilterExpression().getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+ "col");
Assert.assertEquals(brokerRequest.getFilterQuery().getOperator(), FilterOperator.IS_NULL);
Assert.assertEquals(brokerRequest.getFilterQuery().getColumn(), "col");
}
@@ -1744,7 +1928,8 @@ public class CalciteSqlCompilerTest {
BrokerRequest brokerRequest = converter.convert(pinotQuery);
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator().toUpperCase(), "DISTINCT");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "col1");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "col1");
Assert.assertEquals(brokerRequest.getAggregationsInfo().size(), 1);
Assert.assertEquals(brokerRequest.getAggregationsInfo().get(0).getAggregationType().toUpperCase(), "DISTINCT");
@@ -1755,8 +1940,10 @@ public class CalciteSqlCompilerTest {
brokerRequest = converter.convert(pinotQuery);
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator().toUpperCase(), "DISTINCT");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "col1");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "col2");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "col1");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getIdentifier().getName(), "col2");
Assert.assertEquals(brokerRequest.getAggregationsInfo().size(), 1);
Assert.assertEquals(brokerRequest.getAggregationsInfo().get(0).getAggregationType().toUpperCase(), "DISTINCT");
@@ -1767,46 +1954,52 @@ public class CalciteSqlCompilerTest {
brokerRequest = converter.convert(pinotQuery);
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator().toUpperCase(), "DISTINCT");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "PLUS");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "col1");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "PLUS");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "col1");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall()
- .getOperator(), "TIMES");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getFunctionCall().getOperator(), "TIMES");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall()
- .getOperands().get(0).getIdentifier().getName(), "col2");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getFunctionCall().getOperands().get(0).getIdentifier().getName(), "col2");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall()
- .getOperands().get(1).getLiteral().getLongValue(), 5L);
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 5L);
Assert.assertEquals(brokerRequest.getAggregationsInfo().size(), 1);
Assert.assertEquals(brokerRequest.getAggregationsInfo().get(0).getAggregationType().toUpperCase(), "DISTINCT");
- Assert.assertEquals(brokerRequest.getAggregationsInfo().get(0).getAggregationParams().get("column"), "plus(col1,times(col2,'5'))");
+ Assert.assertEquals(brokerRequest.getAggregationsInfo().get(0).getAggregationParams().get("column"),
+ "plus(col1,times(col2,'5'))");
query = "SELECT col1+col2*5 AS col3 FROM foo GROUP BY col1, col2";
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
brokerRequest = converter.convert(pinotQuery);
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator().toUpperCase(), "DISTINCT");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "PLUS");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "col1");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "PLUS");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "col1");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall()
- .getOperator(), "TIMES");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getFunctionCall().getOperator(), "TIMES");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall()
- .getOperands().get(0).getIdentifier().getName(), "col2");
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getFunctionCall().getOperands().get(0).getIdentifier().getName(), "col2");
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1).getFunctionCall()
- .getOperands().get(1).getLiteral().getLongValue(), 5L);
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(1)
+ .getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 5L);
Assert.assertEquals(brokerRequest.getAggregationsInfo().size(), 1);
Assert.assertEquals(brokerRequest.getAggregationsInfo().get(0).getAggregationType().toUpperCase(), "DISTINCT");
- Assert.assertEquals(brokerRequest.getAggregationsInfo().get(0).getAggregationParams().get("column"), "plus(col1,times(col2,'5'))");
+ Assert.assertEquals(brokerRequest.getAggregationsInfo().get(0).getAggregationParams().get("column"),
+ "plus(col1,times(col2,'5'))");
}
@Test(expectedExceptions = SqlCompilationException.class)
@@ -1816,7 +2009,8 @@ public class CalciteSqlCompilerTest {
CalciteSqlParser.compileToPinotQuery("SELECT col1+col2 FROM foo GROUP BY col1");
} catch (SqlCompilationException e) {
Assert.assertEquals(e.getMessage(),
- "For non-aggregation group by query, all the identifiers in select clause should be in groupBys. Found " + "identifier: [col2]");
+ "For non-aggregation group by query, all the identifiers in select clause should be in groupBys. Found "
+ + "identifier: [col2]");
throw e;
}
}
@@ -1866,8 +2060,9 @@ public class CalciteSqlCompilerTest {
}
{
- String query = "SELECT * FROM foo WHERE col1 > 0 AND ((col2 > 0 AND col3 > 0) AND (col1 <= 0 OR (col2 <= 0 OR (col3 <= 0 OR"
- + " col4 <= 0) OR (col3 > 0 AND col4 > 0))))";
+ String query =
+ "SELECT * FROM foo WHERE col1 > 0 AND ((col2 > 0 AND col3 > 0) AND (col1 <= 0 OR (col2 <= 0 OR (col3 <= 0 OR"
+ + " col4 <= 0) OR (col3 > 0 AND col4 > 0))))";
PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
Function functionCall = pinotQuery.getFilterExpression().getFunctionCall();
Assert.assertEquals(functionCall.getOperator(), SqlKind.AND.name());
@@ -1937,7 +2132,8 @@ public class CalciteSqlCompilerTest {
{
String query =
- "SELECT SUM(col1), col2 FROM foo WHERE true GROUP BY col2 HAVING SUM(col1) > 10 AND SUM(col3) > 5 AND SUM" + "(col4) > 15";
+ "SELECT SUM(col1), col2 FROM foo WHERE true GROUP BY col2 HAVING SUM(col1) > 10 AND SUM(col3) > 5 AND SUM"
+ + "(col4) > 15";
PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
Function functionCall = pinotQuery.getHavingExpression().getFunctionCall();
Assert.assertEquals(functionCall.getOperator(), SqlKind.AND.name());
@@ -2035,33 +2231,41 @@ public class CalciteSqlCompilerTest {
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "sumMV");
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().size(), 1);
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
sql = "SELECT MIN(ARRAYMIN(a)) FROM Foo";
pinotQuery = CalciteSqlParser.compileToPinotQuery(sql);
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "minMV");
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().size(), 1);
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
sql = "SELECT Max(ArrayMax(a)) FROM Foo";
pinotQuery = CalciteSqlParser.compileToPinotQuery(sql);
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "maxMV");
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().size(), 1);
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "a");
sql = "SELECT Max(ArrayMax(a)) + 1 FROM Foo";
pinotQuery = CalciteSqlParser.compileToPinotQuery(sql);
Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "PLUS");
Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().size(), 2);
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(), "maxMV");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().size(), 1);
Assert.assertEquals(
- pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier()
- .getName(), "a");
- Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 1L);
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperator(),
+ "maxMV");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().size(),
+ 1);
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getFunctionCall().getOperands().get(0)
+ .getIdentifier().getName(), "a");
+ Assert.assertEquals(
+ pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(), 1L);
}
/**
@@ -2072,7 +2276,8 @@ public class CalciteSqlCompilerTest {
@Test
public void testSqlNumericalLiteralisIntegerNPE() {
CalciteSqlCompiler compiler = new CalciteSqlCompiler();
- BrokerRequest sqlBrokerRequest = compiler.compileToBrokerRequest("SELECT * FROM testTable WHERE floatColumn > " + Double.MAX_VALUE);
+ BrokerRequest sqlBrokerRequest =
+ compiler.compileToBrokerRequest("SELECT * FROM testTable WHERE floatColumn > " + Double.MAX_VALUE);
}
@Test
@@ -2086,10 +2291,12 @@ public class CalciteSqlCompilerTest {
sql = "SELECT DISTINCT col1, col2 FROM foo ORDER BY col3";
testUnsupportedDistinctQuery(sql, "ORDER-BY columns should be included in the DISTINCT columns");
- sql = "SELECT DISTINCT add(col1, sub(col2, 3)), mod(col2, 10), div(col4, mult(col5, 5)) FROM foo ORDER BY col1, " + "col2, col3";
+ sql = "SELECT DISTINCT add(col1, sub(col2, 3)), mod(col2, 10), div(col4, mult(col5, 5)) FROM foo ORDER BY col1, "
+ + "col2, col3";
testUnsupportedDistinctQuery(sql, "ORDER-BY columns should be included in the DISTINCT columns");
- sql = "SELECT DISTINCT add(col1, sub(col2, 3)), mod(col2, 10), div(col4, mult(col5, 5)) FROM foo ORDER BY col1, mod" + "(col2, 10)";
+ sql = "SELECT DISTINCT add(col1, sub(col2, 3)), mod(col2, 10), div(col4, mult(col5, 5)) FROM foo ORDER BY col1, mod"
+ + "(col2, 10)";
testUnsupportedDistinctQuery(sql, "ORDER-BY columns should be included in the DISTINCT columns");
}
@@ -2110,7 +2317,8 @@ public class CalciteSqlCompilerTest {
sql = "SELECT DISTINCT col1, col2 FROM foo ORDER BY col1 DESC, col2 DESC";
testSupportedDistinctQuery(sql);
- sql = "SELECT DISTINCT add(col1, sub(col2, 3)), mod(col2, 10), div(col4, mult(col5, 5)) FROM foo ORDER BY add(col1," + " sub(col2, 3))";
+ sql = "SELECT DISTINCT add(col1, sub(col2, 3)), mod(col2, 10), div(col4, mult(col5, 5)) FROM foo ORDER BY add(col1,"
+ + " sub(col2, 3))";
testSupportedDistinctQuery(sql);
sql = "SELECT DISTINCT add(col1, sub(col2, 3)), mod(col2, 10), div(col4, mult(col5, 5)) FROM foo ORDER BY mod(col2,"
diff --git a/pinot-common/src/test/java/org/apache/pinot/util/TestUtils.java b/pinot-common/src/test/java/org/apache/pinot/util/TestUtils.java
index 16a1117..60de17a 100644
--- a/pinot-common/src/test/java/org/apache/pinot/util/TestUtils.java
+++ b/pinot-common/src/test/java/org/apache/pinot/util/TestUtils.java
@@ -86,7 +86,8 @@ public class TestUtils {
waitForCondition(condition, checkIntervalMs, timeoutMs, errorMessage, true);
}
- public static void waitForCondition(Function<Void, Boolean> condition, long timeoutMs, @Nullable String errorMessage) {
+ public static void waitForCondition(Function<Void, Boolean> condition, long timeoutMs,
+ @Nullable String errorMessage) {
waitForCondition(condition, 100L, timeoutMs, errorMessage);
}
diff --git a/pinot-connectors/pinot-spark-connector/pom.xml b/pinot-connectors/pinot-spark-connector/pom.xml
index 8a34d6e..7924104 100644
--- a/pinot-connectors/pinot-spark-connector/pom.xml
+++ b/pinot-connectors/pinot-spark-connector/pom.xml
@@ -21,262 +21,262 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>pinot-connectors</artifactId>
- <groupId>org.apache.pinot</groupId>
- <version>0.8.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>pinot-spark-connector</artifactId>
- <name>Pinot Spark Connector</name>
- <url>https://pinot.apache.org/</url>
- <properties>
- <pinot.root>${basedir}/../..</pinot.root>
- <spark.version>2.4.5</spark.version>
- <circe.version>0.13.0</circe.version>
- <paranameter.version>2.8</paranameter.version>
- <jackson.module.scala.version>2.10.0</jackson.module.scala.version>
- <scalaxml.version>1.3.0</scalaxml.version>
- <scalatest.version>3.1.1</scalatest.version>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>pinot-connectors</artifactId>
+ <groupId>org.apache.pinot</groupId>
+ <version>0.8.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>pinot-spark-connector</artifactId>
+ <name>Pinot Spark Connector</name>
+ <url>https://pinot.apache.org/</url>
+ <properties>
+ <pinot.root>${basedir}/../..</pinot.root>
+ <spark.version>2.4.5</spark.version>
+ <circe.version>0.13.0</circe.version>
+ <paranameter.version>2.8</paranameter.version>
+ <jackson.module.scala.version>2.10.0</jackson.module.scala.version>
+ <scalaxml.version>1.3.0</scalaxml.version>
+ <scalatest.version>3.1.1</scalatest.version>
- <!-- TODO: delete this prop once all the checkstyle warnings are fixed -->
- <checkstyle.fail.on.violation>false</checkstyle.fail.on.violation>
- </properties>
+ <!-- TODO: delete this prop once all the checkstyle warnings are fixed -->
+ <checkstyle.fail.on.violation>false</checkstyle.fail.on.violation>
+ </properties>
- <profiles>
- <profile>
- <id>scala-2.12</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <properties>
- <scala.version>2.12.11</scala.version>
- <scala.compat.version>2.12</scala.compat.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>com.thoughtworks.paranamer</groupId>
- <artifactId>paranamer</artifactId>
- <version>${paranameter.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-scala_${scala.compat.version}</artifactId>
- <version>${jackson.module.scala.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.thoughtworks.paranamer</groupId>
- <artifactId>paranamer</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.scala-lang.modules</groupId>
- <artifactId>scala-xml_${scala.compat.version}</artifactId>
- <version>${scalaxml.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.spark</groupId>
- <artifactId>spark-sql_${scala.compat.version}</artifactId>
- <version>${spark.version}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-recipes</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.thoughtworks.paranamer</groupId>
- <artifactId>paranamer</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-scala_${scala.compat.version}</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.scala-lang.modules</groupId>
- <artifactId>scala-xml_${scala.compat.version}</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.circe</groupId>
- <artifactId>circe-parser_${scala.compat.version}</artifactId>
- <version>${circe.version}</version>
- </dependency>
- <dependency>
- <groupId>io.circe</groupId>
- <artifactId>circe-generic_${scala.compat.version}</artifactId>
- <version>${circe.version}</version>
- </dependency>
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-library</artifactId>
- <version>${scala.version}</version>
- <scope>provided</scope>
- </dependency>
- <!-- tests -->
- <dependency>
- <groupId>org.scalatest</groupId>
- <artifactId>scalatest_${scala.compat.version}</artifactId>
- <version>${scalatest.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.scala-lang.modules</groupId>
- <artifactId>scala-xml_${scala.compat.version}</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <!-- scala build -->
- <plugin>
- <groupId>net.alchim31.maven</groupId>
- <artifactId>scala-maven-plugin</artifactId>
- <version>3.2.2</version>
- <executions>
- <execution>
- <id>eclipse-add-source</id>
- <goals>
- <goal>add-source</goal>
- </goals>
- </execution>
- <execution>
- <id>scala-compile-first</id>
- <phase>process-resources</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- <execution>
- <id>scala-test-compile-first</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>testCompile</goal>
- </goals>
- </execution>
- <execution>
- <id>attach-scaladocs</id>
- <phase>verify</phase>
- <goals>
- <goal>doc-jar</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <scalaVersion>${scala.version}</scalaVersion>
- <args>
- <arg>-unchecked</arg>
- <arg>-deprecation</arg>
- <arg>-feature</arg>
- </args>
- <jvmArgs>
- <jvmArg>-Xms1024m</jvmArg>
- <jvmArg>-Xmx1024m</jvmArg>
- </jvmArgs>
- <javacArgs>
- <javacArg>-source</javacArg>
- <javacArg>${jdk.version}</javacArg>
- <javacArg>-target</javacArg>
- <javacArg>${jdk.version}</javacArg>
- <javacArg>-Xlint:all,-serial,-path</javacArg>
- </javacArgs>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>release-sign-artifacts</id>
- <build>
- <plugins>
- <plugin>
- <!-- GPG signing. It's due to the fact that maven-source-plugin and scala-maven-plugin
- have separate lifecycles, and the gpg files created by the former get deleted by the latter.
- Thus, explicitly adding this plugin to a new profile to sign the files at the end all at once. -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-gpg-plugin</artifactId>
- <version>1.6</version>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <build>
- <sourceDirectory>src/main/scala</sourceDirectory>
- <testSourceDirectory>src/test/scala</testSourceDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- </testResources>
- <plugins>
- <!-- disable surefire -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.7</version>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- <!-- enable scalatest -->
- <plugin>
- <groupId>org.scalatest</groupId>
- <artifactId>scalatest-maven-plugin</artifactId>
- <version>1.0</version>
- <configuration>
- <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
- <junitxml>.</junitxml>
- <parallel>false</parallel>
- </configuration>
- <executions>
- <execution>
- <id>test</id>
- <goals>
- <goal>test</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
+ <profiles>
+ <profile>
+ <id>scala-2.12</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <scala.version>2.12.11</scala.version>
+ <scala.compat.version>2.12</scala.compat.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>com.thoughtworks.paranamer</groupId>
+ <artifactId>paranamer</artifactId>
+ <version>${paranameter.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.module</groupId>
+ <artifactId>jackson-module-scala_${scala.compat.version}</artifactId>
+ <version>${jackson.module.scala.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.thoughtworks.paranamer</groupId>
+ <artifactId>paranamer</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.scala-lang.modules</groupId>
+ <artifactId>scala-xml_${scala.compat.version}</artifactId>
+ <version>${scalaxml.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.spark</groupId>
+ <artifactId>spark-sql_${scala.compat.version}</artifactId>
+ <version>${spark.version}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.curator</groupId>
+ <artifactId>curator-recipes</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.thoughtworks.paranamer</groupId>
+ <artifactId>paranamer</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.module</groupId>
+ <artifactId>jackson-module-scala_${scala.compat.version}</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.scala-lang.modules</groupId>
+ <artifactId>scala-xml_${scala.compat.version}</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
- <groupId>org.apache.pinot</groupId>
- <artifactId>pinot-core</artifactId>
- <version>${project.parent.version}</version>
+ <groupId>io.circe</groupId>
+ <artifactId>circe-parser_${scala.compat.version}</artifactId>
+ <version>${circe.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.pinot</groupId>
- <artifactId>pinot-spi</artifactId>
- <version>${project.parent.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.thoughtworks.paranamer</groupId>
- <artifactId>paranamer</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>io.circe</groupId>
+ <artifactId>circe-generic_${scala.compat.version}</artifactId>
+ <version>${circe.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.pinot</groupId>
- <artifactId>pinot-yammer</artifactId>
- <version>${project.parent.version}</version>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version}</version>
+ <scope>provided</scope>
</dependency>
+ <!-- tests -->
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
+ <groupId>org.scalatest</groupId>
+ <artifactId>scalatest_${scala.compat.version}</artifactId>
+ <version>${scalatest.version}</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.scala-lang.modules</groupId>
+ <artifactId>scala-xml_${scala.compat.version}</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
- </dependencies>
+ </dependencies>
+ <build>
+ <plugins>
+ <!-- scala build -->
+ <plugin>
+ <groupId>net.alchim31.maven</groupId>
+ <artifactId>scala-maven-plugin</artifactId>
+ <version>3.2.2</version>
+ <executions>
+ <execution>
+ <id>eclipse-add-source</id>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>scala-compile-first</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>scala-test-compile-first</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>attach-scaladocs</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>doc-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <scalaVersion>${scala.version}</scalaVersion>
+ <args>
+ <arg>-unchecked</arg>
+ <arg>-deprecation</arg>
+ <arg>-feature</arg>
+ </args>
+ <jvmArgs>
+ <jvmArg>-Xms1024m</jvmArg>
+ <jvmArg>-Xmx1024m</jvmArg>
+ </jvmArgs>
+ <javacArgs>
+ <javacArg>-source</javacArg>
+ <javacArg>${jdk.version}</javacArg>
+ <javacArg>-target</javacArg>
+ <javacArg>${jdk.version}</javacArg>
+ <javacArg>-Xlint:all,-serial,-path</javacArg>
+ </javacArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>release-sign-artifacts</id>
+ <build>
+ <plugins>
+ <plugin>
+ <!-- GPG signing. It's due to the fact that maven-source-plugin and scala-maven-plugin
+ have separate lifecycles, and the gpg files created by the former get deleted by the latter.
+ Thus, explicitly adding this plugin to a new profile to sign the files at the end all at once. -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.6</version>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <sourceDirectory>src/main/scala</sourceDirectory>
+ <testSourceDirectory>src/test/scala</testSourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <!-- disable surefire -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ <!-- enable scalatest -->
+ <plugin>
+ <groupId>org.scalatest</groupId>
+ <artifactId>scalatest-maven-plugin</artifactId>
+ <version>1.0</version>
+ <configuration>
+ <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
+ <junitxml>.</junitxml>
+ <parallel>false</parallel>
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.pinot</groupId>
+ <artifactId>pinot-core</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.pinot</groupId>
+ <artifactId>pinot-spi</artifactId>
+ <version>${project.parent.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.thoughtworks.paranamer</groupId>
+ <artifactId>paranamer</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.pinot</groupId>
+ <artifactId>pinot-yammer</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+ </dependencies>
</project>
diff --git a/pinot-connectors/pom.xml b/pinot-connectors/pom.xml
index ef2feeb..977fc3a 100644
--- a/pinot-connectors/pom.xml
+++ b/pinot-connectors/pom.xml
@@ -22,26 +22,26 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>pinot</artifactId>
- <groupId>org.apache.pinot</groupId>
- <version>0.8.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>pinot-connectors</artifactId>
- <packaging>pom</packaging>
- <name>Pinot Connectors</name>
- <url>https://pinot.apache.org/</url>
- <properties>
- <pinot.root>${basedir}/..</pinot.root>
- </properties>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>pinot</artifactId>
+ <groupId>org.apache.pinot</groupId>
+ <version>0.8.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>pinot-connectors</artifactId>
+ <packaging>pom</packaging>
+ <name>Pinot Connectors</name>
+ <url>https://pinot.apache.org/</url>
+ <properties>
+ <pinot.root>${basedir}/..</pinot.root>
+ </properties>
- <modules>
- <module>pinot-spark-connector</module>
- </modules>
+ <modules>
+ <module>pinot-spark-connector</module>
+ </modules>
- <dependencies>
- </dependencies>
+ <dependencies>
+ </dependencies>
</project>
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java b/pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
index 34139d1..faac463 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
@@ -192,7 +192,8 @@ public abstract class BaseControllerStarter implements ServiceStartable {
// queries)
FunctionRegistry.init();
_adminApp = new ControllerAdminApiApplication(_config);
- // Do not use this before the invocation of {@link PinotHelixResourceManager::start()}, which happens in {@link ControllerStarter::start()}
+ // Do not use this before the invocation of {@link PinotHelixResourceManager::start()}, which happens in {@link
+ // ControllerStarter::start()}
_helixResourceManager = new PinotHelixResourceManager(_config);
_executorService =
Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("restapi-multiget-thread-%d").build());
@@ -553,7 +554,8 @@ public abstract class BaseControllerStarter implements ServiceStartable {
* Registers, connects to Helix cluster as PARTICIPANT role, and adds listeners.
*/
private void registerAndConnectAsHelixParticipant() {
- // Registers customized Master-Slave state model to state machine engine, which is for calculating participant assignment in lead controller resource.
+ // Registers customized Master-Slave state model to state machine engine, which is for calculating participant
+ // assignment in lead controller resource.
_helixParticipantManager.getStateMachineEngine().registerStateModelFactory(MasterSlaveSMD.name,
new LeadControllerResourceMasterSlaveStateModelFactory(_leadControllerManager));
@@ -570,8 +572,10 @@ public abstract class BaseControllerStarter implements ServiceStartable {
LOGGER.info("Registering helix controller listener");
// This registration is not needed when the leadControllerResource is enabled.
- // However, the resource can be disabled sometime while the cluster is in operation, so we keep it here. Plus, it does not add much overhead.
- // At some point in future when we stop supporting the disabled resource, we will remove this line altogether and the logic that goes with it.
+ // However, the resource can be disabled sometime while the cluster is in operation, so we keep it here. Plus, it
+ // does not add much overhead.
+ // At some point in future when we stop supporting the disabled resource, we will remove this line altogether and
+ // the logic that goes with it.
_helixParticipantManager.addControllerListener(
(ControllerChangeListener) changeContext -> _leadControllerManager.onHelixControllerChange());
@@ -628,7 +632,8 @@ public abstract class BaseControllerStarter implements ServiceStartable {
_segmentRelocator = new SegmentRelocator(_helixResourceManager, _leadControllerManager, _config, _controllerMetrics,
_executorService);
periodicTasks.add(_segmentRelocator);
- _minionInstancesCleanupTask = new MinionInstancesCleanupTask(_helixResourceManager, _leadControllerManager, _config, _controllerMetrics);
+ _minionInstancesCleanupTask =
+ new MinionInstancesCleanupTask(_helixResourceManager, _leadControllerManager, _config, _controllerMetrics);
periodicTasks.add(_minionInstancesCleanupTask);
_taskMetricsEmitter =
new TaskMetricsEmitter(_helixResourceManager, _helixTaskResourceManager, _leadControllerManager, _config,
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java b/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
index dd7be37..a55081b 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
@@ -149,7 +149,8 @@ public class ControllerConf extends PinotConfiguration {
public static final String DEPRECATED_SEGMENT_RELOCATOR_FREQUENCY_IN_SECONDS =
"controller.segment.relocator.frequencyInSeconds";
public static final String SEGMENT_RELOCATOR_FREQUENCY_PERIOD = "controller.segment.relocator.frequencyPeriod";
- // Because segment level validation is expensive and requires heavy ZK access, we run segment level validation with a
+ // Because segment level validation is expensive and requires heavy ZK access, we run segment level validation
+ // with a
// separate interval
// Deprecated as of 0.8.0
@Deprecated
@@ -214,7 +215,8 @@ public class ControllerConf extends PinotConfiguration {
private static final String ENABLE_STORAGE_QUOTA_CHECK = "controller.enable.storage.quota.check";
private static final String ENABLE_BATCH_MESSAGE_MODE = "controller.enable.batch.message.mode";
// It is used to disable the HLC realtime segment completion and disallow HLC table in the cluster. True by default.
- // If it's set to false, existing HLC realtime tables will stop consumption, and creation of new HLC tables will be disallowed.
+ // If it's set to false, existing HLC realtime tables will stop consumption, and creation of new HLC tables will be
+ // disallowed.
// Please make sure there is no HLC table running in the cluster before disallowing it.
public static final String ALLOW_HLC_TABLES = "controller.allow.hlc.tables";
public static final String DIM_TABLE_MAX_SIZE = "controller.dimTable.maxSize";
@@ -501,7 +503,8 @@ public class ControllerConf extends PinotConfiguration {
* <code>controller.realtime.segment.validation.frequencyInSeconds</code> or the default realtime segment
* validation frequncy, in the order of decreasing preference from left to right. This is done in
* order to retain the current behavior, wherein the realtime validation tasks were done at
- * validation controller frequency The default value is the new DEFAULT_REALTIME_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS
+ * validation controller frequency The default value is the new
+ * DEFAULT_REALTIME_SEGMENT_VALIDATION_FREQUENCY_IN_SECONDS
*
* @return supplied config in seconds
*/
@@ -522,7 +525,8 @@ public class ControllerConf extends PinotConfiguration {
* <code>controller.broker.resource.validation.frequencyInSeconds</code> or the default broker resource validation
* frequency, in order of decreasing preference from left to righ. This is done in order
* to retain the current behavior, wherein the broker resource validation tasks were done at
- * validation controller frequency The default value is the new DEFAULT_BROKER_RESOURCE_VALIDATION_FREQUENCY_IN_SECONDS
+ * validation controller frequency The default value is the new
+ * DEFAULT_BROKER_RESOURCE_VALIDATION_FREQUENCY_IN_SECONDS
*
* @return the supplied config in seconds
*/
@@ -581,7 +585,8 @@ public class ControllerConf extends PinotConfiguration {
/**
* RealtimeSegmentRelocator has been rebranded to SegmentRelocator. Returns
- * <code>controller.segment.relocator.frequencyInSeconds</code> or <code>controller.segment.relocator.frequencyInSeconds</code>
+ * <code>controller.segment.relocator.frequencyInSeconds</code> or <code>controller.segment.relocator
+ * .frequencyInSeconds</code>
* or REALTIME_SEGMENT_RELOCATOR_FREQUENCY, in the order of decreasing perference (left ->
* right).
*/
@@ -761,7 +766,8 @@ public class ControllerConf extends PinotConfiguration {
/**
* RealtimeSegmentRelocator has been rebranded to SegmentRelocator.
- * Check for SEGMENT_RELOCATOR_INITIAL_DELAY_IN_SECONDS property, if not found, return REALTIME_SEGMENT_RELOCATION_INITIAL_DELAY_IN_SECONDS
+ * Check for SEGMENT_RELOCATOR_INITIAL_DELAY_IN_SECONDS property, if not found, return
+ * REALTIME_SEGMENT_RELOCATION_INITIAL_DELAY_IN_SECONDS
*/
public long getSegmentRelocatorInitialDelayInSeconds() {
Long segmentRelocatorInitialDelaySeconds =
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/LeadControllerManager.java b/pinot-controller/src/main/java/org/apache/pinot/controller/LeadControllerManager.java
index a33c0c0..5c595ba 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/LeadControllerManager.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/LeadControllerManager.java
@@ -95,7 +95,8 @@ public class LeadControllerManager {
}
/**
- * Checks whether the current controller is the leader for the given table. Return true if current controller is the leader for this table.
+ * Checks whether the current controller is the leader for the given table. Return true if current controller is
+ * the leader for this table.
* Otherwise check whether the current controller is helix leader if the resource is disabled.
* @param tableName table name with/without table type.
*/
@@ -111,7 +112,8 @@ public class LeadControllerManager {
}
/**
- * Given a partition name, marks current controller as lead controller for this partition by caching the partition id to current controller.
+ * Given a partition name, marks current controller as lead controller for this partition by caching the partition
+ * id to current controller.
* @param partitionName partition name in lead controller resource, e.g. leadControllerResource_0.
*/
public synchronized void addPartitionLeader(String partitionName) {
@@ -123,7 +125,8 @@ public class LeadControllerManager {
}
/**
- * Given a partition name, removes current controller as lead controller for this partition by removing the partition id from current controller.
+ * Given a partition name, removes current controller as lead controller for this partition by removing the
+ * partition id from current controller.
* @param partitionName partition name in lead controller resource, e.g. leadControllerResource_0.
*/
public synchronized void removePartitionLeader(String partitionName) {
@@ -179,9 +182,12 @@ public class LeadControllerManager {
}
/**
- * Callback on changes in the controller. Should be registered to the controller callback. This callback is not needed when the resource is enabled.
- * However, the resource can be disabled sometime while the cluster is in operation, so we keep it here. Plus, it does not add much overhead.
- * At some point in future when we stop supporting the disabled resource, we will remove this line altogether and the logic that goes with it.
+ * Callback on changes in the controller. Should be registered to the controller callback. This callback is not
+ * needed when the resource is enabled.
+ * However, the resource can be disabled sometime while the cluster is in operation, so we keep it here. Plus, it
+ * does not add much overhead.
+ * At some point in future when we stop supporting the disabled resource, we will remove this line altogether and
+ * the logic that goes with it.
*/
synchronized void onHelixControllerChange() {
if (_isShuttingDown) {
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java
index f4df0e5..dff3408 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java
@@ -90,7 +90,8 @@ public class ControllerAdminApiApplication extends ResourceConfig {
// So, we setup specific handlers for static resource directory. index.html is served directly
// by a jersey handler
- _httpServer.getServerConfiguration().addHttpHandler(new CLStaticHttpHandler(classLoader, "/webapp/"), "/index.html");
+ _httpServer.getServerConfiguration()
+ .addHttpHandler(new CLStaticHttpHandler(classLoader, "/webapp/"), "/index.html");
_httpServer.getServerConfiguration().addHttpHandler(new CLStaticHttpHandler(classLoader, "/webapp/js/"), "/js/");
}
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/access/BasicAuthAccessControlFactory.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/access/BasicAuthAccessControlFactory.java
index 1fc77184..8501dad 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/access/BasicAuthAccessControlFactory.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/access/BasicAuthAccessControlFactory.java
@@ -31,7 +31,8 @@ import org.apache.pinot.spi.env.PinotConfiguration;
/**
- * Basic Authentication based on http headers. Configured via the "controller.admin.access.control" family of properties.
+ * Basic Authentication based on http headers. Configured via the "controller.admin.access.control" family of
+ * properties.
*
* <pre>
* Example:
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/debug/TableDebugInfo.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/debug/TableDebugInfo.java
index 54d13da..fd60c83 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/debug/TableDebugInfo.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/debug/TableDebugInfo.java
@@ -38,7 +38,9 @@ import org.apache.pinot.spi.config.table.TableStatus;
* <li>Debug information related to segments of the table.</li>
* </ul>
*/
-@JsonPropertyOrder({"tableName", "numSegments", "numServers", "numBrokers", "segmentDebugInfos", "serverDebugInfos", "brokerDebugInfos"})
+@JsonPropertyOrder({
+ "tableName", "numSegments", "numServers", "numBrokers", "segmentDebugInfos", "serverDebugInfos", "brokerDebugInfos"
+})
@JsonIgnoreProperties(ignoreUnknown = true)
@SuppressWarnings("unused")
public class TableDebugInfo {
@@ -70,8 +72,9 @@ public class TableDebugInfo {
private final List<BrokerDebugInfo> _brokerDebugInfos;
@JsonCreator
- public TableDebugInfo(String tableName, TableStatus.IngestionStatus ingestionStatus, TableSizeSummary tableSizeSummary, int numBrokers, int numServers,
- int numSegments, List<SegmentDebugInfo> segmentDebugInfos, List<ServerDebugInfo> serverDebugInfos,
+ public TableDebugInfo(String tableName, TableStatus.IngestionStatus ingestionStatus,
+ TableSizeSummary tableSizeSummary, int numBrokers, int numServers, int numSegments,
+ List<SegmentDebugInfo> segmentDebugInfos, List<ServerDebugInfo> serverDebugInfos,
List<BrokerDebugInfo> brokerDebugInfos) {
_tableName = tableName;
_ingestionStatus = ingestionStatus;
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/events/DefaultMetadataEventNotifier.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/events/DefaultMetadataEventNotifier.java
index 3cca526..608c5e6 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/events/DefaultMetadataEventNotifier.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/events/DefaultMetadataEventNotifier.java
@@ -17,6 +17,7 @@
* under the License.
*/
package org.apache.pinot.controller.api.events;
+
import org.apache.pinot.spi.config.table.TableConfig;
import org.apache.pinot.spi.data.Schema;
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/events/MetadataEventNotifier.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/events/MetadataEventNotifier.java
index 1ef34e7..a8b16d0 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/events/MetadataEventNotifier.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/events/MetadataEventNotifier.java
@@ -17,6 +17,7 @@
* under the License.
*/
package org.apache.pinot.controller.api.events;
+
import org.apache.pinot.spi.config.table.TableConfig;
import org.apache.pinot.spi.data.Schema;
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ControllerFilePathProvider.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ControllerFilePathProvider.java
index c75b98f..31e30de 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ControllerFilePathProvider.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ControllerFilePathProvider.java
@@ -79,8 +79,8 @@ public class ControllerFilePathProvider {
File localTempDir;
if (localTempDirPath == null) {
Preconditions.checkState(_dataDirURI.getScheme().equalsIgnoreCase(CommonConstants.Segment.LOCAL_SEGMENT_SCHEME),
- "Local temporary directory is not configured, cannot use remote data directory: %s as local temporary directory",
- _dataDirURI);
+ "Local temporary directory is not configured, cannot use remote data directory: %s as local temporary "
+ + "directory", _dataDirURI);
// NOTE: use instance id as the directory name so that each controller gets its own temporary directory in case
// of shared file system
localTempDir = new File(new File(_dataDirURI),
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/LLCSegmentCompletionHandlers.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/LLCSegmentCompletionHandlers.java
index 9bab74a..5679720 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/LLCSegmentCompletionHandlers.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/LLCSegmentCompletionHandlers.java
@@ -84,8 +84,8 @@ public class LLCSegmentCompletionHandlers {
@QueryParam(SegmentCompletionProtocol.PARAM_EXTRA_TIME_SEC) int extraTimeSec) {
if (instanceId == null || segmentName == null || (offset == -1 && streamPartitionMsgOffset == null)) {
- LOGGER.error("Invalid call: offset={}, segmentName={}, instanceId={}, streamPartitionMsgOffset={}",
- offset, segmentName, instanceId, streamPartitionMsgOffset);
+ LOGGER.error("Invalid call: offset={}, segmentName={}, instanceId={}, streamPartitionMsgOffset={}", offset,
+ segmentName, instanceId, streamPartitionMsgOffset);
return SegmentCompletionProtocol.RESP_FAILED.toJsonString();
}
if (extraTimeSec <= 0) {
@@ -131,8 +131,8 @@ public class LLCSegmentCompletionHandlers {
@QueryParam(SegmentCompletionProtocol.PARAM_ROW_COUNT) int numRows) {
if (instanceId == null || segmentName == null || (offset == -1 && streamPartitionMsgOffset == null)) {
- LOGGER.error("Invalid call: offset={}, segmentName={}, instanceId={}, streamPartitionMsgOffset={}",
- offset, segmentName, instanceId, streamPartitionMsgOffset);
+ LOGGER.error("Invalid call: offset={}, segmentName={}, instanceId={}, streamPartitionMsgOffset={}", offset,
+ segmentName, instanceId, streamPartitionMsgOffset);
return SegmentCompletionProtocol.RESP_FAILED.toJsonString();
}
SegmentCompletionProtocol.Request.Params requestParams = new SegmentCompletionProtocol.Request.Params();
@@ -157,8 +157,8 @@ public class LLCSegmentCompletionHandlers {
@QueryParam(SegmentCompletionProtocol.PARAM_REASON) String stopReason) {
if (instanceId == null || segmentName == null || (offset == -1 && streamPartitionMsgOffset == null)) {
- LOGGER.error("Invalid call: offset={}, segmentName={}, instanceId={}, streamPartitionMsgOffset={}",
- offset, segmentName, instanceId, streamPartitionMsgOffset);
+ LOGGER.error("Invalid call: offset={}, segmentName={}, instanceId={}, streamPartitionMsgOffset={}", offset,
+ segmentName, instanceId, streamPartitionMsgOffset);
return SegmentCompletionProtocol.RESP_FAILED.toJsonString();
}
SegmentCompletionProtocol.Request.Params requestParams = new SegmentCompletionProtocol.Request.Params();
... 39063 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org