You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ne...@apache.org on 2019/01/10 00:38:50 UTC

[incubator-pinot] 01/01: Change package name from com.linkedin to org.apache

This is an automated email from the ASF dual-hosted git repository.

nehapawar pushed a commit to branch rename_package_apache
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit c1c084ce99d1541b4132ae5f197daaf6bf006924
Author: Neha Pawar <np...@linkedin.com>
AuthorDate: Wed Jan 9 16:38:20 2019 -0800

    Change package name from com.linkedin to org.apache
---
 contrib/pinot-druid-benchmark/pom.xml              |   14 +-
 .../linkedin/pinotdruidbenchmark/DataMerger.java   |    2 +-
 .../pinotdruidbenchmark/DataSeparator.java         |    2 +-
 .../pinotdruidbenchmark/DruidResponseTime.java     |    2 +-
 .../pinotdruidbenchmark/DruidThroughput.java       |    2 +-
 .../pinotdruidbenchmark/PinotResponseTime.java     |    2 +-
 .../pinotdruidbenchmark/PinotThroughput.java       |    2 +-
 pinot-api/pom.xml                                  |    2 +-
 .../linkedin/pinot/client/AbstractResultSet.java   |   89 -
 .../pinot/client/AggregationResultSet.java         |  109 -
 .../com/linkedin/pinot/client/BrokerResponse.java  |   85 -
 .../com/linkedin/pinot/client/BrokerSelector.java  |   29 -
 .../java/com/linkedin/pinot/client/Connection.java |  155 --
 .../linkedin/pinot/client/ConnectionFactory.java   |   67 -
 .../pinot/client/DynamicBrokerSelector.java        |   94 -
 .../linkedin/pinot/client/ExternalViewReader.java  |  149 --
 .../linkedin/pinot/client/GroupByResultSet.java    |  135 --
 .../client/JsonAsyncHttpPinotClientTransport.java  |  123 --
 .../JsonAsyncHttpPinotClientTransportFactory.java  |   29 -
 .../pinot/client/PinotClientException.java         |   36 -
 .../pinot/client/PinotClientTransport.java         |   30 -
 .../pinot/client/PinotClientTransportFactory.java  |   26 -
 .../linkedin/pinot/client/PreparedStatement.java   |  121 --
 .../java/com/linkedin/pinot/client/ResultSet.java  |  190 --
 .../com/linkedin/pinot/client/ResultSetGroup.java  |   87 -
 .../linkedin/pinot/client/SelectionResultSet.java  |  113 -
 .../pinot/client/SimpleBrokerSelector.java         |   42 -
 .../java/com/linkedin/pinot/client/TextTable.java  |  123 --
 .../com/linkedin/pinot/client/package-info.java    |   98 -
 .../org/apache/pinot/client/AbstractResultSet.java |   89 +
 .../apache/pinot/client/AggregationResultSet.java  |  109 +
 .../org/apache/pinot/client/BrokerResponse.java    |   85 +
 .../org/apache/pinot/client/BrokerSelector.java    |   29 +
 .../java/org/apache/pinot/client/Connection.java   |  155 ++
 .../org/apache/pinot/client/ConnectionFactory.java |   67 +
 .../apache/pinot/client/DynamicBrokerSelector.java |   94 +
 .../apache/pinot/client/ExternalViewReader.java    |  149 ++
 .../org/apache/pinot/client/GroupByResultSet.java  |  135 ++
 .../client/JsonAsyncHttpPinotClientTransport.java  |  123 ++
 .../JsonAsyncHttpPinotClientTransportFactory.java  |   29 +
 .../apache/pinot/client/PinotClientException.java  |   36 +
 .../apache/pinot/client/PinotClientTransport.java  |   30 +
 .../pinot/client/PinotClientTransportFactory.java  |   26 +
 .../org/apache/pinot/client/PreparedStatement.java |  121 ++
 .../java/org/apache/pinot/client/ResultSet.java    |  190 ++
 .../org/apache/pinot/client/ResultSetGroup.java    |   87 +
 .../apache/pinot/client/SelectionResultSet.java    |  113 +
 .../apache/pinot/client/SimpleBrokerSelector.java  |   42 +
 .../java/org/apache/pinot/client/TextTable.java    |  123 ++
 .../java/org/apache/pinot/client/package-info.java |   98 +
 .../pinot/client/ConnectionFactoryTest.java        |   77 -
 .../pinot/client/PreparedStatementTest.java        |   87 -
 .../linkedin/pinot/client/ResultSetGroupTest.java  |  167 --
 .../apache/pinot/client/ConnectionFactoryTest.java |   77 +
 .../apache/pinot/client/PreparedStatementTest.java |   87 +
 .../apache/pinot/client/ResultSetGroupTest.java    |  167 ++
 .../com/linkedin/pinot/client/exception.json       |    1 -
 pinot-api/src/test/resources/log4j.properties      |    2 +-
 .../apache}/pinot/client/aggregation.json          |    0
 .../apache}/pinot/client/aggregationGroupBy.json   |    0
 .../org/apache/pinot/client/exception.json         |    1 +
 .../apache}/pinot/client/selection.json            |    0
 pinot-azure-filesystem/pom.xml                     |    9 +-
 .../linkedin/pinot/filesystem/AzurePinotFS.java    |  237 ---
 .../org/apache/pinot/filesystem/AzurePinotFS.java  |  237 +++
 .../pinot/filesystem/test/AzurePinotFSTest.java    |   85 -
 .../pinot/filesystem/test/AzurePinotFSTest.java    |   85 +
 pinot-broker/pom.xml                               |   18 +-
 .../linkedin/pinot/broker/api/AccessControl.java   |   26 -
 .../pinot/broker/api/RequestStatistics.java        |  194 --
 .../pinot/broker/api/RequesterIdentity.java        |   22 -
 .../broker/api/resources/PinotBrokerDebug.java     |  108 -
 .../api/resources/PinotBrokerHealthCheck.java      |   64 -
 .../broker/api/resources/PinotClientRequest.java   |  109 -
 .../pinot/broker/broker/AccessControlFactory.java  |   51 -
 .../broker/AllowAllAccessControlFactory.java       |   46 -
 .../broker/broker/BrokerAdminApiApplication.java   |   93 -
 .../pinot/broker/broker/BrokerServerBuilder.java   |  168 --
 ...okerResourceOnlineOfflineStateModelFactory.java |  157 --
 .../broker/broker/helix/ClusterChangeMediator.java |  160 --
 .../broker/helix/DefaultHelixBrokerConfig.java     |   59 -
 .../broker/broker/helix/HelixBrokerStarter.java    |  304 ---
 .../helix/LiveInstancesChangeListenerImpl.java     |  108 -
 .../TimeboundaryRefreshMessageHandlerFactory.java  |  144 --
 .../broker/pruner/PartitionZKMetadataPruner.java   |  150 --
 .../pinot/broker/pruner/SegmentPrunerContext.java  |   48 -
 .../broker/pruner/SegmentZKMetadataPruner.java     |   38 -
 .../pruner/SegmentZKMetadataPrunerProvider.java    |   56 -
 .../pruner/SegmentZKMetadataPrunerService.java     |   67 -
 .../pinot/broker/queryquota/HitCounter.java        |   87 -
 .../pinot/broker/queryquota/QueryQuotaConfig.java  |   42 -
 .../broker/queryquota/TableQueryQuotaManager.java  |  328 ---
 .../requesthandler/BaseBrokerRequestHandler.java   |  450 ----
 .../requesthandler/BrokerRequestHandler.java       |   42 -
 .../requesthandler/BrokerRequestOptimizer.java     |   87 -
 .../ConnectionPoolBrokerRequestHandler.java        |  404 ----
 .../FilterQueryOptimizerRequest.java               |   64 -
 .../requesthandler/FilterQueryTreeOptimizer.java   |   35 -
 ...enNestedPredicatesFilterQueryTreeOptimizer.java |   87 -
 ...ualitiesToInClauseFilterQueryTreeOptimizer.java |  182 --
 .../broker/requesthandler/OptimizationFlags.java   |  112 -
 .../broker/requesthandler/RangeMergeOptimizer.java |  169 --
 .../SingleConnectionBrokerRequestHandler.java      |  129 --
 .../pinot/broker/routing/CfgBasedRouting.java      |   63 -
 .../routing/HelixExternalViewBasedRouting.java     |  600 ------
 .../HelixExternalViewBasedTimeBoundaryService.java |  162 --
 .../pinot/broker/routing/RoutingTable.java         |   53 -
 .../broker/routing/RoutingTableBuilderFactory.java |  145 --
 .../broker/routing/RoutingTableLookupRequest.java  |   79 -
 .../pinot/broker/routing/TimeBoundaryService.java  |   67 -
 .../builder/BalancedRandomRoutingTableBuilder.java |   64 -
 .../BasePartitionAwareRoutingTableBuilder.java     |  149 --
 .../routing/builder/BaseRoutingTableBuilder.java   |  213 --
 .../builder/DefaultOfflineRoutingTableBuilder.java |  137 --
 .../DefaultRealtimeRoutingTableBuilder.java        |  116 -
 .../builder/GeneratorBasedRoutingTableBuilder.java |  311 ---
 .../HighLevelConsumerBasedRoutingTableBuilder.java |   86 -
 .../builder/LargeClusterRoutingTableBuilder.java   |   63 -
 .../LowLevelConsumerRoutingTableBuilder.java       |  154 --
 .../builder/LowLevelRoutingTableBuilderUtil.java   |   90 -
 .../PartitionAwareOfflineRoutingTableBuilder.java  |  210 --
 .../PartitionAwareRealtimeRoutingTableBuilder.java |  156 --
 .../routing/builder/RoutingTableBuilder.java       |   63 -
 .../builder/RoutingTableInstancePruner.java        |   73 -
 .../routing/selector/MergedSegmentSelector.java    |   95 -
 .../broker/routing/selector/SegmentSelector.java   |   49 -
 .../routing/selector/SegmentSelectorProvider.java  |   47 -
 .../org/apache/pinot/broker/api/AccessControl.java |   26 +
 .../apache/pinot/broker/api/RequestStatistics.java |  194 ++
 .../apache/pinot/broker/api/RequesterIdentity.java |   22 +
 .../broker/api/resources/PinotBrokerDebug.java     |  110 +
 .../api/resources/PinotBrokerHealthCheck.java      |   66 +
 .../broker/api/resources/PinotClientRequest.java   |  110 +
 .../pinot/broker/broker/AccessControlFactory.java  |   51 +
 .../broker/AllowAllAccessControlFactory.java       |   46 +
 .../broker/broker/BrokerAdminApiApplication.java   |   96 +
 .../pinot/broker/broker/BrokerServerBuilder.java   |  175 ++
 ...okerResourceOnlineOfflineStateModelFactory.java |  159 ++
 .../broker/broker/helix/ClusterChangeMediator.java |  162 ++
 .../broker/helix/DefaultHelixBrokerConfig.java     |   59 +
 .../broker/broker/helix/HelixBrokerStarter.java    |  306 +++
 .../helix/LiveInstancesChangeListenerImpl.java     |  108 +
 .../TimeboundaryRefreshMessageHandlerFactory.java  |  145 ++
 .../broker/pruner/PartitionZKMetadataPruner.java   |  150 ++
 .../pinot/broker/pruner/SegmentPrunerContext.java  |   48 +
 .../broker/pruner/SegmentZKMetadataPruner.java     |   38 +
 .../pruner/SegmentZKMetadataPrunerProvider.java    |   56 +
 .../pruner/SegmentZKMetadataPrunerService.java     |   67 +
 .../apache/pinot/broker/queryquota/HitCounter.java |   87 +
 .../pinot/broker/queryquota/QueryQuotaConfig.java  |   42 +
 .../broker/queryquota/TableQueryQuotaManager.java  |  328 +++
 .../requesthandler/BaseBrokerRequestHandler.java   |  450 ++++
 .../requesthandler/BrokerRequestHandler.java       |   42 +
 .../requesthandler/BrokerRequestOptimizer.java     |   87 +
 .../ConnectionPoolBrokerRequestHandler.java        |  404 ++++
 .../FilterQueryOptimizerRequest.java               |   64 +
 .../requesthandler/FilterQueryTreeOptimizer.java   |   35 +
 ...enNestedPredicatesFilterQueryTreeOptimizer.java |   87 +
 ...ualitiesToInClauseFilterQueryTreeOptimizer.java |  182 ++
 .../broker/requesthandler/OptimizationFlags.java   |  112 +
 .../broker/requesthandler/RangeMergeOptimizer.java |  169 ++
 .../SingleConnectionBrokerRequestHandler.java      |  129 ++
 .../pinot/broker/routing/CfgBasedRouting.java      |   63 +
 .../routing/HelixExternalViewBasedRouting.java     |  603 ++++++
 .../HelixExternalViewBasedTimeBoundaryService.java |  162 ++
 .../apache/pinot/broker/routing/RoutingTable.java  |   53 +
 .../broker/routing/RoutingTableBuilderFactory.java |  153 ++
 .../broker/routing/RoutingTableLookupRequest.java  |   79 +
 .../pinot/broker/routing/TimeBoundaryService.java  |   67 +
 .../builder/BalancedRandomRoutingTableBuilder.java |   64 +
 .../BasePartitionAwareRoutingTableBuilder.java     |  150 ++
 .../routing/builder/BaseRoutingTableBuilder.java   |  214 ++
 .../builder/DefaultOfflineRoutingTableBuilder.java |  138 ++
 .../DefaultRealtimeRoutingTableBuilder.java        |  117 +
 .../builder/GeneratorBasedRoutingTableBuilder.java |  311 +++
 .../HighLevelConsumerBasedRoutingTableBuilder.java |   86 +
 .../builder/LargeClusterRoutingTableBuilder.java   |   63 +
 .../LowLevelConsumerRoutingTableBuilder.java       |  154 ++
 .../builder/LowLevelRoutingTableBuilderUtil.java   |   90 +
 .../PartitionAwareOfflineRoutingTableBuilder.java  |  210 ++
 .../PartitionAwareRealtimeRoutingTableBuilder.java |  156 ++
 .../routing/builder/RoutingTableBuilder.java       |   64 +
 .../builder/RoutingTableInstancePruner.java        |   73 +
 .../routing/selector/MergedSegmentSelector.java    |   95 +
 .../broker/routing/selector/SegmentSelector.java   |   49 +
 .../routing/selector/SegmentSelectorProvider.java  |   47 +
 .../pinot/broker/broker/BrokerTestUtils.java       |   51 -
 .../EmptyBrokerOnlineOfflineStateModelFactory.java |   71 -
 ...EmptySegmentOnlineOfflineStateModelFactory.java |   72 -
 .../broker/broker/HelixBrokerStarterTest.java      |  300 ---
 .../broker/broker/HelixBrokerStarterUtilsTest.java |   64 -
 .../broker/pruner/SegmentZKMetadataPrunerTest.java |   66 -
 .../pinot/broker/queryquota/HitCounterTest.java    |  120 --
 .../queryquota/TableQueryQuotaManagerTest.java     |  401 ----
 .../broker/requesthandler/FilterOptimizerTest.java |  165 --
 ...tiesToInClauseFilterQueryTreeOptimizerTest.java |  136 --
 .../requesthandler/OptimizationFlagsTest.java      |   71 -
 .../requesthandler/RangeMergeOptimizerTest.java    |  249 ---
 .../broker/routing/RandomRoutingTableTest.java     |  100 -
 .../pinot/broker/routing/RoutingTableTest.java     |  297 ---
 .../broker/routing/TimeBoundaryServiceTest.java    |  131 --
 .../BalancedRandomRoutingTableBuilderTest.java     |  118 --
 .../HighLevelConsumerRoutingTableBuilderTest.java  |  117 -
 .../LargeClusterRoutingTableBuilderTest.java       |  267 ---
 .../LowLevelConsumerRoutingTableBuilderTest.java   |  233 --
 ...rtitionAwareOfflineRoutingTableBuilderTest.java |  325 ---
 ...titionAwareRealtimeRoutingTableBuilderTest.java |  371 ----
 .../builder/RoutingTableBuilderTestUtil.java       |   46 -
 .../selector/MergedSegmentSelectorTest.java        |  152 --
 .../pinot/broker/util/FakePropertyStore.java       |   78 -
 .../pinot/broker/broker/BrokerTestUtils.java       |   53 +
 .../EmptyBrokerOnlineOfflineStateModelFactory.java |   71 +
 ...EmptySegmentOnlineOfflineStateModelFactory.java |   72 +
 .../broker/broker/HelixBrokerStarterTest.java      |  305 +++
 .../broker/broker/HelixBrokerStarterUtilsTest.java |   65 +
 .../broker/pruner/SegmentZKMetadataPrunerTest.java |   66 +
 .../pinot/broker/queryquota/HitCounterTest.java    |  120 ++
 .../queryquota/TableQueryQuotaManagerTest.java     |  401 ++++
 .../broker/requesthandler/FilterOptimizerTest.java |  165 ++
 ...tiesToInClauseFilterQueryTreeOptimizerTest.java |  136 ++
 .../requesthandler/OptimizationFlagsTest.java      |   71 +
 .../requesthandler/RangeMergeOptimizerTest.java    |  249 +++
 .../broker/routing/RandomRoutingTableTest.java     |  100 +
 .../pinot/broker/routing/RoutingTableTest.java     |  299 +++
 .../broker/routing/TimeBoundaryServiceTest.java    |  131 ++
 .../BalancedRandomRoutingTableBuilderTest.java     |  119 ++
 .../HighLevelConsumerRoutingTableBuilderTest.java  |  118 ++
 .../LargeClusterRoutingTableBuilderTest.java       |  267 +++
 .../LowLevelConsumerRoutingTableBuilderTest.java   |  233 ++
 ...rtitionAwareOfflineRoutingTableBuilderTest.java |  326 +++
 ...titionAwareRealtimeRoutingTableBuilderTest.java |  372 ++++
 .../builder/RoutingTableBuilderTestUtil.java       |   46 +
 .../selector/MergedSegmentSelectorTest.java        |  152 ++
 .../pinot/broker/util/FakePropertyStore.java       |   78 +
 pinot-broker/src/test/resources/log4j.properties   |    2 +-
 pinot-common/pom.xml                               |    4 +-
 .../apache}/pinot/pql/parsers/PQL2.g4              |    0
 .../main/java/com/linkedin/pinot/common/Utils.java |  153 --
 .../config/AdjustTableNameChildKeyTransformer.java |   75 -
 .../pinot/common/config/ChildKeyHandler.java       |   45 -
 .../pinot/common/config/ChildKeyTransformer.java   |   32 -
 .../pinot/common/config/ColumnPartitionConfig.java |  166 --
 .../config/ColumnPartitionMapChildKeyHandler.java  |   28 -
 .../pinot/common/config/CombinedConfig.java        |  110 -
 .../pinot/common/config/CombinedConfigLoader.java  |  176 --
 ...CombinedConfigSeparatorChildKeyTransformer.java |  134 --
 .../linkedin/pinot/common/config/ConfigDoc.java    |   34 -
 .../linkedin/pinot/common/config/ConfigKey.java    |   31 -
 .../common/config/ConfigNodeLifecycleAware.java    |   34 -
 .../linkedin/pinot/common/config/Deserializer.java |  436 ----
 .../com/linkedin/pinot/common/config/Duration.java |   76 -
 .../linkedin/pinot/common/config/DurationDsl.java  |   57 -
 .../pinot/common/config/IndexingConfig.java        |  303 ---
 .../common/config/NamedListChildKeyHandler.java    |   81 -
 .../linkedin/pinot/common/config/NestedConfig.java |   31 -
 .../pinot/common/config/OfflineTagConfig.java      |   39 -
 .../pinot/common/config/PinotTaskConfig.java       |   91 -
 .../linkedin/pinot/common/config/QuotaConfig.java  |  142 --
 .../pinot/common/config/RealtimeTagConfig.java     |   64 -
 .../config/RemapTableTypesChildKeyTransformer.java |   72 -
 .../common/config/ReplicaGroupStrategyConfig.java  |  107 -
 .../pinot/common/config/RoutingConfig.java         |   91 -
 .../common/config/SegmentPartitionConfig.java      |  152 --
 .../SegmentsValidationAndRetentionConfig.java      |  254 ---
 .../linkedin/pinot/common/config/Serializer.java   |  198 --
 .../common/config/SimpleMapChildKeyHandler.java    |   51 -
 .../linkedin/pinot/common/config/SingleKeyDsl.java |   30 -
 .../pinot/common/config/StarTreeIndexConfig.java   |   71 -
 .../common/config/StreamConsumptionConfig.java     |   54 -
 .../linkedin/pinot/common/config/TableConfig.java  |  614 ------
 .../pinot/common/config/TableCustomConfig.java     |   99 -
 .../pinot/common/config/TableNameBuilder.java      |  125 --
 .../pinot/common/config/TableTaskConfig.java       |   87 -
 .../linkedin/pinot/common/config/TagConfig.java    |   44 -
 .../linkedin/pinot/common/config/TagNameUtils.java |  113 -
 .../pinot/common/config/TagOverrideConfig.java     |  101 -
 .../config/TaskConfigMapChildKeyHandler.java       |   61 -
 .../com/linkedin/pinot/common/config/Tenant.java   |  168 --
 .../linkedin/pinot/common/config/TenantConfig.java |  121 --
 .../common/config/TypedMapChildKeyHandler.java     |   77 -
 .../pinot/common/config/UseChildKeyHandler.java    |   31 -
 .../common/config/UseChildKeyTransformers.java     |   34 -
 .../com/linkedin/pinot/common/config/UseDsl.java   |   35 -
 .../pinot/common/data/DateTimeFieldSpec.java       |  153 --
 .../data/DateTimeFieldSpecChildKeyHandler.java     |   31 -
 .../common/data/DateTimeFormatPatternSpec.java     |  105 -
 .../pinot/common/data/DateTimeFormatSpec.java      |  259 ---
 .../pinot/common/data/DateTimeFormatUnitSpec.java  |  137 --
 .../pinot/common/data/DateTimeGranularitySpec.java |  144 --
 .../pinot/common/data/DimensionFieldSpec.java      |   61 -
 .../data/DimensionFieldSpecChildKeyHandler.java    |   31 -
 .../com/linkedin/pinot/common/data/FieldSpec.java  |  455 ----
 .../pinot/common/data/MetricFieldSpec.java         |  184 --
 .../data/MetricFieldSpecChildKeyHandler.java       |   31 -
 .../com/linkedin/pinot/common/data/RowEvent.java   |   36 -
 .../com/linkedin/pinot/common/data/Schema.java     |  657 ------
 .../com/linkedin/pinot/common/data/Segment.java    |   57 -
 .../pinot/common/data/StarTreeIndexSpec.java       |  179 --
 .../linkedin/pinot/common/data/TimeFieldSpec.java  |  242 ---
 .../pinot/common/data/TimeGranularitySpec.java     |  302 ---
 .../common/exception/HttpErrorStatusException.java |   32 -
 .../common/exception/InvalidConfigException.java   |   27 -
 .../pinot/common/exception/QueryException.java     |  148 --
 .../common/exception/TableNotFoundException.java   |   27 -
 .../pinot/common/http/MultiGetRequest.java         |  117 -
 .../pinot/common/lineage/SegmentGroup.java         |   75 -
 .../pinot/common/lineage/SegmentMergeLineage.java  |  351 ---
 .../lineage/SegmentMergeLineageAccessHelper.java   |   88 -
 .../common/messages/SegmentRefreshMessage.java     |   70 -
 .../common/messages/SegmentReloadMessage.java      |   52 -
 .../messages/TimeboundaryRefreshMessage.java       |   45 -
 .../linkedin/pinot/common/metadata/ZKMetadata.java |   26 -
 .../pinot/common/metadata/ZKMetadataProvider.java  |  435 ----
 .../metadata/instance/InstanceZKMetadata.java      |  158 --
 .../metadata/segment/ColumnPartitionMetadata.java  |  121 --
 .../segment/LLCRealtimeSegmentZKMetadata.java      |  152 --
 .../metadata/segment/OfflineSegmentZKMetadata.java |  138 --
 .../segment/RealtimeSegmentZKMetadata.java         |  143 --
 .../metadata/segment/SegmentPartitionMetadata.java |  169 --
 .../common/metadata/segment/SegmentZKMetadata.java |  345 ---
 .../SegmentZKMetadataCustomMapModifier.java        |   94 -
 .../pinot/common/metrics/AbstractMetrics.java      |  484 -----
 .../pinot/common/metrics/AggregatedCounter.java    |  130 --
 .../pinot/common/metrics/AggregatedHistogram.java  |  201 --
 .../pinot/common/metrics/AggregatedLongGauge.java  |  109 -
 .../pinot/common/metrics/AggregatedMeter.java      |  192 --
 .../common/metrics/AggregatedMetricsRegistry.java  |   93 -
 .../linkedin/pinot/common/metrics/BrokerGauge.java |   61 -
 .../linkedin/pinot/common/metrics/BrokerMeter.java |  131 --
 .../pinot/common/metrics/BrokerMetrics.java        |   55 -
 .../pinot/common/metrics/BrokerQueryPhase.java     |   48 -
 .../linkedin/pinot/common/metrics/BrokerTimer.java |   53 -
 .../pinot/common/metrics/ControllerGauge.java      |   80 -
 .../pinot/common/metrics/ControllerMeter.java      |   94 -
 .../pinot/common/metrics/ControllerMetrics.java    |   46 -
 .../pinot/common/metrics/ControllerTimer.java      |   53 -
 ...eporterMetricsRegistryRegistrationListener.java |   34 -
 .../pinot/common/metrics/LatencyMetric.java        |   96 -
 .../pinot/common/metrics/MetricsHelper.java        |  348 ---
 .../MetricsRegistryRegistrationListener.java       |   30 -
 .../linkedin/pinot/common/metrics/ServerGauge.java |   79 -
 .../linkedin/pinot/common/metrics/ServerMeter.java |   93 -
 .../pinot/common/metrics/ServerMetrics.java        |   51 -
 .../pinot/common/metrics/ServerQueryPhase.java     |   50 -
 .../linkedin/pinot/common/metrics/ServerTimer.java |   53 -
 .../pinot/common/metrics/ValidationMetrics.java    |  243 ---
 .../common/partition/PartitionAssignment.java      |  109 -
 .../partition/ReplicaGroupPartitionAssignment.java |  124 --
 .../ReplicaGroupPartitionAssignmentGenerator.java  |  127 --
 .../StreamPartitionAssignmentGenerator.java        |  181 --
 .../protocols/SegmentCompletionProtocol.java       |  529 -----
 .../linkedin/pinot/common/query/ReduceService.java |   51 -
 .../pinot/common/query/ReduceServiceRegistry.java  |   70 -
 .../pinot/common/request/AggregationInfo.java      |  677 ------
 .../pinot/common/request/BrokerRequest.java        | 2201 -------------------
 .../pinot/common/request/FilterOperator.java       |   86 -
 .../linkedin/pinot/common/request/FilterQuery.java |  953 ---------
 .../pinot/common/request/FilterQueryMap.java       |  481 -----
 .../com/linkedin/pinot/common/request/GroupBy.java |  723 -------
 .../pinot/common/request/HavingFilterQuery.java    |  955 ---------
 .../pinot/common/request/HavingFilterQueryMap.java |  476 -----
 .../pinot/common/request/InstanceRequest.java      |  880 --------
 .../linkedin/pinot/common/request/QuerySource.java |  416 ----
 .../linkedin/pinot/common/request/QueryType.java   |  809 -------
 .../linkedin/pinot/common/request/Selection.java   |  831 --------
 .../pinot/common/request/SelectionSort.java        |  520 -----
 .../request/transform/TransformExpressionTree.java |  207 --
 .../pinot/common/response/BrokerResponse.java      |  126 --
 .../common/response/BrokerResponseFactory.java     |  117 -
 .../pinot/common/response/ProcessingException.java |  519 -----
 .../pinot/common/response/ServerInstance.java      |  224 --
 .../common/response/broker/AggregationResult.java  |  145 --
 .../response/broker/BrokerResponseNative.java      |  304 ---
 .../common/response/broker/GroupByResult.java      |   61 -
 .../response/broker/QueryProcessingException.java  |   58 -
 .../common/response/broker/SelectionResults.java   |   59 -
 .../common/restlet/resources/RebalanceResult.java  |   66 -
 .../common/restlet/resources/ResourceUtils.java    |   47 -
 .../common/restlet/resources/SegmentSizeInfo.java  |   61 -
 .../common/restlet/resources/TableSegments.java    |   38 -
 .../common/restlet/resources/TableSizeInfo.java    |   40 -
 .../pinot/common/restlet/resources/TablesList.java |   38 -
 .../linkedin/pinot/common/segment/ReadMode.java    |   40 -
 .../pinot/common/segment/SegmentMetadata.java      |  107 -
 .../pinot/common/segment/StarTreeMetadata.java     |   73 -
 .../common/segment/fetcher/HdfsSegmentFetcher.java |  125 --
 .../common/segment/fetcher/HttpSegmentFetcher.java |   83 -
 .../segment/fetcher/HttpsSegmentFetcher.java       |   72 -
 .../segment/fetcher/LocalFileSegmentFetcher.java   |   48 -
 .../pinot/common/segment/fetcher/NoOpFetcher.java  |   48 -
 .../segment/fetcher/PinotFSSegmentFetcher.java     |   56 -
 .../common/segment/fetcher/SegmentFetcher.java     |   48 -
 .../segment/fetcher/SegmentFetcherFactory.java     |  106 -
 .../common/utils/ClientSSLContextGenerator.java    |  152 --
 .../pinot/common/utils/CommonConstants.java        |  293 ---
 .../linkedin/pinot/common/utils/DataSchema.java    |  259 ---
 .../com/linkedin/pinot/common/utils/DataSize.java  |   91 -
 .../com/linkedin/pinot/common/utils/DataTable.java |   84 -
 .../linkedin/pinot/common/utils/EqualityUtils.java |  134 --
 .../common/utils/FileUploadDownloadClient.java     |  601 ------
 .../com/linkedin/pinot/common/utils/FileUtils.java |   65 -
 .../pinot/common/utils/HLCSegmentName.java         |  150 --
 .../com/linkedin/pinot/common/utils/HashUtil.java  |  110 -
 .../pinot/common/utils/KafkaStarterUtils.java      |  171 --
 .../pinot/common/utils/LLCSegmentName.java         |  163 --
 .../com/linkedin/pinot/common/utils/LLCUtils.java  |   57 -
 .../com/linkedin/pinot/common/utils/LogUtils.java  |   40 -
 .../pinot/common/utils/NamedThreadFactory.java     |   85 -
 .../com/linkedin/pinot/common/utils/NetUtil.java   |   59 -
 .../com/linkedin/pinot/common/utils/Pairs.java     |  283 ---
 .../pinot/common/utils/PrimitiveArrayUtils.java    |  141 --
 .../linkedin/pinot/common/utils/SchemaUtils.java   |  200 --
 .../linkedin/pinot/common/utils/SegmentName.java   |  105 -
 .../linkedin/pinot/common/utils/ServerType.java    |   23 -
 .../linkedin/pinot/common/utils/ServiceStatus.java |  330 ---
 .../pinot/common/utils/SimpleHttpResponse.java     |   37 -
 .../linkedin/pinot/common/utils/StringUtil.java    |   82 -
 .../pinot/common/utils/TarGzCompressionUtils.java  |  230 --
 .../linkedin/pinot/common/utils/TenantRole.java    |   24 -
 .../com/linkedin/pinot/common/utils/ZkStarter.java |  200 --
 .../pinot/common/utils/helix/HelixHelper.java      |  486 -----
 .../PinotHelixPropertyStoreZnRecordProvider.java   |   68 -
 .../pinot/common/utils/primitive/ByteArray.java    |  119 --
 .../common/utils/request/FilterQueryTree.java      |   93 -
 .../common/utils/request/HavingQueryTree.java      |   77 -
 .../pinot/common/utils/request/QueryTree.java      |   40 -
 .../pinot/common/utils/request/RequestUtils.java   |  207 --
 .../utils/retry/AttemptFailureException.java       |   37 -
 .../utils/retry/AttemptsExceededException.java     |   30 -
 .../pinot/common/utils/retry/BaseRetryPolicy.java  |   62 -
 .../utils/retry/ExponentialBackoffRetryPolicy.java |   46 -
 .../common/utils/retry/FixedDelayRetryPolicy.java  |   36 -
 .../common/utils/retry/NoDelayRetryPolicy.java     |   34 -
 .../utils/retry/RetriableOperationException.java   |   29 -
 .../pinot/common/utils/retry/RetryPolicies.java    |   61 -
 .../pinot/common/utils/retry/RetryPolicy.java      |   38 -
 .../pinot/common/utils/time/TimeConverter.java     |   67 -
 .../pinot/common/utils/time/TimeUtils.java         |  144 --
 .../common/utils/webhdfs/WebHdfsV1Client.java      |  119 --
 .../pinot/pql/parsers/AbstractCompiler.java        |   30 -
 .../pinot/pql/parsers/Pql2AstListener.java         |  432 ----
 .../pql/parsers/Pql2CompilationException.java      |   36 -
 .../linkedin/pinot/pql/parsers/Pql2Compiler.java   |  230 --
 .../pinot/pql/parsers/pql2/ast/AstNode.java        |   48 -
 .../pinot/pql/parsers/pql2/ast/BaseAstNode.java    |  102 -
 .../parsers/pql2/ast/BetweenPredicateAstNode.java  |  106 -
 .../pql/parsers/pql2/ast/BinaryMathOpAstNode.java  |   39 -
 .../parsers/pql2/ast/BooleanOperatorAstNode.java   |   84 -
 .../pql2/ast/ComparisonPredicateAstNode.java       |  191 --
 .../ast/ExpressionParenthesisGroupAstNode.java     |   25 -
 .../pql2/ast/FloatingPointLiteralAstNode.java      |   44 -
 .../pql/parsers/pql2/ast/FunctionCallAstNode.java  |  103 -
 .../pinot/pql/parsers/pql2/ast/GroupByAstNode.java |   39 -
 .../pinot/pql/parsers/pql2/ast/HavingAstNode.java  |   35 -
 .../pql/parsers/pql2/ast/IdentifierAstNode.java    |   54 -
 .../pql/parsers/pql2/ast/InPredicateAstNode.java   |  141 --
 .../parsers/pql2/ast/IntegerLiteralAstNode.java    |   44 -
 .../pql/parsers/pql2/ast/IsPredicateAstNode.java   |   31 -
 .../pinot/pql/parsers/pql2/ast/LimitAstNode.java   |   53 -
 .../pinot/pql/parsers/pql2/ast/LiteralAstNode.java |   26 -
 .../pinot/pql/parsers/pql2/ast/OptionAstNode.java  |   57 -
 .../pinot/pql/parsers/pql2/ast/OptionsAstNode.java |   37 -
 .../pinot/pql/parsers/pql2/ast/OrderByAstNode.java |   47 -
 .../parsers/pql2/ast/OrderByExpressionAstNode.java |   45 -
 .../pql/parsers/pql2/ast/OutputColumnAstNode.java  |   51 -
 .../parsers/pql2/ast/OutputColumnListAstNode.java  |   47 -
 .../pql/parsers/pql2/ast/PredicateAstNode.java     |   76 -
 .../pql/parsers/pql2/ast/PredicateListAstNode.java |  148 --
 .../pql2/ast/PredicateParenthesisGroupAstNode.java |   38 -
 .../pql2/ast/RegexpLikePredicateAstNode.java       |   82 -
 .../pinot/pql/parsers/pql2/ast/SelectAstNode.java  |  151 --
 .../parsers/pql2/ast/StarColumnListAstNode.java    |   39 -
 .../parsers/pql2/ast/StarExpressionAstNode.java    |   25 -
 .../pql/parsers/pql2/ast/StringLiteralAstNode.java |   44 -
 .../pql/parsers/pql2/ast/TableNameAstNode.java     |   50 -
 .../pinot/pql/parsers/pql2/ast/TopAstNode.java     |   50 -
 .../pinot/pql/parsers/pql2/ast/WhereAstNode.java   |   34 -
 .../com/linkedin/pinot/pql/parsers/utils/Pair.java |   49 -
 .../main/java/com/linkedin/pinot/serde/SerDe.java  |   72 -
 .../com/linkedin/pinot/startree/hll/HllConfig.java |  187 --
 .../linkedin/pinot/startree/hll/HllConstants.java  |   24 -
 .../linkedin/pinot/startree/hll/HllSizeUtils.java  |   48 -
 .../main/java/org/apache/pinot/common/Utils.java   |  153 ++
 .../config/AdjustTableNameChildKeyTransformer.java |   75 +
 .../pinot/common/config/ChildKeyHandler.java       |   45 +
 .../pinot/common/config/ChildKeyTransformer.java   |   32 +
 .../pinot/common/config/ColumnPartitionConfig.java |  166 ++
 .../config/ColumnPartitionMapChildKeyHandler.java  |   28 +
 .../apache/pinot/common/config/CombinedConfig.java |  110 +
 .../pinot/common/config/CombinedConfigLoader.java  |  176 ++
 ...CombinedConfigSeparatorChildKeyTransformer.java |  134 ++
 .../org/apache/pinot/common/config/ConfigDoc.java  |   34 +
 .../org/apache/pinot/common/config/ConfigKey.java  |   31 +
 .../common/config/ConfigNodeLifecycleAware.java    |   34 +
 .../apache/pinot/common/config/Deserializer.java   |  436 ++++
 .../org/apache/pinot/common/config/Duration.java   |   76 +
 .../apache/pinot/common/config/DurationDsl.java    |   57 +
 .../apache/pinot/common/config/IndexingConfig.java |  303 +++
 .../common/config/NamedListChildKeyHandler.java    |   81 +
 .../apache/pinot/common/config/NestedConfig.java   |   31 +
 .../pinot/common/config/OfflineTagConfig.java      |   39 +
 .../pinot/common/config/PinotTaskConfig.java       |   91 +
 .../apache/pinot/common/config/QuotaConfig.java    |  142 ++
 .../pinot/common/config/RealtimeTagConfig.java     |   64 +
 .../config/RemapTableTypesChildKeyTransformer.java |   72 +
 .../common/config/ReplicaGroupStrategyConfig.java  |  107 +
 .../apache/pinot/common/config/RoutingConfig.java  |   91 +
 .../common/config/SegmentPartitionConfig.java      |  152 ++
 .../SegmentsValidationAndRetentionConfig.java      |  254 +++
 .../org/apache/pinot/common/config/Serializer.java |  198 ++
 .../common/config/SimpleMapChildKeyHandler.java    |   51 +
 .../apache/pinot/common/config/SingleKeyDsl.java   |   30 +
 .../pinot/common/config/StarTreeIndexConfig.java   |   71 +
 .../common/config/StreamConsumptionConfig.java     |   54 +
 .../apache/pinot/common/config/TableConfig.java    |  615 ++++++
 .../pinot/common/config/TableCustomConfig.java     |   99 +
 .../pinot/common/config/TableNameBuilder.java      |  125 ++
 .../pinot/common/config/TableTaskConfig.java       |   87 +
 .../org/apache/pinot/common/config/TagConfig.java  |   44 +
 .../apache/pinot/common/config/TagNameUtils.java   |  113 +
 .../pinot/common/config/TagOverrideConfig.java     |  101 +
 .../config/TaskConfigMapChildKeyHandler.java       |   61 +
 .../org/apache/pinot/common/config/Tenant.java     |  166 ++
 .../apache/pinot/common/config/TenantConfig.java   |  121 ++
 .../common/config/TypedMapChildKeyHandler.java     |   77 +
 .../pinot/common/config/UseChildKeyHandler.java    |   31 +
 .../common/config/UseChildKeyTransformers.java     |   34 +
 .../org/apache/pinot/common/config/UseDsl.java     |   35 +
 .../pinot/common/data/DateTimeFieldSpec.java       |  153 ++
 .../data/DateTimeFieldSpecChildKeyHandler.java     |   31 +
 .../common/data/DateTimeFormatPatternSpec.java     |  105 +
 .../pinot/common/data/DateTimeFormatSpec.java      |  256 +++
 .../pinot/common/data/DateTimeFormatUnitSpec.java  |  137 ++
 .../pinot/common/data/DateTimeGranularitySpec.java |  144 ++
 .../pinot/common/data/DimensionFieldSpec.java      |   61 +
 .../data/DimensionFieldSpecChildKeyHandler.java    |   31 +
 .../org/apache/pinot/common/data/FieldSpec.java    |  455 ++++
 .../apache/pinot/common/data/MetricFieldSpec.java  |  184 ++
 .../data/MetricFieldSpecChildKeyHandler.java       |   31 +
 .../org/apache/pinot/common/data/RowEvent.java     |   36 +
 .../java/org/apache/pinot/common/data/Schema.java  |  660 ++++++
 .../java/org/apache/pinot/common/data/Segment.java |   57 +
 .../pinot/common/data/StarTreeIndexSpec.java       |  179 ++
 .../apache/pinot/common/data/TimeFieldSpec.java    |  242 +++
 .../pinot/common/data/TimeGranularitySpec.java     |  301 +++
 .../common/exception/HttpErrorStatusException.java |   32 +
 .../common/exception/InvalidConfigException.java   |   27 +
 .../pinot/common/exception/QueryException.java     |  148 ++
 .../common/exception/TableNotFoundException.java   |   27 +
 .../apache/pinot/common/http/MultiGetRequest.java  |  117 +
 .../apache/pinot/common/lineage/SegmentGroup.java  |   75 +
 .../pinot/common/lineage/SegmentMergeLineage.java  |  351 +++
 .../lineage/SegmentMergeLineageAccessHelper.java   |   81 +
 .../common/messages/SegmentRefreshMessage.java     |   70 +
 .../common/messages/SegmentReloadMessage.java      |   52 +
 .../messages/TimeboundaryRefreshMessage.java       |   45 +
 .../apache/pinot/common/metadata/ZKMetadata.java   |   26 +
 .../pinot/common/metadata/ZKMetadataProvider.java  |  435 ++++
 .../metadata/instance/InstanceZKMetadata.java      |  158 ++
 .../metadata/segment/ColumnPartitionMetadata.java  |  121 ++
 .../segment/LLCRealtimeSegmentZKMetadata.java      |  152 ++
 .../metadata/segment/OfflineSegmentZKMetadata.java |  138 ++
 .../segment/RealtimeSegmentZKMetadata.java         |  143 ++
 .../metadata/segment/SegmentPartitionMetadata.java |  169 ++
 .../common/metadata/segment/SegmentZKMetadata.java |  345 +++
 .../SegmentZKMetadataCustomMapModifier.java        |   94 +
 .../pinot/common/metrics/AbstractMetrics.java      |  484 +++++
 .../pinot/common/metrics/AggregatedCounter.java    |  130 ++
 .../pinot/common/metrics/AggregatedHistogram.java  |  201 ++
 .../pinot/common/metrics/AggregatedLongGauge.java  |  109 +
 .../pinot/common/metrics/AggregatedMeter.java      |  192 ++
 .../common/metrics/AggregatedMetricsRegistry.java  |   93 +
 .../apache/pinot/common/metrics/BrokerGauge.java   |   61 +
 .../apache/pinot/common/metrics/BrokerMeter.java   |  131 ++
 .../apache/pinot/common/metrics/BrokerMetrics.java |   55 +
 .../pinot/common/metrics/BrokerQueryPhase.java     |   48 +
 .../apache/pinot/common/metrics/BrokerTimer.java   |   53 +
 .../pinot/common/metrics/ControllerGauge.java      |   80 +
 .../pinot/common/metrics/ControllerMeter.java      |   94 +
 .../pinot/common/metrics/ControllerMetrics.java    |   46 +
 .../pinot/common/metrics/ControllerTimer.java      |   53 +
 ...eporterMetricsRegistryRegistrationListener.java |   34 +
 .../apache/pinot/common/metrics/LatencyMetric.java |   96 +
 .../apache/pinot/common/metrics/MetricsHelper.java |  348 +++
 .../MetricsRegistryRegistrationListener.java       |   30 +
 .../apache/pinot/common/metrics/ServerGauge.java   |   79 +
 .../apache/pinot/common/metrics/ServerMeter.java   |   93 +
 .../apache/pinot/common/metrics/ServerMetrics.java |   51 +
 .../pinot/common/metrics/ServerQueryPhase.java     |   50 +
 .../apache/pinot/common/metrics/ServerTimer.java   |   53 +
 .../pinot/common/metrics/ValidationMetrics.java    |  243 +++
 .../common/partition/PartitionAssignment.java      |  109 +
 .../partition/ReplicaGroupPartitionAssignment.java |  124 ++
 .../ReplicaGroupPartitionAssignmentGenerator.java  |  127 ++
 .../StreamPartitionAssignmentGenerator.java        |  181 ++
 .../protocols/SegmentCompletionProtocol.java       |  529 +++++
 .../apache/pinot/common/query/ReduceService.java   |   51 +
 .../pinot/common/query/ReduceServiceRegistry.java  |   70 +
 .../pinot/common/request/AggregationInfo.java      |  677 ++++++
 .../apache/pinot/common/request/BrokerRequest.java | 2201 +++++++++++++++++++
 .../pinot/common/request/FilterOperator.java       |   86 +
 .../apache/pinot/common/request/FilterQuery.java   |  942 +++++++++
 .../pinot/common/request/FilterQueryMap.java       |  481 +++++
 .../org/apache/pinot/common/request/GroupBy.java   |  723 +++++++
 .../pinot/common/request/HavingFilterQuery.java    |  944 +++++++++
 .../pinot/common/request/HavingFilterQueryMap.java |  476 +++++
 .../pinot/common/request/InstanceRequest.java      |  880 ++++++++
 .../apache/pinot/common/request/QuerySource.java   |  416 ++++
 .../org/apache/pinot/common/request/QueryType.java |  809 +++++++
 .../org/apache/pinot/common/request/Selection.java |  831 ++++++++
 .../apache/pinot/common/request/SelectionSort.java |  520 +++++
 .../request/transform/TransformExpressionTree.java |  206 ++
 .../pinot/common/response/BrokerResponse.java      |  126 ++
 .../common/response/BrokerResponseFactory.java     |  117 +
 .../pinot/common/response/ProcessingException.java |  519 +++++
 .../pinot/common/response/ServerInstance.java      |  224 ++
 .../common/response/broker/AggregationResult.java  |  145 ++
 .../response/broker/BrokerResponseNative.java      |  304 +++
 .../common/response/broker/GroupByResult.java      |   61 +
 .../response/broker/QueryProcessingException.java  |   58 +
 .../common/response/broker/SelectionResults.java   |   59 +
 .../common/restlet/resources/RebalanceResult.java  |   66 +
 .../common/restlet/resources/ResourceUtils.java    |   47 +
 .../common/restlet/resources/SegmentSizeInfo.java  |   61 +
 .../common/restlet/resources/TableSegments.java    |   38 +
 .../common/restlet/resources/TableSizeInfo.java    |   40 +
 .../pinot/common/restlet/resources/TablesList.java |   38 +
 .../org/apache/pinot/common/segment/ReadMode.java  |   40 +
 .../pinot/common/segment/SegmentMetadata.java      |  107 +
 .../pinot/common/segment/StarTreeMetadata.java     |   73 +
 .../common/segment/fetcher/HdfsSegmentFetcher.java |  125 ++
 .../common/segment/fetcher/HttpSegmentFetcher.java |   83 +
 .../segment/fetcher/HttpsSegmentFetcher.java       |   72 +
 .../segment/fetcher/LocalFileSegmentFetcher.java   |   48 +
 .../pinot/common/segment/fetcher/NoOpFetcher.java  |   48 +
 .../segment/fetcher/PinotFSSegmentFetcher.java     |   56 +
 .../common/segment/fetcher/SegmentFetcher.java     |   48 +
 .../segment/fetcher/SegmentFetcherFactory.java     |  106 +
 .../common/utils/ClientSSLContextGenerator.java    |  152 ++
 .../apache/pinot/common/utils/CommonConstants.java |  293 +++
 .../org/apache/pinot/common/utils/DataSchema.java  |  259 +++
 .../org/apache/pinot/common/utils/DataSize.java    |   91 +
 .../org/apache/pinot/common/utils/DataTable.java   |   84 +
 .../apache/pinot/common/utils/EqualityUtils.java   |  134 ++
 .../common/utils/FileUploadDownloadClient.java     |  601 ++++++
 .../org/apache/pinot/common/utils/FileUtils.java   |   65 +
 .../apache/pinot/common/utils/HLCSegmentName.java  |  150 ++
 .../org/apache/pinot/common/utils/HashUtil.java    |  110 +
 .../pinot/common/utils/KafkaStarterUtils.java      |  171 ++
 .../apache/pinot/common/utils/LLCSegmentName.java  |  163 ++
 .../org/apache/pinot/common/utils/LLCUtils.java    |   57 +
 .../org/apache/pinot/common/utils/LogUtils.java    |   40 +
 .../pinot/common/utils/NamedThreadFactory.java     |   85 +
 .../org/apache/pinot/common/utils/NetUtil.java     |   59 +
 .../java/org/apache/pinot/common/utils/Pairs.java  |  283 +++
 .../pinot/common/utils/PrimitiveArrayUtils.java    |  141 ++
 .../org/apache/pinot/common/utils/SchemaUtils.java |  200 ++
 .../org/apache/pinot/common/utils/SegmentName.java |  105 +
 .../org/apache/pinot/common/utils/ServerType.java  |   23 +
 .../apache/pinot/common/utils/ServiceStatus.java   |  330 +++
 .../pinot/common/utils/SimpleHttpResponse.java     |   37 +
 .../org/apache/pinot/common/utils/StringUtil.java  |   82 +
 .../pinot/common/utils/TarGzCompressionUtils.java  |  230 ++
 .../org/apache/pinot/common/utils/TenantRole.java  |   24 +
 .../org/apache/pinot/common/utils/ZkStarter.java   |  200 ++
 .../pinot/common/utils/helix/HelixHelper.java      |  486 +++++
 .../PinotHelixPropertyStoreZnRecordProvider.java   |   68 +
 .../pinot/common/utils/primitive/ByteArray.java    |  119 ++
 .../common/utils/request/FilterQueryTree.java      |   93 +
 .../common/utils/request/HavingQueryTree.java      |   77 +
 .../pinot/common/utils/request/QueryTree.java      |   40 +
 .../pinot/common/utils/request/RequestUtils.java   |  207 ++
 .../utils/retry/AttemptFailureException.java       |   37 +
 .../utils/retry/AttemptsExceededException.java     |   30 +
 .../pinot/common/utils/retry/BaseRetryPolicy.java  |   62 +
 .../utils/retry/ExponentialBackoffRetryPolicy.java |   46 +
 .../common/utils/retry/FixedDelayRetryPolicy.java  |   36 +
 .../common/utils/retry/NoDelayRetryPolicy.java     |   34 +
 .../utils/retry/RetriableOperationException.java   |   29 +
 .../pinot/common/utils/retry/RetryPolicies.java    |   61 +
 .../pinot/common/utils/retry/RetryPolicy.java      |   38 +
 .../pinot/common/utils/time/TimeConverter.java     |   67 +
 .../apache/pinot/common/utils/time/TimeUtils.java  |  144 ++
 .../common/utils/webhdfs/WebHdfsV1Client.java      |  119 ++
 .../apache/pinot/pql/parsers/AbstractCompiler.java |   31 +
 .../apache/pinot/pql/parsers/Pql2AstListener.java  |  433 ++++
 .../pql/parsers/Pql2CompilationException.java      |   36 +
 .../org/apache/pinot/pql/parsers/Pql2Compiler.java |  229 ++
 .../apache/pinot/pql/parsers/pql2/ast/AstNode.java |   48 +
 .../pinot/pql/parsers/pql2/ast/BaseAstNode.java    |  102 +
 .../parsers/pql2/ast/BetweenPredicateAstNode.java  |  106 +
 .../pql/parsers/pql2/ast/BinaryMathOpAstNode.java  |   39 +
 .../parsers/pql2/ast/BooleanOperatorAstNode.java   |   84 +
 .../pql2/ast/ComparisonPredicateAstNode.java       |  191 ++
 .../ast/ExpressionParenthesisGroupAstNode.java     |   25 +
 .../pql2/ast/FloatingPointLiteralAstNode.java      |   44 +
 .../pql/parsers/pql2/ast/FunctionCallAstNode.java  |  106 +
 .../pinot/pql/parsers/pql2/ast/GroupByAstNode.java |   39 +
 .../pinot/pql/parsers/pql2/ast/HavingAstNode.java  |   35 +
 .../pql/parsers/pql2/ast/IdentifierAstNode.java    |   54 +
 .../pql/parsers/pql2/ast/InPredicateAstNode.java   |  141 ++
 .../parsers/pql2/ast/IntegerLiteralAstNode.java    |   44 +
 .../pql/parsers/pql2/ast/IsPredicateAstNode.java   |   31 +
 .../pinot/pql/parsers/pql2/ast/LimitAstNode.java   |   53 +
 .../pinot/pql/parsers/pql2/ast/LiteralAstNode.java |   26 +
 .../pinot/pql/parsers/pql2/ast/OptionAstNode.java  |   57 +
 .../pinot/pql/parsers/pql2/ast/OptionsAstNode.java |   37 +
 .../pinot/pql/parsers/pql2/ast/OrderByAstNode.java |   47 +
 .../parsers/pql2/ast/OrderByExpressionAstNode.java |   45 +
 .../pql/parsers/pql2/ast/OutputColumnAstNode.java  |   51 +
 .../parsers/pql2/ast/OutputColumnListAstNode.java  |   47 +
 .../pql/parsers/pql2/ast/PredicateAstNode.java     |   77 +
 .../pql/parsers/pql2/ast/PredicateListAstNode.java |  148 ++
 .../pql2/ast/PredicateParenthesisGroupAstNode.java |   38 +
 .../pql2/ast/RegexpLikePredicateAstNode.java       |   82 +
 .../pinot/pql/parsers/pql2/ast/SelectAstNode.java  |  151 ++
 .../parsers/pql2/ast/StarColumnListAstNode.java    |   39 +
 .../parsers/pql2/ast/StarExpressionAstNode.java    |   25 +
 .../pql/parsers/pql2/ast/StringLiteralAstNode.java |   44 +
 .../pql/parsers/pql2/ast/TableNameAstNode.java     |   50 +
 .../pinot/pql/parsers/pql2/ast/TopAstNode.java     |   50 +
 .../pinot/pql/parsers/pql2/ast/WhereAstNode.java   |   34 +
 .../org/apache/pinot/pql/parsers/utils/Pair.java   |   49 +
 .../main/java/org/apache/pinot/serde/SerDe.java    |   72 +
 .../org/apache/pinot/startree/hll/HllConfig.java   |  184 ++
 .../apache/pinot/startree/hll/HllConstants.java    |   24 +
 .../apache/pinot/startree/hll/HllSizeUtils.java    |   48 +
 .../pinot/common/config/IndexingConfigTest.java    |  178 --
 .../pinot/common/config/QuotaConfigTest.java       |  112 -
 .../pinot/common/config/TableConfigTest.java       |  325 ---
 .../pinot/common/config/TagOverrideConfigTest.java |  125 --
 .../linkedin/pinot/common/config/TenantTest.java   |   52 -
 .../common/config/TestConfigSerialization.java     |   74 -
 .../pinot/common/data/DateTimeFormatSpecTest.java  |  318 ---
 .../common/data/DateTimeGranularitySpecTest.java   |  107 -
 .../linkedin/pinot/common/data/FieldSpecTest.java  |  376 ----
 .../com/linkedin/pinot/common/data/SchemaTest.java |  340 ---
 .../pinot/common/http/MultiGetRequestTest.java     |  160 --
 .../common/lineage/SegmentMergeLineageTest.java    |  145 --
 .../common/metadata/InstanceZKMetadataTest.java    |   73 -
 .../metadata/MetadataEqualsHashCodeTest.java       |   62 -
 .../pinot/common/metadata/MetadataUtils.java       |  127 --
 .../common/metadata/SegmentZKMetadataTest.java     |  225 --
 .../pinot/common/metrics/MetricsHelperTest.java    |   76 -
 .../common/partition/IdealStateBuilderUtil.java    |  173 --
 .../StreamPartitionAssignmentGeneratorTest.java    |  320 ---
 .../pinot/common/query/gen/AvroQueryGenerator.java |  432 ----
 .../transform/TransformExpressionTreeTest.java     |  106 -
 .../segment/fetcher/SegmentFetcherFactoryTest.java |  111 -
 .../pinot/common/utils/DataSchemaTest.java         |  181 --
 .../linkedin/pinot/common/utils/DataSizeTest.java  |   49 -
 .../pinot/common/utils/EqualityUtilsTest.java      |   96 -
 .../common/utils/FileUploadDownloadClientTest.java |  135 --
 .../pinot/common/utils/SegmentNameBuilderTest.java |  169 --
 .../pinot/common/utils/ServiceStatusTest.java      |  220 --
 .../pinot/common/utils/StringUtilTest.java         |   42 -
 .../common/utils/TarGzCompressionUtilsTest.java    |  172 --
 .../com/linkedin/pinot/common/utils/UtilsTest.java |   93 -
 .../pinot/common/utils/retry/RetryPolicyTest.java  |   92 -
 .../pinot/common/utils/time/TimeConverterTest.java |  100 -
 .../pinot/pql/parsers/Pql2CompilerTest.java        |  241 ---
 .../request/BrokerRequestSerializationTest.java    |  134 --
 .../pinot/request/BrokerResponseNativeTest.java    |   74 -
 .../pinot/common/config/IndexingConfigTest.java    |  178 ++
 .../pinot/common/config/QuotaConfigTest.java       |  112 +
 .../pinot/common/config/TableConfigTest.java       |  325 +++
 .../pinot/common/config/TagOverrideConfigTest.java |  125 ++
 .../org/apache/pinot/common/config/TenantTest.java |   52 +
 .../common/config/TestConfigSerialization.java     |   69 +
 .../pinot/common/data/DateTimeFormatSpecTest.java  |  318 +++
 .../common/data/DateTimeGranularitySpecTest.java   |  107 +
 .../apache/pinot/common/data/FieldSpecTest.java    |  376 ++++
 .../org/apache/pinot/common/data/SchemaTest.java   |  340 +++
 .../pinot/common/http/MultiGetRequestTest.java     |  160 ++
 .../common/lineage/SegmentMergeLineageTest.java    |  145 ++
 .../common/metadata/InstanceZKMetadataTest.java    |   73 +
 .../metadata/MetadataEqualsHashCodeTest.java       |   62 +
 .../pinot/common/metadata/MetadataUtils.java       |  127 ++
 .../common/metadata/SegmentZKMetadataTest.java     |  225 ++
 .../pinot/common/metrics/MetricsHelperTest.java    |   76 +
 .../common/partition/IdealStateBuilderUtil.java    |  173 ++
 .../StreamPartitionAssignmentGeneratorTest.java    |  320 +++
 .../pinot/common/query/gen/AvroQueryGenerator.java |  432 ++++
 .../transform/TransformExpressionTreeTest.java     |  106 +
 .../segment/fetcher/SegmentFetcherFactoryTest.java |  111 +
 .../apache/pinot/common/utils/DataSchemaTest.java  |  181 ++
 .../apache/pinot/common/utils/DataSizeTest.java    |   49 +
 .../pinot/common/utils/EqualityUtilsTest.java      |   96 +
 .../common/utils/FileUploadDownloadClientTest.java |  134 ++
 .../pinot/common/utils/SegmentNameBuilderTest.java |  169 ++
 .../pinot/common/utils/ServiceStatusTest.java      |  220 ++
 .../apache/pinot/common/utils/StringUtilTest.java  |   42 +
 .../common/utils/TarGzCompressionUtilsTest.java    |  172 ++
 .../org/apache/pinot/common/utils/UtilsTest.java   |   93 +
 .../pinot/common/utils/retry/RetryPolicyTest.java  |   92 +
 .../pinot/common/utils/time/TimeConverterTest.java |  100 +
 .../apache/pinot/pql/parsers/Pql2CompilerTest.java |  241 +++
 .../request/BrokerRequestSerializationTest.java    |  130 ++
 .../pinot/request/BrokerResponseNativeTest.java    |   74 +
 pinot-common/src/test/resources/log4j.properties   |    2 +-
 pinot-common/src/thrift/request.thrift             |    2 +-
 pinot-common/src/thrift/response.thrift            |    2 +-
 pinot-controller/pom.xml                           |   14 +-
 .../linkedin/pinot/controller/ControllerConf.java  |  551 -----
 .../controller/ControllerLeadershipManager.java    |  128 --
 .../pinot/controller/ControllerStarter.java        |  389 ----
 .../controller/LeadershipChangeSubscriber.java     |   35 -
 .../pinot/controller/api/CallableHttpGet.java      |   37 -
 .../api/ControllerAdminApiApplication.java         |  150 --
 .../pinot/controller/api/access/AccessControl.java |   34 -
 .../api/access/AccessControlFactory.java           |   24 -
 .../api/access/AllowAllAccessFactory.java          |   36 -
 .../api/events/DefaultMetadataEventNotifier.java   |   32 -
 .../DefaultMetadataEventNotifierFactory.java       |   34 -
 .../api/events/MetadataEventNotifier.java          |   28 -
 .../api/events/MetadataEventNotifierFactory.java   |   50 -
 .../controller/api/events/SchemaEventType.java     |   23 -
 .../pinot/controller/api/pojos/Instance.java       |  148 --
 .../pinot/controller/api/resources/Constants.java  |   64 -
 .../resources/ControllerApplicationException.java  |   57 -
 .../api/resources/ControllerResponseFilter.java    |   52 -
 .../api/resources/FileUploadPathProvider.java      |  142 --
 .../controller/api/resources/HeaderAdder.java      |  108 -
 .../InvalidControllerConfigException.java          |   29 -
 .../resources/LLCSegmentCompletionHandlers.java    |  376 ----
 .../api/resources/LandingPageHandler.java          |   41 -
 .../api/resources/PinotControllerHealthCheck.java  |   52 -
 .../resources/PinotControllerResponseFilter.java   |   63 -
 .../resources/PinotInstanceRestletResource.java    |  205 --
 .../api/resources/PinotSchemaRestletResource.java  |  239 ---
 .../api/resources/PinotSegmentRestletResource.java |  555 -----
 .../PinotSegmentUploadRestletResource.java         |  542 -----
 .../resources/PinotTableConfigRestletResource.java |  215 --
 .../api/resources/PinotTableIndexingConfigs.java   |   77 -
 .../api/resources/PinotTableInstances.java         |  138 --
 .../api/resources/PinotTableMetadataConfigs.java   |   66 -
 .../api/resources/PinotTableRestletResource.java   |  522 -----
 .../controller/api/resources/PinotTableSchema.java |   63 -
 .../api/resources/PinotTableSegmentConfigs.java    |   83 -
 .../api/resources/PinotTableTenantConfigs.java     |   71 -
 .../api/resources/PinotTaskRestletResource.java    |  192 --
 .../api/resources/PinotTenantRestletResource.java  |  455 ----
 .../api/resources/PinotVersionRestletResource.java |   48 -
 .../controller/api/resources/PqlQueryResource.java |  236 ---
 .../api/resources/ServerTableSizeReader.java       |  104 -
 .../pinot/controller/api/resources/StateType.java  |   25 -
 .../api/resources/StringResultResponse.java        |   31 -
 .../controller/api/resources/SuccessResponse.java  |   31 -
 .../pinot/controller/api/resources/TableSize.java  |   92 -
 .../pinot/controller/api/resources/TableViews.java |  171 --
 .../resources/WebApplicationExceptionMapper.java   |   69 -
 .../controller/api/upload/SegmentValidator.java    |  148 --
 .../pinot/controller/api/upload/ZKOperator.java    |  227 --
 .../helix/ControllerRequestBuilderUtil.java        |  152 --
 .../helix/ControllerRequestURLBuilder.java         |  253 ---
 .../EmptyBrokerOnlineOfflineStateModelFactory.java |   71 -
 ...EmptySegmentOnlineOfflineStateModelFactory.java |   81 -
 .../controller/helix/SegmentStatusChecker.java     |  273 ---
 ...erResourceOnlineOfflineStateModelGenerator.java |  131 --
 .../helix/core/PinotHelixResourceManager.java      | 2226 -------------------
 ...lixSegmentOnlineOfflineStateModelGenerator.java |  164 --
 .../helix/core/PinotResourceManagerResponse.java   |   57 -
 .../helix/core/PinotTableIdealStateBuilder.java    |  212 --
 .../helix/core/SegmentDeletionManager.java         |  257 ---
 .../controller/helix/core/TableRebalancer.java     |  300 ---
 .../helix/core/minion/ClusterInfoProvider.java     |  134 --
 .../core/minion/PinotHelixTaskResourceManager.java |  336 ---
 .../helix/core/minion/PinotTaskManager.java        |  173 --
 .../generator/ConvertToRawIndexTaskGenerator.java  |  139 --
 .../core/minion/generator/PinotTaskGenerator.java  |   61 -
 .../minion/generator/TaskGeneratorRegistry.java    |   73 -
 .../core/minion/generator/TaskGeneratorUtils.java  |   57 -
 .../core/periodictask/ControllerPeriodicTask.java  |  179 --
 .../ControllerPeriodicTaskScheduler.java           |   59 -
 .../realtime/PinotLLCRealtimeSegmentManager.java   | 1384 ------------
 .../core/realtime/PinotRealtimeSegmentManager.java |  419 ----
 .../core/realtime/SegmentCompletionManager.java    | 1104 ----------
 .../helix/core/realtime/TableConfigCache.java      |   60 -
 .../segment/CommittingSegmentDescriptor.java       |   84 -
 .../segment/DefaultFlushThresholdUpdater.java      |   79 -
 .../segment/FlushThresholdUpdateManager.java       |   67 -
 .../realtime/segment/FlushThresholdUpdater.java    |   42 -
 .../SegmentSizeBasedFlushThresholdUpdater.java     |  187 --
 .../rebalance/DefaultRebalanceSegmentStrategy.java |  350 ---
 .../core/rebalance/RebalanceSegmentStrategy.java   |   53 -
 .../rebalance/RebalanceSegmentStrategyFactory.java |   66 -
 .../rebalance/RebalanceUserConfigConstants.java    |   35 -
 .../ReplicaGroupRebalanceSegmentStrategy.java      |  527 -----
 .../core/relocation/RealtimeSegmentRelocator.java  |  285 ---
 .../helix/core/retention/RetentionManager.java     |  199 --
 .../core/retention/strategy/RetentionStrategy.java |   36 -
 .../retention/strategy/TimeRetentionStrategy.java  |   60 -
 .../BalanceNumSegmentAssignmentStrategy.java       |   99 -
 .../core/sharding/BucketizedSegmentStrategy.java   |   67 -
 .../core/sharding/RandomAssignmentStrategy.java    |   65 -
 .../ReplicaGroupSegmentAssignmentStrategy.java     |  108 -
 .../core/sharding/SegmentAssignmentStrategy.java   |   42 -
 .../sharding/SegmentAssignmentStrategyEnum.java    |   31 -
 .../sharding/SegmentAssignmentStrategyFactory.java |   47 -
 .../helix/core/util/HelixSetupUtils.java           |  173 --
 .../helix/core/util/ZKMetadataUtils.java           |   76 -
 .../controller/helix/starter/HelixConfig.java      |   29 -
 .../controller/util/AutoAddInvertedIndex.java      |  364 ----
 .../controller/util/SegmentCompletionUtils.java    |   44 -
 .../controller/util/TableRetentionValidator.java   |  199 --
 .../pinot/controller/util/TableSizeReader.java     |  242 ---
 .../BrokerResourceValidationManager.java           |   82 -
 .../validation/OfflineSegmentIntervalChecker.java  |  228 --
 .../RealtimeSegmentValidationManager.java          |  167 --
 .../controller/validation/StorageQuotaChecker.java |  204 --
 .../apache/pinot/controller/ControllerConf.java    |  551 +++++
 .../controller/ControllerLeadershipManager.java    |  128 ++
 .../apache/pinot/controller/ControllerStarter.java |  405 ++++
 .../controller/LeadershipChangeSubscriber.java     |   35 +
 .../pinot/controller/api/CallableHttpGet.java      |   37 +
 .../api/ControllerAdminApiApplication.java         |  150 ++
 .../pinot/controller/api/access/AccessControl.java |   34 +
 .../api/access/AccessControlFactory.java           |   24 +
 .../api/access/AllowAllAccessFactory.java          |   36 +
 .../api/events/DefaultMetadataEventNotifier.java   |   32 +
 .../DefaultMetadataEventNotifierFactory.java       |   34 +
 .../api/events/MetadataEventNotifier.java          |   28 +
 .../api/events/MetadataEventNotifierFactory.java   |   50 +
 .../controller/api/events/SchemaEventType.java     |   23 +
 .../pinot/controller/api/pojos/Instance.java       |  148 ++
 .../pinot/controller/api/resources/Constants.java  |   64 +
 .../resources/ControllerApplicationException.java  |   57 +
 .../api/resources/ControllerResponseFilter.java    |   52 +
 .../api/resources/FileUploadPathProvider.java      |  142 ++
 .../controller/api/resources/HeaderAdder.java      |  108 +
 .../InvalidControllerConfigException.java          |   29 +
 .../resources/LLCSegmentCompletionHandlers.java    |  378 ++++
 .../api/resources/LandingPageHandler.java          |   41 +
 .../api/resources/PinotControllerHealthCheck.java  |   52 +
 .../resources/PinotControllerResponseFilter.java   |   63 +
 .../resources/PinotInstanceRestletResource.java    |  207 ++
 .../api/resources/PinotSchemaRestletResource.java  |  240 +++
 .../api/resources/PinotSegmentRestletResource.java |  557 +++++
 .../PinotSegmentUploadRestletResource.java         |  544 +++++
 .../resources/PinotTableConfigRestletResource.java |  216 ++
 .../api/resources/PinotTableIndexingConfigs.java   |   78 +
 .../api/resources/PinotTableInstances.java         |  139 ++
 .../api/resources/PinotTableMetadataConfigs.java   |   67 +
 .../api/resources/PinotTableRestletResource.java   |  525 +++++
 .../controller/api/resources/PinotTableSchema.java |   64 +
 .../api/resources/PinotTableSegmentConfigs.java    |   84 +
 .../api/resources/PinotTableTenantConfigs.java     |   73 +
 .../api/resources/PinotTaskRestletResource.java    |  194 ++
 .../api/resources/PinotTenantRestletResource.java  |  457 ++++
 .../api/resources/PinotVersionRestletResource.java |   48 +
 .../controller/api/resources/PqlQueryResource.java |  237 +++
 .../api/resources/ServerTableSizeReader.java       |  104 +
 .../pinot/controller/api/resources/StateType.java  |   25 +
 .../api/resources/StringResultResponse.java        |   31 +
 .../controller/api/resources/SuccessResponse.java  |   31 +
 .../pinot/controller/api/resources/TableSize.java  |   94 +
 .../pinot/controller/api/resources/TableViews.java |  172 ++
 .../resources/WebApplicationExceptionMapper.java   |   69 +
 .../controller/api/upload/SegmentValidator.java    |  152 ++
 .../pinot/controller/api/upload/ZKOperator.java    |  229 ++
 .../helix/ControllerRequestBuilderUtil.java        |  152 ++
 .../helix/ControllerRequestURLBuilder.java         |  253 +++
 .../EmptyBrokerOnlineOfflineStateModelFactory.java |   71 +
 ...EmptySegmentOnlineOfflineStateModelFactory.java |   81 +
 .../controller/helix/SegmentStatusChecker.java     |  275 +++
 ...erResourceOnlineOfflineStateModelGenerator.java |  131 ++
 .../helix/core/PinotHelixResourceManager.java      | 2235 ++++++++++++++++++++
 ...lixSegmentOnlineOfflineStateModelGenerator.java |  164 ++
 .../helix/core/PinotResourceManagerResponse.java   |   57 +
 .../helix/core/PinotTableIdealStateBuilder.java    |  213 ++
 .../helix/core/SegmentDeletionManager.java         |  257 +++
 .../controller/helix/core/TableRebalancer.java     |  302 +++
 .../helix/core/minion/ClusterInfoProvider.java     |  135 ++
 .../core/minion/PinotHelixTaskResourceManager.java |  336 +++
 .../helix/core/minion/PinotTaskManager.java        |  176 ++
 .../generator/ConvertToRawIndexTaskGenerator.java  |  139 ++
 .../core/minion/generator/PinotTaskGenerator.java  |   61 +
 .../minion/generator/TaskGeneratorRegistry.java    |   74 +
 .../core/minion/generator/TaskGeneratorUtils.java  |   57 +
 .../core/periodictask/ControllerPeriodicTask.java  |  179 ++
 .../ControllerPeriodicTaskScheduler.java           |   59 +
 .../realtime/PinotLLCRealtimeSegmentManager.java   | 1388 ++++++++++++
 .../core/realtime/PinotRealtimeSegmentManager.java |  419 ++++
 .../core/realtime/SegmentCompletionManager.java    | 1105 ++++++++++
 .../helix/core/realtime/TableConfigCache.java      |   60 +
 .../segment/CommittingSegmentDescriptor.java       |   84 +
 .../segment/DefaultFlushThresholdUpdater.java      |   79 +
 .../segment/FlushThresholdUpdateManager.java       |   67 +
 .../realtime/segment/FlushThresholdUpdater.java    |   42 +
 .../SegmentSizeBasedFlushThresholdUpdater.java     |  187 ++
 .../rebalance/DefaultRebalanceSegmentStrategy.java |  350 +++
 .../core/rebalance/RebalanceSegmentStrategy.java   |   53 +
 .../rebalance/RebalanceSegmentStrategyFactory.java |   66 +
 .../rebalance/RebalanceUserConfigConstants.java    |   35 +
 .../ReplicaGroupRebalanceSegmentStrategy.java      |  527 +++++
 .../core/relocation/RealtimeSegmentRelocator.java  |  286 +++
 .../helix/core/retention/RetentionManager.java     |  202 ++
 .../core/retention/strategy/RetentionStrategy.java |   36 +
 .../retention/strategy/TimeRetentionStrategy.java  |   60 +
 .../BalanceNumSegmentAssignmentStrategy.java       |   99 +
 .../core/sharding/BucketizedSegmentStrategy.java   |   67 +
 .../core/sharding/RandomAssignmentStrategy.java    |   65 +
 .../ReplicaGroupSegmentAssignmentStrategy.java     |  108 +
 .../core/sharding/SegmentAssignmentStrategy.java   |   42 +
 .../sharding/SegmentAssignmentStrategyEnum.java    |   31 +
 .../sharding/SegmentAssignmentStrategyFactory.java |   47 +
 .../helix/core/util/HelixSetupUtils.java           |  174 ++
 .../helix/core/util/ZKMetadataUtils.java           |   76 +
 .../controller/helix/starter/HelixConfig.java      |   29 +
 .../controller/util/AutoAddInvertedIndex.java      |  365 ++++
 .../controller/util/SegmentCompletionUtils.java    |   44 +
 .../controller/util/TableRetentionValidator.java   |  199 ++
 .../pinot/controller/util/TableSizeReader.java     |  243 +++
 .../BrokerResourceValidationManager.java           |   82 +
 .../validation/OfflineSegmentIntervalChecker.java  |  229 ++
 .../RealtimeSegmentValidationManager.java          |  167 ++
 .../controller/validation/StorageQuotaChecker.java |  204 ++
 .../api/resources/AccessControlTest.java           |   73 -
 .../api/resources/FileUploadPathProviderTest.java  |   54 -
 .../api/resources/PinotFileUploadTest.java         |   81 -
 .../PinotInstanceRestletResourceTest.java          |  139 --
 .../resources/PinotSchemaRestletResourceTest.java  |  131 --
 .../resources/PinotSegmentRestletResourceTest.java |  125 --
 .../resources/PinotTableRestletResourceTest.java   |  330 ---
 .../resources/PinotTenantRestletResourceTest.java  |  108 -
 .../SegmentCompletionProtocolDeserTest.java        |  167 --
 .../api/resources/SegmentCompletionUtilsTest.java  |   40 -
 .../api/resources/ServerTableSizeReaderTest.java   |  181 --
 .../api/resources/TableSizeReaderTest.java         |  380 ----
 .../controller/api/resources/TableViewsTest.java   |  196 --
 .../helix/ControllerInstanceToggleTest.java        |  132 --
 .../controller/helix/ControllerSentinelTestV2.java |   98 -
 .../controller/helix/ControllerTenantTest.java     |  181 --
 .../pinot/controller/helix/ControllerTest.java     |  253 ---
 .../pinot/controller/helix/HelixHelperTest.java    |   81 -
 .../controller/helix/PinotResourceManagerTest.java |  166 --
 .../controller/helix/SegmentStatusCheckerTest.java |  573 -----
 .../helix/core/PinotHelixResourceManagerTest.java  |  273 ---
 .../periodictask/ControllerPeriodicTaskTest.java   |  165 --
 .../PinotLLCRealtimeSegmentManagerTest.java        | 1580 --------------
 .../helix/core/realtime/SegmentCompletionTest.java | 1153 ----------
 .../segment/FlushThresholdUpdaterTest.java         |  549 -----
 .../rebalance/DefaultRebalanceStrategyTest.java    |  664 ------
 .../ReplicaGroupRebalanceStrategyTest.java         |  323 ---
 .../relocation/RealtimeSegmentRelocatorTest.java   |  277 ---
 .../helix/core/retention/RetentionManagerTest.java |  319 ---
 .../strategy/TimeRetentionStrategyTest.java        |   66 -
 .../sharding/SegmentAssignmentStrategyTest.java    |  370 ----
 .../core/util/SegmentDeletionManagerTest.java      |  293 ---
 .../helix/core/util/TableRebalancerTest.java       |  119 --
 .../controller/utils/ReplicaGroupTestUtils.java    |  140 --
 .../controller/utils/SegmentMetadataMockUtils.java |  105 -
 .../validation/StorageQuotaCheckerTest.java        |  178 --
 .../validation/ValidationManagerTest.java          |  234 --
 .../api/resources/AccessControlTest.java           |   77 +
 .../api/resources/FileUploadPathProviderTest.java  |   56 +
 .../api/resources/PinotFileUploadTest.java         |   83 +
 .../PinotInstanceRestletResourceTest.java          |  140 ++
 .../resources/PinotSchemaRestletResourceTest.java  |  132 ++
 .../resources/PinotSegmentRestletResourceTest.java |  128 ++
 .../resources/PinotTableRestletResourceTest.java   |  333 +++
 .../resources/PinotTenantRestletResourceTest.java  |  110 +
 .../SegmentCompletionProtocolDeserTest.java        |  167 ++
 .../api/resources/SegmentCompletionUtilsTest.java  |   41 +
 .../api/resources/ServerTableSizeReaderTest.java   |  181 ++
 .../api/resources/TableSizeReaderTest.java         |  382 ++++
 .../controller/api/resources/TableViewsTest.java   |  199 ++
 .../helix/ControllerInstanceToggleTest.java        |  133 ++
 .../controller/helix/ControllerSentinelTestV2.java |   99 +
 .../controller/helix/ControllerTenantTest.java     |  181 ++
 .../pinot/controller/helix/ControllerTest.java     |  256 +++
 .../pinot/controller/helix/HelixHelperTest.java    |   81 +
 .../controller/helix/PinotResourceManagerTest.java |  168 ++
 .../controller/helix/SegmentStatusCheckerTest.java |  575 +++++
 .../helix/core/PinotHelixResourceManagerTest.java  |  275 +++
 .../periodictask/ControllerPeriodicTaskTest.java   |  166 ++
 .../PinotLLCRealtimeSegmentManagerTest.java        | 1585 ++++++++++++++
 .../helix/core/realtime/SegmentCompletionTest.java | 1155 ++++++++++
 .../segment/FlushThresholdUpdaterTest.java         |  549 +++++
 .../rebalance/DefaultRebalanceStrategyTest.java    |  665 ++++++
 .../ReplicaGroupRebalanceStrategyTest.java         |  326 +++
 .../relocation/RealtimeSegmentRelocatorTest.java   |  280 +++
 .../helix/core/retention/RetentionManagerTest.java |  324 +++
 .../strategy/TimeRetentionStrategyTest.java        |   66 +
 .../sharding/SegmentAssignmentStrategyTest.java    |  376 ++++
 .../core/util/SegmentDeletionManagerTest.java      |  294 +++
 .../helix/core/util/TableRebalancerTest.java       |  121 ++
 .../controller/utils/ReplicaGroupTestUtils.java    |  141 ++
 .../controller/utils/SegmentMetadataMockUtils.java |  105 +
 .../validation/StorageQuotaCheckerTest.java        |  180 ++
 .../validation/ValidationManagerTest.java          |  237 +++
 .../src/test/resources/log4j.properties            |    2 +-
 pinot-core/pom.xml                                 |    6 +-
 .../com/linkedin/pinot/core/bloom/BloomFilter.java |   72 -
 .../linkedin/pinot/core/bloom/BloomFilterType.java |   53 -
 .../linkedin/pinot/core/bloom/BloomFilterUtil.java |   57 -
 .../pinot/core/bloom/GuavaOnHeapBloomFilter.java   |   77 -
 .../core/bloom/SegmentBloomFilterFactory.java      |   51 -
 .../pinot/core/common/BaseBlockValSet.java         |  143 --
 .../java/com/linkedin/pinot/core/common/Block.java |   59 -
 .../pinot/core/common/BlockDocIdIterator.java      |   49 -
 .../linkedin/pinot/core/common/BlockDocIdSet.java  |   26 -
 .../pinot/core/common/BlockDocIdValueIterator.java |   33 -
 .../pinot/core/common/BlockDocIdValueSet.java      |   25 -
 .../linkedin/pinot/core/common/BlockMetadata.java  |   42 -
 .../pinot/core/common/BlockMultiValIterator.java   |   52 -
 .../pinot/core/common/BlockSingleValIterator.java  |   54 -
 .../pinot/core/common/BlockValIterator.java        |   28 -
 .../linkedin/pinot/core/common/BlockValSet.java    |  215 --
 .../com/linkedin/pinot/core/common/Constants.java  |   25 -
 .../linkedin/pinot/core/common/DataBlockCache.java |  369 ----
 .../linkedin/pinot/core/common/DataFetcher.java    |  336 ---
 .../com/linkedin/pinot/core/common/DataSource.java |   35 -
 .../pinot/core/common/DataSourceMetadata.java      |   41 -
 .../pinot/core/common/MinionConstants.java         |   58 -
 .../pinot/core/common/ObjectSerDeUtils.java        |  462 ----
 .../com/linkedin/pinot/core/common/Operator.java   |   36 -
 .../com/linkedin/pinot/core/common/Predicate.java  |  107 -
 .../core/common/datatable/DataTableBuilder.java    |  359 ----
 .../core/common/datatable/DataTableFactory.java    |   43 -
 .../core/common/datatable/DataTableImplV2.java     |  503 -----
 .../core/common/datatable/DataTableUtils.java      |   74 -
 .../core/common/predicate/BaseInPredicate.java     |   51 -
 .../pinot/core/common/predicate/EqPredicate.java   |   43 -
 .../pinot/core/common/predicate/InPredicate.java   |   37 -
 .../pinot/core/common/predicate/NEqPredicate.java  |   43 -
 .../core/common/predicate/NotInPredicate.java      |   37 -
 .../core/common/predicate/RangePredicate.java      |   93 -
 .../core/common/predicate/RegexpLikePredicate.java |   46 -
 .../pinot/core/crypt/NoOpPinotCrypter.java         |   47 -
 .../linkedin/pinot/core/crypt/PinotCrypter.java    |   50 -
 .../pinot/core/crypt/PinotCrypterFactory.java      |   87 -
 .../com/linkedin/pinot/core/data/GenericRow.java   |  134 --
 .../core/data/aggregator/AvgValueAggregator.java   |   84 -
 .../core/data/aggregator/CountValueAggregator.java |   72 -
 .../DistinctCountHLLValueAggregator.java           |  104 -
 .../core/data/aggregator/MaxValueAggregator.java   |   72 -
 .../aggregator/MinMaxRangeValueAggregator.java     |   86 -
 .../core/data/aggregator/MinValueAggregator.java   |   72 -
 .../aggregator/PercentileEstValueAggregator.java   |   95 -
 .../PercentileTDigestValueAggregator.java          |   95 -
 .../core/data/aggregator/SumValueAggregator.java   |   72 -
 .../core/data/aggregator/ValueAggregator.java      |   79 -
 .../data/aggregator/ValueAggregatorFactory.java    |   93 -
 .../data/function/FunctionExpressionEvaluator.java |  153 --
 .../pinot/core/data/function/FunctionInfo.java     |   78 -
 .../pinot/core/data/function/FunctionInvoker.java  |   90 -
 .../pinot/core/data/function/FunctionRegistry.java |   55 -
 .../core/data/manager/BaseTableDataManager.java    |  224 --
 .../core/data/manager/InstanceDataManager.java     |  128 --
 .../core/data/manager/SegmentDataManager.java      |   70 -
 .../pinot/core/data/manager/TableDataManager.java  |  120 --
 .../manager/config/InstanceDataManagerConfig.java  |   53 -
 .../manager/config/TableDataManagerConfig.java     |   87 -
 .../offline/ImmutableSegmentDataManager.java       |   55 -
 .../manager/offline/OfflineTableDataManager.java   |   54 -
 .../manager/offline/TableDataManagerProvider.java  |   66 -
 .../realtime/HLRealtimeSegmentDataManager.java     |  428 ----
 .../realtime/LLRealtimeSegmentDataManager.java     | 1175 ----------
 .../realtime/RealtimeSegmentDataManager.java       |   44 -
 .../manager/realtime/RealtimeTableDataManager.java |  347 ---
 .../realtime/SegmentBuildTimeLeaseExtender.java    |  148 --
 .../core/data/manager/realtime/TimerService.java   |   26 -
 .../data/partition/ByteArrayPartitionFunction.java |   59 -
 .../data/partition/ModuloPartitionFunction.java    |   72 -
 .../data/partition/MurmurPartitionFunction.java    |   64 -
 .../core/data/partition/PartitionFunction.java     |   39 -
 .../data/partition/PartitionFunctionFactory.java   |   84 -
 .../pinot/core/data/readers/AvroRecordReader.java  |  118 --
 .../pinot/core/data/readers/CSVRecordReader.java   |  143 --
 .../core/data/readers/CSVRecordReaderConfig.java   |   71 -
 .../pinot/core/data/readers/FileFormat.java        |   28 -
 .../core/data/readers/GenericRowRecordReader.java  |   74 -
 .../pinot/core/data/readers/JSONRecordReader.java  |  113 -
 .../readers/MultiplePinotSegmentRecordReader.java  |  276 ---
 .../data/readers/PinotSegmentColumnReader.java     |  156 --
 .../data/readers/PinotSegmentRecordReader.java     |  164 --
 .../pinot/core/data/readers/RecordReader.java      |   58 -
 .../core/data/readers/RecordReaderConfig.java      |   23 -
 .../core/data/readers/RecordReaderFactory.java     |   53 -
 .../pinot/core/data/readers/RecordReaderUtils.java |  148 --
 .../core/data/readers/ThriftRecordReader.java      |  156 --
 .../data/readers/ThriftRecordReaderConfig.java     |   40 -
 .../core/data/readers/sort/PinotSegmentSorter.java |  138 --
 .../core/data/readers/sort/SegmentSorter.java      |   35 -
 .../recordtransformer/CompoundTransformer.java     |   77 -
 .../recordtransformer/DataTypeTransformer.java     |  115 -
 .../recordtransformer/ExpressionTransformer.java   |   68 -
 .../core/data/recordtransformer/PinotDataType.java |  490 -----
 .../data/recordtransformer/RecordTransformer.java  |   38 -
 .../recordtransformer/SanitationTransformer.java   |   77 -
 .../data/recordtransformer/TimeTransformer.java    |   95 -
 .../pinot/core/indexsegment/IndexSegment.java      |   86 -
 .../pinot/core/indexsegment/IndexSegmentUtils.java |   80 -
 .../generator/SegmentGeneratorConfig.java          |  652 ------
 .../indexsegment/generator/SegmentVersion.java     |   25 -
 .../indexsegment/immutable/ImmutableSegment.java   |   60 -
 .../immutable/ImmutableSegmentImpl.java            |  173 --
 .../immutable/ImmutableSegmentLoader.java          |  150 --
 .../core/indexsegment/mutable/MutableSegment.java  |   41 -
 .../indexsegment/mutable/MutableSegmentImpl.java   |  750 -------
 .../pinot/core/io/compression/ChunkCompressor.java |   41 -
 .../io/compression/ChunkCompressorFactory.java     |   84 -
 .../core/io/compression/ChunkDecompressor.java     |   41 -
 .../core/io/compression/PassThroughCompressor.java |   41 -
 .../io/compression/PassThroughDecompressor.java    |   38 -
 .../core/io/compression/SnappyCompressor.java      |   36 -
 .../core/io/compression/SnappyDecompressor.java    |   35 -
 .../reader/BaseSingleColumnMultiValueReader.java   |   67 -
 .../reader/BaseSingleColumnSingleValueReader.java  |  102 -
 .../pinot/core/io/reader/DataFileReader.java       |   30 -
 .../pinot/core/io/reader/ReaderContext.java        |   24 -
 .../io/reader/SingleColumnMultiValueReader.java    |   81 -
 .../io/reader/SingleColumnSingleValueReader.java   |  151 --
 .../io/reader/SingleValueMultiColumnReader.java    |  156 --
 .../core/io/reader/impl/ChunkReaderContext.java    |   53 -
 .../impl/FixedByteSingleValueMultiColReader.java   |  232 --
 .../io/reader/impl/UnSortedValueReaderContext.java |   26 -
 .../reader/impl/v1/BaseChunkSingleValueReader.java |  172 --
 .../reader/impl/v1/FixedBitMultiValueReader.java   |  155 --
 .../reader/impl/v1/FixedBitSingleValueReader.java  |   62 -
 .../impl/v1/FixedByteChunkSingleValueReader.java   |  142 --
 .../core/io/reader/impl/v1/SortedIndexReader.java  |   49 -
 .../io/reader/impl/v1/SortedIndexReaderImpl.java   |  139 --
 .../impl/v1/VarByteChunkSingleValueReader.java     |  122 --
 .../BaseSingleColumnMultiValueReaderWriter.java    |  118 --
 .../BaseSingleColumnSingleValueReaderWriter.java   |  148 --
 .../BaseSingleValueMultiColumnReaderWriter.java    |  133 --
 .../readerwriter/PinotDataBufferMemoryManager.java |   46 -
 .../RealtimeIndexOffHeapMemoryManager.java         |  114 -
 ...ixedByteSingleColumnMultiValueReaderWriter.java |  417 ----
 ...xedByteSingleColumnSingleValueReaderWriter.java |  265 ---
 ...ixedByteSingleValueMultiColumnReaderWriter.java |  210 --
 .../io/util/DictionaryDelegatingValueReader.java   |   78 -
 .../core/io/util/FixedBitIntReaderWriter.java      |   58 -
 .../core/io/util/FixedByteValueReaderWriter.java   |  118 --
 .../pinot/core/io/util/PinotDataBitSet.java        |  248 ---
 .../linkedin/pinot/core/io/util/ValueReader.java   |   43 -
 .../pinot/core/io/writer/DataFileWriter.java       |   29 -
 .../io/writer/SingleColumnMultiValueWriter.java    |   79 -
 .../io/writer/SingleColumnSingleValueWriter.java   |   78 -
 .../io/writer/SingleValueMultiColumnWriter.java    |   70 -
 .../core/io/writer/impl/DirectMemoryManager.java   |   60 -
 .../impl/FixedByteSingleValueMultiColWriter.java   |  105 -
 .../core/io/writer/impl/MmapMemoryManager.java     |  179 --
 .../writer/impl/MutableOffHeapByteArrayStore.java  |  274 ---
 .../core/io/writer/impl/OffHeapStringStore.java    |  220 --
 .../writer/impl/v1/BaseChunkSingleValueWriter.java |  202 --
 .../writer/impl/v1/FixedBitMultiValueWriter.java   |  196 --
 .../writer/impl/v1/FixedBitSingleValueWriter.java  |   95 -
 .../impl/v1/FixedByteChunkSingleValueWriter.java   |  124 --
 .../impl/v1/VarByteChunkSingleValueWriter.java     |  137 --
 .../core/metadata/DefaultMetadataExtractor.java    |   44 -
 .../pinot/core/metadata/MetadataExtractor.java     |   38 -
 .../core/metadata/MetadataExtractorFactory.java    |   48 -
 .../pinot/core/minion/BackfillDateTimeColumn.java  |  195 --
 .../pinot/core/minion/RawIndexConverter.java       |  215 --
 .../pinot/core/minion/SegmentConverter.java        |  239 ---
 .../linkedin/pinot/core/minion/SegmentPurger.java  |  274 ---
 .../minion/rollup/MergeRollupSegmentConverter.java |  189 --
 .../pinot/core/minion/rollup/MergeType.java        |   44 -
 .../core/minion/rollup/RollupRecordAggregator.java |   71 -
 .../rollup/aggregate/MaxValueAggregator.java       |   48 -
 .../rollup/aggregate/SumValueAggregator.java       |   48 -
 .../minion/rollup/aggregate/ValueAggregator.java   |   37 -
 .../rollup/aggregate/ValueAggregatorFactory.java   |   43 -
 .../minion/segment/DefaultRecordPartitioner.java   |   36 -
 .../core/minion/segment/MapperRecordReader.java    |  116 -
 .../core/minion/segment/RecordAggregator.java      |   37 -
 .../core/minion/segment/RecordPartitioner.java     |   37 -
 .../core/minion/segment/RecordTransformer.java     |   36 -
 .../core/minion/segment/ReducerRecordReader.java   |  133 --
 .../linkedin/pinot/core/operator/BaseOperator.java |   60 -
 .../core/operator/CombineGroupByOperator.java      |  223 --
 .../pinot/core/operator/CombineOperator.java       |  203 --
 .../pinot/core/operator/DocIdSetOperator.java      |   96 -
 .../pinot/core/operator/ExecutionStatistics.java   |   93 -
 .../core/operator/InstanceResponseOperator.java    |   44 -
 .../pinot/core/operator/ProjectionOperator.java    |   89 -
 .../core/operator/blocks/BlockMetadataImpl.java    |   81 -
 .../pinot/core/operator/blocks/DocIdSetBlock.java  |   66 -
 .../core/operator/blocks/EmptyFilterBlock.java     |   37 -
 .../pinot/core/operator/blocks/FilterBlock.java    |   57 -
 .../operator/blocks/InstanceResponseBlock.java     |   73 -
 .../operator/blocks/IntermediateResultsBlock.java  |  337 ---
 .../core/operator/blocks/MultiValueBlock.java      |   61 -
 .../core/operator/blocks/ProjectionBlock.java      |   82 -
 .../core/operator/blocks/SingleValueBlock.java     |   67 -
 .../pinot/core/operator/blocks/TransformBlock.java |   82 -
 .../operator/dociditerators/AndDocIdIterator.java  |  135 --
 .../dociditerators/ArrayBasedDocIdIterator.java    |   72 -
 .../dociditerators/BitmapDocIdIterator.java        |   93 -
 .../dociditerators/EmptyBlockDocIdIterator.java    |   52 -
 .../dociditerators/IndexBasedDocIdIterator.java    |   27 -
 .../dociditerators/MVScanDocIdIterator.java        |  162 --
 .../operator/dociditerators/OrDocIdIterator.java   |  155 --
 .../RangelessBitmapDocIdIterator.java              |   73 -
 .../dociditerators/SVScanDocIdIterator.java        |  242 ---
 .../dociditerators/ScanBasedDocIdIterator.java     |   47 -
 .../dociditerators/SizeBasedDocIdIterator.java     |   56 -
 .../dociditerators/SortedDocIdIterator.java        |  106 -
 .../core/operator/docidsets/AndBlockDocIdSet.java  |  265 ---
 .../operator/docidsets/ArrayBasedDocIdSet.java     |   49 -
 .../core/operator/docidsets/BitmapDocIdSet.java    |  101 -
 .../docidsets/EmptyFilterBlockDocIdSet.java        |   70 -
 .../operator/docidsets/FilterBlockDocIdSet.java    |   74 -
 .../core/operator/docidsets/OrBlockDocIdSet.java   |  126 --
 .../docidsets/ScanBasedMultiValueDocIdSet.java     |   86 -
 .../docidsets/ScanBasedSingleValueDocIdSet.java    |   88 -
 .../core/operator/docidsets/SizeBasedDocIdSet.java |   64 -
 .../core/operator/docidsets/SortedDocIdSet.java    |  101 -
 .../core/operator/docidsets/StarTreeDocIdSet.java  |  103 -
 .../docvaliterators/MultiValueIterator.java        |   59 -
 .../docvaliterators/SingleValueIterator.java       |   84 -
 .../core/operator/docvalsets/MultiValueSet.java    |   48 -
 .../operator/docvalsets/ProjectionBlockValSet.java |  137 --
 .../core/operator/docvalsets/SingleValueSet.java   |  170 --
 .../operator/docvalsets/TransformBlockValSet.java  |  154 --
 .../core/operator/filter/AndFilterOperator.java    |   63 -
 .../core/operator/filter/BaseFilterOperator.java   |   43 -
 .../operator/filter/BitmapBasedFilterOperator.java |  108 -
 .../core/operator/filter/EmptyFilterOperator.java  |   53 -
 .../core/operator/filter/FilterOperatorUtils.java  |  185 --
 .../pinot/core/operator/filter/IntRanges.java      |   84 -
 .../operator/filter/MatchAllFilterOperator.java    |   48 -
 .../core/operator/filter/OrFilterOperator.java     |   63 -
 .../operator/filter/ScanBasedFilterOperator.java   |   98 -
 .../SortedInvertedIndexBasedFilterOperator.java    |  164 --
 .../BaseDictionaryBasedPredicateEvaluator.java     |  121 --
 .../filter/predicate/BasePredicateEvaluator.java   |   37 -
 .../BaseRawValueBasedPredicateEvaluator.java       |  185 --
 .../predicate/EqualsPredicateEvaluatorFactory.java |  193 --
 .../predicate/InPredicateEvaluatorFactory.java     |  236 ---
 .../NotEqualsPredicateEvaluatorFactory.java        |  218 --
 .../predicate/NotInPredicateEvaluatorFactory.java  |  254 ---
 .../filter/predicate/PredicateEvaluator.java       |  166 --
 .../predicate/PredicateEvaluatorProvider.java      |   84 -
 .../predicate/RangePredicateEvaluatorFactory.java  |  413 ----
 .../RegexpLikePredicateEvaluatorFactory.java       |  118 --
 .../operator/query/AggregationGroupByOperator.java |  105 -
 .../core/operator/query/AggregationOperator.java   |   93 -
 .../query/DictionaryBasedAggregationOperator.java  |  117 -
 .../operator/query/EmptySelectionOperator.java     |   65 -
 .../query/MetadataBasedAggregationOperator.java    |   92 -
 .../core/operator/query/SelectionOnlyOperator.java |  109 -
 .../operator/query/SelectionOrderByOperator.java   |  116 -
 .../core/operator/transform/TransformOperator.java |  112 -
 .../transform/TransformResultMetadata.java         |   49 -
 .../function/AdditionTransformFunction.java        |  114 -
 .../transform/function/BaseTransformFunction.java  |  426 ----
 .../DateTimeConversionTransformFunction.java       |  168 --
 .../function/DivisionTransformFunction.java        |  161 --
 .../function/IdentifierTransformFunction.java      |  127 --
 .../function/LiteralTransformFunction.java         |  124 --
 .../function/MultiplicationTransformFunction.java  |  115 -
 .../function/SubtractionTransformFunction.java     |  160 --
 .../function/TimeConversionTransformFunction.java  |   79 -
 .../transform/function/TransformFunction.java      |  172 --
 .../function/TransformFunctionFactory.java         |  121 --
 .../function/ValueInTransformFunction.java         |  297 ---
 .../transform/transformer/DataTransformer.java     |   40 -
 .../datetime/BaseDateTimeTransformer.java          |  128 --
 .../datetime/DateTimeTransformerFactory.java       |   52 -
 .../datetime/EpochToEpochTransformer.java          |   42 -
 .../datetime/EpochToSDFTransformer.java            |   43 -
 .../datetime/SDFToEpochTransformer.java            |   42 -
 .../transformer/datetime/SDFToSDFTransformer.java  |   44 -
 .../timeunit/CustomTimeUnitTransformer.java        |   72 -
 .../timeunit/JavaTimeUnitTransformer.java          |   43 -
 .../transformer/timeunit/TimeUnitTransformer.java  |   28 -
 .../timeunit/TimeUnitTransformerFactory.java       |   38 -
 .../pinot/core/periodictask/BasePeriodicTask.java  |   55 -
 .../pinot/core/periodictask/PeriodicTask.java      |   54 -
 .../core/periodictask/PeriodicTaskScheduler.java   |  100 -
 .../core/plan/AggregationFunctionInitializer.java  |   38 -
 .../core/plan/AggregationGroupByPlanNode.java      |  127 --
 .../pinot/core/plan/AggregationPlanNode.java       |  111 -
 .../linkedin/pinot/core/plan/CombinePlanNode.java  |  153 --
 .../plan/DictionaryBasedAggregationPlanNode.java   |   78 -
 .../linkedin/pinot/core/plan/DocIdSetPlanNode.java |   63 -
 .../linkedin/pinot/core/plan/FilterPlanNode.java   |  116 -
 .../linkedin/pinot/core/plan/GlobalPlanImplV0.java |   58 -
 .../pinot/core/plan/InstanceResponsePlanNode.java  |   51 -
 .../plan/MetadataBasedAggregationPlanNode.java     |   83 -
 .../java/com/linkedin/pinot/core/plan/Plan.java    |   38 -
 .../com/linkedin/pinot/core/plan/PlanNode.java     |   42 -
 .../pinot/core/plan/ProjectionPlanNode.java        |   68 -
 .../pinot/core/plan/SelectionPlanNode.java         |   95 -
 .../pinot/core/plan/TransformPlanNode.java         |  103 -
 .../core/plan/maker/BrokerRequestPreProcessor.java |   97 -
 .../core/plan/maker/InstancePlanMakerImplV2.java   |  212 --
 .../linkedin/pinot/core/plan/maker/PlanMaker.java  |   55 -
 .../query/aggregation/AggregationExecutor.java     |   46 -
 .../aggregation/AggregationFunctionContext.java    |   57 -
 .../query/aggregation/AggregationResultHolder.java |   50 -
 .../aggregation/DefaultAggregationExecutor.java    |   78 -
 .../aggregation/DoubleAggregationResultHolder.java |   73 -
 .../aggregation/ObjectAggregationResultHolder.java |   63 -
 .../aggregation/function/AggregationFunction.java  |  121 --
 .../function/AggregationFunctionFactory.java       |  116 -
 .../function/AggregationFunctionType.java          |  103 -
 .../function/AggregationFunctionUtils.java         |  136 --
 .../function/AggregationFunctionVisitorBase.java   |  124 --
 .../function/AvgAggregationFunction.java           |  229 --
 .../function/AvgMVAggregationFunction.java         |   86 -
 .../function/CountAggregationFunction.java         |  152 --
 .../function/CountMVAggregationFunction.java       |   73 -
 .../function/DistinctCountAggregationFunction.java |  287 ---
 .../DistinctCountHLLAggregationFunction.java       |  357 ----
 .../DistinctCountHLLMVAggregationFunction.java     |  219 --
 .../DistinctCountMVAggregationFunction.java        |  213 --
 .../function/FastHLLAggregationFunction.java       |  194 --
 .../function/MaxAggregationFunction.java           |  141 --
 .../function/MaxMVAggregationFunction.java         |   89 -
 .../function/MinAggregationFunction.java           |  141 --
 .../function/MinMVAggregationFunction.java         |   89 -
 .../function/MinMaxRangeAggregationFunction.java   |  234 --
 .../function/MinMaxRangeMVAggregationFunction.java |   95 -
 .../function/PercentileAggregationFunction.java    |  191 --
 .../function/PercentileEstAggregationFunction.java |  238 ---
 .../PercentileEstMVAggregationFunction.java        |   84 -
 .../function/PercentileMVAggregationFunction.java  |   84 -
 .../PercentileTDigestAggregationFunction.java      |  253 ---
 .../PercentileTDigestMVAggregationFunction.java    |   84 -
 .../function/SumAggregationFunction.java           |  129 --
 .../function/SumMVAggregationFunction.java         |   83 -
 .../aggregation/function/customobject/AvgPair.java |   94 -
 .../function/customobject/MinMaxRangePair.java     |   90 -
 .../function/customobject/QuantileDigest.java      | 1069 ----------
 .../groupby/AggregationGroupByResult.java          |   70 -
 .../groupby/AggregationGroupByTrimmingService.java |  352 ---
 .../groupby/DefaultGroupByExecutor.java            |  174 --
 .../groupby/DictionaryBasedGroupKeyGenerator.java  |  814 -------
 .../groupby/DoubleGroupByResultHolder.java         |   99 -
 .../query/aggregation/groupby/GroupByExecutor.java |   44 -
 .../aggregation/groupby/GroupByResultHolder.java   |   71 -
 .../aggregation/groupby/GroupKeyGenerator.java     |   82 -
 .../NoDictionaryMultiColumnGroupKeyGenerator.java  |  258 ---
 .../NoDictionarySingleColumnGroupKeyGenerator.java |  266 ---
 .../groupby/ObjectGroupByResultHolder.java         |   90 -
 .../groupby/utils/BaseValueToIdMap.java            |   74 -
 .../aggregation/groupby/utils/DoubleToIdMap.java   |   62 -
 .../aggregation/groupby/utils/FloatToIdMap.java    |   62 -
 .../aggregation/groupby/utils/IntToIdMap.java      |   62 -
 .../aggregation/groupby/utils/LongToIdMap.java     |   62 -
 .../aggregation/groupby/utils/StringToIdMap.java   |   56 -
 .../aggregation/groupby/utils/ValueToIdMap.java    |   46 -
 .../groupby/utils/ValueToIdMapFactory.java         |   53 -
 .../core/query/config/QueryExecutorConfig.java     |   77 -
 .../core/query/config/QueryPlannerConfig.java      |   51 -
 .../core/query/config/SegmentPrunerConfig.java     |   75 -
 .../query/exception/BadQueryRequestException.java  |   33 -
 .../pinot/core/query/executor/QueryExecutor.java   |   62 -
 .../query/executor/ServerQueryExecutorV1Impl.java  |  233 --
 .../core/query/pruner/AbstractSegmentPruner.java   |  114 -
 .../query/pruner/ColumnValueSegmentPruner.java     |  201 --
 .../core/query/pruner/DataSchemaSegmentPruner.java |   47 -
 .../core/query/pruner/PartitionSegmentPruner.java  |  120 --
 .../pinot/core/query/pruner/SegmentPruner.java     |   37 -
 .../core/query/pruner/SegmentPrunerProvider.java   |   57 -
 .../core/query/pruner/SegmentPrunerService.java    |   61 -
 .../core/query/pruner/ValidSegmentPruner.java      |   64 -
 .../pinot/core/query/reduce/BetweenComparison.java |   62 -
 .../core/query/reduce/BrokerReduceService.java     |  509 -----
 .../pinot/core/query/reduce/CombineService.java    |  152 --
 .../core/query/reduce/ComparisonFunction.java      |   39 -
 .../pinot/core/query/reduce/EqualComparison.java   |   56 -
 .../core/query/reduce/GreaterEqualComparison.java  |   56 -
 .../core/query/reduce/GreaterThanComparison.java   |   56 -
 .../query/reduce/HavingClauseComparisonTree.java   |  151 --
 .../core/query/reduce/InAndNotInComparison.java    |   77 -
 .../core/query/reduce/LessEqualComparison.java     |   56 -
 .../core/query/reduce/LessThanComparison.java      |   56 -
 .../core/query/reduce/NotEqualComparison.java      |   56 -
 .../core/query/request/ServerQueryRequest.java     |  197 --
 .../core/query/request/context/TimerContext.java   |  102 -
 .../query/scheduler/AbstractSchedulerGroup.java    |  136 --
 .../query/scheduler/MultiLevelPriorityQueue.java   |  240 ---
 .../query/scheduler/OutOfCapacityException.java    |   29 -
 .../core/query/scheduler/PriorityScheduler.java    |  165 --
 .../pinot/core/query/scheduler/QueryScheduler.java |  228 --
 .../query/scheduler/QuerySchedulerFactory.java     |   99 -
 .../pinot/core/query/scheduler/SchedulerGroup.java |   72 -
 .../query/scheduler/SchedulerGroupAccountant.java  |   75 -
 .../query/scheduler/SchedulerGroupFactory.java     |   36 -
 .../core/query/scheduler/SchedulerGroupMapper.java |   33 -
 .../query/scheduler/SchedulerPriorityQueue.java    |   54 -
 .../query/scheduler/SchedulerQueryContext.java     |   73 -
 .../query/scheduler/TableBasedGroupMapper.java     |   36 -
 .../query/scheduler/fcfs/BoundedFCFSScheduler.java |   68 -
 .../query/scheduler/fcfs/FCFSQueryScheduler.java   |   75 -
 .../query/scheduler/fcfs/FCFSSchedulerGroup.java   |   66 -
 .../resources/BoundedAccountingExecutor.java       |  110 -
 .../resources/PolicyBasedResourceManager.java      |   86 -
 .../scheduler/resources/QueryExecutorService.java  |  109 -
 .../scheduler/resources/ResourceLimitPolicy.java   |   85 -
 .../query/scheduler/resources/ResourceManager.java |  168 --
 .../resources/UnboundedResourceManager.java        |   56 -
 .../tokenbucket/TokenPriorityScheduler.java        |   74 -
 .../scheduler/tokenbucket/TokenSchedulerGroup.java |  197 --
 .../core/query/selection/SelectionFetcher.java     |  122 --
 .../query/selection/SelectionOperatorService.java  |  329 ---
 .../query/selection/SelectionOperatorUtils.java    |  695 ------
 .../comparator/CompositeDocIdValComparator.java    |   92 -
 .../comparator/DocIdDoubleValComparator.java       |   44 -
 .../comparator/DocIdFloatValComparator.java        |   44 -
 .../comparator/DocIdIntValComparator.java          |   44 -
 .../comparator/DocIdLongValComparator.java         |   44 -
 .../selection/comparator/IDocIdValComparator.java  |   24 -
 .../DoubleArraySelectionColumnIterator.java        |   45 -
 .../iterator/DoubleSelectionColumnIterator.java    |   42 -
 .../FloatArraySelectionColumnIterator.java         |   45 -
 .../iterator/FloatSelectionColumnIterator.java     |   42 -
 .../iterator/IntArraySelectionColumnIterator.java  |   45 -
 .../iterator/IntSelectionColumnIterator.java       |   42 -
 .../iterator/LongArraySelectionColumnIterator.java |   45 -
 .../iterator/LongSelectionColumnIterator.java      |   42 -
 .../iterator/SelectionColumnIterator.java          |   31 -
 .../SelectionMultiValueColumnIterator.java         |   44 -
 ...SelectionSingleValueColumnWithDictIterator.java |   55 -
 .../StringArraySelectionColumnIterator.java        |   45 -
 .../iterator/StringSelectionColumnIterator.java    |   57 -
 .../com/linkedin/pinot/core/query/utils/Pair.java  |   56 -
 .../linkedin/pinot/core/query/utils/TrieNode.java  |   65 -
 .../converter/RealtimeSegmentConverter.java        |  166 --
 .../converter/RealtimeSegmentRecordReader.java     |   88 -
 .../converter/stats/RealtimeColumnStatistics.java  |  238 ---
 .../stats/RealtimeNoDictionaryColStatistics.java   |  128 --
 .../RealtimeSegmentSegmentCreationDataSource.java  |   57 -
 .../stats/RealtimeSegmentStatsContainer.java       |   78 -
 .../core/realtime/impl/RealtimeSegmentConfig.java  |  204 --
 .../realtime/impl/RealtimeSegmentStatsHistory.java |  395 ----
 .../dictionary/BaseOffHeapMutableDictionary.java   |  499 -----
 .../dictionary/BaseOnHeapMutableDictionary.java    |  109 -
 .../dictionary/BytesOffHeapMutableDictionary.java  |  151 --
 .../dictionary/BytesOnHeapMutableDictionary.java   |  102 -
 .../dictionary/DoubleOffHeapMutableDictionary.java |  177 --
 .../dictionary/DoubleOnHeapMutableDictionary.java  |  139 --
 .../dictionary/FloatOffHeapMutableDictionary.java  |  177 --
 .../dictionary/FloatOnHeapMutableDictionary.java   |  139 --
 .../dictionary/IntOffHeapMutableDictionary.java    |  177 --
 .../dictionary/IntOnHeapMutableDictionary.java     |  139 --
 .../dictionary/LongOffHeapMutableDictionary.java   |  177 --
 .../dictionary/LongOnHeapMutableDictionary.java    |  139 --
 .../impl/dictionary/MutableDictionary.java         |   87 -
 .../impl/dictionary/MutableDictionaryFactory.java  |   73 -
 .../dictionary/StringOffHeapMutableDictionary.java |  143 --
 .../dictionary/StringOnHeapMutableDictionary.java  |  116 -
 .../invertedindex/RealtimeInvertedIndexReader.java |   97 -
 .../impl/kafka/AvroRecordToPinotRowGenerator.java  |   61 -
 .../realtime/impl/kafka/ConsumerAndIterator.java   |   61 -
 .../impl/kafka/KafkaAvroMessageDecoder.java        |  281 ---
 .../realtime/impl/kafka/KafkaBrokerWrapper.java    |   82 -
 .../impl/kafka/KafkaConnectionHandler.java         |  436 ----
 .../realtime/impl/kafka/KafkaConsumerFactory.java  |   81 -
 .../realtime/impl/kafka/KafkaConsumerManager.java  |  187 --
 .../impl/kafka/KafkaHighLevelStreamConfig.java     |  161 --
 .../impl/kafka/KafkaJSONMessageDecoder.java        |  128 --
 .../impl/kafka/KafkaLowLevelStreamConfig.java      |  127 --
 .../impl/kafka/KafkaPartitionLevelConsumer.java    |  118 --
 .../impl/kafka/KafkaSimpleConsumerFactory.java     |   30 -
 .../impl/kafka/KafkaSimpleConsumerFactoryImpl.java |   32 -
 .../impl/kafka/KafkaStreamConfigProperties.java    |   62 -
 .../impl/kafka/KafkaStreamLevelConsumer.java       |  139 --
 .../impl/kafka/KafkaStreamMetadataProvider.java    |  230 --
 .../realtime/impl/kafka/SimpleConsumerFactory.java |   29 -
 .../impl/kafka/SimpleConsumerMessageBatch.java     |   55 -
 .../ConsumingSegmentAssignmentStrategy.java        |   61 -
 .../segment/RealtimeSegmentAssignmentStrategy.java |   41 -
 .../pinot/core/realtime/stream/MessageBatch.java   |   60 -
 .../pinot/core/realtime/stream/OffsetCriteria.java |  213 --
 .../realtime/stream/PartitionCountFetcher.java     |   79 -
 .../realtime/stream/PartitionLevelConsumer.java    |   39 -
 .../stream/PartitionLevelStreamConfig.java         |   85 -
 .../realtime/stream/PartitionOffsetFetcher.java    |   87 -
 .../stream/PermanentConsumerException.java         |   29 -
 .../pinot/core/realtime/stream/StreamConfig.java   |  345 ---
 .../realtime/stream/StreamConfigProperties.java    |  111 -
 .../realtime/stream/StreamConsumerFactory.java     |   75 -
 .../stream/StreamConsumerFactoryProvider.java      |   45 -
 .../realtime/stream/StreamDecoderProvider.java     |   49 -
 .../core/realtime/stream/StreamLevelConsumer.java  |   53 -
 .../core/realtime/stream/StreamMessageDecoder.java |   57 -
 .../realtime/stream/StreamMetadataProvider.java    |   45 -
 .../stream/TransientConsumerException.java         |   29 -
 .../creator/BaseSingleValueRawIndexCreator.java    |   59 -
 .../segment/creator/ColumnIndexCreationInfo.java   |  121 --
 .../core/segment/creator/ColumnStatistics.java     |   95 -
 .../core/segment/creator/ForwardIndexCreator.java  |   25 -
 .../core/segment/creator/ForwardIndexType.java     |   27 -
 .../core/segment/creator/InvertedIndexCreator.java |   73 -
 .../core/segment/creator/InvertedIndexType.java    |   27 -
 .../creator/MultiValueForwardIndexCreator.java     |   30 -
 .../RecordReaderSegmentCreationDataSource.java     |   84 -
 .../segment/creator/SegmentCreationDataSource.java |   31 -
 .../pinot/core/segment/creator/SegmentCreator.java |   69 -
 .../creator/SegmentIndexCreationDriver.java        |   61 -
 .../segment/creator/SegmentIndexCreationInfo.java  |   58 -
 .../creator/SegmentPreIndexStatsCollector.java     |   34 -
 .../creator/SegmentPreIndexStatsContainer.java     |   32 -
 .../creator/SingleValueForwardIndexCreator.java    |   30 -
 .../creator/SingleValueRawIndexCreator.java        |   84 -
 .../core/segment/creator/StatsCollectorConfig.java |   83 -
 .../creator/impl/SegmentColumnarIndexCreator.java  |  541 -----
 .../creator/impl/SegmentCreationDriverFactory.java |   35 -
 .../creator/impl/SegmentDictionaryCreator.java     |  268 ---
 .../impl/SegmentIndexCreationDriverImpl.java       |  498 -----
 .../core/segment/creator/impl/V1Constants.java     |  148 --
 .../creator/impl/bloom/BloomFilterCreator.java     |   69 -
 .../fwd/MultiValueUnsortedForwardIndexCreator.java |   49 -
 .../fwd/SingleValueFixedByteRawIndexCreator.java   |  100 -
 .../fwd/SingleValueSortedForwardIndexCreator.java  |   63 -
 .../SingleValueUnsortedForwardIndexCreator.java    |   48 -
 .../fwd/SingleValueVarByteRawIndexCreator.java     |   66 -
 .../inv/OffHeapBitmapInvertedIndexCreator.java     |  245 ---
 .../impl/inv/OnHeapBitmapInvertedIndexCreator.java |   89 -
 .../stats/AbstractColumnStatisticsCollector.java   |  205 --
 .../stats/BytesColumnPredIndexStatsCollector.java  |  165 --
 .../stats/DoubleColumnPreIndexStatsCollector.java  |  155 --
 .../stats/FloatColumnPreIndexStatsCollector.java   |  155 --
 .../stats/IntColumnPreIndexStatsCollector.java     |  157 --
 .../stats/LongColumnPreIndexStatsCollector.java    |  155 --
 .../stats/SegmentPreIndexStatsCollectorImpl.java   |  167 --
 .../stats/StringColumnPreIndexStatsCollector.java  |  185 --
 .../pinot/core/segment/index/ColumnMetadata.java   |  621 ------
 .../core/segment/index/SegmentMetadataImpl.java    |  657 ------
 .../segment/index/column/ColumnIndexContainer.java |   48 -
 .../index/column/PhysicalColumnIndexContainer.java |  202 --
 .../index/converter/SegmentFormatConverter.java    |   31 -
 .../converter/SegmentFormatConverterFactory.java   |   36 -
 .../converter/SegmentV1V2ToV3FormatConverter.java  |  266 ---
 .../index/data/source/ColumnDataSource.java        |  182 --
 .../segment/index/loader/IndexLoadingConfig.java   |  249 ---
 .../core/segment/index/loader/LoaderUtils.java     |  137 --
 .../segment/index/loader/SegmentPreProcessor.java  |  122 --
 .../index/loader/V3RemoveIndexException.java       |   29 -
 .../loader/bloomfilter/BloomFilterHandler.java     |  163 --
 .../ColumnMinMaxValueGenerator.java                |  139 --
 .../ColumnMinMaxValueGeneratorMode.java            |   41 -
 .../defaultcolumn/BaseDefaultColumnHandler.java    |  361 ----
 .../loader/defaultcolumn/DefaultColumnHandler.java |   31 -
 .../defaultcolumn/DefaultColumnHandlerFactory.java |   40 -
 .../defaultcolumn/DefaultColumnStatistics.java     |  129 --
 .../defaultcolumn/V1DefaultColumnHandler.java      |   52 -
 .../defaultcolumn/V3DefaultColumnHandler.java      |   74 -
 .../loader/invertedindex/InvertedIndexHandler.java |  152 --
 .../core/segment/index/readers/BaseDictionary.java |  106 -
 .../index/readers/BitmapInvertedIndexReader.java   |  123 --
 .../segment/index/readers/BloomFilterReader.java   |   57 -
 .../segment/index/readers/BytesDictionary.java     |   61 -
 .../core/segment/index/readers/Dictionary.java     |   68 -
 .../segment/index/readers/DoubleDictionary.java    |   76 -
 .../segment/index/readers/FloatDictionary.java     |   76 -
 .../index/readers/ImmutableDictionaryReader.java   |  248 ---
 .../core/segment/index/readers/IntDictionary.java  |   81 -
 .../segment/index/readers/InvertedIndexReader.java |   30 -
 .../core/segment/index/readers/LongDictionary.java |   76 -
 .../segment/index/readers/OnHeapDictionary.java    |   33 -
 .../index/readers/OnHeapDoubleDictionary.java      |  100 -
 .../index/readers/OnHeapFloatDictionary.java       |  105 -
 .../segment/index/readers/OnHeapIntDictionary.java |  115 -
 .../index/readers/OnHeapLongDictionary.java        |  100 -
 .../index/readers/OnHeapStringDictionary.java      |   97 -
 .../segment/index/readers/StringDictionary.java    |   64 -
 .../core/segment/memory/BasePinotLBuffer.java      |  164 --
 .../pinot/core/segment/memory/PinotByteBuffer.java |  334 ---
 .../pinot/core/segment/memory/PinotDataBuffer.java |  384 ----
 .../segment/memory/PinotNativeOrderLBuffer.java    |  181 --
 .../segment/memory/PinotNonNativeOrderLBuffer.java |  181 --
 .../segment/name/DefaultSegmentNameGenerator.java  |  140 --
 .../name/NormalizedDateSegmentNameGenerator.java   |  163 --
 .../core/segment/name/SegmentNameGenerator.java    |   29 -
 .../core/segment/store/ColumnIndexDirectory.java   |  170 --
 .../pinot/core/segment/store/ColumnIndexType.java  |   44 -
 .../core/segment/store/FilePerIndexDirectory.java  |  194 --
 .../pinot/core/segment/store/IndexEntry.java       |   43 -
 .../pinot/core/segment/store/IndexKey.java         |   72 -
 .../pinot/core/segment/store/SegmentDirectory.java |  267 ---
 .../core/segment/store/SegmentDirectoryPaths.java  |  105 -
 .../segment/store/SegmentLocalFSDirectory.java     |  507 -----
 .../segment/store/SingleFileIndexDirectory.java    |  365 ----
 .../virtualcolumn/BaseVirtualColumnProvider.java   |   44 -
 .../virtualcolumn/DocIdVirtualColumnProvider.java  |  205 --
 .../HostNameVirtualColumnProvider.java             |   29 -
 .../IntSingleValueDataFileReader.java              |   61 -
 .../SegmentNameVirtualColumnProvider.java          |   29 -
 .../SingleStringVirtualColumnProvider.java         |  175 --
 .../virtualcolumn/VirtualColumnContext.java        |   59 -
 .../virtualcolumn/VirtualColumnIndexContainer.java |   63 -
 .../virtualcolumn/VirtualColumnProvider.java       |   38 -
 .../VirtualColumnProviderFactory.java              |   53 -
 .../core/segment/virtualcolumn/package-info.java   |   22 -
 .../pinot/core/startree/DimensionBuffer.java       |   77 -
 .../linkedin/pinot/core/startree/MetricBuffer.java |  150 --
 .../pinot/core/startree/OffHeapStarTree.java       |  143 --
 .../core/startree/OffHeapStarTreeBuilder.java      |  842 --------
 .../pinot/core/startree/OffHeapStarTreeNode.java   |  170 --
 .../com/linkedin/pinot/core/startree/StarTree.java |   45 -
 .../pinot/core/startree/StarTreeBuilder.java       |   80 -
 .../pinot/core/startree/StarTreeBuilderConfig.java |  125 --
 .../pinot/core/startree/StarTreeBuilderUtils.java  |  191 --
 .../pinot/core/startree/StarTreeDataTable.java     |  228 --
 .../linkedin/pinot/core/startree/StarTreeNode.java |   82 -
 .../pinot/core/startree/StarTreeUtils.java         |  131 --
 .../executor/StarTreeAggregationExecutor.java      |   61 -
 .../startree/executor/StarTreeGroupByExecutor.java |   72 -
 .../linkedin/pinot/core/startree/hll/HllUtil.java  |  157 --
 .../startree/operator/StarTreeFilterOperator.java  |  438 ----
 .../startree/plan/StarTreeDocIdSetPlanNode.java    |   55 -
 .../core/startree/plan/StarTreeFilterPlanNode.java |   60 -
 .../startree/plan/StarTreeProjectionPlanNode.java  |   63 -
 .../startree/plan/StarTreeTransformPlanNode.java   |   79 -
 .../startree/v2/AggregationFunctionColumnPair.java |   86 -
 .../pinot/core/startree/v2/StarTreeV2.java         |   46 -
 .../core/startree/v2/StarTreeV2Constants.java      |   55 -
 .../pinot/core/startree/v2/StarTreeV2Metadata.java |   87 -
 .../startree/v2/builder/BaseSingleTreeBuilder.java |  506 -----
 .../startree/v2/builder/MultipleTreesBuilder.java  |  130 --
 .../v2/builder/OffHeapSingleTreeBuilder.java       |  359 ----
 .../v2/builder/OnHeapSingleTreeBuilder.java        |  164 --
 .../startree/v2/builder/SingleTreeBuilder.java     |   33 -
 .../startree/v2/builder/StarTreeIndexCombiner.java |   89 -
 .../v2/builder/StarTreeV2BuilderConfig.java        |  142 --
 .../v2/store/StarTreeDimensionDataSource.java      |  125 --
 .../startree/v2/store/StarTreeIndexContainer.java  |   87 -
 .../startree/v2/store/StarTreeIndexMapUtils.java   |  193 --
 .../startree/v2/store/StarTreeLoaderUtils.java     |  171 --
 .../v2/store/StarTreeMetricDataSource.java         |  130 --
 .../pinot/core/transport/AsyncQueryResponse.java   |  106 -
 .../pinot/core/transport/DataTableHandler.java     |   77 -
 .../linkedin/pinot/core/transport/QueryRouter.java |  136 --
 .../com/linkedin/pinot/core/transport/Server.java  |  106 -
 .../pinot/core/transport/ServerChannels.java       |  108 -
 .../pinot/core/transport/ServerResponse.java       |   85 -
 .../linkedin/pinot/core/util/ArrayCopyUtils.java   |  147 --
 .../com/linkedin/pinot/core/util/AvroUtils.java    |  324 ---
 .../pinot/core/util/BaseIndexedPriorityQueue.java  |  104 -
 .../com/linkedin/pinot/core/util/CrcUtils.java     |  113 -
 .../linkedin/pinot/core/util/FixedIntArray.java    |   68 -
 .../pinot/core/util/FixedIntArrayOffHeapIdMap.java |  147 --
 .../java/com/linkedin/pinot/core/util/IdMap.java   |   78 -
 .../core/util/IntDoubleIndexedPriorityQueue.java   |  284 ---
 .../core/util/IntObjectIndexedPriorityQueue.java   |  283 ---
 .../com/linkedin/pinot/core/util/SizeUtil.java     |   34 -
 .../pinot/core/util/SortedRangeIntersection.java   |  130 --
 .../pinot/core/util/trace/TraceCallable.java       |   52 -
 .../pinot/core/util/trace/TraceContext.java        |  201 --
 .../pinot/core/util/trace/TraceRunnable.java       |   49 -
 .../server/realtime/ControllerLeaderLocator.java   |  151 --
 .../ServerSegmentCompletionProtocolHandler.java    |  254 ---
 .../org/apache/pinot/core/bloom/BloomFilter.java   |   72 +
 .../apache/pinot/core/bloom/BloomFilterType.java   |   53 +
 .../apache/pinot/core/bloom/BloomFilterUtil.java   |   57 +
 .../pinot/core/bloom/GuavaOnHeapBloomFilter.java   |   77 +
 .../core/bloom/SegmentBloomFilterFactory.java      |   51 +
 .../apache/pinot/core/common/BaseBlockValSet.java  |  143 ++
 .../java/org/apache/pinot/core/common/Block.java   |   59 +
 .../pinot/core/common/BlockDocIdIterator.java      |   49 +
 .../apache/pinot/core/common/BlockDocIdSet.java    |   26 +
 .../pinot/core/common/BlockDocIdValueIterator.java |   33 +
 .../pinot/core/common/BlockDocIdValueSet.java      |   25 +
 .../apache/pinot/core/common/BlockMetadata.java    |   42 +
 .../pinot/core/common/BlockMultiValIterator.java   |   52 +
 .../pinot/core/common/BlockSingleValIterator.java  |   54 +
 .../apache/pinot/core/common/BlockValIterator.java |   28 +
 .../org/apache/pinot/core/common/BlockValSet.java  |  215 ++
 .../org/apache/pinot/core/common/Constants.java    |   25 +
 .../apache/pinot/core/common/DataBlockCache.java   |  369 ++++
 .../org/apache/pinot/core/common/DataFetcher.java  |  336 +++
 .../org/apache/pinot/core/common/DataSource.java   |   37 +
 .../pinot/core/common/DataSourceMetadata.java      |   41 +
 .../apache/pinot/core/common/MinionConstants.java  |   58 +
 .../apache/pinot/core/common/ObjectSerDeUtils.java |  465 ++++
 .../org/apache/pinot/core/common/Operator.java     |   37 +
 .../org/apache/pinot/core/common/Predicate.java    |  107 +
 .../core/common/datatable/DataTableBuilder.java    |  362 ++++
 .../core/common/datatable/DataTableFactory.java    |   43 +
 .../core/common/datatable/DataTableImplV2.java     |  503 +++++
 .../core/common/datatable/DataTableUtils.java      |   74 +
 .../core/common/predicate/BaseInPredicate.java     |   52 +
 .../pinot/core/common/predicate/EqPredicate.java   |   44 +
 .../pinot/core/common/predicate/InPredicate.java   |   37 +
 .../pinot/core/common/predicate/NEqPredicate.java  |   44 +
 .../core/common/predicate/NotInPredicate.java      |   37 +
 .../core/common/predicate/RangePredicate.java      |   94 +
 .../core/common/predicate/RegexpLikePredicate.java |   47 +
 .../apache/pinot/core/crypt/NoOpPinotCrypter.java  |   47 +
 .../org/apache/pinot/core/crypt/PinotCrypter.java  |   50 +
 .../pinot/core/crypt/PinotCrypterFactory.java      |   87 +
 .../org/apache/pinot/core/data/GenericRow.java     |  134 ++
 .../core/data/aggregator/AvgValueAggregator.java   |   87 +
 .../core/data/aggregator/CountValueAggregator.java |   73 +
 .../DistinctCountHLLValueAggregator.java           |  107 +
 .../core/data/aggregator/MaxValueAggregator.java   |   73 +
 .../aggregator/MinMaxRangeValueAggregator.java     |   89 +
 .../core/data/aggregator/MinValueAggregator.java   |   73 +
 .../aggregator/PercentileEstValueAggregator.java   |   99 +
 .../PercentileTDigestValueAggregator.java          |   98 +
 .../core/data/aggregator/SumValueAggregator.java   |   73 +
 .../core/data/aggregator/ValueAggregator.java      |   80 +
 .../data/aggregator/ValueAggregatorFactory.java    |   94 +
 .../data/function/FunctionExpressionEvaluator.java |  154 ++
 .../pinot/core/data/function/FunctionInfo.java     |   78 +
 .../pinot/core/data/function/FunctionInvoker.java  |   90 +
 .../pinot/core/data/function/FunctionRegistry.java |   55 +
 .../core/data/manager/BaseTableDataManager.java    |  226 ++
 .../core/data/manager/InstanceDataManager.java     |  128 ++
 .../core/data/manager/SegmentDataManager.java      |   71 +
 .../pinot/core/data/manager/TableDataManager.java  |  120 ++
 .../manager/config/InstanceDataManagerConfig.java  |   53 +
 .../manager/config/TableDataManagerConfig.java     |   87 +
 .../offline/ImmutableSegmentDataManager.java       |   57 +
 .../manager/offline/OfflineTableDataManager.java   |   56 +
 .../manager/offline/TableDataManagerProvider.java  |   70 +
 .../realtime/HLRealtimeSegmentDataManager.java     |  433 ++++
 .../realtime/LLRealtimeSegmentDataManager.java     | 1196 +++++++++++
 .../realtime/RealtimeSegmentDataManager.java       |   45 +
 .../manager/realtime/RealtimeTableDataManager.java |  349 +++
 .../realtime/SegmentBuildTimeLeaseExtender.java    |  149 ++
 .../core/data/manager/realtime/TimerService.java   |   26 +
 .../data/partition/ByteArrayPartitionFunction.java |   59 +
 .../data/partition/ModuloPartitionFunction.java    |   72 +
 .../data/partition/MurmurPartitionFunction.java    |   64 +
 .../core/data/partition/PartitionFunction.java     |   39 +
 .../data/partition/PartitionFunctionFactory.java   |   84 +
 .../pinot/core/data/readers/AvroRecordReader.java  |  120 ++
 .../pinot/core/data/readers/CSVRecordReader.java   |  144 ++
 .../core/data/readers/CSVRecordReaderConfig.java   |   71 +
 .../apache/pinot/core/data/readers/FileFormat.java |   28 +
 .../core/data/readers/GenericRowRecordReader.java  |   75 +
 .../pinot/core/data/readers/JSONRecordReader.java  |  114 +
 .../readers/MultiplePinotSegmentRecordReader.java  |  277 +++
 .../data/readers/PinotSegmentColumnReader.java     |  157 ++
 .../data/readers/PinotSegmentRecordReader.java     |  167 ++
 .../pinot/core/data/readers/RecordReader.java      |   59 +
 .../core/data/readers/RecordReaderConfig.java      |   23 +
 .../core/data/readers/RecordReaderFactory.java     |   54 +
 .../pinot/core/data/readers/RecordReaderUtils.java |  149 ++
 .../core/data/readers/ThriftRecordReader.java      |  157 ++
 .../data/readers/ThriftRecordReaderConfig.java     |   40 +
 .../core/data/readers/sort/PinotSegmentSorter.java |  138 ++
 .../core/data/readers/sort/SegmentSorter.java      |   35 +
 .../recordtransformer/CompoundTransformer.java     |   78 +
 .../recordtransformer/DataTypeTransformer.java     |  116 +
 .../recordtransformer/ExpressionTransformer.java   |   70 +
 .../core/data/recordtransformer/PinotDataType.java |  490 +++++
 .../data/recordtransformer/RecordTransformer.java  |   39 +
 .../recordtransformer/SanitationTransformer.java   |   78 +
 .../data/recordtransformer/TimeTransformer.java    |   96 +
 .../pinot/core/indexsegment/IndexSegment.java      |   87 +
 .../pinot/core/indexsegment/IndexSegmentUtils.java |   80 +
 .../generator/SegmentGeneratorConfig.java          |  652 ++++++
 .../indexsegment/generator/SegmentVersion.java     |   25 +
 .../indexsegment/immutable/ImmutableSegment.java   |   60 +
 .../immutable/ImmutableSegmentImpl.java            |  173 ++
 .../immutable/ImmutableSegmentLoader.java          |  150 ++
 .../core/indexsegment/mutable/MutableSegment.java  |   41 +
 .../indexsegment/mutable/MutableSegmentImpl.java   |  750 +++++++
 .../pinot/core/io/compression/ChunkCompressor.java |   41 +
 .../io/compression/ChunkCompressorFactory.java     |   84 +
 .../core/io/compression/ChunkDecompressor.java     |   41 +
 .../core/io/compression/PassThroughCompressor.java |   41 +
 .../io/compression/PassThroughDecompressor.java    |   38 +
 .../core/io/compression/SnappyCompressor.java      |   36 +
 .../core/io/compression/SnappyDecompressor.java    |   35 +
 .../reader/BaseSingleColumnMultiValueReader.java   |   67 +
 .../reader/BaseSingleColumnSingleValueReader.java  |  102 +
 .../pinot/core/io/reader/DataFileReader.java       |   30 +
 .../apache/pinot/core/io/reader/ReaderContext.java |   24 +
 .../io/reader/SingleColumnMultiValueReader.java    |   81 +
 .../io/reader/SingleColumnSingleValueReader.java   |  151 ++
 .../io/reader/SingleValueMultiColumnReader.java    |  156 ++
 .../core/io/reader/impl/ChunkReaderContext.java    |   53 +
 .../impl/FixedByteSingleValueMultiColReader.java   |  232 ++
 .../io/reader/impl/UnSortedValueReaderContext.java |   26 +
 .../reader/impl/v1/BaseChunkSingleValueReader.java |  175 ++
 .../reader/impl/v1/FixedBitMultiValueReader.java   |  156 ++
 .../reader/impl/v1/FixedBitSingleValueReader.java  |   63 +
 .../impl/v1/FixedByteChunkSingleValueReader.java   |  144 ++
 .../core/io/reader/impl/v1/SortedIndexReader.java  |   49 +
 .../io/reader/impl/v1/SortedIndexReaderImpl.java   |  139 ++
 .../impl/v1/VarByteChunkSingleValueReader.java     |  124 ++
 .../BaseSingleColumnMultiValueReaderWriter.java    |  118 ++
 .../BaseSingleColumnSingleValueReaderWriter.java   |  148 ++
 .../BaseSingleValueMultiColumnReaderWriter.java    |  135 ++
 .../readerwriter/PinotDataBufferMemoryManager.java |   46 +
 .../RealtimeIndexOffHeapMemoryManager.java         |  115 +
 ...ixedByteSingleColumnMultiValueReaderWriter.java |  419 ++++
 ...xedByteSingleColumnSingleValueReaderWriter.java |  267 +++
 ...ixedByteSingleValueMultiColumnReaderWriter.java |  212 ++
 .../io/util/DictionaryDelegatingValueReader.java   |   78 +
 .../core/io/util/FixedBitIntReaderWriter.java      |   58 +
 .../core/io/util/FixedByteValueReaderWriter.java   |  119 ++
 .../apache/pinot/core/io/util/PinotDataBitSet.java |  248 +++
 .../org/apache/pinot/core/io/util/ValueReader.java |   43 +
 .../pinot/core/io/writer/DataFileWriter.java       |   29 +
 .../io/writer/SingleColumnMultiValueWriter.java    |   79 +
 .../io/writer/SingleColumnSingleValueWriter.java   |   78 +
 .../io/writer/SingleValueMultiColumnWriter.java    |   70 +
 .../core/io/writer/impl/DirectMemoryManager.java   |   62 +
 .../impl/FixedByteSingleValueMultiColWriter.java   |  106 +
 .../core/io/writer/impl/MmapMemoryManager.java     |  181 ++
 .../writer/impl/MutableOffHeapByteArrayStore.java  |  276 +++
 .../core/io/writer/impl/OffHeapStringStore.java    |  222 ++
 .../writer/impl/v1/BaseChunkSingleValueWriter.java |  204 ++
 .../writer/impl/v1/FixedBitMultiValueWriter.java   |  194 ++
 .../writer/impl/v1/FixedBitSingleValueWriter.java  |   96 +
 .../impl/v1/FixedByteChunkSingleValueWriter.java   |  124 ++
 .../impl/v1/VarByteChunkSingleValueWriter.java     |  138 ++
 .../core/metadata/DefaultMetadataExtractor.java    |   45 +
 .../pinot/core/metadata/MetadataExtractor.java     |   38 +
 .../core/metadata/MetadataExtractorFactory.java    |   48 +
 .../pinot/core/minion/BackfillDateTimeColumn.java  |  197 ++
 .../pinot/core/minion/RawIndexConverter.java       |  218 ++
 .../apache/pinot/core/minion/SegmentConverter.java |  240 +++
 .../apache/pinot/core/minion/SegmentPurger.java    |  276 +++
 .../minion/rollup/MergeRollupSegmentConverter.java |  194 ++
 .../apache/pinot/core/minion/rollup/MergeType.java |   44 +
 .../core/minion/rollup/RollupRecordAggregator.java |   75 +
 .../rollup/aggregate/MaxValueAggregator.java       |   48 +
 .../rollup/aggregate/SumValueAggregator.java       |   48 +
 .../minion/rollup/aggregate/ValueAggregator.java   |   37 +
 .../rollup/aggregate/ValueAggregatorFactory.java   |   43 +
 .../minion/segment/DefaultRecordPartitioner.java   |   37 +
 .../core/minion/segment/MapperRecordReader.java    |  120 ++
 .../core/minion/segment/RecordAggregator.java      |   38 +
 .../core/minion/segment/RecordPartitioner.java     |   38 +
 .../core/minion/segment/RecordTransformer.java     |   37 +
 .../core/minion/segment/ReducerRecordReader.java   |  138 ++
 .../apache/pinot/core/operator/BaseOperator.java   |   60 +
 .../core/operator/CombineGroupByOperator.java      |  223 ++
 .../pinot/core/operator/CombineOperator.java       |  203 ++
 .../pinot/core/operator/DocIdSetOperator.java      |   96 +
 .../pinot/core/operator/ExecutionStatistics.java   |   93 +
 .../core/operator/InstanceResponseOperator.java    |   44 +
 .../pinot/core/operator/ProjectionOperator.java    |   89 +
 .../core/operator/blocks/BlockMetadataImpl.java    |   83 +
 .../pinot/core/operator/blocks/DocIdSetBlock.java  |   71 +
 .../core/operator/blocks/EmptyFilterBlock.java     |   37 +
 .../pinot/core/operator/blocks/FilterBlock.java    |   62 +
 .../operator/blocks/InstanceResponseBlock.java     |   78 +
 .../operator/blocks/IntermediateResultsBlock.java  |  347 +++
 .../core/operator/blocks/MultiValueBlock.java      |   67 +
 .../core/operator/blocks/ProjectionBlock.java      |   88 +
 .../core/operator/blocks/SingleValueBlock.java     |   73 +
 .../pinot/core/operator/blocks/TransformBlock.java |   87 +
 .../operator/dociditerators/AndDocIdIterator.java  |  137 ++
 .../dociditerators/ArrayBasedDocIdIterator.java    |   74 +
 .../dociditerators/BitmapDocIdIterator.java        |   94 +
 .../dociditerators/EmptyBlockDocIdIterator.java    |   54 +
 .../dociditerators/IndexBasedDocIdIterator.java    |   30 +
 .../dociditerators/MVScanDocIdIterator.java        |  166 ++
 .../operator/dociditerators/OrDocIdIterator.java   |  157 ++
 .../RangelessBitmapDocIdIterator.java              |   75 +
 .../dociditerators/SVScanDocIdIterator.java        |  246 +++
 .../dociditerators/ScanBasedDocIdIterator.java     |   48 +
 .../dociditerators/SizeBasedDocIdIterator.java     |   58 +
 .../dociditerators/SortedDocIdIterator.java        |  108 +
 .../core/operator/docidsets/AndBlockDocIdSet.java  |  273 +++
 .../operator/docidsets/ArrayBasedDocIdSet.java     |   52 +
 .../core/operator/docidsets/BitmapDocIdSet.java    |  103 +
 .../docidsets/EmptyFilterBlockDocIdSet.java        |   72 +
 .../operator/docidsets/FilterBlockDocIdSet.java    |   75 +
 .../core/operator/docidsets/OrBlockDocIdSet.java   |  130 ++
 .../docidsets/ScanBasedMultiValueDocIdSet.java     |   90 +
 .../docidsets/ScanBasedSingleValueDocIdSet.java    |   92 +
 .../core/operator/docidsets/SizeBasedDocIdSet.java |   66 +
 .../core/operator/docidsets/SortedDocIdSet.java    |  104 +
 .../core/operator/docidsets/StarTreeDocIdSet.java  |  106 +
 .../docvaliterators/MultiValueIterator.java        |   60 +
 .../docvaliterators/SingleValueIterator.java       |   85 +
 .../core/operator/docvalsets/MultiValueSet.java    |   50 +
 .../operator/docvalsets/ProjectionBlockValSet.java |  140 ++
 .../core/operator/docvalsets/SingleValueSet.java   |  172 ++
 .../operator/docvalsets/TransformBlockValSet.java  |  158 ++
 .../core/operator/filter/AndFilterOperator.java    |   65 +
 .../core/operator/filter/BaseFilterOperator.java   |   44 +
 .../operator/filter/BitmapBasedFilterOperator.java |  110 +
 .../core/operator/filter/EmptyFilterOperator.java  |   53 +
 .../core/operator/filter/FilterOperatorUtils.java  |  188 ++
 .../pinot/core/operator/filter/IntRanges.java      |   84 +
 .../operator/filter/MatchAllFilterOperator.java    |   49 +
 .../core/operator/filter/OrFilterOperator.java     |   65 +
 .../operator/filter/ScanBasedFilterOperator.java   |  103 +
 .../SortedInvertedIndexBasedFilterOperator.java    |  165 ++
 .../BaseDictionaryBasedPredicateEvaluator.java     |  121 ++
 .../filter/predicate/BasePredicateEvaluator.java   |   37 +
 .../BaseRawValueBasedPredicateEvaluator.java       |  185 ++
 .../predicate/EqualsPredicateEvaluatorFactory.java |  196 ++
 .../predicate/InPredicateEvaluatorFactory.java     |  239 +++
 .../NotEqualsPredicateEvaluatorFactory.java        |  221 ++
 .../predicate/NotInPredicateEvaluatorFactory.java  |  257 +++
 .../filter/predicate/PredicateEvaluator.java       |  167 ++
 .../predicate/PredicateEvaluatorProvider.java      |   94 +
 .../predicate/RangePredicateEvaluatorFactory.java  |  417 ++++
 .../RegexpLikePredicateEvaluatorFactory.java       |  121 ++
 .../operator/query/AggregationGroupByOperator.java |  114 +
 .../core/operator/query/AggregationOperator.java   |  101 +
 .../query/DictionaryBasedAggregationOperator.java  |  128 ++
 .../operator/query/EmptySelectionOperator.java     |   70 +
 .../query/MetadataBasedAggregationOperator.java    |   98 +
 .../core/operator/query/SelectionOnlyOperator.java |  119 ++
 .../operator/query/SelectionOrderByOperator.java   |  125 ++
 .../core/operator/transform/TransformOperator.java |  117 +
 .../transform/TransformResultMetadata.java         |   49 +
 .../function/AdditionTransformFunction.java        |  118 ++
 .../transform/function/BaseTransformFunction.java  |  431 ++++
 .../DateTimeConversionTransformFunction.java       |  172 ++
 .../function/DivisionTransformFunction.java        |  166 ++
 .../function/IdentifierTransformFunction.java      |  132 ++
 .../function/LiteralTransformFunction.java         |  128 ++
 .../function/MultiplicationTransformFunction.java  |  119 ++
 .../function/SubtractionTransformFunction.java     |  165 ++
 .../function/TimeConversionTransformFunction.java  |   83 +
 .../transform/function/TransformFunction.java      |  176 ++
 .../function/TransformFunctionFactory.java         |  123 ++
 .../function/ValueInTransformFunction.java         |  302 +++
 .../transform/transformer/DataTransformer.java     |   40 +
 .../datetime/BaseDateTimeTransformer.java          |  130 ++
 .../datetime/DateTimeTransformerFactory.java       |   52 +
 .../datetime/EpochToEpochTransformer.java          |   42 +
 .../datetime/EpochToSDFTransformer.java            |   43 +
 .../datetime/SDFToEpochTransformer.java            |   42 +
 .../transformer/datetime/SDFToSDFTransformer.java  |   44 +
 .../timeunit/CustomTimeUnitTransformer.java        |   72 +
 .../timeunit/JavaTimeUnitTransformer.java          |   43 +
 .../transformer/timeunit/TimeUnitTransformer.java  |   29 +
 .../timeunit/TimeUnitTransformerFactory.java       |   38 +
 .../pinot/core/periodictask/BasePeriodicTask.java  |   55 +
 .../pinot/core/periodictask/PeriodicTask.java      |   54 +
 .../core/periodictask/PeriodicTaskScheduler.java   |  100 +
 .../core/plan/AggregationFunctionInitializer.java  |   38 +
 .../core/plan/AggregationGroupByPlanNode.java      |  128 ++
 .../pinot/core/plan/AggregationPlanNode.java       |  112 +
 .../apache/pinot/core/plan/CombinePlanNode.java    |  156 ++
 .../plan/DictionaryBasedAggregationPlanNode.java   |   80 +
 .../apache/pinot/core/plan/DocIdSetPlanNode.java   |   65 +
 .../org/apache/pinot/core/plan/FilterPlanNode.java |  119 ++
 .../apache/pinot/core/plan/GlobalPlanImplV0.java   |   59 +
 .../pinot/core/plan/InstanceResponsePlanNode.java  |   52 +
 .../plan/MetadataBasedAggregationPlanNode.java     |   86 +
 .../main/java/org/apache/pinot/core/plan/Plan.java |   38 +
 .../java/org/apache/pinot/core/plan/PlanNode.java  |   43 +
 .../apache/pinot/core/plan/ProjectionPlanNode.java |   71 +
 .../apache/pinot/core/plan/SelectionPlanNode.java  |   97 +
 .../apache/pinot/core/plan/TransformPlanNode.java  |  104 +
 .../core/plan/maker/BrokerRequestPreProcessor.java |   98 +
 .../core/plan/maker/InstancePlanMakerImplV2.java   |  224 ++
 .../apache/pinot/core/plan/maker/PlanMaker.java    |   59 +
 .../query/aggregation/AggregationExecutor.java     |   46 +
 .../aggregation/AggregationFunctionContext.java    |   57 +
 .../query/aggregation/AggregationResultHolder.java |   50 +
 .../aggregation/DefaultAggregationExecutor.java    |   78 +
 .../aggregation/DoubleAggregationResultHolder.java |   73 +
 .../aggregation/ObjectAggregationResultHolder.java |   63 +
 .../aggregation/function/AggregationFunction.java  |  123 ++
 .../function/AggregationFunctionFactory.java       |  117 +
 .../function/AggregationFunctionType.java          |  104 +
 .../function/AggregationFunctionUtils.java         |  138 ++
 .../function/AggregationFunctionVisitorBase.java   |  124 ++
 .../function/AvgAggregationFunction.java           |  232 ++
 .../function/AvgMVAggregationFunction.java         |   88 +
 .../function/CountAggregationFunction.java         |  155 ++
 .../function/CountMVAggregationFunction.java       |   75 +
 .../function/DistinctCountAggregationFunction.java |  290 +++
 .../DistinctCountHLLAggregationFunction.java       |  360 ++++
 .../DistinctCountHLLMVAggregationFunction.java     |  221 ++
 .../DistinctCountMVAggregationFunction.java        |  215 ++
 .../function/FastHLLAggregationFunction.java       |  197 ++
 .../function/MaxAggregationFunction.java           |  144 ++
 .../function/MaxMVAggregationFunction.java         |   91 +
 .../function/MinAggregationFunction.java           |  144 ++
 .../function/MinMVAggregationFunction.java         |   91 +
 .../function/MinMaxRangeAggregationFunction.java   |  237 +++
 .../function/MinMaxRangeMVAggregationFunction.java |   97 +
 .../function/PercentileAggregationFunction.java    |  194 ++
 .../function/PercentileEstAggregationFunction.java |  241 +++
 .../PercentileEstMVAggregationFunction.java        |   86 +
 .../function/PercentileMVAggregationFunction.java  |   86 +
 .../PercentileTDigestAggregationFunction.java      |  256 +++
 .../PercentileTDigestMVAggregationFunction.java    |   86 +
 .../function/SumAggregationFunction.java           |  132 ++
 .../function/SumMVAggregationFunction.java         |   85 +
 .../aggregation/function/customobject/AvgPair.java |   94 +
 .../function/customobject/MinMaxRangePair.java     |   90 +
 .../function/customobject/QuantileDigest.java      | 1069 ++++++++++
 .../groupby/AggregationGroupByResult.java          |   71 +
 .../groupby/AggregationGroupByTrimmingService.java |  355 ++++
 .../groupby/DefaultGroupByExecutor.java            |  179 ++
 .../groupby/DictionaryBasedGroupKeyGenerator.java  |  815 +++++++
 .../groupby/DoubleGroupByResultHolder.java         |   99 +
 .../query/aggregation/groupby/GroupByExecutor.java |   44 +
 .../aggregation/groupby/GroupByResultHolder.java   |   71 +
 .../aggregation/groupby/GroupKeyGenerator.java     |   82 +
 .../NoDictionaryMultiColumnGroupKeyGenerator.java  |  260 +++
 .../NoDictionarySingleColumnGroupKeyGenerator.java |  267 +++
 .../groupby/ObjectGroupByResultHolder.java         |   90 +
 .../groupby/utils/BaseValueToIdMap.java            |   74 +
 .../aggregation/groupby/utils/DoubleToIdMap.java   |   62 +
 .../aggregation/groupby/utils/FloatToIdMap.java    |   62 +
 .../aggregation/groupby/utils/IntToIdMap.java      |   62 +
 .../aggregation/groupby/utils/LongToIdMap.java     |   62 +
 .../aggregation/groupby/utils/StringToIdMap.java   |   56 +
 .../aggregation/groupby/utils/ValueToIdMap.java    |   46 +
 .../groupby/utils/ValueToIdMapFactory.java         |   53 +
 .../core/query/config/QueryExecutorConfig.java     |   77 +
 .../core/query/config/QueryPlannerConfig.java      |   51 +
 .../core/query/config/SegmentPrunerConfig.java     |   75 +
 .../query/exception/BadQueryRequestException.java  |   33 +
 .../pinot/core/query/executor/QueryExecutor.java   |   63 +
 .../query/executor/ServerQueryExecutorV1Impl.java  |  243 +++
 .../core/query/pruner/AbstractSegmentPruner.java   |  115 +
 .../query/pruner/ColumnValueSegmentPruner.java     |  202 ++
 .../core/query/pruner/DataSchemaSegmentPruner.java |   48 +
 .../core/query/pruner/PartitionSegmentPruner.java  |  122 ++
 .../pinot/core/query/pruner/SegmentPruner.java     |   38 +
 .../core/query/pruner/SegmentPrunerProvider.java   |   57 +
 .../core/query/pruner/SegmentPrunerService.java    |   62 +
 .../core/query/pruner/ValidSegmentPruner.java      |   65 +
 .../pinot/core/query/reduce/BetweenComparison.java |   62 +
 .../core/query/reduce/BrokerReduceService.java     |  509 +++++
 .../pinot/core/query/reduce/CombineService.java    |  152 ++
 .../core/query/reduce/ComparisonFunction.java      |   39 +
 .../pinot/core/query/reduce/EqualComparison.java   |   56 +
 .../core/query/reduce/GreaterEqualComparison.java  |   56 +
 .../core/query/reduce/GreaterThanComparison.java   |   56 +
 .../query/reduce/HavingClauseComparisonTree.java   |  151 ++
 .../core/query/reduce/InAndNotInComparison.java    |   77 +
 .../core/query/reduce/LessEqualComparison.java     |   56 +
 .../core/query/reduce/LessThanComparison.java      |   56 +
 .../core/query/reduce/NotEqualComparison.java      |   56 +
 .../core/query/request/ServerQueryRequest.java     |  200 ++
 .../core/query/request/context/TimerContext.java   |  102 +
 .../query/scheduler/AbstractSchedulerGroup.java    |  136 ++
 .../query/scheduler/MultiLevelPriorityQueue.java   |  240 +++
 .../query/scheduler/OutOfCapacityException.java    |   29 +
 .../core/query/scheduler/PriorityScheduler.java    |  165 ++
 .../pinot/core/query/scheduler/QueryScheduler.java |  228 ++
 .../query/scheduler/QuerySchedulerFactory.java     |   99 +
 .../pinot/core/query/scheduler/SchedulerGroup.java |   72 +
 .../query/scheduler/SchedulerGroupAccountant.java  |   75 +
 .../query/scheduler/SchedulerGroupFactory.java     |   36 +
 .../core/query/scheduler/SchedulerGroupMapper.java |   33 +
 .../query/scheduler/SchedulerPriorityQueue.java    |   54 +
 .../query/scheduler/SchedulerQueryContext.java     |   73 +
 .../query/scheduler/TableBasedGroupMapper.java     |   36 +
 .../query/scheduler/fcfs/BoundedFCFSScheduler.java |   74 +
 .../query/scheduler/fcfs/FCFSQueryScheduler.java   |   77 +
 .../query/scheduler/fcfs/FCFSSchedulerGroup.java   |   70 +
 .../resources/BoundedAccountingExecutor.java       |  111 +
 .../resources/PolicyBasedResourceManager.java      |   87 +
 .../scheduler/resources/QueryExecutorService.java  |  109 +
 .../scheduler/resources/ResourceLimitPolicy.java   |   85 +
 .../query/scheduler/resources/ResourceManager.java |  169 ++
 .../resources/UnboundedResourceManager.java        |   57 +
 .../tokenbucket/TokenPriorityScheduler.java        |   80 +
 .../scheduler/tokenbucket/TokenSchedulerGroup.java |  200 ++
 .../core/query/selection/SelectionFetcher.java     |  123 ++
 .../query/selection/SelectionOperatorService.java  |  333 +++
 .../query/selection/SelectionOperatorUtils.java    |  697 ++++++
 .../comparator/CompositeDocIdValComparator.java    |   94 +
 .../comparator/DocIdDoubleValComparator.java       |   47 +
 .../comparator/DocIdFloatValComparator.java        |   47 +
 .../comparator/DocIdIntValComparator.java          |   47 +
 .../comparator/DocIdLongValComparator.java         |   47 +
 .../selection/comparator/IDocIdValComparator.java  |   24 +
 .../DoubleArraySelectionColumnIterator.java        |   47 +
 .../iterator/DoubleSelectionColumnIterator.java    |   45 +
 .../FloatArraySelectionColumnIterator.java         |   47 +
 .../iterator/FloatSelectionColumnIterator.java     |   45 +
 .../iterator/IntArraySelectionColumnIterator.java  |   47 +
 .../iterator/IntSelectionColumnIterator.java       |   45 +
 .../iterator/LongArraySelectionColumnIterator.java |   47 +
 .../iterator/LongSelectionColumnIterator.java      |   45 +
 .../iterator/SelectionColumnIterator.java          |   31 +
 .../SelectionMultiValueColumnIterator.java         |   47 +
 ...SelectionSingleValueColumnWithDictIterator.java |   58 +
 .../StringArraySelectionColumnIterator.java        |   47 +
 .../iterator/StringSelectionColumnIterator.java    |   60 +
 .../org/apache/pinot/core/query/utils/Pair.java    |   56 +
 .../apache/pinot/core/query/utils/TrieNode.java    |   65 +
 .../converter/RealtimeSegmentConverter.java        |  170 ++
 .../converter/RealtimeSegmentRecordReader.java     |   91 +
 .../converter/stats/RealtimeColumnStatistics.java  |  246 +++
 .../stats/RealtimeNoDictionaryColStatistics.java   |  134 ++
 .../RealtimeSegmentSegmentCreationDataSource.java  |   63 +
 .../stats/RealtimeSegmentStatsContainer.java       |   83 +
 .../core/realtime/impl/RealtimeSegmentConfig.java  |  205 ++
 .../realtime/impl/RealtimeSegmentStatsHistory.java |  395 ++++
 .../dictionary/BaseOffHeapMutableDictionary.java   |  502 +++++
 .../dictionary/BaseOnHeapMutableDictionary.java    |  110 +
 .../dictionary/BytesOffHeapMutableDictionary.java  |  153 ++
 .../dictionary/BytesOnHeapMutableDictionary.java   |  103 +
 .../dictionary/DoubleOffHeapMutableDictionary.java |  178 ++
 .../dictionary/DoubleOnHeapMutableDictionary.java  |  139 ++
 .../dictionary/FloatOffHeapMutableDictionary.java  |  178 ++
 .../dictionary/FloatOnHeapMutableDictionary.java   |  139 ++
 .../dictionary/IntOffHeapMutableDictionary.java    |  178 ++
 .../dictionary/IntOnHeapMutableDictionary.java     |  139 ++
 .../dictionary/LongOffHeapMutableDictionary.java   |  178 ++
 .../dictionary/LongOnHeapMutableDictionary.java    |  139 ++
 .../impl/dictionary/MutableDictionary.java         |   88 +
 .../impl/dictionary/MutableDictionaryFactory.java  |   74 +
 .../dictionary/StringOffHeapMutableDictionary.java |  144 ++
 .../dictionary/StringOnHeapMutableDictionary.java  |  116 +
 .../invertedindex/RealtimeInvertedIndexReader.java |   98 +
 .../impl/kafka/AvroRecordToPinotRowGenerator.java  |   63 +
 .../realtime/impl/kafka/ConsumerAndIterator.java   |   61 +
 .../impl/kafka/KafkaAvroMessageDecoder.java        |  283 +++
 .../realtime/impl/kafka/KafkaBrokerWrapper.java    |   82 +
 .../impl/kafka/KafkaConnectionHandler.java         |  439 ++++
 .../realtime/impl/kafka/KafkaConsumerFactory.java  |   85 +
 .../realtime/impl/kafka/KafkaConsumerManager.java  |  187 ++
 .../impl/kafka/KafkaHighLevelStreamConfig.java     |  163 ++
 .../impl/kafka/KafkaJSONMessageDecoder.java        |  130 ++
 .../impl/kafka/KafkaLowLevelStreamConfig.java      |  128 ++
 .../impl/kafka/KafkaPartitionLevelConsumer.java    |  121 ++
 .../impl/kafka/KafkaSimpleConsumerFactory.java     |   30 +
 .../impl/kafka/KafkaSimpleConsumerFactoryImpl.java |   32 +
 .../impl/kafka/KafkaStreamConfigProperties.java    |   63 +
 .../impl/kafka/KafkaStreamLevelConsumer.java       |  144 ++
 .../impl/kafka/KafkaStreamMetadataProvider.java    |  233 ++
 .../realtime/impl/kafka/SimpleConsumerFactory.java |   29 +
 .../impl/kafka/SimpleConsumerMessageBatch.java     |   56 +
 .../ConsumingSegmentAssignmentStrategy.java        |   63 +
 .../segment/RealtimeSegmentAssignmentStrategy.java |   43 +
 .../pinot/core/realtime/stream/MessageBatch.java   |   60 +
 .../pinot/core/realtime/stream/OffsetCriteria.java |  213 ++
 .../realtime/stream/PartitionCountFetcher.java     |   79 +
 .../realtime/stream/PartitionLevelConsumer.java    |   39 +
 .../stream/PartitionLevelStreamConfig.java         |   85 +
 .../realtime/stream/PartitionOffsetFetcher.java    |   87 +
 .../stream/PermanentConsumerException.java         |   29 +
 .../pinot/core/realtime/stream/StreamConfig.java   |  345 +++
 .../realtime/stream/StreamConfigProperties.java    |  111 +
 .../realtime/stream/StreamConsumerFactory.java     |   75 +
 .../stream/StreamConsumerFactoryProvider.java      |   45 +
 .../realtime/stream/StreamDecoderProvider.java     |   49 +
 .../core/realtime/stream/StreamLevelConsumer.java  |   54 +
 .../core/realtime/stream/StreamMessageDecoder.java |   58 +
 .../realtime/stream/StreamMetadataProvider.java    |   45 +
 .../stream/TransientConsumerException.java         |   29 +
 .../creator/BaseSingleValueRawIndexCreator.java    |   59 +
 .../segment/creator/ColumnIndexCreationInfo.java   |  123 ++
 .../core/segment/creator/ColumnStatistics.java     |   96 +
 .../core/segment/creator/ForwardIndexCreator.java  |   25 +
 .../core/segment/creator/ForwardIndexType.java     |   27 +
 .../core/segment/creator/InvertedIndexCreator.java |   73 +
 .../core/segment/creator/InvertedIndexType.java    |   27 +
 .../creator/MultiValueForwardIndexCreator.java     |   30 +
 .../RecordReaderSegmentCreationDataSource.java     |   86 +
 .../segment/creator/SegmentCreationDataSource.java |   32 +
 .../pinot/core/segment/creator/SegmentCreator.java |   71 +
 .../creator/SegmentIndexCreationDriver.java        |   62 +
 .../segment/creator/SegmentIndexCreationInfo.java  |   58 +
 .../creator/SegmentPreIndexStatsCollector.java     |   36 +
 .../creator/SegmentPreIndexStatsContainer.java     |   32 +
 .../creator/SingleValueForwardIndexCreator.java    |   30 +
 .../creator/SingleValueRawIndexCreator.java        |   84 +
 .../core/segment/creator/StatsCollectorConfig.java |   85 +
 .../creator/impl/SegmentColumnarIndexCreator.java  |  552 +++++
 .../creator/impl/SegmentCreationDriverFactory.java |   37 +
 .../creator/impl/SegmentDictionaryCreator.java     |  270 +++
 .../impl/SegmentIndexCreationDriverImpl.java       |  521 +++++
 .../core/segment/creator/impl/V1Constants.java     |  148 ++
 .../creator/impl/bloom/BloomFilterCreator.java     |   70 +
 .../fwd/MultiValueUnsortedForwardIndexCreator.java |   51 +
 .../fwd/SingleValueFixedByteRawIndexCreator.java   |  103 +
 .../fwd/SingleValueSortedForwardIndexCreator.java  |   65 +
 .../SingleValueUnsortedForwardIndexCreator.java    |   50 +
 .../fwd/SingleValueVarByteRawIndexCreator.java     |   68 +
 .../inv/OffHeapBitmapInvertedIndexCreator.java     |  248 +++
 .../impl/inv/OnHeapBitmapInvertedIndexCreator.java |   90 +
 .../stats/AbstractColumnStatisticsCollector.java   |  209 ++
 .../stats/BytesColumnPredIndexStatsCollector.java  |  167 ++
 .../stats/DoubleColumnPreIndexStatsCollector.java  |  156 ++
 .../stats/FloatColumnPreIndexStatsCollector.java   |  156 ++
 .../stats/IntColumnPreIndexStatsCollector.java     |  158 ++
 .../stats/LongColumnPreIndexStatsCollector.java    |  156 ++
 .../stats/SegmentPreIndexStatsCollectorImpl.java   |  171 ++
 .../stats/StringColumnPreIndexStatsCollector.java  |  187 ++
 .../pinot/core/segment/index/ColumnMetadata.java   |  623 ++++++
 .../core/segment/index/SegmentMetadataImpl.java    |  658 ++++++
 .../segment/index/column/ColumnIndexContainer.java |   50 +
 .../index/column/PhysicalColumnIndexContainer.java |  222 ++
 .../index/converter/SegmentFormatConverter.java    |   31 +
 .../converter/SegmentFormatConverterFactory.java   |   37 +
 .../converter/SegmentV1V2ToV3FormatConverter.java  |  272 +++
 .../index/data/source/ColumnDataSource.java        |  189 ++
 .../segment/index/loader/IndexLoadingConfig.java   |  251 +++
 .../core/segment/index/loader/LoaderUtils.java     |  140 ++
 .../segment/index/loader/SegmentPreProcessor.java  |  124 ++
 .../index/loader/V3RemoveIndexException.java       |   29 +
 .../loader/bloomfilter/BloomFilterHandler.java     |  180 ++
 .../ColumnMinMaxValueGenerator.java                |  150 ++
 .../ColumnMinMaxValueGeneratorMode.java            |   41 +
 .../defaultcolumn/BaseDefaultColumnHandler.java    |  367 ++++
 .../loader/defaultcolumn/DefaultColumnHandler.java |   31 +
 .../defaultcolumn/DefaultColumnHandlerFactory.java |   43 +
 .../defaultcolumn/DefaultColumnStatistics.java     |  131 ++
 .../defaultcolumn/V1DefaultColumnHandler.java      |   53 +
 .../defaultcolumn/V3DefaultColumnHandler.java      |   79 +
 .../loader/invertedindex/InvertedIndexHandler.java |  160 ++
 .../core/segment/index/readers/BaseDictionary.java |  106 +
 .../index/readers/BitmapInvertedIndexReader.java   |  124 ++
 .../segment/index/readers/BloomFilterReader.java   |   58 +
 .../segment/index/readers/BytesDictionary.java     |   62 +
 .../core/segment/index/readers/Dictionary.java     |   68 +
 .../segment/index/readers/DoubleDictionary.java    |   77 +
 .../segment/index/readers/FloatDictionary.java     |   77 +
 .../index/readers/ImmutableDictionaryReader.java   |  250 +++
 .../core/segment/index/readers/IntDictionary.java  |   82 +
 .../segment/index/readers/InvertedIndexReader.java |   30 +
 .../core/segment/index/readers/LongDictionary.java |   77 +
 .../segment/index/readers/OnHeapDictionary.java    |   34 +
 .../index/readers/OnHeapDoubleDictionary.java      |  101 +
 .../index/readers/OnHeapFloatDictionary.java       |  106 +
 .../segment/index/readers/OnHeapIntDictionary.java |  116 +
 .../index/readers/OnHeapLongDictionary.java        |  101 +
 .../index/readers/OnHeapStringDictionary.java      |   98 +
 .../segment/index/readers/StringDictionary.java    |   65 +
 .../core/segment/memory/BasePinotLBuffer.java      |  164 ++
 .../pinot/core/segment/memory/PinotByteBuffer.java |  334 +++
 .../pinot/core/segment/memory/PinotDataBuffer.java |  384 ++++
 .../segment/memory/PinotNativeOrderLBuffer.java    |  181 ++
 .../segment/memory/PinotNonNativeOrderLBuffer.java |  181 ++
 .../segment/name/DefaultSegmentNameGenerator.java  |  141 ++
 .../name/NormalizedDateSegmentNameGenerator.java   |  164 ++
 .../core/segment/name/SegmentNameGenerator.java    |   30 +
 .../core/segment/store/ColumnIndexDirectory.java   |  172 ++
 .../pinot/core/segment/store/ColumnIndexType.java  |   44 +
 .../core/segment/store/FilePerIndexDirectory.java  |  194 ++
 .../pinot/core/segment/store/IndexEntry.java       |   44 +
 .../apache/pinot/core/segment/store/IndexKey.java  |   72 +
 .../pinot/core/segment/store/SegmentDirectory.java |  269 +++
 .../core/segment/store/SegmentDirectoryPaths.java  |  106 +
 .../segment/store/SegmentLocalFSDirectory.java     |  510 +++++
 .../segment/store/SingleFileIndexDirectory.java    |  367 ++++
 .../virtualcolumn/BaseVirtualColumnProvider.java   |   46 +
 .../virtualcolumn/DocIdVirtualColumnProvider.java  |  209 ++
 .../HostNameVirtualColumnProvider.java             |   29 +
 .../IntSingleValueDataFileReader.java              |   61 +
 .../SegmentNameVirtualColumnProvider.java          |   29 +
 .../SingleStringVirtualColumnProvider.java         |  179 ++
 .../virtualcolumn/VirtualColumnContext.java        |   59 +
 .../virtualcolumn/VirtualColumnIndexContainer.java |   66 +
 .../virtualcolumn/VirtualColumnProvider.java       |   42 +
 .../VirtualColumnProviderFactory.java              |   53 +
 .../core/segment/virtualcolumn/package-info.java   |   22 +
 .../pinot/core/startree/DimensionBuffer.java       |   77 +
 .../apache/pinot/core/startree/MetricBuffer.java   |  150 ++
 .../pinot/core/startree/OffHeapStarTree.java       |  143 ++
 .../core/startree/OffHeapStarTreeBuilder.java      |  843 ++++++++
 .../pinot/core/startree/OffHeapStarTreeNode.java   |  170 ++
 .../org/apache/pinot/core/startree/StarTree.java   |   45 +
 .../pinot/core/startree/StarTreeBuilder.java       |   81 +
 .../pinot/core/startree/StarTreeBuilderConfig.java |  125 ++
 .../pinot/core/startree/StarTreeBuilderUtils.java  |  192 ++
 .../pinot/core/startree/StarTreeDataTable.java     |  228 ++
 .../apache/pinot/core/startree/StarTreeNode.java   |   82 +
 .../apache/pinot/core/startree/StarTreeUtils.java  |  135 ++
 .../executor/StarTreeAggregationExecutor.java      |   68 +
 .../startree/executor/StarTreeGroupByExecutor.java |   81 +
 .../apache/pinot/core/startree/hll/HllUtil.java    |  158 ++
 .../startree/operator/StarTreeFilterOperator.java  |  438 ++++
 .../startree/plan/StarTreeDocIdSetPlanNode.java    |   59 +
 .../core/startree/plan/StarTreeFilterPlanNode.java |   63 +
 .../startree/plan/StarTreeProjectionPlanNode.java  |   67 +
 .../startree/plan/StarTreeTransformPlanNode.java   |   83 +
 .../startree/v2/AggregationFunctionColumnPair.java |   87 +
 .../apache/pinot/core/startree/v2/StarTreeV2.java  |   48 +
 .../core/startree/v2/StarTreeV2Constants.java      |   55 +
 .../pinot/core/startree/v2/StarTreeV2Metadata.java |   87 +
 .../startree/v2/builder/BaseSingleTreeBuilder.java |  515 +++++
 .../startree/v2/builder/MultipleTreesBuilder.java  |  134 ++
 .../v2/builder/OffHeapSingleTreeBuilder.java       |  361 ++++
 .../v2/builder/OnHeapSingleTreeBuilder.java        |  165 ++
 .../startree/v2/builder/SingleTreeBuilder.java     |   33 +
 .../startree/v2/builder/StarTreeIndexCombiner.java |   91 +
 .../v2/builder/StarTreeV2BuilderConfig.java        |  143 ++
 .../v2/store/StarTreeDimensionDataSource.java      |  132 ++
 .../startree/v2/store/StarTreeIndexContainer.java  |   93 +
 .../startree/v2/store/StarTreeIndexMapUtils.java   |  193 ++
 .../startree/v2/store/StarTreeLoaderUtils.java     |  183 ++
 .../v2/store/StarTreeMetricDataSource.java         |  138 ++
 .../pinot/core/transport/AsyncQueryResponse.java   |  106 +
 .../pinot/core/transport/DataTableHandler.java     |   78 +
 .../apache/pinot/core/transport/QueryRouter.java   |  136 ++
 .../org/apache/pinot/core/transport/Server.java    |  106 +
 .../pinot/core/transport/ServerChannels.java       |  108 +
 .../pinot/core/transport/ServerResponse.java       |   85 +
 .../org/apache/pinot/core/util/ArrayCopyUtils.java |  147 ++
 .../java/org/apache/pinot/core/util/AvroUtils.java |  325 +++
 .../pinot/core/util/BaseIndexedPriorityQueue.java  |  104 +
 .../java/org/apache/pinot/core/util/CrcUtils.java  |  113 +
 .../org/apache/pinot/core/util/FixedIntArray.java  |   68 +
 .../pinot/core/util/FixedIntArrayOffHeapIdMap.java |  147 ++
 .../java/org/apache/pinot/core/util/IdMap.java     |   78 +
 .../core/util/IntDoubleIndexedPriorityQueue.java   |  284 +++
 .../core/util/IntObjectIndexedPriorityQueue.java   |  283 +++
 .../java/org/apache/pinot/core/util/SizeUtil.java  |   34 +
 .../pinot/core/util/SortedRangeIntersection.java   |  130 ++
 .../pinot/core/util/trace/TraceCallable.java       |   52 +
 .../apache/pinot/core/util/trace/TraceContext.java |  201 ++
 .../pinot/core/util/trace/TraceRunnable.java       |   49 +
 .../server/realtime/ControllerLeaderLocator.java   |  151 ++
 .../ServerSegmentCompletionProtocolHandler.java    |  254 +++
 .../pinot/core/common/DataFetcherTest.java         |  238 ---
 .../pinot/core/common/ObjectSerDeUtilsTest.java    |  205 --
 .../core/common/RealtimeNoDictionaryTest.java      |  267 ---
 .../core/common/datatable/DataTableSerDeTest.java  |  239 ---
 .../core/common/docidsets/BitmapDocIdSetTest.java  |   79 -
 .../core/common/docidsets/SortedDocIdSetTest.java  |  138 --
 .../pinot/core/crypt/PinotCrypterFactoryTest.java  |   68 -
 .../function/FunctionExpressionEvaluatorTest.java  |   96 -
 .../data/manager/BaseTableDataManagerTest.java     |  432 ----
 .../realtime/LLRealtimeSegmentDataManagerTest.java |  849 --------
 .../core/data/partition/PartitionFunctionTest.java |  133 --
 .../readers/BackfillDateTimeRecordReaderTest.java  |  254 ---
 .../core/data/readers/CSVRecordReaderTest.java     |   71 -
 .../core/data/readers/JSONRecordReaderTest.java    |   66 -
 .../MultiplePinotSegmentRecordReaderTest.java      |  151 --
 .../data/readers/PinotSegmentRecordReaderTest.java |  131 --
 .../pinot/core/data/readers/PinotSegmentUtil.java  |  121 --
 .../pinot/core/data/readers/RecordReaderTest.java  |   49 -
 .../core/data/readers/ThriftRecordReaderTest.java  |  155 --
 .../pinot/core/data/readers/ThriftSampleData.java  | 1250 -----------
 .../data/recordtransformer/PinotDataTypeTest.java  |  147 --
 .../recordtransformer/RecordTransformerTest.java   |  136 --
 .../recordtransformer/TimeTransformerTest.java     |  149 --
 .../MutableSegmentImplAggregateMetricsTest.java    |  103 -
 .../mutable/MutableSegmentImplTest.java            |  174 --
 .../mutable/MutableSegmentImplTestUtils.java       |   59 -
 .../pinot/core/io/util/PinotDataBitSetTest.java    |  159 --
 .../impl/MmapMemoryManagerFileCleanupTest.java     |   65 -
 .../core/io/writer/impl/MmapMemoryManagerTest.java |  182 --
 .../impl/MutableOffHeapByteArrayStoreTest.java     |  120 --
 .../io/writer/impl/OffHeapStringStoreTest.java     |  116 -
 .../metadata/MetadataExtractorFactoryTest.java     |   34 -
 .../minion/MergeRollupSegmentConverterTest.java    |  186 --
 .../pinot/core/minion/SegmentConverterTest.java    |  229 --
 .../pinot/core/minion/SegmentPurgerTest.java       |  156 --
 .../dociditerators/BitmapDocIdIteratorTest.java    |   73 -
 .../RealtimeSingleValueIteratorTest.java           |  162 --
 .../operator/filter/AndFilterOperatorTest.java     |  110 -
 .../operator/filter/FilterOperatorUtilsTest.java   |  101 -
 .../pinot/core/operator/filter/IntRangesTest.java  |  101 -
 .../core/operator/filter/OrFilterOperatorTest.java |  107 -
 .../core/operator/filter/TestFilterOperator.java   |   81 -
 .../function/AdditionTransformFunctionTest.java    |   71 -
 .../function/BaseTransformFunctionTest.java        |  163 --
 .../DateTimeConversionTransformFunctionTest.java   |   70 -
 .../function/DivisionTransformFunctionTest.java    |  106 -
 .../MultiplicationTransformFunctionTest.java       |   71 -
 .../function/SubtractionTransformFunctionTest.java |  106 -
 .../TimeConversionTransformFunctionTest.java       |   76 -
 .../function/ValueInTransformFunctionTest.java     |   94 -
 .../datetime/DateTimeConverterTest.java            |  299 ---
 .../timeunit/TimeUnitTransformerTest.java          |   84 -
 .../periodictask/PeriodicTaskSchedulerTest.java    |  104 -
 .../pinot/core/plan/CombinePlanNodeTest.java       |  130 --
 ...adataAndDictionaryAggregationPlanMakerTest.java |  320 ---
 .../pinot/core/predicate/InPredicateTest.java      |   75 -
 .../NoDictionaryEqualsPredicateEvaluatorsTest.java |  221 --
 .../NoDictionaryInPredicateEvaluatorTest.java      |  259 ---
 .../NoDictionaryRangePredicateEvaluatorTest.java   |  266 ---
 .../predicate/PredicateEvaluatorTestUtils.java     |   57 -
 ...ngeOfflineDictionaryPredicateEvaluatorTest.java |  266 ---
 .../function/AggregationFunctionFactoryTest.java   |  147 --
 .../function/AggregationFunctionTypeTest.java      |   65 -
 .../scheduler/MultiLevelPriorityQueueTest.java     |  257 ---
 .../query/scheduler/PrioritySchedulerTest.java     |  318 ---
 .../pinot/core/query/scheduler/TestHelper.java     |   57 -
 .../core/query/scheduler/TestSchedulerGroup.java   |   46 -
 .../query/scheduler/TestSchedulerGroupFactory.java |   44 -
 .../scheduler/fcfs/FCFSSchedulerGroupTest.java     |   58 -
 .../resources/BoundedAccountingExecutorTest.java   |   97 -
 .../scheduler/resources/ResourceManagerTest.java   |   76 -
 .../resources/UnboundedResourceManagerTest.java    |   65 -
 .../tokenbucket/TokenSchedulerGroupTest.java       |  136 --
 .../impl/RealtimeSegmentStatsHistoryTest.java      |  289 ---
 .../impl/dictionary/DictionaryPerfRunner.java      |  134 --
 .../impl/dictionary/MultiValueDictionaryTest.java  |   93 -
 .../impl/dictionary/MutableDictionaryTest.java     |  377 ----
 .../kafka/AvroRecordToPinotRowGeneratorTest.java   |   55 -
 .../impl/kafka/KafkaLowLevelStreamConfigTest.java  |  103 -
 .../kafka/KafkaPartitionLevelConsumerTest.java     |  358 ----
 .../ConsumingSegmentAssignmentStrategyTest.java    |  286 ---
 .../stream/MetadataEqualsHashCodeTest.java         |   36 -
 .../core/realtime/stream/OffsetCriteriaTest.java   |   99 -
 .../core/realtime/stream/StreamConfigTest.java     |  467 ----
 .../core/segment/index/ColumnMetadataTest.java     |  225 --
 .../segment/index/SegmentMetadataImplTest.java     |  101 -
 .../SegmentV1V2ToV3FormatConverterTest.java        |  130 --
 .../index/creator/BloomFilterCreatorTest.java      |  153 --
 .../segment/index/creator/RawIndexCreatorTest.java |  288 ---
 .../SegmentGenerationWithBytesTypeTest.java        |  328 ---
 .../SegmentGenerationWithTimeColumnTest.java       |  171 --
 .../index/creator/SegmentPartitionTest.java        |  329 ---
 .../core/segment/index/loader/LoaderTest.java      |  225 --
 .../core/segment/index/loader/LoaderUtilsTest.java |   98 -
 .../index/loader/SegmentPreProcessorTest.java      |  430 ----
 .../readers/ImmutableDictionaryReaderTest.java     |  283 ---
 .../core/segment/memory/PinotDataBufferTest.java   |  629 ------
 .../name/DefaultSegmentNameGeneratorTest.java      |  155 --
 .../NormalizedDateSegmentNameGeneratorTest.java    |  143 --
 .../store/ColumnIndexDirectoryTestHelper.java      |  153 --
 .../segment/store/FilePerIndexDirectoryTest.java   |  182 --
 .../segment/store/SegmentDirectoryPathsTest.java   |   68 -
 .../segment/store/SegmentLocalFSDirectoryTest.java |  185 --
 .../store/SingleFileIndexDirectoryTest.java        |  204 --
 .../pinot/core/startree/BaseStarTreeIndexTest.java |  125 --
 .../core/startree/OffHeapStarTreeBuilderTest.java  |  124 --
 .../pinot/core/startree/StarTreeDataTableTest.java |   78 -
 .../startree/StarTreeIndexTestSegmentHelper.java   |  122 --
 .../pinot/core/startree/SumStarTreeIndexTest.java  |  127 --
 .../pinot/core/startree/TestStarTreeMetadata.java  |  126 --
 .../pinot/core/startree/hll/HllFieldSizeTest.java  |   54 -
 .../core/startree/hll/HllIndexCreationTest.java    |  180 --
 .../core/startree/hll/HllStarTreeIndexTest.java    |  149 --
 .../core/startree/hll/HllTypeConversionTest.java   |   73 -
 .../OffHeapStarTreeBuilderWithHllFieldTest.java    |  247 ---
 .../hll/SegmentWithHllIndexCreateHelper.java       |  180 --
 .../v2/AggregationFunctionColumnPairTest.java      |   94 -
 .../pinot/core/startree/v2/AvgStarTreeV2Test.java  |   52 -
 .../pinot/core/startree/v2/BaseStarTreeV2Test.java |  373 ----
 .../core/startree/v2/CountStarTreeV2Test.java      |   50 -
 .../v2/DistinctCountHLLStarTreeV2Test.java         |   51 -
 .../pinot/core/startree/v2/MaxStarTreeV2Test.java  |   50 -
 .../startree/v2/MinMaxRangeStarTreeV2Test.java     |   52 -
 .../pinot/core/startree/v2/MinStarTreeV2Test.java  |   50 -
 .../startree/v2/PercentileEstStarTreeV2Test.java   |   55 -
 .../v2/PercentileTDigestStarTreeV2Test.java        |   53 -
 .../v2/PreAggregatedAvgStarTreeV2Test.java         |   53 -
 ...reAggregatedDistinctCountHLLStarTreeV2Test.java |   57 -
 .../v2/PreAggregatedMinMaxRangeStarTreeV2Test.java |   56 -
 .../PreAggregatedPercentileEstStarTreeV2Test.java  |   60 -
 ...eAggregatedPercentileTDigestStarTreeV2Test.java |   59 -
 .../pinot/core/startree/v2/SumStarTreeV2Test.java  |   50 -
 .../linkedin/pinot/core/transport/DummyServer.java |  101 -
 .../pinot/core/transport/QueryRouterTest.java      |  227 --
 .../pinot/core/util/ArrayCopyUtilsTest.java        |  125 --
 .../com/linkedin/pinot/core/util/CrcUtilsTest.java |   90 -
 .../pinot/core/util/DoubleComparisonUtil.java      |   46 -
 .../core/util/SortedRangeIntersectionTest.java     |  208 --
 .../pinot/core/util/trace/TraceContextTest.java    |  122 --
 .../pinot/index/persist/AvroDataPublisherTest.java |  168 --
 .../pinot/index/reader/FileReaderTestUtils.java    |   44 -
 .../pinot/index/reader/FixedBitMultiValueTest.java |  206 --
 .../FixedByteWidthRowColDataFileReaderTest.java    |  103 -
 .../index/reader/SortedForwardIndexReaderTest.java |   90 -
 .../FixedByteChunkSingleValueReaderWriteTest.java  |  277 ---
 ...ByteSingleColumnMultiValueReaderWriterTest.java |  260 ---
 ...yteSingleColumnSingleValueReaderWriterTest.java |  173 --
 ...ByteSingleValueMultiColumnReaderWriterTest.java |  136 --
 .../VarByteChunkSingleValueReaderWriteTest.java    |  136 --
 .../FixedByteWidthRowColDataFileWriterTest.java    |  259 ---
 .../pinot/queries/BaseMultiValueQueriesTest.java   |  145 --
 .../linkedin/pinot/queries/BaseQueriesTest.java    |  124 --
 .../pinot/queries/BaseSingleValueQueriesTest.java  |  151 --
 .../linkedin/pinot/queries/FastHllQueriesTest.java |  263 ---
 ...nerSegmentAggregationMultiValueQueriesTest.java |  170 --
 ...erSegmentAggregationSingleValueQueriesTest.java |  147 --
 ...InnerSegmentSelectionMultiValueQueriesTest.java |  216 --
 ...nnerSegmentSelectionSingleValueQueriesTest.java |  277 ---
 ...terSegmentAggregationMultiValueQueriesTest.java |  378 ----
 ...erSegmentAggregationSingleValueQueriesTest.java |  383 ----
 .../queries/PercentileTDigestMVQueriesTest.java    |  104 -
 .../queries/PercentileTDigestQueriesTest.java      |  259 ---
 .../linkedin/pinot/queries/QueriesTestUtils.java   |  105 -
 .../DefaultAggregationExecutorTest.java            |  288 ---
 .../DoubleAggregationResultHolderTest.java         |   64 -
 .../AggregationGroupByTrimmingServiceTest.java     |  141 --
 .../DictionaryBasedGroupKeyGeneratorTest.java      |  411 ----
 .../groupby/DoubleGroupByResultHolderTest.java     |  114 -
 .../groupby/NoDictionaryGroupKeyGeneratorTest.java |  261 ---
 .../pinot/query/executor/QueryExecutorTest.java    |  166 --
 .../query/pruner/ColumnValueSegmentPrunerTest.java |  105 -
 .../selection/SelectionOperatorServiceTest.java    |  204 --
 .../converter/RealtimeSegmentConverterTest.java    |   53 -
 .../pinot/reduce/HavingClauseComparisonTests.java  |  346 ---
 .../v1/creator/BitmapInvertedIndexCreatorTest.java |  166 --
 .../v1/creator/BitmapInvertedIndexTest.java        |  139 --
 .../pinot/segments/v1/creator/BlocksTest.java      |   73 -
 .../segments/v1/creator/DictionariesTest.java      |  457 ----
 .../v1/creator/FixedIntArrayIdMapTest.java         |  126 --
 .../pinot/segments/v1/creator/IntArraysTest.java   |  113 -
 .../v1/creator/OnHeapDictionariesTest.java         |  214 --
 .../segments/v1/creator/SegmentTestUtils.java      |  239 ---
 .../realtime/ControllerLeaderLocatorTest.java      |  157 --
 .../util/IntDoubleIndexedPriorityQueueTest.java    |  108 -
 .../util/IntObjectIndexedPriorityQueueTest.java    |  119 --
 .../java/com/linkedin/pinot/util/TestUtils.java    |  210 --
 .../apache/pinot/core/common/DataFetcherTest.java  |  240 +++
 .../pinot/core/common/ObjectSerDeUtilsTest.java    |  205 ++
 .../core/common/RealtimeNoDictionaryTest.java      |  267 +++
 .../core/common/datatable/DataTableSerDeTest.java  |  239 +++
 .../core/common/docidsets/BitmapDocIdSetTest.java  |   81 +
 .../core/common/docidsets/SortedDocIdSetTest.java  |  140 ++
 .../pinot/core/crypt/PinotCrypterFactoryTest.java  |   68 +
 .../function/FunctionExpressionEvaluatorTest.java  |   96 +
 .../data/manager/BaseTableDataManagerTest.java     |  436 ++++
 .../realtime/LLRealtimeSegmentDataManagerTest.java |  852 ++++++++
 .../core/data/partition/PartitionFunctionTest.java |  133 ++
 .../readers/BackfillDateTimeRecordReaderTest.java  |  254 +++
 .../core/data/readers/CSVRecordReaderTest.java     |   71 +
 .../core/data/readers/JSONRecordReaderTest.java    |   66 +
 .../MultiplePinotSegmentRecordReaderTest.java      |  151 ++
 .../data/readers/PinotSegmentRecordReaderTest.java |  131 ++
 .../pinot/core/data/readers/PinotSegmentUtil.java  |  122 ++
 .../pinot/core/data/readers/RecordReaderTest.java  |   49 +
 .../core/data/readers/ThriftRecordReaderTest.java  |  155 ++
 .../pinot/core/data/readers/ThriftSampleData.java  | 1250 +++++++++++
 .../data/recordtransformer/PinotDataTypeTest.java  |  147 ++
 .../recordtransformer/RecordTransformerTest.java   |  136 ++
 .../recordtransformer/TimeTransformerTest.java     |  149 ++
 .../MutableSegmentImplAggregateMetricsTest.java    |  104 +
 .../mutable/MutableSegmentImplTest.java            |  185 ++
 .../mutable/MutableSegmentImplTestUtils.java       |   59 +
 .../pinot/core/io/util/PinotDataBitSetTest.java    |  160 ++
 .../impl/MmapMemoryManagerFileCleanupTest.java     |   65 +
 .../core/io/writer/impl/MmapMemoryManagerTest.java |  182 ++
 .../impl/MutableOffHeapByteArrayStoreTest.java     |  120 ++
 .../io/writer/impl/OffHeapStringStoreTest.java     |  116 +
 .../metadata/MetadataExtractorFactoryTest.java     |   34 +
 .../minion/MergeRollupSegmentConverterTest.java    |  186 ++
 .../pinot/core/minion/SegmentConverterTest.java    |  230 ++
 .../pinot/core/minion/SegmentPurgerTest.java       |  157 ++
 .../dociditerators/BitmapDocIdIteratorTest.java    |   75 +
 .../RealtimeSingleValueIteratorTest.java           |  163 ++
 .../operator/filter/AndFilterOperatorTest.java     |  110 +
 .../operator/filter/FilterOperatorUtilsTest.java   |  101 +
 .../pinot/core/operator/filter/IntRangesTest.java  |  101 +
 .../core/operator/filter/OrFilterOperatorTest.java |  107 +
 .../core/operator/filter/TestFilterOperator.java   |   81 +
 .../function/AdditionTransformFunctionTest.java    |   71 +
 .../function/BaseTransformFunctionTest.java        |  171 ++
 .../DateTimeConversionTransformFunctionTest.java   |   70 +
 .../function/DivisionTransformFunctionTest.java    |  106 +
 .../MultiplicationTransformFunctionTest.java       |   71 +
 .../function/SubtractionTransformFunctionTest.java |  106 +
 .../TimeConversionTransformFunctionTest.java       |   76 +
 .../function/ValueInTransformFunctionTest.java     |   94 +
 .../datetime/DateTimeConverterTest.java            |  299 +++
 .../timeunit/TimeUnitTransformerTest.java          |   84 +
 .../periodictask/PeriodicTaskSchedulerTest.java    |  104 +
 .../pinot/core/plan/CombinePlanNodeTest.java       |  130 ++
 ...adataAndDictionaryAggregationPlanMakerTest.java |  322 +++
 .../pinot/core/predicate/InPredicateTest.java      |   75 +
 .../NoDictionaryEqualsPredicateEvaluatorsTest.java |  221 ++
 .../NoDictionaryInPredicateEvaluatorTest.java      |  259 +++
 .../NoDictionaryRangePredicateEvaluatorTest.java   |  266 +++
 .../predicate/PredicateEvaluatorTestUtils.java     |   57 +
 ...ngeOfflineDictionaryPredicateEvaluatorTest.java |  266 +++
 .../function/AggregationFunctionFactoryTest.java   |  147 ++
 .../function/AggregationFunctionTypeTest.java      |   65 +
 .../scheduler/MultiLevelPriorityQueueTest.java     |  257 +++
 .../query/scheduler/PrioritySchedulerTest.java     |  318 +++
 .../pinot/core/query/scheduler/TestHelper.java     |   57 +
 .../core/query/scheduler/TestSchedulerGroup.java   |   46 +
 .../query/scheduler/TestSchedulerGroupFactory.java |   44 +
 .../scheduler/fcfs/FCFSSchedulerGroupTest.java     |   59 +
 .../resources/BoundedAccountingExecutorTest.java   |   97 +
 .../scheduler/resources/ResourceManagerTest.java   |   76 +
 .../resources/UnboundedResourceManagerTest.java    |   65 +
 .../tokenbucket/TokenSchedulerGroupTest.java       |  136 ++
 .../impl/RealtimeSegmentStatsHistoryTest.java      |  290 +++
 .../impl/dictionary/DictionaryPerfRunner.java      |  134 ++
 .../impl/dictionary/MultiValueDictionaryTest.java  |   94 +
 .../impl/dictionary/MutableDictionaryTest.java     |  377 ++++
 .../kafka/AvroRecordToPinotRowGeneratorTest.java   |   56 +
 .../impl/kafka/KafkaLowLevelStreamConfigTest.java  |  103 +
 .../kafka/KafkaPartitionLevelConsumerTest.java     |  358 ++++
 .../ConsumingSegmentAssignmentStrategyTest.java    |  289 +++
 .../stream/MetadataEqualsHashCodeTest.java         |   36 +
 .../core/realtime/stream/OffsetCriteriaTest.java   |   99 +
 .../core/realtime/stream/StreamConfigTest.java     |  467 ++++
 .../core/segment/index/ColumnMetadataTest.java     |  231 ++
 .../segment/index/SegmentMetadataImplTest.java     |  104 +
 .../SegmentV1V2ToV3FormatConverterTest.java        |  136 ++
 .../index/creator/BloomFilterCreatorTest.java      |  153 ++
 .../segment/index/creator/RawIndexCreatorTest.java |  289 +++
 .../SegmentGenerationWithBytesTypeTest.java        |  332 +++
 .../SegmentGenerationWithTimeColumnTest.java       |  172 ++
 .../index/creator/SegmentPartitionTest.java        |  331 +++
 .../core/segment/index/loader/LoaderTest.java      |  230 ++
 .../core/segment/index/loader/LoaderUtilsTest.java |   98 +
 .../index/loader/SegmentPreProcessorTest.java      |  433 ++++
 .../readers/ImmutableDictionaryReaderTest.java     |  284 +++
 .../core/segment/memory/PinotDataBufferTest.java   |  629 ++++++
 .../name/DefaultSegmentNameGeneratorTest.java      |  157 ++
 .../NormalizedDateSegmentNameGeneratorTest.java    |  143 ++
 .../store/ColumnIndexDirectoryTestHelper.java      |  154 ++
 .../segment/store/FilePerIndexDirectoryTest.java   |  183 ++
 .../segment/store/SegmentDirectoryPathsTest.java   |   69 +
 .../segment/store/SegmentLocalFSDirectoryTest.java |  186 ++
 .../store/SingleFileIndexDirectoryTest.java        |  205 ++
 .../pinot/core/startree/BaseStarTreeIndexTest.java |  125 ++
 .../core/startree/OffHeapStarTreeBuilderTest.java  |  124 ++
 .../pinot/core/startree/StarTreeDataTableTest.java |   78 +
 .../startree/StarTreeIndexTestSegmentHelper.java   |  122 ++
 .../pinot/core/startree/SumStarTreeIndexTest.java  |  127 ++
 .../pinot/core/startree/TestStarTreeMetadata.java  |  128 ++
 .../pinot/core/startree/hll/HllFieldSizeTest.java  |   54 +
 .../core/startree/hll/HllIndexCreationTest.java    |  180 ++
 .../core/startree/hll/HllStarTreeIndexTest.java    |  149 ++
 .../core/startree/hll/HllTypeConversionTest.java   |   73 +
 .../OffHeapStarTreeBuilderWithHllFieldTest.java    |  247 +++
 .../hll/SegmentWithHllIndexCreateHelper.java       |  182 ++
 .../v2/AggregationFunctionColumnPairTest.java      |   94 +
 .../pinot/core/startree/v2/AvgStarTreeV2Test.java  |   52 +
 .../pinot/core/startree/v2/BaseStarTreeV2Test.java |  373 ++++
 .../core/startree/v2/CountStarTreeV2Test.java      |   50 +
 .../v2/DistinctCountHLLStarTreeV2Test.java         |   51 +
 .../pinot/core/startree/v2/MaxStarTreeV2Test.java  |   50 +
 .../startree/v2/MinMaxRangeStarTreeV2Test.java     |   52 +
 .../pinot/core/startree/v2/MinStarTreeV2Test.java  |   50 +
 .../startree/v2/PercentileEstStarTreeV2Test.java   |   55 +
 .../v2/PercentileTDigestStarTreeV2Test.java        |   53 +
 .../v2/PreAggregatedAvgStarTreeV2Test.java         |   53 +
 ...reAggregatedDistinctCountHLLStarTreeV2Test.java |   57 +
 .../v2/PreAggregatedMinMaxRangeStarTreeV2Test.java |   56 +
 .../PreAggregatedPercentileEstStarTreeV2Test.java  |   60 +
 ...eAggregatedPercentileTDigestStarTreeV2Test.java |   59 +
 .../pinot/core/startree/v2/SumStarTreeV2Test.java  |   50 +
 .../apache/pinot/core/transport/DummyServer.java   |  101 +
 .../pinot/core/transport/QueryRouterTest.java      |  227 ++
 .../apache/pinot/core/util/ArrayCopyUtilsTest.java |  125 ++
 .../org/apache/pinot/core/util/CrcUtilsTest.java   |   94 +
 .../pinot/core/util/DoubleComparisonUtil.java      |   46 +
 .../core/util/SortedRangeIntersectionTest.java     |  208 ++
 .../pinot/core/util/trace/TraceContextTest.java    |  122 ++
 .../pinot/index/persist/AvroDataPublisherTest.java |  168 ++
 .../pinot/index/reader/FileReaderTestUtils.java    |   44 +
 .../pinot/index/reader/FixedBitMultiValueTest.java |  206 ++
 .../FixedByteWidthRowColDataFileReaderTest.java    |  103 +
 .../index/reader/SortedForwardIndexReaderTest.java |   90 +
 .../FixedByteChunkSingleValueReaderWriteTest.java  |  277 +++
 ...ByteSingleColumnMultiValueReaderWriterTest.java |  260 +++
 ...yteSingleColumnSingleValueReaderWriterTest.java |  173 ++
 ...ByteSingleValueMultiColumnReaderWriterTest.java |  138 ++
 .../VarByteChunkSingleValueReaderWriteTest.java    |  136 ++
 .../FixedByteWidthRowColDataFileWriterTest.java    |  259 +++
 .../pinot/queries/BaseMultiValueQueriesTest.java   |  145 ++
 .../org/apache/pinot/queries/BaseQueriesTest.java  |  124 ++
 .../pinot/queries/BaseSingleValueQueriesTest.java  |  151 ++
 .../apache/pinot/queries/FastHllQueriesTest.java   |  263 +++
 ...nerSegmentAggregationMultiValueQueriesTest.java |  170 ++
 ...erSegmentAggregationSingleValueQueriesTest.java |  147 ++
 ...InnerSegmentSelectionMultiValueQueriesTest.java |  216 ++
 ...nnerSegmentSelectionSingleValueQueriesTest.java |  277 +++
 ...terSegmentAggregationMultiValueQueriesTest.java |  378 ++++
 ...erSegmentAggregationSingleValueQueriesTest.java |  383 ++++
 .../queries/PercentileTDigestMVQueriesTest.java    |  104 +
 .../queries/PercentileTDigestQueriesTest.java      |  262 +++
 .../org/apache/pinot/queries/QueriesTestUtils.java |  105 +
 .../DefaultAggregationExecutorTest.java            |  288 +++
 .../DoubleAggregationResultHolderTest.java         |   64 +
 .../AggregationGroupByTrimmingServiceTest.java     |  141 ++
 .../DictionaryBasedGroupKeyGeneratorTest.java      |  411 ++++
 .../groupby/DoubleGroupByResultHolderTest.java     |  114 +
 .../groupby/NoDictionaryGroupKeyGeneratorTest.java |  261 +++
 .../pinot/query/executor/QueryExecutorTest.java    |  167 ++
 .../query/pruner/ColumnValueSegmentPrunerTest.java |  105 +
 .../selection/SelectionOperatorServiceTest.java    |  204 ++
 .../converter/RealtimeSegmentConverterTest.java    |   53 +
 .../pinot/reduce/HavingClauseComparisonTests.java  |  346 +++
 .../v1/creator/BitmapInvertedIndexCreatorTest.java |  166 ++
 .../v1/creator/BitmapInvertedIndexTest.java        |  139 ++
 .../pinot/segments/v1/creator/BlocksTest.java      |   73 +
 .../segments/v1/creator/DictionariesTest.java      |  457 ++++
 .../v1/creator/FixedIntArrayIdMapTest.java         |  129 ++
 .../pinot/segments/v1/creator/IntArraysTest.java   |  113 +
 .../v1/creator/OnHeapDictionariesTest.java         |  222 ++
 .../segments/v1/creator/SegmentTestUtils.java      |  239 +++
 .../realtime/ControllerLeaderLocatorTest.java      |  157 ++
 .../util/IntDoubleIndexedPriorityQueueTest.java    |  108 +
 .../util/IntObjectIndexedPriorityQueueTest.java    |  119 ++
 .../test/java/org/apache/pinot/util/TestUtils.java |  210 ++
 .../test/resources/conf/query-executor.properties  |    2 +-
 pinot-core/src/test/resources/log4j.properties     |    2 +-
 pinot-core/testng.xml                              |   12 +-
 pinot-distribution/pom.xml                         |   30 +-
 pinot-filesystem/pom.xml                           |    4 +-
 .../linkedin/pinot/filesystem/LocalPinotFS.java    |  185 --
 .../com/linkedin/pinot/filesystem/PinotFS.java     |  155 --
 .../linkedin/pinot/filesystem/PinotFSFactory.java  |   87 -
 .../org/apache/pinot/filesystem/LocalPinotFS.java  |  185 ++
 .../java/org/apache/pinot/filesystem/PinotFS.java  |  155 ++
 .../apache/pinot/filesystem/PinotFSFactory.java    |   87 +
 .../pinot/filesystem/LocalPinotFSTest.java         |  201 --
 .../pinot/filesystem/PinotFSFactoryTest.java       |  128 --
 .../apache/pinot/filesystem/LocalPinotFSTest.java  |  201 ++
 .../pinot/filesystem/PinotFSFactoryTest.java       |  128 ++
 pinot-hadoop-filesystem/pom.xml                    |    8 +-
 .../linkedin/pinot/filesystem/HadoopPinotFS.java   |  224 --
 .../org/apache/pinot/filesystem/HadoopPinotFS.java |  224 ++
 pinot-hadoop/README.md                             |    2 +-
 pinot-hadoop/pom.xml                               |   12 +-
 .../pinot/hadoop/PinotHadoopJobLauncher.java       |   96 -
 .../com/linkedin/pinot/hadoop/io/FileHandler.java  |  162 --
 .../pinot/hadoop/io/JsonPinotOutputFormat.java     |  130 --
 .../pinot/hadoop/io/PinotOutputFormat.java         |  258 ---
 .../com/linkedin/pinot/hadoop/io/PinotRecord.java  |   82 -
 .../pinot/hadoop/io/PinotRecordSerialization.java  |   47 -
 .../pinot/hadoop/io/PinotRecordWriter.java         |  127 --
 .../pinot/hadoop/job/ControllerRestApi.java        |  102 -
 .../pinot/hadoop/job/JobConfigConstants.java       |   43 -
 .../pinot/hadoop/job/SegmentCreationJob.java       |  355 ----
 .../pinot/hadoop/job/SegmentTarPushJob.java        |   97 -
 .../pinot/hadoop/job/SegmentUriPushJob.java        |  101 -
 .../mapper/HadoopSegmentCreationMapReduceJob.java  |  325 ---
 .../linkedin/pinot/hadoop/utils/PushLocation.java  |   64 -
 .../pinot/hadoop/PinotHadoopJobLauncher.java       |   95 +
 .../org/apache/pinot/hadoop/io/FileHandler.java    |  162 ++
 .../pinot/hadoop/io/JsonPinotOutputFormat.java     |  130 ++
 .../apache/pinot/hadoop/io/PinotOutputFormat.java  |  258 +++
 .../org/apache/pinot/hadoop/io/PinotRecord.java    |   82 +
 .../pinot/hadoop/io/PinotRecordSerialization.java  |   47 +
 .../apache/pinot/hadoop/io/PinotRecordWriter.java  |  128 ++
 .../apache/pinot/hadoop/job/ControllerRestApi.java |  103 +
 .../pinot/hadoop/job/JobConfigConstants.java       |   43 +
 .../pinot/hadoop/job/SegmentCreationJob.java       |  356 ++++
 .../apache/pinot/hadoop/job/SegmentTarPushJob.java |   97 +
 .../apache/pinot/hadoop/job/SegmentUriPushJob.java |  101 +
 .../mapper/HadoopSegmentCreationMapReduceJob.java  |  325 +++
 .../apache/pinot/hadoop/utils/PushLocation.java    |   64 +
 .../pinot/hadoop/io/PinotOutputFormatTest.java     |  201 --
 .../pinot/hadoop/io/PinotOutputFormatTest.java     |  201 ++
 pinot-integration-tests/pom.xml                    |   30 +-
 ...umSegmentAssignmentStrategyIntegrationTest.java |  138 --
 .../tests/BaseClusterIntegrationTest.java          |  343 ---
 .../tests/BaseClusterIntegrationTestSet.java       |  419 ----
 .../tests/ChaosMonkeyIntegrationTest.java          |  221 --
 .../tests/ClusterIntegrationTestUtils.java         |  856 --------
 .../pinot/integration/tests/ClusterTest.java       |  496 -----
 ...vertToRawIndexMinionClusterIntegrationTest.java |  204 --
 .../DeleteAPIHybridClusterIntegrationTest.java     |  275 ---
 ...lakyConsumerRealtimeClusterIntegrationTest.java |  121 --
 ...mentBuildPushOfflineClusterIntegrationTest.java |  161 --
 .../tests/HybridClusterIntegrationTest.java        |  310 ---
 ...ridClusterIntegrationTestCommandLineRunner.java |  381 ----
 .../tests/LLCRealtimeClusterIntegrationTest.java   |  140 --
 ...CRealtimeClusterSplitCommitIntegrationTest.java |   44 -
 ...onaryAggregationPlanClusterIntegrationTest.java |  492 -----
 .../MultiNodesOfflineClusterIntegrationTest.java   |   80 -
 .../tests/NewConfigApplyIntegrationTest.java       |  117 -
 .../tests/OfflineClusterIntegrationTest.java       |  572 -----
 .../tests/PinotURIUploadIntegrationTest.java       |  265 ---
 .../pinot/integration/tests/QueryGenerator.java    | 1104 ----------
 .../tests/RealtimeClusterIntegrationTest.java      |  197 --
 .../tests/SegmentCompletionIntegrationTests.java   |  282 ---
 .../tests/SimpleMinionClusterIntegrationTest.java  |  293 ---
 .../tests/StarTreeClusterIntegrationTest.java      |  214 --
 .../tests/StarTreeV2ClusterIntegrationTest.java    |  156 --
 .../tests/UploadRefreshDeleteIntegrationTest.java  |  291 ---
 ...umSegmentAssignmentStrategyIntegrationTest.java |  139 ++
 .../tests/BaseClusterIntegrationTest.java          |  345 +++
 .../tests/BaseClusterIntegrationTestSet.java       |  424 ++++
 .../tests/ChaosMonkeyIntegrationTest.java          |  225 ++
 .../tests/ClusterIntegrationTestUtils.java         |  858 ++++++++
 .../pinot/integration/tests/ClusterTest.java       |  505 +++++
 ...vertToRawIndexMinionClusterIntegrationTest.java |  207 ++
 .../DeleteAPIHybridClusterIntegrationTest.java     |  275 +++
 ...lakyConsumerRealtimeClusterIntegrationTest.java |  121 ++
 ...mentBuildPushOfflineClusterIntegrationTest.java |  161 ++
 .../tests/HybridClusterIntegrationTest.java        |  312 +++
 ...ridClusterIntegrationTestCommandLineRunner.java |  384 ++++
 .../tests/LLCRealtimeClusterIntegrationTest.java   |  141 ++
 ...CRealtimeClusterSplitCommitIntegrationTest.java |   45 +
 ...onaryAggregationPlanClusterIntegrationTest.java |  493 +++++
 .../MultiNodesOfflineClusterIntegrationTest.java   |   80 +
 .../tests/NewConfigApplyIntegrationTest.java       |  117 +
 .../tests/OfflineClusterIntegrationTest.java       |  575 +++++
 .../tests/PinotURIUploadIntegrationTest.java       |  265 +++
 .../pinot/integration/tests/QueryGenerator.java    | 1104 ++++++++++
 .../tests/RealtimeClusterIntegrationTest.java      |  198 ++
 .../tests/SegmentCompletionIntegrationTests.java   |  288 +++
 .../tests/SimpleMinionClusterIntegrationTest.java  |  302 +++
 .../tests/StarTreeClusterIntegrationTest.java      |  218 ++
 .../tests/StarTreeV2ClusterIntegrationTest.java    |  156 ++
 .../tests/UploadRefreshDeleteIntegrationTest.java  |  293 +++
 .../src/test/resources/log4j.properties            |    2 +-
 pinot-minion/pom.xml                               |    8 +-
 .../com/linkedin/pinot/minion/MinionContext.java   |   98 -
 .../com/linkedin/pinot/minion/MinionStarter.java   |  217 --
 .../minion/events/DefaultMinionEventObserver.java  |   46 -
 .../events/DefaultMinionEventObserverFactory.java  |   36 -
 .../events/EventObserverFactoryRegistry.java       |   52 -
 .../pinot/minion/events/MinionEventObserver.java   |   60 -
 .../minion/events/MinionEventObserverFactory.java  |   32 -
 .../pinot/minion/exception/FatalException.java     |   34 -
 .../minion/exception/TaskCancelledException.java   |   29 -
 .../BaseMultipleSegmentsConversionExecutor.java    |  152 --
 .../BaseSingleSegmentConversionExecutor.java       |  154 --
 .../pinot/minion/executor/BaseTaskExecutor.java    |   33 -
 .../executor/ConvertToRawIndexTaskExecutor.java    |   51 -
 .../ConvertToRawIndexTaskExecutorFactory.java      |   27 -
 .../pinot/minion/executor/PinotTaskExecutor.java   |   43 -
 .../minion/executor/PinotTaskExecutorFactory.java  |   32 -
 .../pinot/minion/executor/PurgeTaskExecutor.java   |   74 -
 .../minion/executor/PurgeTaskExecutorFactory.java  |   27 -
 .../minion/executor/SegmentConversionResult.java   |   92 -
 .../minion/executor/SegmentConversionUtils.java    |   97 -
 .../executor/TaskExecutorFactoryRegistry.java      |   69 -
 .../linkedin/pinot/minion/metrics/MinionGauge.java |   52 -
 .../linkedin/pinot/minion/metrics/MinionMeter.java |   59 -
 .../pinot/minion/metrics/MinionMetrics.java        |   46 -
 .../pinot/minion/metrics/MinionQueryPhase.java     |   38 -
 .../linkedin/pinot/minion/metrics/MinionTimer.java |   45 -
 .../minion/taskfactory/TaskFactoryRegistry.java    |  131 --
 .../org/apache/pinot/minion/MinionContext.java     |   98 +
 .../org/apache/pinot/minion/MinionStarter.java     |  219 ++
 .../minion/events/DefaultMinionEventObserver.java  |   46 +
 .../events/DefaultMinionEventObserverFactory.java  |   36 +
 .../events/EventObserverFactoryRegistry.java       |   52 +
 .../pinot/minion/events/MinionEventObserver.java   |   60 +
 .../minion/events/MinionEventObserverFactory.java  |   32 +
 .../pinot/minion/exception/FatalException.java     |   34 +
 .../minion/exception/TaskCancelledException.java   |   29 +
 .../BaseMultipleSegmentsConversionExecutor.java    |  152 ++
 .../BaseSingleSegmentConversionExecutor.java       |  154 ++
 .../pinot/minion/executor/BaseTaskExecutor.java    |   34 +
 .../executor/ConvertToRawIndexTaskExecutor.java    |   52 +
 .../ConvertToRawIndexTaskExecutorFactory.java      |   27 +
 .../pinot/minion/executor/PinotTaskExecutor.java   |   43 +
 .../minion/executor/PinotTaskExecutorFactory.java  |   32 +
 .../pinot/minion/executor/PurgeTaskExecutor.java   |   75 +
 .../minion/executor/PurgeTaskExecutorFactory.java  |   27 +
 .../minion/executor/SegmentConversionResult.java   |   92 +
 .../minion/executor/SegmentConversionUtils.java    |   97 +
 .../executor/TaskExecutorFactoryRegistry.java      |   69 +
 .../apache/pinot/minion/metrics/MinionGauge.java   |   52 +
 .../apache/pinot/minion/metrics/MinionMeter.java   |   59 +
 .../apache/pinot/minion/metrics/MinionMetrics.java |   46 +
 .../pinot/minion/metrics/MinionQueryPhase.java     |   38 +
 .../apache/pinot/minion/metrics/MinionTimer.java   |   45 +
 .../minion/taskfactory/TaskFactoryRegistry.java    |  135 ++
 .../minion/executor/PurgeTaskExecutorTest.java     |  135 --
 .../minion/executor/PurgeTaskExecutorTest.java     |  137 ++
 pinot-minion/src/test/resources/log4j.properties   |    2 +-
 pinot-perf/pom.xml                                 |   24 +-
 .../linkedin/pinot/perf/BenchmarkDictionary.java   |  181 --
 .../pinot/perf/BenchmarkDictionaryCreation.java    |  143 --
 .../perf/BenchmarkFixedIntArrayOffHeapIdMap.java   |  159 --
 .../perf/BenchmarkOffHeapDictionaryMemory.java     |  135 --
 .../pinot/perf/BenchmarkOfflineIndexReader.java    |  304 ---
 .../pinot/perf/BenchmarkOrDocIdIterator.java       |  167 --
 .../linkedin/pinot/perf/BenchmarkQueryEngine.java  |  175 --
 .../perf/BenchmarkRealtimeConsumptionSpeed.java    |  133 --
 .../pinot/perf/BenchmarkStringDictionary.java      |  123 --
 .../com/linkedin/pinot/perf/DictionaryDumper.java  |   56 -
 .../pinot/perf/ForwardIndexWriterBenchmark.java    |  116 -
 .../com/linkedin/pinot/perf/RawIndexBenchmark.java |  297 ---
 .../linkedin/pinot/perf/RealtimeStressTest.java    |  131 --
 .../pinot/perf/StringDictionaryPerfTest.java       |  147 --
 .../org/apache/pinot/perf/BenchmarkDictionary.java |  181 ++
 .../pinot/perf/BenchmarkDictionaryCreation.java    |  143 ++
 .../perf/BenchmarkFixedIntArrayOffHeapIdMap.java   |  159 ++
 .../perf/BenchmarkOffHeapDictionaryMemory.java     |  135 ++
 .../pinot/perf/BenchmarkOfflineIndexReader.java    |  306 +++
 .../pinot/perf/BenchmarkOrDocIdIterator.java       |  167 ++
 .../apache/pinot/perf/BenchmarkQueryEngine.java    |  176 ++
 .../perf/BenchmarkRealtimeConsumptionSpeed.java    |  134 ++
 .../pinot/perf/BenchmarkStringDictionary.java      |  123 ++
 .../org/apache/pinot/perf/DictionaryDumper.java    |   58 +
 .../pinot/perf/ForwardIndexWriterBenchmark.java    |  116 +
 .../org/apache/pinot/perf/RawIndexBenchmark.java   |  300 +++
 .../org/apache/pinot/perf/RealtimeStressTest.java  |  132 ++
 .../pinot/perf/StringDictionaryPerfTest.java       |  150 ++
 pinot-perf/src/main/resources/log4j.properties     |   12 +-
 pinot-server/pom.xml                               |   16 +-
 .../api/resources/DefaultExceptionMapper.java      |   58 -
 .../pinot/server/api/resources/ErrorInfo.java      |   44 -
 .../pinot/server/api/resources/ErrorResponse.java  |   36 -
 .../server/api/resources/HealthCheckResource.java  |   59 -
 .../server/api/resources/MmapDebugResource.java    |   48 -
 .../server/api/resources/SchedulerResource.java    |   49 -
 .../server/api/resources/TableSizeResource.java    |  130 --
 .../pinot/server/api/resources/TablesResource.java |  193 --
 .../pinot/server/conf/NettyServerConfig.java       |   45 -
 .../com/linkedin/pinot/server/conf/ServerConf.java |  102 -
 .../server/request/ScheduledRequestHandler.java    |   86 -
 .../pinot/server/starter/ServerBuilder.java        |  123 --
 .../pinot/server/starter/ServerInstance.java       |  138 --
 .../server/starter/helix/AdminApiApplication.java  |  118 --
 .../helix/DefaultHelixStarterServerConfig.java     |   80 -
 .../starter/helix/HelixInstanceDataManager.java    |  319 ---
 .../helix/HelixInstanceDataManagerConfig.java      |  199 --
 .../server/starter/helix/HelixServerStarter.java   |  511 -----
 .../starter/helix/SegmentFetcherAndLoader.java     |  236 ---
 .../pinot/server/starter/helix/SegmentLocks.java   |   38 -
 .../helix/SegmentMessageHandlerFactory.java        |  192 --
 .../SegmentOnlineOfflineStateModelFactory.java     |  234 --
 .../api/resources/DefaultExceptionMapper.java      |   58 +
 .../pinot/server/api/resources/ErrorInfo.java      |   44 +
 .../pinot/server/api/resources/ErrorResponse.java  |   36 +
 .../server/api/resources/HealthCheckResource.java  |   59 +
 .../server/api/resources/MmapDebugResource.java    |   49 +
 .../server/api/resources/SchedulerResource.java    |   50 +
 .../server/api/resources/TableSizeResource.java    |  136 ++
 .../pinot/server/api/resources/TablesResource.java |  198 ++
 .../pinot/server/conf/NettyServerConfig.java       |   45 +
 .../org/apache/pinot/server/conf/ServerConf.java   |  102 +
 .../server/request/ScheduledRequestHandler.java    |   88 +
 .../apache/pinot/server/starter/ServerBuilder.java |  129 ++
 .../pinot/server/starter/ServerInstance.java       |  142 ++
 .../server/starter/helix/AdminApiApplication.java  |  118 ++
 .../helix/DefaultHelixStarterServerConfig.java     |   80 +
 .../starter/helix/HelixInstanceDataManager.java    |  328 +++
 .../helix/HelixInstanceDataManagerConfig.java      |  200 ++
 .../server/starter/helix/HelixServerStarter.java   |  517 +++++
 .../starter/helix/SegmentFetcherAndLoader.java     |  243 +++
 .../pinot/server/starter/helix/SegmentLocks.java   |   38 +
 .../helix/SegmentMessageHandlerFactory.java        |  193 ++
 .../SegmentOnlineOfflineStateModelFactory.java     |  238 +++
 .../server/api/resources/BaseResourceTest.java     |  136 --
 .../api/resources/TableSizeResourceTest.java       |   73 -
 .../server/api/resources/TablesResourceTest.java   |  151 --
 .../realtime/RealtimeTableDataManagerTest.java     |  317 ---
 .../request/ScheduledRequestHandlerTest.java       |  213 --
 .../pinot/server/util/SegmentTestUtils.java        |   61 -
 .../server/api/resources/BaseResourceTest.java     |  146 ++
 .../api/resources/TableSizeResourceTest.java       |   74 +
 .../server/api/resources/TablesResourceTest.java   |  154 ++
 .../realtime/RealtimeTableDataManagerTest.java     |  332 +++
 .../request/ScheduledRequestHandlerTest.java       |  222 ++
 .../apache/pinot/server/util/SegmentTestUtils.java |   65 +
 pinot-tools/pom.xml                                |   44 +-
 .../linkedin/pinot/tools/AbstractBaseCommand.java  |   62 -
 .../pinot/tools/AutoAddInvertedIndexTool.java      |   97 -
 .../linkedin/pinot/tools/ClusterStateVerifier.java |  155 --
 .../java/com/linkedin/pinot/tools/Command.java     |   34 -
 .../com/linkedin/pinot/tools/HybridQuickstart.java |  172 --
 .../pinot/tools/PinotIdealstateChanger.java        |   67 -
 .../pinot/tools/PinotNumReplicaChanger.java        |  123 --
 .../pinot/tools/PinotSegmentRebalancer.java        |  236 ---
 .../linkedin/pinot/tools/PinotToolLauncher.java    |  101 -
 .../com/linkedin/pinot/tools/PinotZKChanger.java   |  150 --
 .../java/com/linkedin/pinot/tools/Quickstart.java  |  232 --
 .../pinot/tools/QuickstartTableRequest.java        |  100 -
 .../linkedin/pinot/tools/RealtimeQuickStart.java   |  139 --
 .../com/linkedin/pinot/tools/SegmentDumpTool.java  |  119 --
 .../java/com/linkedin/pinot/tools/SpeedTest.java   |  121 --
 .../linkedin/pinot/tools/StarTreeIndexViewer.java  |  228 --
 .../linkedin/pinot/tools/UpdateSegmentState.java   |  208 --
 .../pinot/tools/ValidateTableRetention.java        |   69 -
 .../pinot/tools/admin/PinotAdministrator.java      |  168 --
 .../linkedin/pinot/tools/admin/PinotBroker.java    |   36 -
 .../pinot/tools/admin/PinotController.java         |   36 -
 .../linkedin/pinot/tools/admin/PinotServer.java    |   36 -
 .../admin/command/AbstractBaseAdminCommand.java    |  134 --
 .../tools/admin/command/AddSchemaCommand.java      |  126 --
 .../pinot/tools/admin/command/AddTableCommand.java |  132 --
 .../tools/admin/command/AddTenantCommand.java      |  155 --
 .../admin/command/ApplyTableConfigCommand.java     |  145 --
 .../admin/command/AvroSchemaToPinotSchema.java     |  145 --
 .../command/BackfillDateTimeColumnCommand.java     |  236 ---
 .../admin/command/ChangeNumReplicasCommand.java    |   72 -
 .../tools/admin/command/ChangeTableState.java      |  104 -
 .../tools/admin/command/CreateSegmentCommand.java  |  392 ----
 .../tools/admin/command/DeleteClusterCommand.java  |   90 -
 .../tools/admin/command/GenerateDataCommand.java   |  219 --
 .../tools/admin/command/MoveReplicaGroup.java      |  482 -----
 .../tools/admin/command/PostQueryCommand.java      |  129 --
 .../tools/admin/command/QuickstartRunner.java      |  219 --
 .../command/RealtimeProvisioningHelperCommand.java |  220 --
 .../tools/admin/command/RebalanceTableCommand.java |   82 -
 .../admin/command/ShowClusterInfoCommand.java      |  257 ---
 .../tools/admin/command/StartBrokerCommand.java    |  138 --
 .../admin/command/StartControllerCommand.java      |  220 --
 .../tools/admin/command/StartKafkaCommand.java     |   77 -
 .../tools/admin/command/StartServerCommand.java    |  172 --
 .../tools/admin/command/StartZookeeperCommand.java |  145 --
 .../tools/admin/command/StopProcessCommand.java    |  227 --
 .../admin/command/StreamAvroIntoKafkaCommand.java  |  137 --
 .../tools/admin/command/UploadSegmentCommand.java  |  138 --
 .../tools/admin/command/ValidateConfigCommand.java |  195 --
 .../admin/command/VerifyClusterStateCommand.java   |   89 -
 .../tools/admin/command/VerifySegmentState.java    |  138 --
 .../pinot/tools/backfill/BackfillSegmentUtils.java |  186 --
 .../tools/config/validator/SchemaValidator.java    |   32 -
 .../config/validator/TableConfigValidator.java     |   33 -
 .../pinot/tools/data/generator/AvroWriter.java     |   73 -
 .../pinot/tools/data/generator/DataGenerator.java  |  162 --
 .../tools/data/generator/DataGeneratorSpec.java    |  123 --
 .../pinot/tools/data/generator/Generator.java      |   29 -
 .../tools/data/generator/GeneratorFactory.java     |   73 -
 .../tools/data/generator/NumberGenerator.java      |  132 --
 .../tools/data/generator/RangeDoubleGenerator.java |   45 -
 .../tools/data/generator/RangeFloatGenerator.java  |   45 -
 .../tools/data/generator/RangeIntGenerator.java    |   45 -
 .../tools/data/generator/RangeLongGenerator.java   |   46 -
 .../tools/data/generator/SchemaAnnotation.java     |   82 -
 .../tools/data/generator/StringGenerator.java      |   70 -
 .../pinot/tools/perf/PerfBenchmarkDriver.java      |  431 ----
 .../pinot/tools/perf/PerfBenchmarkDriverConf.java  |  340 ---
 .../pinot/tools/perf/PerfBenchmarkRunner.java      |  200 --
 .../com/linkedin/pinot/tools/perf/QueryRunner.java |  750 -------
 .../pinot/tools/perf/ZookeeperLauncher.java        |   75 -
 .../tools/query/comparison/ClusterStarter.java     |  282 ---
 .../tools/query/comparison/QueryComparison.java    |  589 ------
 .../query/comparison/QueryComparisonConfig.java    |  207 --
 .../query/comparison/SegmentInfoProvider.java      |  183 --
 .../query/comparison/StarQueryComparison.java      |  129 --
 .../query/comparison/StarTreeQueryGenerator.java   |  359 ----
 .../tools/query/comparison/StatsGenerator.java     |   84 -
 .../realtime/provisioning/MemoryEstimator.java     |  373 ----
 .../pinot/tools/scan/query/Aggregation.java        |  201 --
 .../pinot/tools/scan/query/AggregationFunc.java    |   33 -
 .../tools/scan/query/AggregationFuncFactory.java   |   57 -
 .../pinot/tools/scan/query/AvgFunction.java        |   59 -
 .../pinot/tools/scan/query/CountFunction.java      |   45 -
 .../tools/scan/query/DistinctCountFunction.java    |   59 -
 .../tools/scan/query/EqualsPredicateFilter.java    |   45 -
 .../pinot/tools/scan/query/GroupByOperator.java    |   91 -
 .../pinot/tools/scan/query/InPredicateFilter.java  |   53 -
 .../pinot/tools/scan/query/MaxFunction.java        |   47 -
 .../pinot/tools/scan/query/MinFunction.java        |   46 -
 .../tools/scan/query/MinMaxRangeFunction.java      |   48 -
 .../tools/scan/query/NotInPredicateFilter.java     |   52 -
 .../pinot/tools/scan/query/NotPredicateFilter.java |   45 -
 .../pinot/tools/scan/query/PredicateFilter.java    |   25 -
 .../pinot/tools/scan/query/Projection.java         |  146 --
 .../pinot/tools/scan/query/QueryResponse.java      |  273 ---
 .../tools/scan/query/RangePredicateFilter.java     |   83 -
 .../pinot/tools/scan/query/ResultTable.java        |  300 ---
 .../tools/scan/query/ScanBasedQueryProcessor.java  |  184 --
 .../tools/scan/query/SegmentQueryProcessor.java    |  310 ---
 .../linkedin/pinot/tools/scan/query/Selection.java |   62 -
 .../pinot/tools/scan/query/SumFunction.java        |   46 -
 .../com/linkedin/pinot/tools/scan/query/Utils.java |   67 -
 .../converter/ColumnarToStarTreeConverter.java     |  177 --
 .../converter/DictionaryToRawIndexConverter.java   |  377 ----
 .../converter/PinotSegmentConvertCommand.java      |  165 --
 .../segment/converter/PinotSegmentConverter.java   |   30 -
 .../converter/PinotSegmentToAvroConverter.java     |   73 -
 .../converter/PinotSegmentToCsvConverter.java      |   82 -
 .../converter/PinotSegmentToJsonConverter.java     |   65 -
 .../segment/converter/SegmentMergeCommand.java     |  300 ---
 .../pinot/tools/streams/AirlineDataStream.java     |  167 --
 .../pinot/tools/streams/MeetupRsvpStream.java      |  132 --
 .../apache/pinot/tools/AbstractBaseCommand.java    |   62 +
 .../pinot/tools/AutoAddInvertedIndexTool.java      |   98 +
 .../apache/pinot/tools/ClusterStateVerifier.java   |  155 ++
 .../main/java/org/apache/pinot/tools/Command.java  |   34 +
 .../org/apache/pinot/tools/HybridQuickstart.java   |  174 ++
 .../apache/pinot/tools/PinotIdealstateChanger.java |   67 +
 .../apache/pinot/tools/PinotNumReplicaChanger.java |  123 ++
 .../apache/pinot/tools/PinotSegmentRebalancer.java |  236 +++
 .../org/apache/pinot/tools/PinotToolLauncher.java  |  101 +
 .../org/apache/pinot/tools/PinotZKChanger.java     |  150 ++
 .../java/org/apache/pinot/tools/Quickstart.java    |  233 ++
 .../apache/pinot/tools/QuickstartTableRequest.java |  100 +
 .../org/apache/pinot/tools/RealtimeQuickStart.java |  141 ++
 .../org/apache/pinot/tools/SegmentDumpTool.java    |  120 ++
 .../java/org/apache/pinot/tools/SpeedTest.java     |  121 ++
 .../apache/pinot/tools/StarTreeIndexViewer.java    |  229 ++
 .../org/apache/pinot/tools/UpdateSegmentState.java |  208 ++
 .../apache/pinot/tools/ValidateTableRetention.java |   70 +
 .../pinot/tools/admin/PinotAdministrator.java      |  170 ++
 .../org/apache/pinot/tools/admin/PinotBroker.java  |   36 +
 .../apache/pinot/tools/admin/PinotController.java  |   36 +
 .../org/apache/pinot/tools/admin/PinotServer.java  |   36 +
 .../admin/command/AbstractBaseAdminCommand.java    |  134 ++
 .../tools/admin/command/AddSchemaCommand.java      |  127 ++
 .../pinot/tools/admin/command/AddTableCommand.java |  133 ++
 .../tools/admin/command/AddTenantCommand.java      |  155 ++
 .../admin/command/ApplyTableConfigCommand.java     |  145 ++
 .../admin/command/AvroSchemaToPinotSchema.java     |  145 ++
 .../command/BackfillDateTimeColumnCommand.java     |  237 +++
 .../admin/command/ChangeNumReplicasCommand.java    |   72 +
 .../tools/admin/command/ChangeTableState.java      |  104 +
 .../tools/admin/command/CreateSegmentCommand.java  |  393 ++++
 .../tools/admin/command/DeleteClusterCommand.java  |   90 +
 .../tools/admin/command/GenerateDataCommand.java   |  222 ++
 .../tools/admin/command/MoveReplicaGroup.java      |  482 +++++
 .../tools/admin/command/PostQueryCommand.java      |  129 ++
 .../tools/admin/command/QuickstartRunner.java      |  219 ++
 .../command/RealtimeProvisioningHelperCommand.java |  220 ++
 .../tools/admin/command/RebalanceTableCommand.java |   82 +
 .../admin/command/ShowClusterInfoCommand.java      |  257 +++
 .../tools/admin/command/StartBrokerCommand.java    |  139 ++
 .../admin/command/StartControllerCommand.java      |  222 ++
 .../tools/admin/command/StartKafkaCommand.java     |   77 +
 .../tools/admin/command/StartServerCommand.java    |  172 ++
 .../tools/admin/command/StartZookeeperCommand.java |  145 ++
 .../tools/admin/command/StopProcessCommand.java    |  227 ++
 .../admin/command/StreamAvroIntoKafkaCommand.java  |  137 ++
 .../tools/admin/command/UploadSegmentCommand.java  |  139 ++
 .../tools/admin/command/ValidateConfigCommand.java |  195 ++
 .../admin/command/VerifyClusterStateCommand.java   |   89 +
 .../tools/admin/command/VerifySegmentState.java    |  138 ++
 .../pinot/tools/backfill/BackfillSegmentUtils.java |  188 ++
 .../tools/config/validator/SchemaValidator.java    |   32 +
 .../config/validator/TableConfigValidator.java     |   33 +
 .../pinot/tools/data/generator/AvroWriter.java     |   73 +
 .../pinot/tools/data/generator/DataGenerator.java  |  162 ++
 .../tools/data/generator/DataGeneratorSpec.java    |  123 ++
 .../pinot/tools/data/generator/Generator.java      |   29 +
 .../tools/data/generator/GeneratorFactory.java     |   73 +
 .../tools/data/generator/NumberGenerator.java      |  132 ++
 .../tools/data/generator/RangeDoubleGenerator.java |   45 +
 .../tools/data/generator/RangeFloatGenerator.java  |   45 +
 .../tools/data/generator/RangeIntGenerator.java    |   45 +
 .../tools/data/generator/RangeLongGenerator.java   |   46 +
 .../tools/data/generator/SchemaAnnotation.java     |   82 +
 .../tools/data/generator/StringGenerator.java      |   70 +
 .../pinot/tools/perf/PerfBenchmarkDriver.java      |  436 ++++
 .../pinot/tools/perf/PerfBenchmarkDriverConf.java  |  340 +++
 .../pinot/tools/perf/PerfBenchmarkRunner.java      |  202 ++
 .../org/apache/pinot/tools/perf/QueryRunner.java   |  752 +++++++
 .../apache/pinot/tools/perf/ZookeeperLauncher.java |   75 +
 .../tools/query/comparison/ClusterStarter.java     |  293 +++
 .../tools/query/comparison/QueryComparison.java    |  592 ++++++
 .../query/comparison/QueryComparisonConfig.java    |  207 ++
 .../query/comparison/SegmentInfoProvider.java      |  184 ++
 .../query/comparison/StarQueryComparison.java      |  129 ++
 .../query/comparison/StarTreeQueryGenerator.java   |  360 ++++
 .../tools/query/comparison/StatsGenerator.java     |   84 +
 .../realtime/provisioning/MemoryEstimator.java     |  374 ++++
 .../apache/pinot/tools/scan/query/Aggregation.java |  202 ++
 .../pinot/tools/scan/query/AggregationFunc.java    |   33 +
 .../tools/scan/query/AggregationFuncFactory.java   |   57 +
 .../apache/pinot/tools/scan/query/AvgFunction.java |   59 +
 .../pinot/tools/scan/query/CountFunction.java      |   45 +
 .../tools/scan/query/DistinctCountFunction.java    |   59 +
 .../tools/scan/query/EqualsPredicateFilter.java    |   45 +
 .../pinot/tools/scan/query/GroupByOperator.java    |   91 +
 .../pinot/tools/scan/query/InPredicateFilter.java  |   53 +
 .../apache/pinot/tools/scan/query/MaxFunction.java |   47 +
 .../apache/pinot/tools/scan/query/MinFunction.java |   46 +
 .../tools/scan/query/MinMaxRangeFunction.java      |   48 +
 .../tools/scan/query/NotInPredicateFilter.java     |   52 +
 .../pinot/tools/scan/query/NotPredicateFilter.java |   45 +
 .../pinot/tools/scan/query/PredicateFilter.java    |   25 +
 .../apache/pinot/tools/scan/query/Projection.java  |  147 ++
 .../pinot/tools/scan/query/QueryResponse.java      |  273 +++
 .../tools/scan/query/RangePredicateFilter.java     |   83 +
 .../apache/pinot/tools/scan/query/ResultTable.java |  300 +++
 .../tools/scan/query/ScanBasedQueryProcessor.java  |  184 ++
 .../tools/scan/query/SegmentQueryProcessor.java    |  312 +++
 .../apache/pinot/tools/scan/query/Selection.java   |   63 +
 .../apache/pinot/tools/scan/query/SumFunction.java |   46 +
 .../org/apache/pinot/tools/scan/query/Utils.java   |   67 +
 .../converter/ColumnarToStarTreeConverter.java     |  178 ++
 .../converter/DictionaryToRawIndexConverter.java   |  378 ++++
 .../converter/PinotSegmentConvertCommand.java      |  165 ++
 .../segment/converter/PinotSegmentConverter.java   |   30 +
 .../converter/PinotSegmentToAvroConverter.java     |   73 +
 .../converter/PinotSegmentToCsvConverter.java      |   82 +
 .../converter/PinotSegmentToJsonConverter.java     |   65 +
 .../segment/converter/SegmentMergeCommand.java     |  300 +++
 .../pinot/tools/streams/AirlineDataStream.java     |  167 ++
 .../pinot/tools/streams/MeetupRsvpStream.java      |  132 ++
 .../resources/conf/pinot-admin-log4j.properties    |   12 +-
 .../resources/conf/pinot-broker-log4j.properties   |    2 +-
 .../conf/pinot-controller-log4j.properties         |    2 +-
 .../resources/conf/pinot-server-log4j.properties   |    2 +-
 .../resources/conf/pinot-tools-log4j.properties    |   12 +-
 .../resources/conf/quickstart-log4j.properties     |   12 +-
 .../conf/quickstart-offline-log4j.properties       |   12 +-
 .../conf/quickstart-realtime-log4j.properties      |   12 +-
 .../main/resources/conf/sample_perf_benchmark.yaml |    2 +-
 .../conf/sample_realtime_table_config.json         |    2 +-
 pinot-tools/src/main/resources/log4j.properties    |   12 +-
 .../airlineStats_realtime_table_config.json        |    2 +-
 .../meetupRsvp_realtime_table_config.json          |    4 +-
 pinot-transport/pom.xml                            |   10 +-
 .../common/AbstractCompositeListenableFuture.java  |  243 ---
 .../transport/common/AsyncResponseFuture.java      |  341 ---
 .../linkedin/pinot/transport/common/Callback.java  |   39 -
 .../pinot/transport/common/Cancellable.java        |   28 -
 .../pinot/transport/common/CompositeFuture.java    |  224 --
 .../pinot/transport/common/LinkedDequeue.java      |  360 ----
 .../linkedin/pinot/transport/common/NoneType.java  |   28 -
 .../pinot/transport/common/SelectingFuture.java    |  174 --
 .../transport/common/ServerResponseFuture.java     |   96 -
 .../pinot/transport/conf/TransportClientConf.java  |   76 -
 .../transport/config/ConnectionPoolConfig.java     |  138 --
 .../transport/config/PerTableRoutingConfig.java    |  145 --
 .../pinot/transport/config/RoutingTableConfig.java |   82 -
 .../pinot/transport/config/ThreadPoolConfig.java   |   79 -
 .../transport/metrics/AggregatedPoolStats.java     |  250 ---
 .../metrics/AggregatedTransportClientMetrics.java  |  200 --
 .../metrics/AggregatedTransportServerMetrics.java  |  180 --
 .../pinot/transport/metrics/AsyncPoolStats.java    |  239 ---
 .../transport/metrics/NettyClientMetrics.java      |  167 --
 .../transport/metrics/NettyServerMetrics.java      |  137 --
 .../pinot/transport/metrics/PoolStats.java         |  165 --
 .../pinot/transport/metrics/PoolStatsProvider.java |   35 -
 .../transport/metrics/TransportClientMetrics.java  |   69 -
 .../transport/metrics/TransportServerMetrics.java  |   64 -
 .../transport/netty/NettyClientConnection.java     |  157 --
 .../pinot/transport/netty/NettyServer.java         |  324 ---
 .../transport/netty/NettyTCPClientConnection.java  |  431 ----
 .../pinot/transport/netty/NettyTCPServer.java      |  116 -
 .../netty/PooledNettyClientResourceManager.java    |  145 --
 .../linkedin/pinot/transport/pool/AsyncPool.java   |  138 --
 .../pinot/transport/pool/AsyncPoolImpl.java        |  713 -------
 .../pool/AsyncPoolResourceManagerAdapter.java      |  129 --
 .../linkedin/pinot/transport/pool/KeyedPool.java   |  108 -
 .../pinot/transport/pool/KeyedPoolImpl.java        |  225 --
 .../transport/pool/PooledResourceManager.java      |   59 -
 .../transport/pool/SizeLimitExceededException.java |   32 -
 .../transport/scattergather/ScatterGather.java     |   64 -
 .../transport/scattergather/ScatterGatherImpl.java |  392 ----
 .../scattergather/ScatterGatherRequest.java        |   65 -
 .../scattergather/ScatterGatherStats.java          |  112 -
 .../common/AbstractCompositeListenableFuture.java  |  242 +++
 .../transport/common/AsyncResponseFuture.java      |  341 +++
 .../apache/pinot/transport/common/Callback.java    |   39 +
 .../apache/pinot/transport/common/Cancellable.java |   28 +
 .../pinot/transport/common/CompositeFuture.java    |  224 ++
 .../pinot/transport/common/LinkedDequeue.java      |  360 ++++
 .../apache/pinot/transport/common/NoneType.java    |   28 +
 .../pinot/transport/common/SelectingFuture.java    |  173 ++
 .../transport/common/ServerResponseFuture.java     |   95 +
 .../pinot/transport/conf/TransportClientConf.java  |   76 +
 .../transport/config/ConnectionPoolConfig.java     |  138 ++
 .../transport/config/PerTableRoutingConfig.java    |  145 ++
 .../pinot/transport/config/RoutingTableConfig.java |   82 +
 .../pinot/transport/config/ThreadPoolConfig.java   |   79 +
 .../transport/metrics/AggregatedPoolStats.java     |  250 +++
 .../metrics/AggregatedTransportClientMetrics.java  |  200 ++
 .../metrics/AggregatedTransportServerMetrics.java  |  180 ++
 .../pinot/transport/metrics/AsyncPoolStats.java    |  239 +++
 .../transport/metrics/NettyClientMetrics.java      |  167 ++
 .../transport/metrics/NettyServerMetrics.java      |  137 ++
 .../apache/pinot/transport/metrics/PoolStats.java  |  165 ++
 .../pinot/transport/metrics/PoolStatsProvider.java |   35 +
 .../transport/metrics/TransportClientMetrics.java  |   69 +
 .../transport/metrics/TransportServerMetrics.java  |   64 +
 .../transport/netty/NettyClientConnection.java     |  157 ++
 .../apache/pinot/transport/netty/NettyServer.java  |  323 +++
 .../transport/netty/NettyTCPClientConnection.java  |  430 ++++
 .../pinot/transport/netty/NettyTCPServer.java      |  115 +
 .../netty/PooledNettyClientResourceManager.java    |  145 ++
 .../org/apache/pinot/transport/pool/AsyncPool.java |  137 ++
 .../apache/pinot/transport/pool/AsyncPoolImpl.java |  713 +++++++
 .../pool/AsyncPoolResourceManagerAdapter.java      |  127 ++
 .../org/apache/pinot/transport/pool/KeyedPool.java |  108 +
 .../apache/pinot/transport/pool/KeyedPoolImpl.java |  225 ++
 .../transport/pool/PooledResourceManager.java      |   59 +
 .../transport/pool/SizeLimitExceededException.java |   32 +
 .../transport/scattergather/ScatterGather.java     |   64 +
 .../transport/scattergather/ScatterGatherImpl.java |  392 ++++
 .../scattergather/ScatterGatherRequest.java        |   65 +
 .../scattergather/ScatterGatherStats.java          |  112 +
 .../test/java/com/linkedin/pinot/Checkable.java    |   30 -
 .../test/java/com/linkedin/pinot/TestUtils.java    |   56 -
 .../transport/common/CompositeFutureTest.java      |  662 ------
 .../pinot/transport/common/ResponseFutureTest.java |  709 -------
 .../transport/common/SelectingFutureTest.java      |  287 ---
 .../pinot/transport/common/ServerInstanceTest.java |   79 -
 .../transport/netty/NettyCloseChannelTest.java     |  125 --
 .../NettySingleConnectionIntegrationTest.java      |  310 ---
 .../pinot/transport/netty/NettyTestUtils.java      |  110 -
 .../transport/perf/ScatterGatherPerfClient.java    |  486 -----
 .../transport/perf/ScatterGatherPerfServer.java    |  212 --
 .../transport/perf/ScatterGatherPerfTester.java    |  337 ---
 .../pool/AsyncPoolResourceManagerAdapterTest.java  |  243 ---
 .../pinot/transport/pool/KeyedPoolImplTest.java    |  649 ------
 .../transport/scattergather/ScatterGatherTest.java |  322 ---
 .../src/test/java/org/apache/pinot/Checkable.java  |   30 +
 .../src/test/java/org/apache/pinot/TestUtils.java  |   56 +
 .../transport/common/CompositeFutureTest.java      |  662 ++++++
 .../pinot/transport/common/ResponseFutureTest.java |  710 +++++++
 .../transport/common/SelectingFutureTest.java      |  287 +++
 .../pinot/transport/common/ServerInstanceTest.java |   77 +
 .../transport/netty/NettyCloseChannelTest.java     |  125 ++
 .../NettySingleConnectionIntegrationTest.java      |  310 +++
 .../pinot/transport/netty/NettyTestUtils.java      |  110 +
 .../transport/perf/ScatterGatherPerfClient.java    |  486 +++++
 .../transport/perf/ScatterGatherPerfServer.java    |  212 ++
 .../transport/perf/ScatterGatherPerfTester.java    |  338 +++
 .../pool/AsyncPoolResourceManagerAdapterTest.java  |  242 +++
 .../pinot/transport/pool/KeyedPoolImplTest.java    |  647 ++++++
 .../transport/scattergather/ScatterGatherTest.java |  322 +++
 pom.xml                                            |   36 +-
 .../hadoop/backfill/BackfillControllerAPIs.java    |    2 +-
 .../hadoop/backfill/BackfillPhaseMapJob.java       |    4 +-
 .../thirdeye/hadoop/config/ThirdEyeConfig.java     |    2 +-
 .../linkedin/thirdeye/hadoop/config/TimeSpec.java  |    2 +-
 .../thirdeye/hadoop/push/SegmentPushPhase.java     |    4 +-
 .../creation/SegmentCreationPhaseMapReduceJob.java |   22 +-
 .../thirdeye/hadoop/util/ThirdeyeAvroUtils.java    |    8 +-
 .../hadoop/util/ThirdeyePinotSchemaUtils.java      |   14 +-
 .../hadoop/util/ThirdeyeAvroUtilsTest.java         |   14 +-
 .../hadoop/util/ThirdeyePinotSchemaUtilsTest.java  |    2 +-
 .../alert/content/BaseEmailContentFormatter.java   |    2 +-
 .../AnomalyDetectionInputContextBuilder.java       |    2 +-
 .../anomaly/override/OverrideConfigHelper.java     |    2 +-
 .../AbstractModularizedAnomalyFunction.java        |    2 +-
 .../function/BackwardAnomalyFunctionUtils.java     |    2 +-
 .../java/com/linkedin/thirdeye/api/TimeSpec.java   |    2 +-
 .../onboard/AutoOnboardPinotMetadataSource.java    |    6 +-
 .../auto/onboard/AutoOnboardPinotMetricsUtils.java |    2 +-
 .../thirdeye/auto/onboard/ConfigGenerator.java     |    8 +-
 .../dashboard/resources/AnomalyResource.java       |    2 +-
 .../dashboard/resources/v2/AnomaliesResource.java  |    2 +-
 .../com/linkedin/thirdeye/dataframe/DataFrame.java |    4 +-
 .../pinot/PinotControllerResponseCacheLoader.java  |   10 +-
 .../datasource/pinot/PinotThirdEyeResponse.java    |    2 +-
 .../thirdeye/datasource/pinot/PqlUtils.java        |    2 +-
 .../resultset/ThirdEyeDataFrameResultSet.java      |    2 +-
 .../pinot/resultset/ThirdEyeResultSet.java         |    2 +-
 .../pinot/resultset/ThirdEyeResultSetGroup.java    |    4 +-
 .../algorithm/LegacyAnomalyFunctionAlgorithm.java  |    2 +-
 .../detection/algorithm/LegacyMergeWrapper.java    |    2 +-
 .../detector/function/AnomalyFunction.java         |    2 +-
 .../detector/function/BaseAnomalyFunction.java     |    2 +-
 .../com/linkedin/thirdeye/util/ThirdEyeUtils.java  |    2 +-
 .../AutoOnboardPinotMetricsServiceTest.java        |   12 +-
 .../resultset/ThirdEyeDataFrameResultSetTest.java  |    4 +-
 3415 files changed, 249623 insertions(+), 248046 deletions(-)

diff --git a/contrib/pinot-druid-benchmark/pom.xml b/contrib/pinot-druid-benchmark/pom.xml
index 1f919aa..050e312 100644
--- a/contrib/pinot-druid-benchmark/pom.xml
+++ b/contrib/pinot-druid-benchmark/pom.xml
@@ -24,7 +24,7 @@
          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>
 
-  <groupId>com.linkedin.pinotdruidbenchmark</groupId>
+  <groupId>org.apache.pinotdruidbenchmark</groupId>
   <artifactId>pinot-druid-benchmark</artifactId>
   <version>1.0-SNAPSHOT</version>
   <packaging>jar</packaging>
@@ -52,27 +52,27 @@
         <configuration>
           <programs>
             <program>
-              <mainClass>com.linkedin.pinotdruidbenchmark.DataSeparator</mainClass>
+              <mainClass>org.apache.pinotdruidbenchmark.DataSeparator</mainClass>
               <name>data-separator</name>
             </program>
             <program>
-              <mainClass>com.linkedin.pinotdruidbenchmark.DataMerger</mainClass>
+              <mainClass>org.apache.pinotdruidbenchmark.DataMerger</mainClass>
               <name>data-merger</name>
             </program>
             <program>
-              <mainClass>com.linkedin.pinotdruidbenchmark.PinotResponseTime</mainClass>
+              <mainClass>org.apache.pinotdruidbenchmark.PinotResponseTime</mainClass>
               <name>pinot-response-time</name>
             </program>
             <program>
-              <mainClass>com.linkedin.pinotdruidbenchmark.DruidResponseTime</mainClass>
+              <mainClass>org.apache.pinotdruidbenchmark.DruidResponseTime</mainClass>
               <name>druid-response-time</name>
             </program>
             <program>
-              <mainClass>com.linkedin.pinotdruidbenchmark.PinotThroughput</mainClass>
+              <mainClass>org.apache.pinotdruidbenchmark.PinotThroughput</mainClass>
               <name>pinot-throughput</name>
             </program>
             <program>
-              <mainClass>com.linkedin.pinotdruidbenchmark.DruidThroughput</mainClass>
+              <mainClass>org.apache.pinotdruidbenchmark.DruidThroughput</mainClass>
               <name>druid-throughput</name>
             </program>
           </programs>
diff --git a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DataMerger.java b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DataMerger.java
index 4849e6e..bce28cf 100644
--- a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DataMerger.java
+++ b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DataMerger.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package com.linkedin.pinotdruidbenchmark;
+package org.apache.pinotdruidbenchmark;
 
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
diff --git a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DataSeparator.java b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DataSeparator.java
index 6e6f735..9211599 100644
--- a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DataSeparator.java
+++ b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DataSeparator.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package com.linkedin.pinotdruidbenchmark;
+package org.apache.pinotdruidbenchmark;
 
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
diff --git a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DruidResponseTime.java b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DruidResponseTime.java
index 06caf2e..6650c9e 100644
--- a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DruidResponseTime.java
+++ b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DruidResponseTime.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package com.linkedin.pinotdruidbenchmark;
+package org.apache.pinotdruidbenchmark;
 
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
diff --git a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DruidThroughput.java b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DruidThroughput.java
index 789db27..11af155 100644
--- a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DruidThroughput.java
+++ b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/DruidThroughput.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package com.linkedin.pinotdruidbenchmark;
+package org.apache.pinotdruidbenchmark;
 
 import java.io.BufferedReader;
 import java.io.File;
diff --git a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/PinotResponseTime.java b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/PinotResponseTime.java
index 32c2499..353eafc 100644
--- a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/PinotResponseTime.java
+++ b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/PinotResponseTime.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package com.linkedin.pinotdruidbenchmark;
+package org.apache.pinotdruidbenchmark;
 
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
diff --git a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/PinotThroughput.java b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/PinotThroughput.java
index c50f61f..1ac1bf2 100644
--- a/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/PinotThroughput.java
+++ b/contrib/pinot-druid-benchmark/src/main/java/com/linkedin/pinotdruidbenchmark/PinotThroughput.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package com.linkedin.pinotdruidbenchmark;
+package org.apache.pinotdruidbenchmark;
 
 import java.io.BufferedReader;
 import java.io.File;
diff --git a/pinot-api/pom.xml b/pinot-api/pom.xml
index 9dc3304..65e1bfc 100644
--- a/pinot-api/pom.xml
+++ b/pinot-api/pom.xml
@@ -24,7 +24,7 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <artifactId>pinot</artifactId>
-    <groupId>com.linkedin.pinot</groupId>
+    <groupId>org.apache.pinot</groupId>
     <version>0.016</version>
   </parent>
   <artifactId>pinot-api</artifactId>
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/AbstractResultSet.java b/pinot-api/src/main/java/com/linkedin/pinot/client/AbstractResultSet.java
deleted file mode 100644
index 6a3fda6..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/AbstractResultSet.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-/**
- * Shared implementation between the different ResultSets.
- */
-abstract class AbstractResultSet implements ResultSet {
-  @Override
-  public int getInt(int rowIndex) {
-    return getInt(rowIndex, 0);
-  }
-
-  @Override
-  public long getLong(int rowIndex) {
-    return getLong(rowIndex, 0);
-  }
-
-  @Override
-  public float getFloat(int rowIndex) {
-    return getFloat(rowIndex, 0);
-  }
-
-  @Override
-  public double getDouble(int rowIndex) {
-    return getDouble(rowIndex, 0);
-  }
-
-  @Override
-  public String getString(int rowIndex) {
-    return getString(rowIndex, 0);
-  }
-
-  @Override
-  public int getInt(int rowIndex, int columnIndex) {
-    return Integer.parseInt(getString(rowIndex, columnIndex));
-  }
-
-  @Override
-  public long getLong(int rowIndex, int columnIndex) {
-    return Long.parseLong(getString(rowIndex, columnIndex));
-  }
-
-  @Override
-  public float getFloat(int rowIndex, int columnIndex) {
-    return Float.parseFloat(getString(rowIndex, columnIndex));
-  }
-
-  @Override
-  public double getDouble(int rowIndex, int columnIndex) {
-    return Double.parseDouble(getString(rowIndex, columnIndex));
-  }
-
-  @Override
-  public int getGroupKeyInt(int rowIndex, int groupKeyColumnIndex) {
-    return Integer.parseInt(getGroupKeyString(rowIndex, groupKeyColumnIndex));
-  }
-
-  @Override
-  public long getGroupKeyLong(int rowIndex, int groupKeyColumnIndex) {
-    return Long.parseLong(getGroupKeyString(rowIndex, groupKeyColumnIndex));
-  }
-
-  @Override
-  public float getGroupKeyFloat(int rowIndex, int groupKeyColumnIndex) {
-    return Float.parseFloat(getGroupKeyString(rowIndex, groupKeyColumnIndex));
-  }
-
-  @Override
-  public double getGroupKeyDouble(int rowIndex, int groupKeyColumnIndex) {
-    return Double.parseDouble(getGroupKeyString(rowIndex, groupKeyColumnIndex));
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/AggregationResultSet.java b/pinot-api/src/main/java/com/linkedin/pinot/client/AggregationResultSet.java
deleted file mode 100644
index 18934f6..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/AggregationResultSet.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/**
- * A Pinot query result set for aggregation results without group by clauses, of which there is one
- * of per aggregation
- * function in the query.
- */
-class AggregationResultSet extends AbstractResultSet {
-  private final JSONObject _jsonObject;
-
-  public AggregationResultSet(JSONObject jsonObject) {
-    _jsonObject = jsonObject;
-  }
-
-  @Override
-  public int getRowCount() {
-    return 1;
-  }
-
-  @Override
-  public int getColumnCount() {
-    return 1;
-  }
-
-  @Override
-  public String getColumnName(int columnIndex) {
-    try {
-      return _jsonObject.getString("function");
-    } catch (JSONException e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  @Override
-  public String getString(int rowIndex, int columnIndex) {
-    if (columnIndex != 0) {
-      throw new IllegalArgumentException(
-          "Column index must always be 0 for aggregation result sets");
-    }
-
-    if (rowIndex != 0) {
-      throw new IllegalArgumentException("Row index must always be 0 for aggregation result sets");
-    }
-
-    try {
-      return _jsonObject.get("value").toString();
-    } catch (Exception e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  @Override
-  public int getGroupKeyLength() {
-    return 0;
-  }
-
-  @Override
-  public String getGroupKeyColumnName(int groupKeyColumnIndex) {
-    throw new AssertionError("No group key column name for aggregation results");
-  }
-
-  @Override
-  public String getGroupKeyString(int rowIndex, int groupKeyColumnIndex) {
-    throw new AssertionError("No grouping key for queries without a group by clause");
-  }
-
-  @Override
-  public String toString() {
-    int numColumns = getColumnCount();
-    TextTable table = new TextTable();
-    String[] columnNames = new String[numColumns];
-
-    for (int c = 0; c < getColumnCount(); c++) {
-      columnNames[c] = getColumnName(c);
-    }
-    table.addHeader(columnNames);
-
-    int numRows = getRowCount();
-    for (int r = 0; r < numRows; r++) {
-      String[] columnValues = new String[numColumns];
-      for (int c = 0; c < getColumnCount(); c++) {
-        columnValues[c] = getString(r, c);
-      }
-      table.addRow(columnValues);
-    }
-    return table.toString();
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/BrokerResponse.java b/pinot-api/src/main/java/com/linkedin/pinot/client/BrokerResponse.java
deleted file mode 100644
index cd81e7b..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/BrokerResponse.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.List;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-
-/**
- * Reimplementation of BrokerResponse from pinot-common, so that pinot-api does not depend on pinot-common.
- */
-class BrokerResponse {
-  private JSONArray _aggregationResults;
-  private JSONObject _selectionResults;
-  private JSONArray _exceptions;
-
-  private BrokerResponse() {
-  }
-
-  private BrokerResponse(JSONObject brokerResponse) {
-    try {
-      if (brokerResponse.has("aggregationResults")) {
-        _aggregationResults = brokerResponse.getJSONArray("aggregationResults");
-      }
-      if (brokerResponse.has("exceptions")) {
-        _exceptions = brokerResponse.getJSONArray("exceptions");
-      }
-      if (brokerResponse.has("selectionResults")) {
-        _selectionResults = brokerResponse.getJSONObject("selectionResults");
-      }
-    } catch (JSONException e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  boolean hasExceptions() {
-    return _exceptions != null && _exceptions.length() != 0;
-  }
-
-  JSONArray getExceptions() {
-    return _exceptions;
-  }
-
-  JSONArray getAggregationResults() {
-    return _aggregationResults;
-  }
-
-  JSONObject getSelectionResults() {
-    return _selectionResults;
-  }
-
-  int getAggregationResultsSize() {
-    if (_aggregationResults == null) {
-      return 0;
-    } else {
-      return _aggregationResults.length();
-    }
-  }
-
-  static BrokerResponse fromJson(JSONObject json) {
-    return new BrokerResponse(json);
-  }
-
-  static BrokerResponse empty() {
-    return new BrokerResponse();
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/BrokerSelector.java b/pinot-api/src/main/java/com/linkedin/pinot/client/BrokerSelector.java
deleted file mode 100644
index 5968344..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/BrokerSelector.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-public interface BrokerSelector {
-  /**
-   * Returns the broker address in the form host:port
-   * @param table
-   * @return
-   */
-  String selectBroker(String table); 
-  
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/Connection.java b/pinot-api/src/main/java/com/linkedin/pinot/client/Connection.java
deleted file mode 100644
index 236c34f..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/Connection.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * A connection to Pinot, normally created through calls to the {@link ConnectionFactory}.
- */
-public class Connection {
-  private static final Logger LOGGER = LoggerFactory.getLogger(Connection.class);
-  private final PinotClientTransport _transport;
-  private BrokerSelector _brokerSelector;
-  private List<String> _brokerList;
-
-  Connection(List<String> brokerList, PinotClientTransport transport) {
-    _brokerList = brokerList;
-    LOGGER.info("Creating connection to broker list {}", brokerList);
-    _brokerSelector = new SimpleBrokerSelector(brokerList);
-    _transport = transport;
-  }
-
-  Connection(BrokerSelector brokerSelector , PinotClientTransport transport) {
-    _brokerSelector = brokerSelector;
-    _transport = transport;
-  }
-
-  /**
-   * Creates a prepared statement, to escape query parameters.
-   *
-   * @param statement The statement for which to create a prepared statement.
-   * @return A prepared statement for this connection.
-   */
-  public PreparedStatement prepareStatement(String statement) {
-    return new PreparedStatement(this, statement);
-  }
-
-  /**
-   * Executes a PQL statement.
-   * @param statement The statement to execute
-   * @return The result of the query
-   * @throws PinotClientException If an exception occurs while processing the query
-   */
-  public ResultSetGroup execute(String statement) throws PinotClientException {
-    return execute(null, statement);
-  }
-
-  /**
-   * Executes a PQL statement.
-   *
-   * @param statement The statement to execute
-   * @return The result of the query
-   * @throws PinotClientException If an exception occurs while processing the query
-   */
-  public ResultSetGroup execute(String tableName, String statement) throws PinotClientException {
-    String brokerHostPort = _brokerSelector.selectBroker(tableName);
-    if (brokerHostPort == null) {
-      throw new PinotClientException("Could not find broker to query for table: " +
-          (tableName == null ? "null" : tableName));
-    }
-    BrokerResponse response = _transport.executeQuery(brokerHostPort, statement);
-    if (response.hasExceptions()) {
-      throw new PinotClientException("Query had processing exceptions: \n" + response.getExceptions());
-    }
-    return new ResultSetGroup(response);
-  }
-
-  /**
-   * Executes a PQL statement asynchronously.
-   *
-   * @param statement The statement to execute
-   * @return A future containing the result of the query
-   * @throws PinotClientException If an exception occurs while processing the query
-   */
-  public Future<ResultSetGroup> executeAsync(String statement) throws PinotClientException {
-    String brokerHostPort = _brokerSelector.selectBroker(null);
-    if (brokerHostPort == null) {
-      throw new PinotClientException("Could not find broker to query for statement: " +
-          (statement == null ? "null" : statement));
-    }
-    final Future<BrokerResponse> responseFuture = _transport.executeQueryAsync(brokerHostPort, statement);
-    return new ResultSetGroupFuture(responseFuture);
-  }
-
-  /**
-   * Returns the list of brokers to which this connection can connect to.
-   *
-   * @return The list of brokers to which this connection can connect to.
-   */
-  List<String> getBrokerList() {
-    return _brokerList;
-  }
-
-  private static class ResultSetGroupFuture implements Future<ResultSetGroup> {
-    private final Future<BrokerResponse> _responseFuture;
-
-    public ResultSetGroupFuture(Future<BrokerResponse> responseFuture) {
-      _responseFuture = responseFuture;
-    }
-
-    @Override
-    public boolean cancel(boolean mayInterruptIfRunning) {
-      return _responseFuture.cancel(mayInterruptIfRunning);
-    }
-
-    @Override
-    public boolean isCancelled() {
-      return _responseFuture.isCancelled();
-    }
-
-    @Override
-    public boolean isDone() {
-      return _responseFuture.isDone();
-    }
-
-    @Override
-    public ResultSetGroup get() throws InterruptedException, ExecutionException {
-      try {
-        return get(1000L, TimeUnit.DAYS);
-      } catch (TimeoutException e) {
-        throw new ExecutionException(e);
-      }
-    }
-
-    @Override
-    public ResultSetGroup get(long timeout, TimeUnit unit)
-        throws InterruptedException, ExecutionException, TimeoutException {
-      BrokerResponse response = _responseFuture.get(timeout, unit);
-      return new ResultSetGroup(response);
-    }
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/ConnectionFactory.java b/pinot-api/src/main/java/com/linkedin/pinot/client/ConnectionFactory.java
deleted file mode 100644
index f4cd8db..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/ConnectionFactory.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.Arrays;
-import java.util.Properties;
-
-/**
- * Creates connections to Pinot, given various initialization methods.
- */
-public class ConnectionFactory {
-  static PinotClientTransportFactory _transportFactory = new JsonAsyncHttpPinotClientTransportFactory();
-
-  private ConnectionFactory() {
-  }
-
-  /**
-   * Creates a connection to a Pinot cluster, given its Zookeeper URL
-   *
-   * @param zkUrl The URL to the Zookeeper cluster, must include the cluster name e.g host:port/chroot/pinot-cluster
-   * @return A connection that connects to the brokers in the given Helix cluster
-   */
-  public static Connection fromZookeeper(String zkUrl) {
-    try {
-      DynamicBrokerSelector dynamicBrokerSelector = new DynamicBrokerSelector(zkUrl);
-      return new Connection(dynamicBrokerSelector, _transportFactory.buildTransport());
-    } catch (Exception e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  /**
-   * Creates a connection from properties containing the connection parameters.
-   *
-   * @param properties The properties to use for the connection
-   * @return A connection that connects to the brokers specified in the properties
-   */
-  public static Connection fromProperties(Properties properties) {
-    return new Connection(Arrays.asList(properties.getProperty("brokerList").split(",")), _transportFactory.buildTransport());
-  }
-
-  /**
-   * Creates a connection which sends queries randomly between the specified brokers.
-   *
-   * @param brokers The list of brokers to send queries to
-   * @return A connection to the set of brokers specified
-   */
-  public static Connection fromHostList(String... brokers) {
-    return new Connection(Arrays.asList(brokers), _transportFactory.buildTransport());
-  }  
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/DynamicBrokerSelector.java b/pinot-api/src/main/java/com/linkedin/pinot/client/DynamicBrokerSelector.java
deleted file mode 100644
index 4a6ab26..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/DynamicBrokerSelector.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-import javax.annotation.Nullable;
-import org.I0Itec.zkclient.IZkDataListener;
-import org.I0Itec.zkclient.ZkClient;
-import org.I0Itec.zkclient.serialize.BytesPushThroughSerializer;
-
-import static com.linkedin.pinot.client.ExternalViewReader.OFFLINE_SUFFIX;
-import static com.linkedin.pinot.client.ExternalViewReader.REALTIME_SUFFIX;
-
-
-/**
- * Maintains a mapping between table name and list of brokers
- */
-public class DynamicBrokerSelector implements BrokerSelector, IZkDataListener {
-  AtomicReference<Map<String, List<String>>> tableToBrokerListMapRef =
-      new AtomicReference<Map<String, List<String>>>();
-  AtomicReference<List<String>> allBrokerListRef = new AtomicReference<List<String>>();
-  private final Random _random = new Random();
-  private ExternalViewReader evReader;
-
-  public DynamicBrokerSelector(String zkServers) {
-    ZkClient zkClient = new ZkClient(zkServers);
-    zkClient.setZkSerializer(new BytesPushThroughSerializer());
-    zkClient.waitUntilConnected(60, TimeUnit.SECONDS);
-    zkClient.subscribeDataChanges(ExternalViewReader.BROKER_EXTERNAL_VIEW_PATH, this);
-    evReader = new ExternalViewReader(zkClient);
-    refresh();
-  }
-
-  private void refresh() {
-    Map<String, List<String>> tableToBrokerListMap = evReader.getTableToBrokersMap();
-    tableToBrokerListMapRef.set(tableToBrokerListMap);
-    Set<String> brokerSet = new HashSet<>();
-    for (List<String> brokerList : tableToBrokerListMap.values()) {
-      brokerSet.addAll(brokerList);
-    }
-    allBrokerListRef.set(new ArrayList<>(brokerSet));
-  }
-
-  @Override
-  public @Nullable String selectBroker(String table) {
-    if (table == null) {
-      List<String> list = allBrokerListRef.get();
-      if (list != null && !list.isEmpty()) {
-        return list.get(_random.nextInt(list.size()));
-      } else {
-        return null;
-      }
-    }
-    String tableName = table.replace(OFFLINE_SUFFIX, "").replace(REALTIME_SUFFIX, "");
-    List<String> list = tableToBrokerListMapRef.get().get(tableName);
-    if (list != null && !list.isEmpty()) {
-      return list.get(_random.nextInt(list.size()));
-    }
-    return null;
-  }
-
-  @Override
-  public void handleDataChange(String dataPath, Object data) throws Exception {
-    refresh();
-  }
-
-  @Override
-  public void handleDataDeleted(String dataPath) throws Exception {
-    refresh();
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/ExternalViewReader.java b/pinot-api/src/main/java/com/linkedin/pinot/client/ExternalViewReader.java
deleted file mode 100644
index 157d061..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/ExternalViewReader.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import java.util.zip.GZIPInputStream;
-import org.I0Itec.zkclient.ZkClient;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Reads brokers external view from Zookeeper
- */
-public class ExternalViewReader {
-  private static final Logger LOGGER = LoggerFactory.getLogger(ExternalViewReader.class);
-
-  private ZkClient zkClient;
-
-  public static String BROKER_EXTERNAL_VIEW_PATH = "/EXTERNALVIEW/brokerResource";
-  public static String REALTIME_SUFFIX = "_REALTIME";
-  public static String OFFLINE_SUFFIX = "_OFFLINE";
-
-  public ExternalViewReader(ZkClient zkClient) {
-    this.zkClient = zkClient;
-  }
-
-  public List<String> getLiveBrokers() {
-    List<String> brokerUrls = new ArrayList<String>();
-    try {
-
-      byte[] brokerResourceNodeData = zkClient.readData(BROKER_EXTERNAL_VIEW_PATH, true);
-      brokerResourceNodeData = unpackZnodeIfNecessary(brokerResourceNodeData);
-      JSONObject jsonObject = new JSONObject(new String(brokerResourceNodeData));
-      JSONObject brokerResourceNode = jsonObject.getJSONObject("mapFields");
-
-      Iterator<String> resourceNames = brokerResourceNode.keys();
-      while (resourceNames.hasNext()) {
-        String resourceName = resourceNames.next();
-        JSONObject resource = brokerResourceNode.getJSONObject(resourceName);
-
-        Iterator<String> brokerNames = resource.keys();
-        while (brokerNames.hasNext()) {
-          String brokerName = brokerNames.next();
-          if (brokerName.startsWith("Broker_") && "ONLINE".equals(resource.getString(brokerName))) {
-            // Turn Broker_12.34.56.78_1234 into 12.34.56.78:1234
-            String brokerHostPort = brokerName.replace("Broker_", "").replace("_", ":");
-            brokerUrls.add(brokerHostPort);
-          }
-        }
-      }
-    } catch (Exception e) {
-      LOGGER.warn("Exception while reading External view from zookeeper", e);
-      // ignore
-    }
-    return brokerUrls;
-  }
-
-  @SuppressWarnings("unchecked")
-  public Map<String, List<String>> getTableToBrokersMap() {
-    Map<String, Set<String>> brokerUrlsMap = new HashMap<>();
-    try {
-      byte[] brokerResourceNodeData = zkClient.readData("/EXTERNALVIEW/brokerResource", true);
-      brokerResourceNodeData = unpackZnodeIfNecessary(brokerResourceNodeData);
-      JSONObject jsonObject = new JSONObject(new String(brokerResourceNodeData));
-      JSONObject brokerResourceNode = jsonObject.getJSONObject("mapFields");
-
-      Iterator<String> resourceNames = brokerResourceNode.keys();
-      while (resourceNames.hasNext()) {
-        String resourceName = resourceNames.next();
-        String tableName = resourceName.replace(OFFLINE_SUFFIX, "").replace(REALTIME_SUFFIX, "");
-        Set<String> brokerUrls = brokerUrlsMap.get(tableName);
-        if (brokerUrls == null) {
-          brokerUrls = new HashSet<>();
-          brokerUrlsMap.put(tableName, brokerUrls);
-        }
-        JSONObject resource = brokerResourceNode.getJSONObject(resourceName);
-        Iterator<String> brokerNames = resource.keys();
-        while (brokerNames.hasNext()) {
-          String brokerName = brokerNames.next();
-          if (brokerName.startsWith("Broker_") && "ONLINE".equals(resource.getString(brokerName))) {
-            // Turn Broker_12.34.56.78_1234 into 12.34.56.78:1234
-            String brokerHostPort = brokerName.replace("Broker_", "").replace("_", ":");
-            brokerUrls.add(brokerHostPort);
-          }
-        }
-      }
-    } catch (Exception e) {
-      LOGGER.warn("Exception while reading External view from zookeeper", e);
-      // ignore
-    }
-    Map<String, List<String>> tableToBrokersMap = new HashMap<>();
-    for (Entry<String, Set<String>> entry : brokerUrlsMap.entrySet()) {
-      tableToBrokersMap.put(entry.getKey(), new ArrayList<>(entry.getValue()));
-    }
-    return tableToBrokersMap;
-  }
-
-  private static byte[] unpackZnodeIfNecessary(byte[] znodeContents) {
-    // Check for gzip header
-    if (znodeContents[0] == 0x1F && znodeContents[1] == (byte) 0x8B) {
-      try {
-        GZIPInputStream inputStream = new GZIPInputStream(new ByteArrayInputStream(znodeContents));
-        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-        int byteRead = inputStream.read();
-
-        while (byteRead != -1) {
-          outputStream.write(byteRead);
-          byteRead = inputStream.read();
-        }
-
-        return outputStream.toByteArray();
-      } catch (IOException e) {
-        LOGGER.error("Failed to decompress znode contents", e);
-        return znodeContents;
-      }
-    } else {
-      // Doesn't look compressed, just return the contents verbatim
-      return znodeContents;
-    }
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/GroupByResultSet.java b/pinot-api/src/main/java/com/linkedin/pinot/client/GroupByResultSet.java
deleted file mode 100644
index a510aad..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/GroupByResultSet.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/**
- * A Pinot query result set for group by results, of which there is one of per aggregation function
- * in the query.
- */
-class GroupByResultSet extends AbstractResultSet {
-  private final JSONArray _groupByResults;
-  private final JSONArray _groupByColumns;
-  private final String _functionName;
-
-  public GroupByResultSet(JSONObject jsonObject) {
-    try {
-      _groupByResults = jsonObject.getJSONArray("groupByResult");
-      _groupByColumns = jsonObject.getJSONArray("groupByColumns");
-      _functionName = jsonObject.getString("function");
-    } catch (JSONException e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  /**
-   * Returns the number of rows in this result group.
-   * @return The number of rows in this result group
-   */
-  @Override
-  public int getRowCount() {
-    return _groupByResults.length();
-  }
-
-  @Override
-  public int getColumnCount() {
-    return 1;
-  }
-
-  @Override
-  public String getColumnName(int columnIndex) {
-    return _functionName;
-  }
-
-  @Override
-  public String getString(int rowIndex, int columnIndex) {
-    if (columnIndex != 0) {
-      throw new IllegalArgumentException(
-          "Column index must always be 0 for aggregation result sets");
-    }
-
-    try {
-      return _groupByResults.getJSONObject(rowIndex).get("value").toString();
-    } catch (Exception e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  @Override
-  public int getGroupKeyLength() {
-    return _groupByColumns.length();
-  }
-
-  @Override
-  public String getGroupKeyString(int rowIndex, int groupKeyColumnIndex) {
-    try {
-      return _groupByResults.getJSONObject(rowIndex).getJSONArray("group").getString(groupKeyColumnIndex);
-    } catch (Exception e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  @Override
-  public String getGroupKeyColumnName(int groupKeyColumnIndex) {
-    try {
-      return _groupByColumns.getString(groupKeyColumnIndex);
-    } catch (Exception e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  @Override
-  public String toString() {
-    int groupKeyLength = getGroupKeyLength();
-    int numColumns = groupKeyLength + getColumnCount();
-    TextTable table = new TextTable();
-    String[] columnNames = new String[numColumns];
-    for (int c = 0; c < groupKeyLength; c++) {
-      try {
-        columnNames[c] = getGroupKeyColumnName(c);
-      } catch (Exception e) {
-        columnNames[c] = "ERROR";
-      }
-    }
-    for (int c = 0; c < getColumnCount(); c++) {
-      columnNames[groupKeyLength + c] = getColumnName(c);
-    }
-    table.addHeader(columnNames);
-
-    int numRows = getRowCount();
-    for (int r = 0; r < numRows; r++) {
-      String[] columnValues = new String[numColumns];
-      for (int c = 0; c < groupKeyLength; c++) {
-        try {
-          columnValues[c] = getGroupKeyString(r, c);
-        } catch (Exception e) {
-          columnValues[c] = "ERROR";
-        }
-      }
-      for (int c = 0; c < getColumnCount(); c++) {
-        columnValues[groupKeyLength + c] = getString(r, c);
-      }
-      table.addRow(columnValues);
-    }
-    return table.toString();
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/JsonAsyncHttpPinotClientTransport.java b/pinot-api/src/main/java/com/linkedin/pinot/client/JsonAsyncHttpPinotClientTransport.java
deleted file mode 100644
index f91c8cd..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/JsonAsyncHttpPinotClientTransport.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import com.ning.http.client.AsyncHttpClient;
-import com.ning.http.client.Response;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * JSON encoded Pinot client transport over AsyncHttpClient.
- */
-class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
-  private static final Logger LOGGER = LoggerFactory.getLogger(JsonAsyncHttpPinotClientTransport.class);
-  AsyncHttpClient _httpClient = new AsyncHttpClient();
-
-  @Override
-  public BrokerResponse executeQuery(String brokerAddress, String query) throws PinotClientException {
-    try {
-      return executeQueryAsync(brokerAddress, query).get();
-    } catch (Exception e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  @Override
-  public Future<BrokerResponse> executeQueryAsync(String brokerAddress, final String query) {
-    try {
-      final JSONObject json = new JSONObject();
-      json.put("pql", query);
-
-      final String url = "http://" + brokerAddress + "/query";
-
-      final Future<Response> response = _httpClient.preparePost(url).setBody(json.toString()).execute();
-
-      return new BrokerResponseFuture(response, query, url);
-    } catch (Exception e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  private static class BrokerResponseFuture implements Future<BrokerResponse> {
-    private final Future<Response> _response;
-    private final String _query;
-    private final String _url;
-
-    public BrokerResponseFuture(Future<Response> response, String query, String url) {
-      _response = response;
-      _query = query;
-      _url = url;
-    }
-
-    @Override
-    public boolean cancel(boolean mayInterruptIfRunning) {
-      return _response.cancel(mayInterruptIfRunning);
-    }
-
-    @Override
-    public boolean isCancelled() {
-      return _response.isCancelled();
-    }
-
-    @Override
-    public boolean isDone() {
-      return _response.isDone();
-    }
-
-    @Override
-    public BrokerResponse get()
-        throws InterruptedException, ExecutionException {
-      try {
-        return get(1000L, TimeUnit.DAYS);
-      } catch (TimeoutException e) {
-        LOGGER.error("Caught timeout during synchronous get", e);
-        throw new InterruptedException();
-      }
-    }
-
-    @Override
-    public BrokerResponse get(long timeout, TimeUnit unit)
-        throws InterruptedException, ExecutionException, TimeoutException {
-      try {
-        LOGGER.debug("Sending query {} to {}", _query, _url);
-
-        Response httpResponse = _response.get(timeout, unit);
-
-        LOGGER.debug("Completed query, HTTP status is {}", httpResponse.getStatusCode());
-
-        if (httpResponse.getStatusCode() != 200) {
-          throw new PinotClientException("Pinot returned HTTP status " + httpResponse.getStatusCode() +
-              ", expected 200");
-        }
-
-        String responseBody = httpResponse.getResponseBody();
-        return BrokerResponse.fromJson(new JSONObject(responseBody));
-      } catch (Exception e) {
-        throw new ExecutionException(e);
-      }
-    }
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java b/pinot-api/src/main/java/com/linkedin/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java
deleted file mode 100644
index e5c0e55..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-/**
- * Pinot client transport factory for JSON encoded BrokerResults through HTTP.
- */
-class JsonAsyncHttpPinotClientTransportFactory implements PinotClientTransportFactory {
-  @Override
-  public PinotClientTransport buildTransport() {
-    return new JsonAsyncHttpPinotClientTransport();
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/PinotClientException.java b/pinot-api/src/main/java/com/linkedin/pinot/client/PinotClientException.java
deleted file mode 100644
index f43818c..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/PinotClientException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-/**
- * Pinot client exception.
- */
-public class PinotClientException extends RuntimeException {
-  public PinotClientException(String message) {
-    super(message);
-  }
-
-  public PinotClientException(String message, Throwable cause) {
-    super(message, cause);
-  }
-
-  public PinotClientException(Throwable cause) {
-    super(cause);
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/PinotClientTransport.java b/pinot-api/src/main/java/com/linkedin/pinot/client/PinotClientTransport.java
deleted file mode 100644
index c54e091..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/PinotClientTransport.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.concurrent.Future;
-
-
-/**
- * Interface for plugging different client transports.
- */
-interface PinotClientTransport {
-  BrokerResponse executeQuery(String brokerAddress, String query) throws PinotClientException;
-  Future<BrokerResponse> executeQueryAsync(String brokerAddress, String query) throws PinotClientException;
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/PinotClientTransportFactory.java b/pinot-api/src/main/java/com/linkedin/pinot/client/PinotClientTransportFactory.java
deleted file mode 100644
index efbcd25..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/PinotClientTransportFactory.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-/**
- * Factory for client transports.
- */
-interface PinotClientTransportFactory {
-  PinotClientTransport buildTransport();
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/PreparedStatement.java b/pinot-api/src/main/java/com/linkedin/pinot/client/PreparedStatement.java
deleted file mode 100644
index 1406cba..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/PreparedStatement.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.concurrent.Future;
-
-
-/**
- * A prepared statement, which is used to escape query parameters sent to Pinot.
- */
-public class PreparedStatement {
-  private final Connection _connection;
-  private final String _statement;
-  private final String[] _parameters;
-
-  PreparedStatement(Connection connection, String statement) {
-    _connection = connection;
-    _statement = statement;
-
-    int questionMarkCount = 0;
-    int index = statement.indexOf('?');
-    while (index != -1) {
-      questionMarkCount++;
-      index = statement.indexOf('?', index + 1);
-    }
-
-    _parameters = new String[questionMarkCount];
-  }
-
-  private String fillStatementWithParameters() {
-    String statement = _statement;
-    for (String parameter : _parameters) {
-      statement = statement.replaceFirst("\\?", parameter);
-    }
-    return statement;
-  }
-
-  /**
-   * Executes this prepared statement.
-   *
-   * @return The query results
-   */
-  public ResultSetGroup execute() {
-    return _connection.execute(fillStatementWithParameters());
-  }
-
-  /**
-   * Executes this prepared statement asynchronously.
-   *
-   * @return The query results
-   */
-  public Future<ResultSetGroup> executeAsync() {
-    return _connection.executeAsync(fillStatementWithParameters());
-  }
-
-  /**
-   * Replaces the given parameter by its value.
-   *
-   * @param parameterIndex The index of the parameter to replace
-   * @param value The value of the parameter to replace
-   */
-  public void setString(int parameterIndex, String value) {
-    _parameters[parameterIndex] = "'" + value.replace("'", "''") + "'";
-  }
-
-  /**
-   * Replaces the given parameter by its value.
-   *
-   * @param parameterIndex The index of the parameter to replace
-   * @param value The value of the parameter to replace
-   */
-  public void setInt(int parameterIndex, int value) {
-    _parameters[parameterIndex] = String.valueOf(value);
-  }
-
-  /**
-   * Replaces the given parameter by its value.
-   *
-   * @param parameterIndex The index of the parameter to replace
-   * @param value The value of the parameter to replace
-   */
-  public void setLong(int parameterIndex, long value) {
-    _parameters[parameterIndex] = String.valueOf(value);
-  }
-
-  /**
-   * Replaces the given parameter by its value.
-   *
-   * @param parameterIndex The index of the parameter to replace
-   * @param value The value of the parameter to replace
-   */
-  public void setFloat(int parameterIndex, float value) {
-    _parameters[parameterIndex] = String.valueOf(value);
-  }
-
-  /**
-   * Replaces the given parameter by its value.
-   *
-   * @param parameterIndex The index of the parameter to replace
-   * @param value The value of the parameter to replace
-   */
-  public void setDouble(int parameterIndex, double value) {
-    _parameters[parameterIndex] = String.valueOf(value);
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/ResultSet.java b/pinot-api/src/main/java/com/linkedin/pinot/client/ResultSet.java
deleted file mode 100644
index e8051fd..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/ResultSet.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-/**
- * A Pinot result group, representing an aggregation function in the original query.
- */
-public interface ResultSet {
-  /**
-   * Returns the number of rows in this result set.
-   *
-   * @return The number of rows in this result set
-   */
-  int getRowCount();
-
-  /**
-   * Returns the number of columns in this result set.
-   *
-   * @return The number of columns in this result set
-   */
-  int getColumnCount();
-
-  /**
-   * Returns the column name at a given index.
-   *
-   * @param columnIndex The index of the column for which to retrieve the name
-   * @return The name of the column at the given column index
-   */
-  String getColumnName(int columnIndex);
-
-  /**
-   * Obtains the integer value for the given row.
-   *
-   * @param rowIndex The index of the row
-   * @return The integer value for the given row
-   */
-  int getInt(int rowIndex);
-
-  /**
-   * Obtains the long value for the given row.
-   *
-   * @param rowIndex The index of the row
-   * @return The long value for the given row
-   */
-  long getLong(int rowIndex);
-
-  /**
-   * Obtains the float value for the given row.
-   *
-   * @param rowIndex The index of the row
-   * @return The float value for the given row
-   */
-  float getFloat(int rowIndex);
-
-  /**
-   * Obtains the double value for the given row.
-   *
-   * @param rowIndex The index of the row
-   * @return The double value for the given row
-   */
-  double getDouble(int rowIndex);
-
-  /**
-   * Obtains the String value for the given row.
-   *
-   * @param rowIndex The index of the row
-   * @return The String value for the given row
-   */
-  String getString(int rowIndex);
-
-  /**
-   * Obtains the integer value for the given row and column.
-   *
-   * @param rowIndex The index of the row
-   * @param columnIndex The index of the column for which to fetch the value
-   * @return The integer value for the given row and column
-   */
-  int getInt(int rowIndex, int columnIndex);
-
-  /**
-   * Obtains the long value for the given row and column.
-   *
-   * @param rowIndex The index of the row
-   * @param columnIndex The index of the column for which to fetch the value
-   * @return The long value for the given row and column
-   */
-  long getLong(int rowIndex, int columnIndex);
-
-  /**
-   * Obtains the float value for the given row and column.
-   *
-   * @param rowIndex The index of the row
-   * @param columnIndex The index of the column for which to fetch the value
-   * @return The float value for the given row and column
-   */
-  float getFloat(int rowIndex, int columnIndex);
-
-  /**
-   * Obtains the double value for the given row and column.
-   *
-   * @param rowIndex The index of the row
-   * @param columnIndex The index of the column for which to fetch the value
-   * @return The double value for the given row and column
-   */
-  double getDouble(int rowIndex, int columnIndex);
-
-  /**
-   * Obtains the String value for the given row and column.
-   *
-   * @param rowIndex The index of the row
-   * @param columnIndex The index of the column for which to fetch the value
-   * @return The String value for the given row and column
-   */
-  String getString(int rowIndex, int columnIndex);
-
-  /**
-   * Obtains the length of the group key, or 0 if there is no grouping key.
-   *
-   * @return The length of the group key, or 0 if there is no grouping key.
-   */
-  int getGroupKeyLength();
-
-  /**
-   * Get the group key name for the given key column index. use getGroupKeyLength() to know the number of groupKey
-   * @param groupKeyColumnIndex
-   * @return group key column name 
-   */
-  String getGroupKeyColumnName(int groupKeyColumnIndex);
-  
-  /**
-   * Obtains the group key value for the given row and key column index.
-   *
-   * @param rowIndex The index of the row
-   * @param groupKeyColumnIndex The group key column's index
-   * @return The group key value, as an integer
-   */
-  int getGroupKeyInt(int rowIndex, int groupKeyColumnIndex);
-
-  /**
-   * Obtains the group key value for the given row and key column index.
-   *
-   * @param rowIndex The index of the row
-   * @param groupKeyColumnIndex The group key column's index
-   * @return The group key value, as a long
-   */
-  long getGroupKeyLong(int rowIndex, int groupKeyColumnIndex);
-
-  /**
-   * Obtains the group key value for the given row and key column index.
-   *
-   * @param rowIndex The index of the row
-   * @param groupKeyColumnIndex The group key column's index
-   * @return The group key value, as a float
-   */
-  float getGroupKeyFloat(int rowIndex, int groupKeyColumnIndex);
-
-  /**
-   * Obtains the group key value for the given row and key column index.
-   *
-   * @param rowIndex The index of the row
-   * @param groupKeyColumnIndex The group key column's index
-   * @return The group key value, as a double
-   */
-  double getGroupKeyDouble(int rowIndex, int groupKeyColumnIndex);
-
-  /**
-   * Obtains the group key value for the given row and key column index.
-   *
-   * @param rowIndex The index of the row
-   * @param groupKeyColumnIndex The group key column's index
-   * @return The group key value, as a String
-   */
-  String getGroupKeyString(int rowIndex, int groupKeyColumnIndex);
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/ResultSetGroup.java b/pinot-api/src/main/java/com/linkedin/pinot/client/ResultSetGroup.java
deleted file mode 100644
index 248ef19..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/ResultSetGroup.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-
-/**
- * A Pinot result set group, containing the results given back by Pinot for a given query.
- */
-public class ResultSetGroup {
-  private final List<ResultSet> _resultSets;
-
-  ResultSetGroup(BrokerResponse brokerResponse) {
-    _resultSets = new ArrayList<ResultSet>();
-
-    if (brokerResponse.getSelectionResults() != null) {
-      _resultSets.add(new SelectionResultSet(brokerResponse.getSelectionResults()));
-    }
-
-    int aggregationResultCount = brokerResponse.getAggregationResultsSize();
-    for (int i = 0; i < aggregationResultCount; i++) {
-      JSONObject aggregationResult;
-      try {
-        aggregationResult = brokerResponse.getAggregationResults().getJSONObject(i);
-      } catch (JSONException e) {
-        throw new PinotClientException(e);
-      }
-      if (aggregationResult.has("value")) {
-        _resultSets.add(new AggregationResultSet(aggregationResult));
-      } else if (aggregationResult.has("groupByResult")) {
-        _resultSets.add(new GroupByResultSet(aggregationResult));
-      } else {
-        throw new PinotClientException("Unrecognized result group, neither a value nor group by result");
-      }
-    }
-  }
-
-  /**
-   * Returns the number of result sets in this result set group, or 0 if there are no result sets; there is one result
-   * set per aggregation function in the original query and one result set in the case of a selection query.
-   *
-   * @return The number of result sets in this result set
-   */
-  public int getResultSetCount() {
-    return _resultSets.size();
-  }
-
-  /**
-   * Obtains the result set at the given index, starting from zero.
-   *
-   * @param index The index for which to obtain the result set
-   * @return The result set at the given index
-   */
-  public ResultSet getResultSet(int index) {
-    return _resultSets.get(index);
-  }
-  
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder();
-    for(ResultSet resultSet:_resultSets){
-      sb.append(resultSet);
-      sb.append("\n");
-    }
-    return sb.toString();
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/SelectionResultSet.java b/pinot-api/src/main/java/com/linkedin/pinot/client/SelectionResultSet.java
deleted file mode 100644
index d26f41c..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/SelectionResultSet.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/**
- * Selection result set, which contains the results of a selection query.
- */
-class SelectionResultSet extends AbstractResultSet {
-  private JSONArray _resultsArray;
-  private JSONArray _columnsArray;
-
-  public SelectionResultSet(JSONObject selectionResults) {
-    try {
-      _resultsArray = selectionResults.getJSONArray("results");
-      _columnsArray = selectionResults.getJSONArray("columns");
-    } catch (JSONException e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  @Override
-  public int getRowCount() {
-    return _resultsArray.length();
-  }
-
-  @Override
-  public int getColumnCount() {
-    return _columnsArray.length();
-  }
-
-  @Override
-  public String getColumnName(int columnIndex) {
-    try {
-      return _columnsArray.getString(columnIndex);
-    } catch (JSONException e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  @Override
-  public String getString(int rowIndex, int columnIndex) {
-    try {
-      return _resultsArray.getJSONArray(rowIndex).get(columnIndex).toString();
-    } catch (JSONException e) {
-      throw new PinotClientException(e);
-    }
-  }
-
-  @Override
-  public int getGroupKeyLength() {
-    return 0;
-  }
-
-  @Override
-  public String getGroupKeyString(int rowIndex, int groupKeyColumnIndex) {
-    throw new AssertionError("No group key string for selection results");
-  }
-
-  @Override
-  public String getGroupKeyColumnName(int groupKeyColumnIndex) {
-    throw new AssertionError("No group key column name for selection results");
-  }
-
-  @Override
-  public String toString() {
-    int numColumns = getColumnCount();
-    TextTable table = new TextTable();
-    String[] columnNames = new String[numColumns];
-    for (int c = 0; c < numColumns; c++) {
-      try {
-        columnNames[c] = _columnsArray.getString(c);
-      } catch (JSONException e) {
-        columnNames[c] = "ERROR";
-      }
-    }
-    table.addHeader(columnNames);
-
-    int numRows = getRowCount();
-    for (int r = 0; r < numRows; r++) {
-      String[] columnValues = new String[numColumns];
-      for (int c = 0; c < numColumns; c++) {
-        try {
-          columnValues[c] = getString(r, c);
-        } catch (Exception e) {
-          columnNames[c] = "ERROR";
-        }
-      }
-      table.addRow(columnValues);
-    }
-    return table.toString();
-
-  }
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/SimpleBrokerSelector.java b/pinot-api/src/main/java/com/linkedin/pinot/client/SimpleBrokerSelector.java
deleted file mode 100644
index fb89488..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/SimpleBrokerSelector.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.List;
-import java.util.Random;
-
-/**
- * Picks a broker randomly from list of brokers provided. This assumes that all the provided brokers
- * are healthy. There is no health check done on the brokers
- */
-public class SimpleBrokerSelector implements BrokerSelector {
-
-  private List<String> _brokerList;
-  private final Random _random = new Random();
-
-  public SimpleBrokerSelector(List<String> brokerList) {
-    this._brokerList = brokerList;
-  }
-
-  @Override
-  public String selectBroker(String table) {
-    return _brokerList.get(_random.nextInt(_brokerList.size()));
-  }
-
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/TextTable.java b/pinot-api/src/main/java/com/linkedin/pinot/client/TextTable.java
deleted file mode 100644
index 67c5875..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/TextTable.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Utility class to format tabular data. Useful to display on console for debugging
- */
-public class TextTable {
-
-  private List<String[]> rows = new LinkedList<>();
-  private String[] headerColumnNames;
-  private final static char PAD_CHAR = ' ';
-
-  public TextTable() {
-
-  }
-
-  public void addHeader(String... headerColumnNames) {
-    this.headerColumnNames = headerColumnNames;
-  }
-
-  public void addRow(String... columnValues) {
-    rows.add(columnValues);
-  }
-
-  private int[] colWidths() {
-    int cols = 0;
-    if (headerColumnNames != null) {
-      cols = headerColumnNames.length;
-    }
-    for (String[] row : rows) {
-      cols = Math.max(cols, row.length);
-    }
-    int[] widths = new int[cols];
-    if (headerColumnNames != null) {
-      updateWidths(widths, headerColumnNames);
-    }
-    for (String[] row : rows) {
-      updateWidths(widths, row);
-    }
-    return widths;
-  }
-
-  private void updateWidths(int[] widths, String[] values) {
-    for (int colNum = 0; colNum < values.length; colNum++) {
-      int length = 0;
-      if (values[colNum] != null) {
-        length = values[colNum].getBytes().length;
-      }
-      widths[colNum] = Math.max(widths[colNum], length);
-    }
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder buf = new StringBuilder();
-
-    int[] colWidths = colWidths();
-    if (headerColumnNames != null) {
-      append(buf, colWidths, headerColumnNames);
-      int totalWidth = 0;
-      for (int width : colWidths) {
-        totalWidth += width;
-      }
-      buf.append(rightPad("", totalWidth, '='));
-      buf.append('\n');
-    }
-    for (String[] row : rows) {
-      append(buf, colWidths, row);
-    }
-
-    return buf.toString();
-  }
-
-  private void append(StringBuilder buf, int[] colWidths, String[] row) {
-    for (int colNum = 0; colNum < row.length; colNum++) {
-      buf.append(rightPad(row[colNum], colWidths[colNum], PAD_CHAR));
-      buf.append(' ');
-    }
-    buf.append('\n');
-  }
-
-  public static String rightPad(String str, final int size, final char padChar) {
-    int length = 0;
-    if (str != null) {
-      length = str.length();
-    }
-
-    final int pads = size - length;
-    if (pads <= 0) {
-      return str; // returns original String when possible
-    }
-    char[] buf = new char[size];
-
-    for (int i = 0; i < length; i++) {
-      buf[i] = str.charAt(i);
-    }
-    for (int i = str.length(); i < size; i++) {
-      buf[i] = padChar;
-    }
-    return String.valueOf(buf);
-  }
-
-}
diff --git a/pinot-api/src/main/java/com/linkedin/pinot/client/package-info.java b/pinot-api/src/main/java/com/linkedin/pinot/client/package-info.java
deleted file mode 100644
index ac22e3f..0000000
--- a/pinot-api/src/main/java/com/linkedin/pinot/client/package-info.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/**
- * This package contains the Pinot client API.
- *
- * Connections to Pinot are created using the
- * {@link com.linkedin.pinot.client.ConnectionFactory} class' utility methods to create connections to a Pinot cluster
- * given a Zookeeper URL, a Java Properties object or a list of broker addresses to connect to.
- *
- * <pre>{@code Connection connection = ConnectionFactory.fromZookeeper
- *     (some-zookeeper-server:2191/zookeeperPath");
- *
- * Connection connection = ConnectionFactory.fromProperties("demo.properties");
- *
- * Connection connection = ConnectionFactory.fromHostList
- *     ("some-server:1234", "some-other-server:1234", ...);}</pre>
- *
- * Queries can be sent directly to the Pinot cluster using the
- * {@link com.linkedin.pinot.client.Connection#execute(java.lang.String)} and
- * {@link com.linkedin.pinot.client.Connection#executeAsync(java.lang.String)} methods of
- * {@link com.linkedin.pinot.client.Connection}.
- *
- * <pre>{@code ResultSetGroup resultSetGroup = connection.execute("select * from foo...");
- * Future<ResultSetGroup> futureResultSetGroup = connection.executeAsync
- *     ("select * from foo...");}</pre>
- *
- * Queries can also use a {@link com.linkedin.pinot.client.PreparedStatement} to escape query parameters:
- *
- * <pre>{@code PreparedStatement statement = connection.prepareStatement
- *     ("select * from foo where a = ?");
- * statement.setString(1, "bar");
- *
- * ResultSetGroup resultSetGroup = statement.execute();
- * Future<ResultSetGroup> futureResultSetGroup = statement.executeAsync();}</pre>
- *
- * In the case of a selection query, results can be obtained with the various <code>get</code> methods in the first
- * {@link com.linkedin.pinot.client.ResultSet}, obtained through the
- * {@link com.linkedin.pinot.client.ResultSetGroup#getResultSet(int)} method:
- *
- * <pre>{@code ResultSet resultSet = connection.execute
- *     ("select foo, bar from baz where quux = 'quuux'").getResultSet(0);
- *
- * for(int i = 0; i < resultSet.getRowCount(); ++i) {
- *     System.out.println("foo: " + resultSet.getString(i, 0);
- *     System.out.println("bar: " + resultSet.getInt(i, 1);
- * }
- *
- * resultSet.close();}</pre>
- *
- * In the case where there is an aggregation, each aggregation function is within its own
- * {@link com.linkedin.pinot.client.ResultSet}:
- *
- * <pre>{@code ResultSetGroup resultSetGroup = connection.execute("select count(*) from foo");
- *
- * ResultSet resultSet = resultSetGroup.getResultSet(0);
- * System.out.println("Number of records: " + resultSet.getInt(0));
- * resultSet.close();}</pre>
- *
- * There can be more than one {@link com.linkedin.pinot.client.ResultSet}, each of which can contain multiple results
- * grouped by a group key.
- *
- * <pre>{@code ResultSetGroup resultSetGroup = connection.execute
- *     ("select min(foo), max(foo) from bar group by baz");
- *
- * System.out.println("Number of result groups:" +
- *     resultSetGroup.getResultSetCount(); // 2, min(foo) and max(foo)
- *
- * ResultSet minResultSet = resultSetGroup.getResultSet(0);
- * for(int i = 0; i < minResultSet.length(); ++i) {
- *     System.out.println("Minimum foo for " + minResultSet.getGroupKeyString(i, 1) +
- *         ": " + minResultSet.getInt(i));
- * }
- *
- * ResultSet maxResultSet = resultSetGroup.getResultSet(1);
- * for(int i = 0; i < maxResultSet.length(); ++i) {
- *     System.out.println("Maximum foo for " + maxResultSet.getGroupKeyString(i, 1) +
- *         ": " + maxResultSet.getInt(i));
- * }
- *
- * resultSet.close();}</pre>
- */
-package com.linkedin.pinot.client;
\ No newline at end of file
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/AbstractResultSet.java b/pinot-api/src/main/java/org/apache/pinot/client/AbstractResultSet.java
new file mode 100644
index 0000000..87cb98c
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/AbstractResultSet.java
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+/**
+ * Shared implementation between the different ResultSets.
+ */
+abstract class AbstractResultSet implements ResultSet {
+  @Override
+  public int getInt(int rowIndex) {
+    return getInt(rowIndex, 0);
+  }
+
+  @Override
+  public long getLong(int rowIndex) {
+    return getLong(rowIndex, 0);
+  }
+
+  @Override
+  public float getFloat(int rowIndex) {
+    return getFloat(rowIndex, 0);
+  }
+
+  @Override
+  public double getDouble(int rowIndex) {
+    return getDouble(rowIndex, 0);
+  }
+
+  @Override
+  public String getString(int rowIndex) {
+    return getString(rowIndex, 0);
+  }
+
+  @Override
+  public int getInt(int rowIndex, int columnIndex) {
+    return Integer.parseInt(getString(rowIndex, columnIndex));
+  }
+
+  @Override
+  public long getLong(int rowIndex, int columnIndex) {
+    return Long.parseLong(getString(rowIndex, columnIndex));
+  }
+
+  @Override
+  public float getFloat(int rowIndex, int columnIndex) {
+    return Float.parseFloat(getString(rowIndex, columnIndex));
+  }
+
+  @Override
+  public double getDouble(int rowIndex, int columnIndex) {
+    return Double.parseDouble(getString(rowIndex, columnIndex));
+  }
+
+  @Override
+  public int getGroupKeyInt(int rowIndex, int groupKeyColumnIndex) {
+    return Integer.parseInt(getGroupKeyString(rowIndex, groupKeyColumnIndex));
+  }
+
+  @Override
+  public long getGroupKeyLong(int rowIndex, int groupKeyColumnIndex) {
+    return Long.parseLong(getGroupKeyString(rowIndex, groupKeyColumnIndex));
+  }
+
+  @Override
+  public float getGroupKeyFloat(int rowIndex, int groupKeyColumnIndex) {
+    return Float.parseFloat(getGroupKeyString(rowIndex, groupKeyColumnIndex));
+  }
+
+  @Override
+  public double getGroupKeyDouble(int rowIndex, int groupKeyColumnIndex) {
+    return Double.parseDouble(getGroupKeyString(rowIndex, groupKeyColumnIndex));
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/AggregationResultSet.java b/pinot-api/src/main/java/org/apache/pinot/client/AggregationResultSet.java
new file mode 100644
index 0000000..7080c4c
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/AggregationResultSet.java
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * A Pinot query result set for aggregation results without group by clauses, of which there is one
+ * of per aggregation
+ * function in the query.
+ */
+class AggregationResultSet extends AbstractResultSet {
+  private final JSONObject _jsonObject;
+
+  public AggregationResultSet(JSONObject jsonObject) {
+    _jsonObject = jsonObject;
+  }
+
+  @Override
+  public int getRowCount() {
+    return 1;
+  }
+
+  @Override
+  public int getColumnCount() {
+    return 1;
+  }
+
+  @Override
+  public String getColumnName(int columnIndex) {
+    try {
+      return _jsonObject.getString("function");
+    } catch (JSONException e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  @Override
+  public String getString(int rowIndex, int columnIndex) {
+    if (columnIndex != 0) {
+      throw new IllegalArgumentException(
+          "Column index must always be 0 for aggregation result sets");
+    }
+
+    if (rowIndex != 0) {
+      throw new IllegalArgumentException("Row index must always be 0 for aggregation result sets");
+    }
+
+    try {
+      return _jsonObject.get("value").toString();
+    } catch (Exception e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  @Override
+  public int getGroupKeyLength() {
+    return 0;
+  }
+
+  @Override
+  public String getGroupKeyColumnName(int groupKeyColumnIndex) {
+    throw new AssertionError("No group key column name for aggregation results");
+  }
+
+  @Override
+  public String getGroupKeyString(int rowIndex, int groupKeyColumnIndex) {
+    throw new AssertionError("No grouping key for queries without a group by clause");
+  }
+
+  @Override
+  public String toString() {
+    int numColumns = getColumnCount();
+    TextTable table = new TextTable();
+    String[] columnNames = new String[numColumns];
+
+    for (int c = 0; c < getColumnCount(); c++) {
+      columnNames[c] = getColumnName(c);
+    }
+    table.addHeader(columnNames);
+
+    int numRows = getRowCount();
+    for (int r = 0; r < numRows; r++) {
+      String[] columnValues = new String[numColumns];
+      for (int c = 0; c < getColumnCount(); c++) {
+        columnValues[c] = getString(r, c);
+      }
+      table.addRow(columnValues);
+    }
+    return table.toString();
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/BrokerResponse.java b/pinot-api/src/main/java/org/apache/pinot/client/BrokerResponse.java
new file mode 100644
index 0000000..7db976e
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/BrokerResponse.java
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.List;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+/**
+ * Reimplementation of BrokerResponse from pinot-common, so that pinot-api does not depend on pinot-common.
+ */
+class BrokerResponse {
+  private JSONArray _aggregationResults;
+  private JSONObject _selectionResults;
+  private JSONArray _exceptions;
+
+  private BrokerResponse() {
+  }
+
+  private BrokerResponse(JSONObject brokerResponse) {
+    try {
+      if (brokerResponse.has("aggregationResults")) {
+        _aggregationResults = brokerResponse.getJSONArray("aggregationResults");
+      }
+      if (brokerResponse.has("exceptions")) {
+        _exceptions = brokerResponse.getJSONArray("exceptions");
+      }
+      if (brokerResponse.has("selectionResults")) {
+        _selectionResults = brokerResponse.getJSONObject("selectionResults");
+      }
+    } catch (JSONException e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  boolean hasExceptions() {
+    return _exceptions != null && _exceptions.length() != 0;
+  }
+
+  JSONArray getExceptions() {
+    return _exceptions;
+  }
+
+  JSONArray getAggregationResults() {
+    return _aggregationResults;
+  }
+
+  JSONObject getSelectionResults() {
+    return _selectionResults;
+  }
+
+  int getAggregationResultsSize() {
+    if (_aggregationResults == null) {
+      return 0;
+    } else {
+      return _aggregationResults.length();
+    }
+  }
+
+  static BrokerResponse fromJson(JSONObject json) {
+    return new BrokerResponse(json);
+  }
+
+  static BrokerResponse empty() {
+    return new BrokerResponse();
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/BrokerSelector.java b/pinot-api/src/main/java/org/apache/pinot/client/BrokerSelector.java
new file mode 100644
index 0000000..519e169
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/BrokerSelector.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+public interface BrokerSelector {
+  /**
+   * Returns the broker address in the form host:port
+   * @param table
+   * @return
+   */
+  String selectBroker(String table);
+
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/Connection.java b/pinot-api/src/main/java/org/apache/pinot/client/Connection.java
new file mode 100644
index 0000000..023cb64
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/Connection.java
@@ -0,0 +1,155 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A connection to Pinot, normally created through calls to the {@link ConnectionFactory}.
+ */
+public class Connection {
+  private static final Logger LOGGER = LoggerFactory.getLogger(Connection.class);
+  private final PinotClientTransport _transport;
+  private BrokerSelector _brokerSelector;
+  private List<String> _brokerList;
+
+  Connection(List<String> brokerList, PinotClientTransport transport) {
+    _brokerList = brokerList;
+    LOGGER.info("Creating connection to broker list {}", brokerList);
+    _brokerSelector = new SimpleBrokerSelector(brokerList);
+    _transport = transport;
+  }
+
+  Connection(BrokerSelector brokerSelector , PinotClientTransport transport) {
+    _brokerSelector = brokerSelector;
+    _transport = transport;
+  }
+
+  /**
+   * Creates a prepared statement, to escape query parameters.
+   *
+   * @param statement The statement for which to create a prepared statement.
+   * @return A prepared statement for this connection.
+   */
+  public PreparedStatement prepareStatement(String statement) {
+    return new PreparedStatement(this, statement);
+  }
+
+  /**
+   * Executes a PQL statement.
+   * @param statement The statement to execute
+   * @return The result of the query
+   * @throws PinotClientException If an exception occurs while processing the query
+   */
+  public ResultSetGroup execute(String statement) throws PinotClientException {
+    return execute(null, statement);
+  }
+
+  /**
+   * Executes a PQL statement.
+   *
+   * @param statement The statement to execute
+   * @return The result of the query
+   * @throws PinotClientException If an exception occurs while processing the query
+   */
+  public ResultSetGroup execute(String tableName, String statement) throws PinotClientException {
+    String brokerHostPort = _brokerSelector.selectBroker(tableName);
+    if (brokerHostPort == null) {
+      throw new PinotClientException("Could not find broker to query for table: " +
+          (tableName == null ? "null" : tableName));
+    }
+    BrokerResponse response = _transport.executeQuery(brokerHostPort, statement);
+    if (response.hasExceptions()) {
+      throw new PinotClientException("Query had processing exceptions: \n" + response.getExceptions());
+    }
+    return new ResultSetGroup(response);
+  }
+
+  /**
+   * Executes a PQL statement asynchronously.
+   *
+   * @param statement The statement to execute
+   * @return A future containing the result of the query
+   * @throws PinotClientException If an exception occurs while processing the query
+   */
+  public Future<ResultSetGroup> executeAsync(String statement) throws PinotClientException {
+    String brokerHostPort = _brokerSelector.selectBroker(null);
+    if (brokerHostPort == null) {
+      throw new PinotClientException("Could not find broker to query for statement: " +
+          (statement == null ? "null" : statement));
+    }
+    final Future<BrokerResponse> responseFuture = _transport.executeQueryAsync(brokerHostPort, statement);
+    return new ResultSetGroupFuture(responseFuture);
+  }
+
+  /**
+   * Returns the list of brokers to which this connection can connect to.
+   *
+   * @return The list of brokers to which this connection can connect to.
+   */
+  List<String> getBrokerList() {
+    return _brokerList;
+  }
+
+  private static class ResultSetGroupFuture implements Future<ResultSetGroup> {
+    private final Future<BrokerResponse> _responseFuture;
+
+    public ResultSetGroupFuture(Future<BrokerResponse> responseFuture) {
+      _responseFuture = responseFuture;
+    }
+
+    @Override
+    public boolean cancel(boolean mayInterruptIfRunning) {
+      return _responseFuture.cancel(mayInterruptIfRunning);
+    }
+
+    @Override
+    public boolean isCancelled() {
+      return _responseFuture.isCancelled();
+    }
+
+    @Override
+    public boolean isDone() {
+      return _responseFuture.isDone();
+    }
+
+    @Override
+    public ResultSetGroup get() throws InterruptedException, ExecutionException {
+      try {
+        return get(1000L, TimeUnit.DAYS);
+      } catch (TimeoutException e) {
+        throw new ExecutionException(e);
+      }
+    }
+
+    @Override
+    public ResultSetGroup get(long timeout, TimeUnit unit)
+        throws InterruptedException, ExecutionException, TimeoutException {
+      BrokerResponse response = _responseFuture.get(timeout, unit);
+      return new ResultSetGroup(response);
+    }
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/ConnectionFactory.java b/pinot-api/src/main/java/org/apache/pinot/client/ConnectionFactory.java
new file mode 100644
index 0000000..54484dc
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/ConnectionFactory.java
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.Arrays;
+import java.util.Properties;
+
+/**
+ * Creates connections to Pinot, given various initialization methods.
+ */
+public class ConnectionFactory {
+  static PinotClientTransportFactory _transportFactory = new JsonAsyncHttpPinotClientTransportFactory();
+
+  private ConnectionFactory() {
+  }
+
+  /**
+   * Creates a connection to a Pinot cluster, given its Zookeeper URL
+   *
+   * @param zkUrl The URL to the Zookeeper cluster, must include the cluster name e.g host:port/chroot/pinot-cluster
+   * @return A connection that connects to the brokers in the given Helix cluster
+   */
+  public static Connection fromZookeeper(String zkUrl) {
+    try {
+      DynamicBrokerSelector dynamicBrokerSelector = new DynamicBrokerSelector(zkUrl);
+      return new Connection(dynamicBrokerSelector, _transportFactory.buildTransport());
+    } catch (Exception e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  /**
+   * Creates a connection from properties containing the connection parameters.
+   *
+   * @param properties The properties to use for the connection
+   * @return A connection that connects to the brokers specified in the properties
+   */
+  public static Connection fromProperties(Properties properties) {
+    return new Connection(Arrays.asList(properties.getProperty("brokerList").split(",")), _transportFactory.buildTransport());
+  }
+
+  /**
+   * Creates a connection which sends queries randomly between the specified brokers.
+   *
+   * @param brokers The list of brokers to send queries to
+   * @return A connection to the set of brokers specified
+   */
+  public static Connection fromHostList(String... brokers) {
+    return new Connection(Arrays.asList(brokers), _transportFactory.buildTransport());
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/DynamicBrokerSelector.java b/pinot-api/src/main/java/org/apache/pinot/client/DynamicBrokerSelector.java
new file mode 100644
index 0000000..1e554d5
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/DynamicBrokerSelector.java
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.annotation.Nullable;
+import org.I0Itec.zkclient.IZkDataListener;
+import org.I0Itec.zkclient.ZkClient;
+import org.I0Itec.zkclient.serialize.BytesPushThroughSerializer;
+
+import static org.apache.pinot.client.ExternalViewReader.OFFLINE_SUFFIX;
+import static org.apache.pinot.client.ExternalViewReader.REALTIME_SUFFIX;
+
+
+/**
+ * Maintains a mapping between table name and list of brokers
+ */
+public class DynamicBrokerSelector implements BrokerSelector, IZkDataListener {
+  AtomicReference<Map<String, List<String>>> tableToBrokerListMapRef =
+      new AtomicReference<Map<String, List<String>>>();
+  AtomicReference<List<String>> allBrokerListRef = new AtomicReference<List<String>>();
+  private final Random _random = new Random();
+  private ExternalViewReader evReader;
+
+  public DynamicBrokerSelector(String zkServers) {
+    ZkClient zkClient = new ZkClient(zkServers);
+    zkClient.setZkSerializer(new BytesPushThroughSerializer());
+    zkClient.waitUntilConnected(60, TimeUnit.SECONDS);
+    zkClient.subscribeDataChanges(ExternalViewReader.BROKER_EXTERNAL_VIEW_PATH, this);
+    evReader = new ExternalViewReader(zkClient);
+    refresh();
+  }
+
+  private void refresh() {
+    Map<String, List<String>> tableToBrokerListMap = evReader.getTableToBrokersMap();
+    tableToBrokerListMapRef.set(tableToBrokerListMap);
+    Set<String> brokerSet = new HashSet<>();
+    for (List<String> brokerList : tableToBrokerListMap.values()) {
+      brokerSet.addAll(brokerList);
+    }
+    allBrokerListRef.set(new ArrayList<>(brokerSet));
+  }
+
+  @Override
+  public @Nullable String selectBroker(String table) {
+    if (table == null) {
+      List<String> list = allBrokerListRef.get();
+      if (list != null && !list.isEmpty()) {
+        return list.get(_random.nextInt(list.size()));
+      } else {
+        return null;
+      }
+    }
+    String tableName = table.replace(ExternalViewReader.OFFLINE_SUFFIX, "").replace(ExternalViewReader.REALTIME_SUFFIX, "");
+    List<String> list = tableToBrokerListMapRef.get().get(tableName);
+    if (list != null && !list.isEmpty()) {
+      return list.get(_random.nextInt(list.size()));
+    }
+    return null;
+  }
+
+  @Override
+  public void handleDataChange(String dataPath, Object data) throws Exception {
+    refresh();
+  }
+
+  @Override
+  public void handleDataDeleted(String dataPath) throws Exception {
+    refresh();
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/ExternalViewReader.java b/pinot-api/src/main/java/org/apache/pinot/client/ExternalViewReader.java
new file mode 100644
index 0000000..237d4a5
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/ExternalViewReader.java
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import java.util.zip.GZIPInputStream;
+import org.I0Itec.zkclient.ZkClient;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Reads brokers external view from Zookeeper
+ */
+public class ExternalViewReader {
+  private static final Logger LOGGER = LoggerFactory.getLogger(ExternalViewReader.class);
+
+  private ZkClient zkClient;
+
+  public static String BROKER_EXTERNAL_VIEW_PATH = "/EXTERNALVIEW/brokerResource";
+  public static String REALTIME_SUFFIX = "_REALTIME";
+  public static String OFFLINE_SUFFIX = "_OFFLINE";
+
+  public ExternalViewReader(ZkClient zkClient) {
+    this.zkClient = zkClient;
+  }
+
+  public List<String> getLiveBrokers() {
+    List<String> brokerUrls = new ArrayList<String>();
+    try {
+
+      byte[] brokerResourceNodeData = zkClient.readData(BROKER_EXTERNAL_VIEW_PATH, true);
+      brokerResourceNodeData = unpackZnodeIfNecessary(brokerResourceNodeData);
+      JSONObject jsonObject = new JSONObject(new String(brokerResourceNodeData));
+      JSONObject brokerResourceNode = jsonObject.getJSONObject("mapFields");
+
+      Iterator<String> resourceNames = brokerResourceNode.keys();
+      while (resourceNames.hasNext()) {
+        String resourceName = resourceNames.next();
+        JSONObject resource = brokerResourceNode.getJSONObject(resourceName);
+
+        Iterator<String> brokerNames = resource.keys();
+        while (brokerNames.hasNext()) {
+          String brokerName = brokerNames.next();
+          if (brokerName.startsWith("Broker_") && "ONLINE".equals(resource.getString(brokerName))) {
+            // Turn Broker_12.34.56.78_1234 into 12.34.56.78:1234
+            String brokerHostPort = brokerName.replace("Broker_", "").replace("_", ":");
+            brokerUrls.add(brokerHostPort);
+          }
+        }
+      }
+    } catch (Exception e) {
+      LOGGER.warn("Exception while reading External view from zookeeper", e);
+      // ignore
+    }
+    return brokerUrls;
+  }
+
+  @SuppressWarnings("unchecked")
+  public Map<String, List<String>> getTableToBrokersMap() {
+    Map<String, Set<String>> brokerUrlsMap = new HashMap<>();
+    try {
+      byte[] brokerResourceNodeData = zkClient.readData("/EXTERNALVIEW/brokerResource", true);
+      brokerResourceNodeData = unpackZnodeIfNecessary(brokerResourceNodeData);
+      JSONObject jsonObject = new JSONObject(new String(brokerResourceNodeData));
+      JSONObject brokerResourceNode = jsonObject.getJSONObject("mapFields");
+
+      Iterator<String> resourceNames = brokerResourceNode.keys();
+      while (resourceNames.hasNext()) {
+        String resourceName = resourceNames.next();
+        String tableName = resourceName.replace(OFFLINE_SUFFIX, "").replace(REALTIME_SUFFIX, "");
+        Set<String> brokerUrls = brokerUrlsMap.get(tableName);
+        if (brokerUrls == null) {
+          brokerUrls = new HashSet<>();
+          brokerUrlsMap.put(tableName, brokerUrls);
+        }
+        JSONObject resource = brokerResourceNode.getJSONObject(resourceName);
+        Iterator<String> brokerNames = resource.keys();
+        while (brokerNames.hasNext()) {
+          String brokerName = brokerNames.next();
+          if (brokerName.startsWith("Broker_") && "ONLINE".equals(resource.getString(brokerName))) {
+            // Turn Broker_12.34.56.78_1234 into 12.34.56.78:1234
+            String brokerHostPort = brokerName.replace("Broker_", "").replace("_", ":");
+            brokerUrls.add(brokerHostPort);
+          }
+        }
+      }
+    } catch (Exception e) {
+      LOGGER.warn("Exception while reading External view from zookeeper", e);
+      // ignore
+    }
+    Map<String, List<String>> tableToBrokersMap = new HashMap<>();
+    for (Entry<String, Set<String>> entry : brokerUrlsMap.entrySet()) {
+      tableToBrokersMap.put(entry.getKey(), new ArrayList<>(entry.getValue()));
+    }
+    return tableToBrokersMap;
+  }
+
+  private static byte[] unpackZnodeIfNecessary(byte[] znodeContents) {
+    // Check for gzip header
+    if (znodeContents[0] == 0x1F && znodeContents[1] == (byte) 0x8B) {
+      try {
+        GZIPInputStream inputStream = new GZIPInputStream(new ByteArrayInputStream(znodeContents));
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        int byteRead = inputStream.read();
+
+        while (byteRead != -1) {
+          outputStream.write(byteRead);
+          byteRead = inputStream.read();
+        }
+
+        return outputStream.toByteArray();
+      } catch (IOException e) {
+        LOGGER.error("Failed to decompress znode contents", e);
+        return znodeContents;
+      }
+    } else {
+      // Doesn't look compressed, just return the contents verbatim
+      return znodeContents;
+    }
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/GroupByResultSet.java b/pinot-api/src/main/java/org/apache/pinot/client/GroupByResultSet.java
new file mode 100644
index 0000000..290cf78
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/GroupByResultSet.java
@@ -0,0 +1,135 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * A Pinot query result set for group by results, of which there is one of per aggregation function
+ * in the query.
+ */
+class GroupByResultSet extends AbstractResultSet {
+  private final JSONArray _groupByResults;
+  private final JSONArray _groupByColumns;
+  private final String _functionName;
+
+  public GroupByResultSet(JSONObject jsonObject) {
+    try {
+      _groupByResults = jsonObject.getJSONArray("groupByResult");
+      _groupByColumns = jsonObject.getJSONArray("groupByColumns");
+      _functionName = jsonObject.getString("function");
+    } catch (JSONException e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  /**
+   * Returns the number of rows in this result group.
+   * @return The number of rows in this result group
+   */
+  @Override
+  public int getRowCount() {
+    return _groupByResults.length();
+  }
+
+  @Override
+  public int getColumnCount() {
+    return 1;
+  }
+
+  @Override
+  public String getColumnName(int columnIndex) {
+    return _functionName;
+  }
+
+  @Override
+  public String getString(int rowIndex, int columnIndex) {
+    if (columnIndex != 0) {
+      throw new IllegalArgumentException(
+          "Column index must always be 0 for aggregation result sets");
+    }
+
+    try {
+      return _groupByResults.getJSONObject(rowIndex).get("value").toString();
+    } catch (Exception e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  @Override
+  public int getGroupKeyLength() {
+    return _groupByColumns.length();
+  }
+
+  @Override
+  public String getGroupKeyString(int rowIndex, int groupKeyColumnIndex) {
+    try {
+      return _groupByResults.getJSONObject(rowIndex).getJSONArray("group").getString(groupKeyColumnIndex);
+    } catch (Exception e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  @Override
+  public String getGroupKeyColumnName(int groupKeyColumnIndex) {
+    try {
+      return _groupByColumns.getString(groupKeyColumnIndex);
+    } catch (Exception e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  @Override
+  public String toString() {
+    int groupKeyLength = getGroupKeyLength();
+    int numColumns = groupKeyLength + getColumnCount();
+    TextTable table = new TextTable();
+    String[] columnNames = new String[numColumns];
+    for (int c = 0; c < groupKeyLength; c++) {
+      try {
+        columnNames[c] = getGroupKeyColumnName(c);
+      } catch (Exception e) {
+        columnNames[c] = "ERROR";
+      }
+    }
+    for (int c = 0; c < getColumnCount(); c++) {
+      columnNames[groupKeyLength + c] = getColumnName(c);
+    }
+    table.addHeader(columnNames);
+
+    int numRows = getRowCount();
+    for (int r = 0; r < numRows; r++) {
+      String[] columnValues = new String[numColumns];
+      for (int c = 0; c < groupKeyLength; c++) {
+        try {
+          columnValues[c] = getGroupKeyString(r, c);
+        } catch (Exception e) {
+          columnValues[c] = "ERROR";
+        }
+      }
+      for (int c = 0; c < getColumnCount(); c++) {
+        columnValues[groupKeyLength + c] = getString(r, c);
+      }
+      table.addRow(columnValues);
+    }
+    return table.toString();
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java b/pinot-api/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
new file mode 100644
index 0000000..2e4d2de
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import com.ning.http.client.AsyncHttpClient;
+import com.ning.http.client.Response;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * JSON encoded Pinot client transport over AsyncHttpClient.
+ */
+class JsonAsyncHttpPinotClientTransport implements PinotClientTransport {
+  private static final Logger LOGGER = LoggerFactory.getLogger(JsonAsyncHttpPinotClientTransport.class);
+  AsyncHttpClient _httpClient = new AsyncHttpClient();
+
+  @Override
+  public BrokerResponse executeQuery(String brokerAddress, String query) throws PinotClientException {
+    try {
+      return executeQueryAsync(brokerAddress, query).get();
+    } catch (Exception e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  @Override
+  public Future<BrokerResponse> executeQueryAsync(String brokerAddress, final String query) {
+    try {
+      final JSONObject json = new JSONObject();
+      json.put("pql", query);
+
+      final String url = "http://" + brokerAddress + "/query";
+
+      final Future<Response> response = _httpClient.preparePost(url).setBody(json.toString()).execute();
+
+      return new BrokerResponseFuture(response, query, url);
+    } catch (Exception e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  private static class BrokerResponseFuture implements Future<BrokerResponse> {
+    private final Future<Response> _response;
+    private final String _query;
+    private final String _url;
+
+    public BrokerResponseFuture(Future<Response> response, String query, String url) {
+      _response = response;
+      _query = query;
+      _url = url;
+    }
+
+    @Override
+    public boolean cancel(boolean mayInterruptIfRunning) {
+      return _response.cancel(mayInterruptIfRunning);
+    }
+
+    @Override
+    public boolean isCancelled() {
+      return _response.isCancelled();
+    }
+
+    @Override
+    public boolean isDone() {
+      return _response.isDone();
+    }
+
+    @Override
+    public BrokerResponse get()
+        throws InterruptedException, ExecutionException {
+      try {
+        return get(1000L, TimeUnit.DAYS);
+      } catch (TimeoutException e) {
+        LOGGER.error("Caught timeout during synchronous get", e);
+        throw new InterruptedException();
+      }
+    }
+
+    @Override
+    public BrokerResponse get(long timeout, TimeUnit unit)
+        throws InterruptedException, ExecutionException, TimeoutException {
+      try {
+        LOGGER.debug("Sending query {} to {}", _query, _url);
+
+        Response httpResponse = _response.get(timeout, unit);
+
+        LOGGER.debug("Completed query, HTTP status is {}", httpResponse.getStatusCode());
+
+        if (httpResponse.getStatusCode() != 200) {
+          throw new PinotClientException("Pinot returned HTTP status " + httpResponse.getStatusCode() +
+              ", expected 200");
+        }
+
+        String responseBody = httpResponse.getResponseBody();
+        return BrokerResponse.fromJson(new JSONObject(responseBody));
+      } catch (Exception e) {
+        throw new ExecutionException(e);
+      }
+    }
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java b/pinot-api/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java
new file mode 100644
index 0000000..da2ff12
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransportFactory.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+/**
+ * Pinot client transport factory for JSON encoded BrokerResults through HTTP.
+ */
+class JsonAsyncHttpPinotClientTransportFactory implements PinotClientTransportFactory {
+  @Override
+  public PinotClientTransport buildTransport() {
+    return new JsonAsyncHttpPinotClientTransport();
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/PinotClientException.java b/pinot-api/src/main/java/org/apache/pinot/client/PinotClientException.java
new file mode 100644
index 0000000..c2c8f15
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/PinotClientException.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+/**
+ * Pinot client exception.
+ */
+public class PinotClientException extends RuntimeException {
+  public PinotClientException(String message) {
+    super(message);
+  }
+
+  public PinotClientException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+  public PinotClientException(Throwable cause) {
+    super(cause);
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/PinotClientTransport.java b/pinot-api/src/main/java/org/apache/pinot/client/PinotClientTransport.java
new file mode 100644
index 0000000..9c2dffd
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/PinotClientTransport.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.concurrent.Future;
+
+
+/**
+ * Interface for plugging different client transports.
+ */
+interface PinotClientTransport {
+  BrokerResponse executeQuery(String brokerAddress, String query) throws PinotClientException;
+  Future<BrokerResponse> executeQueryAsync(String brokerAddress, String query) throws PinotClientException;
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/PinotClientTransportFactory.java b/pinot-api/src/main/java/org/apache/pinot/client/PinotClientTransportFactory.java
new file mode 100644
index 0000000..ce74ce8
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/PinotClientTransportFactory.java
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+/**
+ * Factory for client transports.
+ */
+interface PinotClientTransportFactory {
+  PinotClientTransport buildTransport();
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/PreparedStatement.java b/pinot-api/src/main/java/org/apache/pinot/client/PreparedStatement.java
new file mode 100644
index 0000000..fee0d52
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/PreparedStatement.java
@@ -0,0 +1,121 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.concurrent.Future;
+
+
+/**
+ * A prepared statement, which is used to escape query parameters sent to Pinot.
+ */
+public class PreparedStatement {
+  private final Connection _connection;
+  private final String _statement;
+  private final String[] _parameters;
+
+  PreparedStatement(Connection connection, String statement) {
+    _connection = connection;
+    _statement = statement;
+
+    int questionMarkCount = 0;
+    int index = statement.indexOf('?');
+    while (index != -1) {
+      questionMarkCount++;
+      index = statement.indexOf('?', index + 1);
+    }
+
+    _parameters = new String[questionMarkCount];
+  }
+
+  private String fillStatementWithParameters() {
+    String statement = _statement;
+    for (String parameter : _parameters) {
+      statement = statement.replaceFirst("\\?", parameter);
+    }
+    return statement;
+  }
+
+  /**
+   * Executes this prepared statement.
+   *
+   * @return The query results
+   */
+  public ResultSetGroup execute() {
+    return _connection.execute(fillStatementWithParameters());
+  }
+
+  /**
+   * Executes this prepared statement asynchronously.
+   *
+   * @return The query results
+   */
+  public Future<ResultSetGroup> executeAsync() {
+    return _connection.executeAsync(fillStatementWithParameters());
+  }
+
+  /**
+   * Replaces the given parameter by its value.
+   *
+   * @param parameterIndex The index of the parameter to replace
+   * @param value The value of the parameter to replace
+   */
+  public void setString(int parameterIndex, String value) {
+    _parameters[parameterIndex] = "'" + value.replace("'", "''") + "'";
+  }
+
+  /**
+   * Replaces the given parameter by its value.
+   *
+   * @param parameterIndex The index of the parameter to replace
+   * @param value The value of the parameter to replace
+   */
+  public void setInt(int parameterIndex, int value) {
+    _parameters[parameterIndex] = String.valueOf(value);
+  }
+
+  /**
+   * Replaces the given parameter by its value.
+   *
+   * @param parameterIndex The index of the parameter to replace
+   * @param value The value of the parameter to replace
+   */
+  public void setLong(int parameterIndex, long value) {
+    _parameters[parameterIndex] = String.valueOf(value);
+  }
+
+  /**
+   * Replaces the given parameter by its value.
+   *
+   * @param parameterIndex The index of the parameter to replace
+   * @param value The value of the parameter to replace
+   */
+  public void setFloat(int parameterIndex, float value) {
+    _parameters[parameterIndex] = String.valueOf(value);
+  }
+
+  /**
+   * Replaces the given parameter by its value.
+   *
+   * @param parameterIndex The index of the parameter to replace
+   * @param value The value of the parameter to replace
+   */
+  public void setDouble(int parameterIndex, double value) {
+    _parameters[parameterIndex] = String.valueOf(value);
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/ResultSet.java b/pinot-api/src/main/java/org/apache/pinot/client/ResultSet.java
new file mode 100644
index 0000000..05e1e21
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/ResultSet.java
@@ -0,0 +1,190 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+/**
+ * A Pinot result group, representing an aggregation function in the original query.
+ */
+public interface ResultSet {
+  /**
+   * Returns the number of rows in this result set.
+   *
+   * @return The number of rows in this result set
+   */
+  int getRowCount();
+
+  /**
+   * Returns the number of columns in this result set.
+   *
+   * @return The number of columns in this result set
+   */
+  int getColumnCount();
+
+  /**
+   * Returns the column name at a given index.
+   *
+   * @param columnIndex The index of the column for which to retrieve the name
+   * @return The name of the column at the given column index
+   */
+  String getColumnName(int columnIndex);
+
+  /**
+   * Obtains the integer value for the given row.
+   *
+   * @param rowIndex The index of the row
+   * @return The integer value for the given row
+   */
+  int getInt(int rowIndex);
+
+  /**
+   * Obtains the long value for the given row.
+   *
+   * @param rowIndex The index of the row
+   * @return The long value for the given row
+   */
+  long getLong(int rowIndex);
+
+  /**
+   * Obtains the float value for the given row.
+   *
+   * @param rowIndex The index of the row
+   * @return The float value for the given row
+   */
+  float getFloat(int rowIndex);
+
+  /**
+   * Obtains the double value for the given row.
+   *
+   * @param rowIndex The index of the row
+   * @return The double value for the given row
+   */
+  double getDouble(int rowIndex);
+
+  /**
+   * Obtains the String value for the given row.
+   *
+   * @param rowIndex The index of the row
+   * @return The String value for the given row
+   */
+  String getString(int rowIndex);
+
+  /**
+   * Obtains the integer value for the given row and column.
+   *
+   * @param rowIndex The index of the row
+   * @param columnIndex The index of the column for which to fetch the value
+   * @return The integer value for the given row and column
+   */
+  int getInt(int rowIndex, int columnIndex);
+
+  /**
+   * Obtains the long value for the given row and column.
+   *
+   * @param rowIndex The index of the row
+   * @param columnIndex The index of the column for which to fetch the value
+   * @return The long value for the given row and column
+   */
+  long getLong(int rowIndex, int columnIndex);
+
+  /**
+   * Obtains the float value for the given row and column.
+   *
+   * @param rowIndex The index of the row
+   * @param columnIndex The index of the column for which to fetch the value
+   * @return The float value for the given row and column
+   */
+  float getFloat(int rowIndex, int columnIndex);
+
+  /**
+   * Obtains the double value for the given row and column.
+   *
+   * @param rowIndex The index of the row
+   * @param columnIndex The index of the column for which to fetch the value
+   * @return The double value for the given row and column
+   */
+  double getDouble(int rowIndex, int columnIndex);
+
+  /**
+   * Obtains the String value for the given row and column.
+   *
+   * @param rowIndex The index of the row
+   * @param columnIndex The index of the column for which to fetch the value
+   * @return The String value for the given row and column
+   */
+  String getString(int rowIndex, int columnIndex);
+
+  /**
+   * Obtains the length of the group key, or 0 if there is no grouping key.
+   *
+   * @return The length of the group key, or 0 if there is no grouping key.
+   */
+  int getGroupKeyLength();
+
+  /**
+   * Get the group key name for the given key column index. use getGroupKeyLength() to know the number of groupKey
+   * @param groupKeyColumnIndex
+   * @return group key column name
+   */
+  String getGroupKeyColumnName(int groupKeyColumnIndex);
+
+  /**
+   * Obtains the group key value for the given row and key column index.
+   *
+   * @param rowIndex The index of the row
+   * @param groupKeyColumnIndex The group key column's index
+   * @return The group key value, as an integer
+   */
+  int getGroupKeyInt(int rowIndex, int groupKeyColumnIndex);
+
+  /**
+   * Obtains the group key value for the given row and key column index.
+   *
+   * @param rowIndex The index of the row
+   * @param groupKeyColumnIndex The group key column's index
+   * @return The group key value, as a long
+   */
+  long getGroupKeyLong(int rowIndex, int groupKeyColumnIndex);
+
+  /**
+   * Obtains the group key value for the given row and key column index.
+   *
+   * @param rowIndex The index of the row
+   * @param groupKeyColumnIndex The group key column's index
+   * @return The group key value, as a float
+   */
+  float getGroupKeyFloat(int rowIndex, int groupKeyColumnIndex);
+
+  /**
+   * Obtains the group key value for the given row and key column index.
+   *
+   * @param rowIndex The index of the row
+   * @param groupKeyColumnIndex The group key column's index
+   * @return The group key value, as a double
+   */
+  double getGroupKeyDouble(int rowIndex, int groupKeyColumnIndex);
+
+  /**
+   * Obtains the group key value for the given row and key column index.
+   *
+   * @param rowIndex The index of the row
+   * @param groupKeyColumnIndex The group key column's index
+   * @return The group key value, as a String
+   */
+  String getGroupKeyString(int rowIndex, int groupKeyColumnIndex);
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/ResultSetGroup.java b/pinot-api/src/main/java/org/apache/pinot/client/ResultSetGroup.java
new file mode 100644
index 0000000..89e717b
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/ResultSetGroup.java
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+/**
+ * A Pinot result set group, containing the results given back by Pinot for a given query.
+ */
+public class ResultSetGroup {
+  private final List<ResultSet> _resultSets;
+
+  ResultSetGroup(BrokerResponse brokerResponse) {
+    _resultSets = new ArrayList<ResultSet>();
+
+    if (brokerResponse.getSelectionResults() != null) {
+      _resultSets.add(new SelectionResultSet(brokerResponse.getSelectionResults()));
+    }
+
+    int aggregationResultCount = brokerResponse.getAggregationResultsSize();
+    for (int i = 0; i < aggregationResultCount; i++) {
+      JSONObject aggregationResult;
+      try {
+        aggregationResult = brokerResponse.getAggregationResults().getJSONObject(i);
+      } catch (JSONException e) {
+        throw new PinotClientException(e);
+      }
+      if (aggregationResult.has("value")) {
+        _resultSets.add(new AggregationResultSet(aggregationResult));
+      } else if (aggregationResult.has("groupByResult")) {
+        _resultSets.add(new GroupByResultSet(aggregationResult));
+      } else {
+        throw new PinotClientException("Unrecognized result group, neither a value nor group by result");
+      }
+    }
+  }
+
+  /**
+   * Returns the number of result sets in this result set group, or 0 if there are no result sets; there is one result
+   * set per aggregation function in the original query and one result set in the case of a selection query.
+   *
+   * @return The number of result sets in this result set
+   */
+  public int getResultSetCount() {
+    return _resultSets.size();
+  }
+
+  /**
+   * Obtains the result set at the given index, starting from zero.
+   *
+   * @param index The index for which to obtain the result set
+   * @return The result set at the given index
+   */
+  public ResultSet getResultSet(int index) {
+    return _resultSets.get(index);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder();
+    for(ResultSet resultSet:_resultSets){
+      sb.append(resultSet);
+      sb.append("\n");
+    }
+    return sb.toString();
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/SelectionResultSet.java b/pinot-api/src/main/java/org/apache/pinot/client/SelectionResultSet.java
new file mode 100644
index 0000000..8b179c4
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/SelectionResultSet.java
@@ -0,0 +1,113 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * Selection result set, which contains the results of a selection query.
+ */
+class SelectionResultSet extends AbstractResultSet {
+  private JSONArray _resultsArray;
+  private JSONArray _columnsArray;
+
+  public SelectionResultSet(JSONObject selectionResults) {
+    try {
+      _resultsArray = selectionResults.getJSONArray("results");
+      _columnsArray = selectionResults.getJSONArray("columns");
+    } catch (JSONException e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  @Override
+  public int getRowCount() {
+    return _resultsArray.length();
+  }
+
+  @Override
+  public int getColumnCount() {
+    return _columnsArray.length();
+  }
+
+  @Override
+  public String getColumnName(int columnIndex) {
+    try {
+      return _columnsArray.getString(columnIndex);
+    } catch (JSONException e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  @Override
+  public String getString(int rowIndex, int columnIndex) {
+    try {
+      return _resultsArray.getJSONArray(rowIndex).get(columnIndex).toString();
+    } catch (JSONException e) {
+      throw new PinotClientException(e);
+    }
+  }
+
+  @Override
+  public int getGroupKeyLength() {
+    return 0;
+  }
+
+  @Override
+  public String getGroupKeyString(int rowIndex, int groupKeyColumnIndex) {
+    throw new AssertionError("No group key string for selection results");
+  }
+
+  @Override
+  public String getGroupKeyColumnName(int groupKeyColumnIndex) {
+    throw new AssertionError("No group key column name for selection results");
+  }
+
+  @Override
+  public String toString() {
+    int numColumns = getColumnCount();
+    TextTable table = new TextTable();
+    String[] columnNames = new String[numColumns];
+    for (int c = 0; c < numColumns; c++) {
+      try {
+        columnNames[c] = _columnsArray.getString(c);
+      } catch (JSONException e) {
+        columnNames[c] = "ERROR";
+      }
+    }
+    table.addHeader(columnNames);
+
+    int numRows = getRowCount();
+    for (int r = 0; r < numRows; r++) {
+      String[] columnValues = new String[numColumns];
+      for (int c = 0; c < numColumns; c++) {
+        try {
+          columnValues[c] = getString(r, c);
+        } catch (Exception e) {
+          columnNames[c] = "ERROR";
+        }
+      }
+      table.addRow(columnValues);
+    }
+    return table.toString();
+
+  }
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/SimpleBrokerSelector.java b/pinot-api/src/main/java/org/apache/pinot/client/SimpleBrokerSelector.java
new file mode 100644
index 0000000..97a8ddd
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/SimpleBrokerSelector.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Picks a broker randomly from list of brokers provided. This assumes that all the provided brokers
+ * are healthy. There is no health check done on the brokers
+ */
+public class SimpleBrokerSelector implements BrokerSelector {
+
+  private List<String> _brokerList;
+  private final Random _random = new Random();
+
+  public SimpleBrokerSelector(List<String> brokerList) {
+    this._brokerList = brokerList;
+  }
+
+  @Override
+  public String selectBroker(String table) {
+    return _brokerList.get(_random.nextInt(_brokerList.size()));
+  }
+
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/TextTable.java b/pinot-api/src/main/java/org/apache/pinot/client/TextTable.java
new file mode 100644
index 0000000..bde857d
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/TextTable.java
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Utility class to format tabular data. Useful to display on console for debugging
+ */
+public class TextTable {
+
+  private List<String[]> rows = new LinkedList<>();
+  private String[] headerColumnNames;
+  private final static char PAD_CHAR = ' ';
+
+  public TextTable() {
+
+  }
+
+  public void addHeader(String... headerColumnNames) {
+    this.headerColumnNames = headerColumnNames;
+  }
+
+  public void addRow(String... columnValues) {
+    rows.add(columnValues);
+  }
+
+  private int[] colWidths() {
+    int cols = 0;
+    if (headerColumnNames != null) {
+      cols = headerColumnNames.length;
+    }
+    for (String[] row : rows) {
+      cols = Math.max(cols, row.length);
+    }
+    int[] widths = new int[cols];
+    if (headerColumnNames != null) {
+      updateWidths(widths, headerColumnNames);
+    }
+    for (String[] row : rows) {
+      updateWidths(widths, row);
+    }
+    return widths;
+  }
+
+  private void updateWidths(int[] widths, String[] values) {
+    for (int colNum = 0; colNum < values.length; colNum++) {
+      int length = 0;
+      if (values[colNum] != null) {
+        length = values[colNum].getBytes().length;
+      }
+      widths[colNum] = Math.max(widths[colNum], length);
+    }
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder buf = new StringBuilder();
+
+    int[] colWidths = colWidths();
+    if (headerColumnNames != null) {
+      append(buf, colWidths, headerColumnNames);
+      int totalWidth = 0;
+      for (int width : colWidths) {
+        totalWidth += width;
+      }
+      buf.append(rightPad("", totalWidth, '='));
+      buf.append('\n');
+    }
+    for (String[] row : rows) {
+      append(buf, colWidths, row);
+    }
+
+    return buf.toString();
+  }
+
+  private void append(StringBuilder buf, int[] colWidths, String[] row) {
+    for (int colNum = 0; colNum < row.length; colNum++) {
+      buf.append(rightPad(row[colNum], colWidths[colNum], PAD_CHAR));
+      buf.append(' ');
+    }
+    buf.append('\n');
+  }
+
+  public static String rightPad(String str, final int size, final char padChar) {
+    int length = 0;
+    if (str != null) {
+      length = str.length();
+    }
+
+    final int pads = size - length;
+    if (pads <= 0) {
+      return str; // returns original String when possible
+    }
+    char[] buf = new char[size];
+
+    for (int i = 0; i < length; i++) {
+      buf[i] = str.charAt(i);
+    }
+    for (int i = str.length(); i < size; i++) {
+      buf[i] = padChar;
+    }
+    return String.valueOf(buf);
+  }
+
+}
diff --git a/pinot-api/src/main/java/org/apache/pinot/client/package-info.java b/pinot-api/src/main/java/org/apache/pinot/client/package-info.java
new file mode 100644
index 0000000..d135043
--- /dev/null
+++ b/pinot-api/src/main/java/org/apache/pinot/client/package-info.java
@@ -0,0 +1,98 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * This package contains the Pinot client API.
+ *
+ * Connections to Pinot are created using the
+ * {@link org.apache.pinot.client.ConnectionFactory} class' utility methods to create connections to a Pinot cluster
+ * given a Zookeeper URL, a Java Properties object or a list of broker addresses to connect to.
+ *
+ * <pre>{@code Connection connection = ConnectionFactory.fromZookeeper
+ *     (some-zookeeper-server:2191/zookeeperPath");
+ *
+ * Connection connection = ConnectionFactory.fromProperties("demo.properties");
+ *
+ * Connection connection = ConnectionFactory.fromHostList
+ *     ("some-server:1234", "some-other-server:1234", ...);}</pre>
+ *
+ * Queries can be sent directly to the Pinot cluster using the
+ * {@link org.apache.pinot.client.Connection#execute(java.lang.String)} and
+ * {@link org.apache.pinot.client.Connection#executeAsync(java.lang.String)} methods of
+ * {@link org.apache.pinot.client.Connection}.
+ *
+ * <pre>{@code ResultSetGroup resultSetGroup = connection.execute("select * from foo...");
+ * Future<ResultSetGroup> futureResultSetGroup = connection.executeAsync
+ *     ("select * from foo...");}</pre>
+ *
+ * Queries can also use a {@link org.apache.pinot.client.PreparedStatement} to escape query parameters:
+ *
+ * <pre>{@code PreparedStatement statement = connection.prepareStatement
+ *     ("select * from foo where a = ?");
+ * statement.setString(1, "bar");
+ *
+ * ResultSetGroup resultSetGroup = statement.execute();
+ * Future<ResultSetGroup> futureResultSetGroup = statement.executeAsync();}</pre>
+ *
+ * In the case of a selection query, results can be obtained with the various <code>get</code> methods in the first
+ * {@link org.apache.pinot.client.ResultSet}, obtained through the
+ * {@link org.apache.pinot.client.ResultSetGroup#getResultSet(int)} method:
+ *
+ * <pre>{@code ResultSet resultSet = connection.execute
+ *     ("select foo, bar from baz where quux = 'quuux'").getResultSet(0);
+ *
+ * for(int i = 0; i < resultSet.getRowCount(); ++i) {
+ *     System.out.println("foo: " + resultSet.getString(i, 0);
+ *     System.out.println("bar: " + resultSet.getInt(i, 1);
+ * }
+ *
+ * resultSet.close();}</pre>
+ *
+ * In the case where there is an aggregation, each aggregation function is within its own
+ * {@link org.apache.pinot.client.ResultSet}:
+ *
+ * <pre>{@code ResultSetGroup resultSetGroup = connection.execute("select count(*) from foo");
+ *
+ * ResultSet resultSet = resultSetGroup.getResultSet(0);
+ * System.out.println("Number of records: " + resultSet.getInt(0));
+ * resultSet.close();}</pre>
+ *
+ * There can be more than one {@link org.apache.pinot.client.ResultSet}, each of which can contain multiple results
+ * grouped by a group key.
+ *
+ * <pre>{@code ResultSetGroup resultSetGroup = connection.execute
+ *     ("select min(foo), max(foo) from bar group by baz");
+ *
+ * System.out.println("Number of result groups:" +
+ *     resultSetGroup.getResultSetCount(); // 2, min(foo) and max(foo)
+ *
+ * ResultSet minResultSet = resultSetGroup.getResultSet(0);
+ * for(int i = 0; i < minResultSet.length(); ++i) {
+ *     System.out.println("Minimum foo for " + minResultSet.getGroupKeyString(i, 1) +
+ *         ": " + minResultSet.getInt(i));
+ * }
+ *
+ * ResultSet maxResultSet = resultSetGroup.getResultSet(1);
+ * for(int i = 0; i < maxResultSet.length(); ++i) {
+ *     System.out.println("Maximum foo for " + maxResultSet.getGroupKeyString(i, 1) +
+ *         ": " + maxResultSet.getInt(i));
+ * }
+ *
+ * resultSet.close();}</pre>
+ */
+package org.apache.pinot.client;
\ No newline at end of file
diff --git a/pinot-api/src/test/java/com/linkedin/pinot/client/ConnectionFactoryTest.java b/pinot-api/src/test/java/com/linkedin/pinot/client/ConnectionFactoryTest.java
deleted file mode 100644
index 705f2a6..0000000
--- a/pinot-api/src/test/java/com/linkedin/pinot/client/ConnectionFactoryTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- * Tests for the connection factory
- */
-public class ConnectionFactoryTest {
-  @Test
-  public void testZkConnection() {
-    // TODO Write test
-    // Create a dummy Helix structure
-    // Create the connection
-    // Check that the broker list has the right length and has the same servers
-  }
-
-  @Test
-  public void testPropertiesConnection() {
-    // TODO Write test
-    // Create a properties object
-    // Create the connection
-    // Check that the broker list has the right length and has the same servers
-  }
-
-  @Test
-  public void testBrokerList() {
-    // Create the connection
-    String broker1 = "127.0.0.1:1234";
-    String broker2 = "localhost:2345";
-    Connection connection = ConnectionFactory.fromHostList(broker1, broker2);
-
-    // Check that the broker list has the right length and has the same servers
-    List<String> brokers = new ArrayList<String>();
-    brokers.add(broker1);
-    brokers.add(broker2);
-    Assert.assertEquals(connection.getBrokerList(), brokers);
-  }
-
-  // For testing DynamicBrokerSelector
-  /**
-   * ConnectionFactoryTest <ZK_URL> <tableName> <query>
-   * @param args
-   */
-  public static void main(String[] args) {
-    if (args.length != 3) {
-      System.err.println("USAGE ConnectionFactoryTest <ZK_URL> <tableName> <query>");
-      System.exit(1);
-    }
-    String zkUrl = args[0];
-    Connection connection = ConnectionFactory.fromZookeeper(zkUrl);
-    String tableName = args[1];
-    ResultSetGroup resultSetGroup = connection.execute(tableName, args[2]);
-    System.out.println(resultSetGroup);
-  }
-
-}
diff --git a/pinot-api/src/test/java/com/linkedin/pinot/client/PreparedStatementTest.java b/pinot-api/src/test/java/com/linkedin/pinot/client/PreparedStatementTest.java
deleted file mode 100644
index 365ca3c..0000000
--- a/pinot-api/src/test/java/com/linkedin/pinot/client/PreparedStatementTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.util.concurrent.Future;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-
-/**
- * Tests for prepared statement escaping
- *
- */
-public class PreparedStatementTest {
-  @Test
-  public void testPreparedStatementEscaping() {
-    // Create a prepared statement that has to quote a string appropriately
-    Connection connection = ConnectionFactory.fromHostList("dummy");
-    PreparedStatement preparedStatement = connection.prepareStatement("SELECT foo FROM bar WHERE baz = ?");
-    preparedStatement.setString(0, "'hello'");
-    preparedStatement.execute();
-
-    // Check that the query sent is appropriately escaped
-    Assert.assertEquals("SELECT foo FROM bar WHERE baz = '''hello'''", _dummyPinotClientTransport.getLastQuery());
-  }
-
-  private DummyPinotClientTransport _dummyPinotClientTransport = new DummyPinotClientTransport();
-  private PinotClientTransportFactory _previousTransportFactory = null;
-
-  class DummyPinotClientTransport implements PinotClientTransport {
-    private String _lastQuery;
-
-    @Override
-    public BrokerResponse executeQuery(String brokerAddress, String query)
-        throws PinotClientException {
-      _lastQuery = query;
-      return BrokerResponse.empty();
-    }
-
-    @Override
-    public Future<BrokerResponse> executeQueryAsync(String brokerAddress, String query)
-        throws PinotClientException {
-      _lastQuery = query;
-      return null;
-    }
-
-    public String getLastQuery() {
-      return _lastQuery;
-    }
-  }
-
-  class DummyPinotClientTransportFactory implements PinotClientTransportFactory {
-    @Override
-    public PinotClientTransport buildTransport() {
-      return _dummyPinotClientTransport;
-    }
-  }
-
-  @BeforeClass
-  public void overridePinotClientTransport() {
-    _previousTransportFactory = ConnectionFactory._transportFactory;
-    ConnectionFactory._transportFactory = new DummyPinotClientTransportFactory();
-  }
-
-  @AfterClass
-  public void resetPinotClientTransport() {
-    ConnectionFactory._transportFactory = _previousTransportFactory;
-  }
-}
diff --git a/pinot-api/src/test/java/com/linkedin/pinot/client/ResultSetGroupTest.java b/pinot-api/src/test/java/com/linkedin/pinot/client/ResultSetGroupTest.java
deleted file mode 100644
index 892cd7a..0000000
--- a/pinot-api/src/test/java/com/linkedin/pinot/client/ResultSetGroupTest.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.client;
-
-import java.io.InputStream;
-import java.util.concurrent.Future;
-import org.json.JSONObject;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-
-/**
- * Tests deserialization of a ResultSet given hardcoded Pinot results.
- *
- */
-public class ResultSetGroupTest {
-  @Test
-  public void testDeserializeSelectionResultSet() {
-    // Deserialize selection result
-    ResultSetGroup resultSetGroup = getResultSet("selection.json");
-    ResultSet resultSet = resultSetGroup.getResultSet(0);
-
-    // Check length
-    Assert.assertEquals(resultSetGroup.getResultSetCount(), 1, "Expected one result set for selection query");
-    Assert.assertEquals(resultSet.getRowCount(), 24, "Mismatched selection query length");
-
-    // Check that values match and are in the same order
-    Assert.assertEquals(resultSet.getInt(0, 0), 84);
-    Assert.assertEquals(resultSet.getLong(1, 0), 202L);
-    Assert.assertEquals(resultSet.getString(2, 0), "95");
-    Assert.assertEquals(resultSet.getInt(0, 78), 2014);
-
-    // Check the columns
-    Assert.assertEquals(resultSet.getColumnCount(), 79);
-    Assert.assertEquals(resultSet.getColumnName(0), "ActualElapsedTime");
-    Assert.assertEquals(resultSet.getColumnName(1), "AirTime");
-  }
-
-  @Test
-  public void testDeserializeAggregationResultSet() throws Exception {
-    // Deserialize aggregation result
-    ResultSetGroup resultSetGroup = getResultSet("aggregation.json");
-
-    // Check length and number of result groups
-    Assert.assertEquals(resultSetGroup.getResultSetCount(), 1, "Result set count mismatch");
-    ResultSet resultSet = resultSetGroup.getResultSet(0);
-    Assert.assertEquals(resultSet.getGroupKeyLength(), 0, "Expected 0 length group key for non-group by aggregation query");
-    Assert.assertEquals(resultSet.getRowCount(), 1, "Result group length mismatch");
-
-    // Check that values match and are in the same order
-    Assert.assertEquals(resultSet.getInt(0), 36542, "Mismatched int value");
-    Assert.assertEquals(resultSet.getLong(0), 36542L, "Mismatched long value");
-    Assert.assertEquals(resultSet.getString(0), "36542", "Mismatched String value");
-
-    // Check the columns
-    Assert.assertEquals(resultSet.getColumnCount(), 1);
-    Assert.assertEquals(resultSet.getColumnName(0), "count_star");
-  }
-
-  @Test
-  public void testDeserializeAggregationGroupByResultSet() {
-    // Deserialize aggregation group by result
-    ResultSetGroup resultSetGroup = getResultSet("aggregationGroupBy.json");
-
-    // Check length and number of result groups
-    Assert.assertEquals(resultSetGroup.getResultSetCount(), 1, "Result set count mismatch");
-    ResultSet resultSet = resultSetGroup.getResultSet(0);
-    Assert.assertEquals(resultSet.getGroupKeyLength(), 1, "Group key length mismatch");
-    Assert.assertEquals(resultSet.getRowCount(), 10, "Result group length mismatch");
-
-    // Check that values match and are in the same order
-    Assert.assertEquals(resultSet.getGroupKeyInt(0, 0), 30194);
-    Assert.assertEquals(resultSet.getGroupKeyLong(1, 0), 31057L);
-    Assert.assertEquals(resultSet.getGroupKeyString(2, 0), "32467");
-    Assert.assertEquals(resultSet.getInt(0), 3604);
-    Assert.assertEquals(resultSet.getLong(1), 1804L);
-    Assert.assertEquals(resultSet.getString(2), "1316");
-
-    // Check the columns
-    Assert.assertEquals(resultSet.getColumnCount(), 1);
-    Assert.assertEquals(resultSet.getColumnName(0), "count_star");
-  }
-
-  @Test
-  public void testDeserializeExceptionResultSet() {
-    try {
-      getResultSet("exception.json");
-      Assert.fail("Execute should have thrown an exception");
-    } catch (PinotClientException e) {
-      // We expect an exception here
-    }
-  }
-
-  private ResultSetGroup getResultSet(String resourceName) {
-    _dummyJsonTransport._resource = resourceName;
-    Connection connection = ConnectionFactory.fromHostList("dummy");
-    return connection.execute("dummy");
-  }
-
-  private DummyJsonTransport _dummyJsonTransport = new DummyJsonTransport();
-  private PinotClientTransportFactory _previousTransportFactory = null;
-
-  class DummyJsonTransport implements PinotClientTransport {
-    public String _resource;
-
-    @Override
-    public BrokerResponse executeQuery(String brokerAddress, String query)
-        throws PinotClientException {
-      try {
-        StringBuilder builder = new StringBuilder();
-        InputStream stream = getClass().getResourceAsStream(_resource);
-        int lastByte = stream.read();
-        while (lastByte != -1) {
-          builder.append((char)lastByte);
-          lastByte = stream.read();
-        }
-        String jsonText = builder.toString();
-        return BrokerResponse.fromJson(new JSONObject(jsonText));
-      } catch (Exception e) {
-        Assert.fail("Unexpected exception", e);
-        return null;
-      }
-    }
-
-    @Override
-    public Future<BrokerResponse> executeQueryAsync(String brokerAddress, String query)
-        throws PinotClientException {
-      return null;
-    }
-  }
-
-  class DummyJsonTransportFactory implements PinotClientTransportFactory {
-    @Override
-    public PinotClientTransport buildTransport() {
-      return _dummyJsonTransport;
-    }
-  }
-
-  @BeforeClass
-  public void overridePinotClientTransport() {
-    _previousTransportFactory = ConnectionFactory._transportFactory;
-    ConnectionFactory._transportFactory = new DummyJsonTransportFactory();
-  }
-
-  @AfterClass
-  public void resetPinotClientTransport() {
-    ConnectionFactory._transportFactory = _previousTransportFactory;
-  }
-}
diff --git a/pinot-api/src/test/java/org/apache/pinot/client/ConnectionFactoryTest.java b/pinot-api/src/test/java/org/apache/pinot/client/ConnectionFactoryTest.java
new file mode 100644
index 0000000..fecf5cb
--- /dev/null
+++ b/pinot-api/src/test/java/org/apache/pinot/client/ConnectionFactoryTest.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for the connection factory
+ */
+public class ConnectionFactoryTest {
+  @Test
+  public void testZkConnection() {
+    // TODO Write test
+    // Create a dummy Helix structure
+    // Create the connection
+    // Check that the broker list has the right length and has the same servers
+  }
+
+  @Test
+  public void testPropertiesConnection() {
+    // TODO Write test
+    // Create a properties object
+    // Create the connection
+    // Check that the broker list has the right length and has the same servers
+  }
+
+  @Test
+  public void testBrokerList() {
+    // Create the connection
+    String broker1 = "127.0.0.1:1234";
+    String broker2 = "localhost:2345";
+    Connection connection = ConnectionFactory.fromHostList(broker1, broker2);
+
+    // Check that the broker list has the right length and has the same servers
+    List<String> brokers = new ArrayList<String>();
+    brokers.add(broker1);
+    brokers.add(broker2);
+    Assert.assertEquals(connection.getBrokerList(), brokers);
+  }
+
+  // For testing DynamicBrokerSelector
+  /**
+   * ConnectionFactoryTest <ZK_URL> <tableName> <query>
+   * @param args
+   */
+  public static void main(String[] args) {
+    if (args.length != 3) {
+      System.err.println("USAGE ConnectionFactoryTest <ZK_URL> <tableName> <query>");
+      System.exit(1);
+    }
+    String zkUrl = args[0];
+    Connection connection = ConnectionFactory.fromZookeeper(zkUrl);
+    String tableName = args[1];
+    ResultSetGroup resultSetGroup = connection.execute(tableName, args[2]);
+    System.out.println(resultSetGroup);
+  }
+
+}
diff --git a/pinot-api/src/test/java/org/apache/pinot/client/PreparedStatementTest.java b/pinot-api/src/test/java/org/apache/pinot/client/PreparedStatementTest.java
new file mode 100644
index 0000000..672c357
--- /dev/null
+++ b/pinot-api/src/test/java/org/apache/pinot/client/PreparedStatementTest.java
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.util.concurrent.Future;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests for prepared statement escaping
+ *
+ */
+public class PreparedStatementTest {
+  @Test
+  public void testPreparedStatementEscaping() {
+    // Create a prepared statement that has to quote a string appropriately
+    Connection connection = ConnectionFactory.fromHostList("dummy");
+    PreparedStatement preparedStatement = connection.prepareStatement("SELECT foo FROM bar WHERE baz = ?");
+    preparedStatement.setString(0, "'hello'");
+    preparedStatement.execute();
+
+    // Check that the query sent is appropriately escaped
+    Assert.assertEquals("SELECT foo FROM bar WHERE baz = '''hello'''", _dummyPinotClientTransport.getLastQuery());
+  }
+
+  private DummyPinotClientTransport _dummyPinotClientTransport = new DummyPinotClientTransport();
+  private PinotClientTransportFactory _previousTransportFactory = null;
+
+  class DummyPinotClientTransport implements PinotClientTransport {
+    private String _lastQuery;
+
+    @Override
+    public BrokerResponse executeQuery(String brokerAddress, String query)
+        throws PinotClientException {
+      _lastQuery = query;
+      return BrokerResponse.empty();
+    }
+
+    @Override
+    public Future<BrokerResponse> executeQueryAsync(String brokerAddress, String query)
+        throws PinotClientException {
+      _lastQuery = query;
+      return null;
+    }
+
+    public String getLastQuery() {
+      return _lastQuery;
+    }
+  }
+
+  class DummyPinotClientTransportFactory implements PinotClientTransportFactory {
+    @Override
+    public PinotClientTransport buildTransport() {
+      return _dummyPinotClientTransport;
+    }
+  }
+
+  @BeforeClass
+  public void overridePinotClientTransport() {
+    _previousTransportFactory = ConnectionFactory._transportFactory;
+    ConnectionFactory._transportFactory = new DummyPinotClientTransportFactory();
+  }
+
+  @AfterClass
+  public void resetPinotClientTransport() {
+    ConnectionFactory._transportFactory = _previousTransportFactory;
+  }
+}
diff --git a/pinot-api/src/test/java/org/apache/pinot/client/ResultSetGroupTest.java b/pinot-api/src/test/java/org/apache/pinot/client/ResultSetGroupTest.java
new file mode 100644
index 0000000..3bbb02b
--- /dev/null
+++ b/pinot-api/src/test/java/org/apache/pinot/client/ResultSetGroupTest.java
@@ -0,0 +1,167 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.client;
+
+import java.io.InputStream;
+import java.util.concurrent.Future;
+import org.json.JSONObject;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests deserialization of a ResultSet given hardcoded Pinot results.
+ *
+ */
+public class ResultSetGroupTest {
+  @Test
+  public void testDeserializeSelectionResultSet() {
+    // Deserialize selection result
+    ResultSetGroup resultSetGroup = getResultSet("selection.json");
+    ResultSet resultSet = resultSetGroup.getResultSet(0);
+
+    // Check length
+    Assert.assertEquals(resultSetGroup.getResultSetCount(), 1, "Expected one result set for selection query");
+    Assert.assertEquals(resultSet.getRowCount(), 24, "Mismatched selection query length");
+
+    // Check that values match and are in the same order
+    Assert.assertEquals(resultSet.getInt(0, 0), 84);
+    Assert.assertEquals(resultSet.getLong(1, 0), 202L);
+    Assert.assertEquals(resultSet.getString(2, 0), "95");
+    Assert.assertEquals(resultSet.getInt(0, 78), 2014);
+
+    // Check the columns
+    Assert.assertEquals(resultSet.getColumnCount(), 79);
+    Assert.assertEquals(resultSet.getColumnName(0), "ActualElapsedTime");
+    Assert.assertEquals(resultSet.getColumnName(1), "AirTime");
+  }
+
+  @Test
+  public void testDeserializeAggregationResultSet() throws Exception {
+    // Deserialize aggregation result
+    ResultSetGroup resultSetGroup = getResultSet("aggregation.json");
+
+    // Check length and number of result groups
+    Assert.assertEquals(resultSetGroup.getResultSetCount(), 1, "Result set count mismatch");
+    ResultSet resultSet = resultSetGroup.getResultSet(0);
+    Assert.assertEquals(resultSet.getGroupKeyLength(), 0, "Expected 0 length group key for non-group by aggregation query");
+    Assert.assertEquals(resultSet.getRowCount(), 1, "Result group length mismatch");
+
+    // Check that values match and are in the same order
+    Assert.assertEquals(resultSet.getInt(0), 36542, "Mismatched int value");
+    Assert.assertEquals(resultSet.getLong(0), 36542L, "Mismatched long value");
+    Assert.assertEquals(resultSet.getString(0), "36542", "Mismatched String value");
+
+    // Check the columns
+    Assert.assertEquals(resultSet.getColumnCount(), 1);
+    Assert.assertEquals(resultSet.getColumnName(0), "count_star");
+  }
+
+  @Test
+  public void testDeserializeAggregationGroupByResultSet() {
+    // Deserialize aggregation group by result
+    ResultSetGroup resultSetGroup = getResultSet("aggregationGroupBy.json");
+
+    // Check length and number of result groups
+    Assert.assertEquals(resultSetGroup.getResultSetCount(), 1, "Result set count mismatch");
+    ResultSet resultSet = resultSetGroup.getResultSet(0);
+    Assert.assertEquals(resultSet.getGroupKeyLength(), 1, "Group key length mismatch");
+    Assert.assertEquals(resultSet.getRowCount(), 10, "Result group length mismatch");
+
+    // Check that values match and are in the same order
+    Assert.assertEquals(resultSet.getGroupKeyInt(0, 0), 30194);
+    Assert.assertEquals(resultSet.getGroupKeyLong(1, 0), 31057L);
+    Assert.assertEquals(resultSet.getGroupKeyString(2, 0), "32467");
+    Assert.assertEquals(resultSet.getInt(0), 3604);
+    Assert.assertEquals(resultSet.getLong(1), 1804L);
+    Assert.assertEquals(resultSet.getString(2), "1316");
+
+    // Check the columns
+    Assert.assertEquals(resultSet.getColumnCount(), 1);
+    Assert.assertEquals(resultSet.getColumnName(0), "count_star");
+  }
+
+  @Test
+  public void testDeserializeExceptionResultSet() {
+    try {
+      getResultSet("exception.json");
+      Assert.fail("Execute should have thrown an exception");
+    } catch (PinotClientException e) {
+      // We expect an exception here
+    }
+  }
+
+  private ResultSetGroup getResultSet(String resourceName) {
+    _dummyJsonTransport._resource = resourceName;
+    Connection connection = ConnectionFactory.fromHostList("dummy");
+    return connection.execute("dummy");
+  }
+
+  private DummyJsonTransport _dummyJsonTransport = new DummyJsonTransport();
+  private PinotClientTransportFactory _previousTransportFactory = null;
+
+  class DummyJsonTransport implements PinotClientTransport {
+    public String _resource;
+
+    @Override
+    public BrokerResponse executeQuery(String brokerAddress, String query)
+        throws PinotClientException {
+      try {
+        StringBuilder builder = new StringBuilder();
+        InputStream stream = getClass().getResourceAsStream(_resource);
+        int lastByte = stream.read();
+        while (lastByte != -1) {
+          builder.append((char)lastByte);
+          lastByte = stream.read();
+        }
+        String jsonText = builder.toString();
+        return BrokerResponse.fromJson(new JSONObject(jsonText));
+      } catch (Exception e) {
+        Assert.fail("Unexpected exception", e);
+        return null;
+      }
+    }
+
+    @Override
+    public Future<BrokerResponse> executeQueryAsync(String brokerAddress, String query)
+        throws PinotClientException {
+      return null;
+    }
+  }
+
+  class DummyJsonTransportFactory implements PinotClientTransportFactory {
+    @Override
+    public PinotClientTransport buildTransport() {
+      return _dummyJsonTransport;
+    }
+  }
+
+  @BeforeClass
+  public void overridePinotClientTransport() {
+    _previousTransportFactory = ConnectionFactory._transportFactory;
+    ConnectionFactory._transportFactory = new DummyJsonTransportFactory();
+  }
+
+  @AfterClass
+  public void resetPinotClientTransport() {
+    ConnectionFactory._transportFactory = _previousTransportFactory;
+  }
+}
diff --git a/pinot-api/src/test/resources/com/linkedin/pinot/client/exception.json b/pinot-api/src/test/resources/com/linkedin/pinot/client/exception.json
deleted file mode 100644
index 9b43ad1..0000000
--- a/pinot-api/src/test/resources/com/linkedin/pinot/client/exception.json
+++ /dev/null
@@ -1 +0,0 @@
-{"traceInfo":{},"numDocsScanned":0,"aggregationResults":[],"timeUsedMs":0,"segmentStatistics":[],"exceptions":["ProcessingException(errorCode:350, message:java.lang.NullPointerException\n\tat com.linkedin.pinot.core.plan.GlobalPlanImplV0.execute(GlobalPlanImplV0.java:66)\n\tat com.linkedin.pinot.core.query.executor.ServerQueryExecutorV1Impl$3.call(ServerQueryExecutorV1Impl.java:141)\n\tat com.linkedin.pinot.common.metrics.AbstractMetrics.timePhase(AbstractMetrics.java:106)\n\tat com.link [...]
\ No newline at end of file
diff --git a/pinot-api/src/test/resources/log4j.properties b/pinot-api/src/test/resources/log4j.properties
index 0453d9d..9f399d0 100644
--- a/pinot-api/src/test/resources/log4j.properties
+++ b/pinot-api/src/test/resources/log4j.properties
@@ -15,7 +15,7 @@
 #
 
 log4j.rootLogger=WARN, stdout
-log4j.logger.com.linkedin.pinot=WARN
+log4j.logger.org.apache.pinot=WARN
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.Target=System.out
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
diff --git a/pinot-api/src/test/resources/com/linkedin/pinot/client/aggregation.json b/pinot-api/src/test/resources/org/apache/pinot/client/aggregation.json
similarity index 100%
rename from pinot-api/src/test/resources/com/linkedin/pinot/client/aggregation.json
rename to pinot-api/src/test/resources/org/apache/pinot/client/aggregation.json
diff --git a/pinot-api/src/test/resources/com/linkedin/pinot/client/aggregationGroupBy.json b/pinot-api/src/test/resources/org/apache/pinot/client/aggregationGroupBy.json
similarity index 100%
rename from pinot-api/src/test/resources/com/linkedin/pinot/client/aggregationGroupBy.json
rename to pinot-api/src/test/resources/org/apache/pinot/client/aggregationGroupBy.json
diff --git a/pinot-api/src/test/resources/org/apache/pinot/client/exception.json b/pinot-api/src/test/resources/org/apache/pinot/client/exception.json
new file mode 100644
index 0000000..bfb8ba3
--- /dev/null
+++ b/pinot-api/src/test/resources/org/apache/pinot/client/exception.json
@@ -0,0 +1 @@
+{"traceInfo":{},"numDocsScanned":0,"aggregationResults":[],"timeUsedMs":0,"segmentStatistics":[],"exceptions":["ProcessingException(errorCode:350, message:java.lang.NullPointerException\n\tat org.apache.pinot.core.plan.GlobalPlanImplV0.execute(GlobalPlanImplV0.java:66)\n\tat org.apache.pinot.core.query.executor.ServerQueryExecutorV1Impl$3.call(ServerQueryExecutorV1Impl.java:141)\n\tat org.apache.pinot.common.metrics.AbstractMetrics.timePhase(AbstractMetrics.java:106)\n\tat org.apache.pin [...]
\ No newline at end of file
diff --git a/pinot-api/src/test/resources/com/linkedin/pinot/client/selection.json b/pinot-api/src/test/resources/org/apache/pinot/client/selection.json
similarity index 100%
rename from pinot-api/src/test/resources/com/linkedin/pinot/client/selection.json
rename to pinot-api/src/test/resources/org/apache/pinot/client/selection.json
diff --git a/pinot-azure-filesystem/pom.xml b/pinot-azure-filesystem/pom.xml
index 2080d4d..ecd43d9 100644
--- a/pinot-azure-filesystem/pom.xml
+++ b/pinot-azure-filesystem/pom.xml
@@ -24,7 +24,7 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
     <artifactId>pinot</artifactId>
-    <groupId>com.linkedin.pinot</groupId>
+    <groupId>org.apache.pinot</groupId>
     <version>0.016</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
@@ -46,15 +46,14 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>com.linkedin.pinot</groupId>
+      <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-filesystem</artifactId>
       <version>0.016</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
-      <groupId>com.linkedin.pinot</groupId>
+      <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-common</artifactId>
     </dependency>
 </dependencies>
-
-</project>
\ No newline at end of file
+</project>
diff --git a/pinot-azure-filesystem/src/main/java/com/linkedin/pinot/filesystem/AzurePinotFS.java b/pinot-azure-filesystem/src/main/java/com/linkedin/pinot/filesystem/AzurePinotFS.java
deleted file mode 100644
index 34c2e80..0000000
--- a/pinot-azure-filesystem/src/main/java/com/linkedin/pinot/filesystem/AzurePinotFS.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.filesystem;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.linkedin.pinot.common.utils.CommonConstants;
-import com.microsoft.azure.datalake.store.ADLStoreClient;
-import com.microsoft.azure.datalake.store.DirectoryEntry;
-import com.microsoft.azure.datalake.store.DirectoryEntryType;
-import com.microsoft.azure.datalake.store.IfExists;
-import com.microsoft.azure.datalake.store.oauth2.AccessTokenProvider;
-import com.microsoft.azure.datalake.store.oauth2.ClientCredsTokenProvider;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.net.URI;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Azure implementation for the PinotFS interface. This class will implement using azure-data-lake libraries all
- * the basic FS methods needed within Pinot.
- */
-public class AzurePinotFS extends PinotFS {
-  private static final Logger LOGGER = LoggerFactory.getLogger(AzurePinotFS.class);
-  private static final int BUFFER_SIZE = 4096;
-  private ADLStoreClient _adlStoreClient;
-  private static final String[] EMPTY_ARR = new String[0];
-
-  public AzurePinotFS() {
-
-  }
-
-  @VisibleForTesting
-  public AzurePinotFS(ADLStoreClient adlStoreClient) {
-    _adlStoreClient = adlStoreClient;
-  }
-
-  @Override
-  public void init(Configuration config) {
-    // The ADL account id. Example: {@code mystore.azuredatalakestore.net}.
-    String account = config.getString(CommonConstants.SegmentOperations.AzureSegmentOperations.ACCOUNT_ID);
-    // The endpoint that should be used for authentication.
-    // Usually of the form {@code https://login.microsoftonline.com/<tenant-id>/oauth2/token}.
-    String authEndpoint = config.getString(CommonConstants.SegmentOperations.AzureSegmentOperations.AUTH_ENDPOINT);
-    // The clientId used to authenticate this application
-    String clientId = config.getString(CommonConstants.SegmentOperations.AzureSegmentOperations.CLIENT_ID);
-    // The secret key used to authenticate this application
-    String clientSecret = config.getString(CommonConstants.SegmentOperations.AzureSegmentOperations.CLIENT_SECRET);
-
-    AccessTokenProvider tokenProvider =
-        new ClientCredsTokenProvider(authEndpoint, clientId, clientSecret);
-    _adlStoreClient = ADLStoreClient.createClient(account, tokenProvider);
-  }
-
-  @Override
-  public boolean mkdir(URI uri) throws IOException {
-    return _adlStoreClient.createDirectory(uri.getPath());
-  }
-
-  @Override
-  public boolean delete(URI segmentUri, boolean forceDelete) throws IOException {
-    // Returns false if directory we want to delete is not empty
-    if (isDirectory(segmentUri)
-        && listFiles(segmentUri, false).length > 0
-        && !forceDelete) {
-      return false;
-    }
-    return _adlStoreClient.deleteRecursive(segmentUri.getPath());
-  }
-
-  @Override
-  public boolean move(URI srcUri, URI dstUri, boolean overwrite) throws IOException {
-    if (exists(dstUri) && !overwrite) {
-      return false;
-    }
-    //rename the file
-    return _adlStoreClient.rename(srcUri.getPath(), dstUri.getPath());
-  }
-
-  @Override
-  public boolean copy(URI srcUri, URI dstUri) throws IOException {
-    if (exists(dstUri)) {
-      delete(dstUri, true);
-    }
-
-    _adlStoreClient.createEmptyFile(dstUri.getPath());
-    try {
-      InputStream inputStream = _adlStoreClient.getReadStream(srcUri.getPath());
-      OutputStream outputStream = _adlStoreClient.getAppendStream(dstUri.getPath());
-
-      int bytesRead;
-      byte[] buffer = new byte[BUFFER_SIZE];
-      while ((bytesRead = inputStream.read(buffer)) != -1) {
-        outputStream.write(buffer, 0, bytesRead);
-      }
-      inputStream.close();
-      outputStream.close();
-    } catch (IOException e) {
-      LOGGER.error("Exception encountered during copy, input: '{}', output: '{}'.", srcUri.toString(),
-          dstUri.toString(), e);
-    }
-    return true;
-  }
-
-  @Override
-  public boolean exists(URI fileUri) throws IOException {
-    return _adlStoreClient.checkExists(fileUri.getPath());
-  }
-
-  @Override
-  public long length(URI fileUri) throws IOException {
-    // get file metadata
-    DirectoryEntry ent = _adlStoreClient.getDirectoryEntry(fileUri.getPath());
-    return ent.length;
-  }
-
-  @Override
-  public String[] listFiles(URI fileUri, boolean recursive) throws IOException {
-    DirectoryEntry rootDir = _adlStoreClient.getDirectoryEntry(fileUri.getPath());
-    if (rootDir == null) {
-      return EMPTY_ARR;
-    }
-
-    if (!recursive) {
-      List<DirectoryEntry> shallowDirectoryEntries = _adlStoreClient.enumerateDirectory(rootDir.fullName);
-      List<String> shallowDirPaths = new ArrayList<>(shallowDirectoryEntries.size());
-      for (DirectoryEntry directoryEntry : shallowDirectoryEntries) {
-        shallowDirPaths.add(directoryEntry.fullName);
-      }
-      return shallowDirPaths.toArray(new String[shallowDirPaths.size()]);
-    }
-
-    List<DirectoryEntry> directoryEntries = listFiles(rootDir);
-    List<String> fullFilePaths = new ArrayList<>(directoryEntries.size());
-    for (DirectoryEntry directoryEntry : directoryEntries) {
-      fullFilePaths.add(directoryEntry.fullName);
-    }
-    return fullFilePaths.toArray(new String[fullFilePaths.size()]);
-  }
-
-  private List<DirectoryEntry> listFiles(DirectoryEntry origDirEntry) throws IOException {
-    List<DirectoryEntry> fileList = new ArrayList<>();
-    if (origDirEntry.type.equals(DirectoryEntryType.DIRECTORY)) {
-      for (DirectoryEntry directoryEntry : _adlStoreClient.enumerateDirectory(origDirEntry.fullName)) {
-        fileList.add(directoryEntry);
-        fileList.addAll(listFiles(directoryEntry));
-      }
-    } else {
-      fileList.add(origDirEntry);
-    }
-    return fileList;
-  }
-
-  @Override
-  public void copyToLocalFile(URI srcUri, File dstFile) throws Exception {
-    if (dstFile.exists()) {
-      if (dstFile.isDirectory()) {
-        FileUtils.deleteDirectory(dstFile);
-      } else {
-        FileUtils.deleteQuietly(dstFile);
-      }
-    }
-    try (InputStream adlStream = _adlStoreClient.getReadStream(srcUri.getPath())) {
-      Path dstFilePath = Paths.get(dstFile.toURI());
-
-      /* Copy the source file to the destination directory as a file with the same name as the source,
-       * replace an existing file with the same name in the destination directory, if any.
-       * Set new file permissions on the copied file.
-       */
-      Files.copy(adlStream, dstFilePath);
-
-    } catch (Exception ex) {
-      throw ex;
-    }
-  }
-
-  @Override
-  public void copyFromLocalFile(File srcFile, URI dstUri) throws Exception {
-    OutputStream stream = _adlStoreClient.createFile(dstUri.getPath(), IfExists.OVERWRITE);
-    PrintStream out = new PrintStream(stream);
-    byte[] inputStream = IOUtils.toByteArray(new FileInputStream(srcFile));
-    out.write(inputStream);
-    out.close();
-  }
-
-  @Override
-  public boolean isDirectory(URI uri) {
-    DirectoryEntry dirEntry;
-    try {
-      dirEntry = _adlStoreClient.getDirectoryEntry(uri.getPath());
-    } catch (IOException e) {
-      LOGGER.error("Could not get directory entry for {}", uri);
-      throw new RuntimeException(e);
-    }
-
-    return dirEntry.type.equals(DirectoryEntryType.DIRECTORY);
-  }
-
-  @Override
-  public long lastModified(URI uri) {
-    try {
-      return _adlStoreClient.getDirectoryEntry(uri.getPath()).lastModifiedTime.getTime();
-    } catch (IOException e) {
-      LOGGER.error("Could not get directory entry for {}", uri);
-      throw new RuntimeException(e);
-    }
-  }
-}
diff --git a/pinot-azure-filesystem/src/main/java/org/apache/pinot/filesystem/AzurePinotFS.java b/pinot-azure-filesystem/src/main/java/org/apache/pinot/filesystem/AzurePinotFS.java
new file mode 100644
index 0000000..5780571
--- /dev/null
+++ b/pinot-azure-filesystem/src/main/java/org/apache/pinot/filesystem/AzurePinotFS.java
@@ -0,0 +1,237 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.filesystem;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.pinot.common.utils.CommonConstants;
+import com.microsoft.azure.datalake.store.ADLStoreClient;
+import com.microsoft.azure.datalake.store.DirectoryEntry;
+import com.microsoft.azure.datalake.store.DirectoryEntryType;
+import com.microsoft.azure.datalake.store.IfExists;
+import com.microsoft.azure.datalake.store.oauth2.AccessTokenProvider;
+import com.microsoft.azure.datalake.store.oauth2.ClientCredsTokenProvider;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Azure implementation for the PinotFS interface. This class will implement using azure-data-lake libraries all
+ * the basic FS methods needed within Pinot.
+ */
+public class AzurePinotFS extends PinotFS {
+  private static final Logger LOGGER = LoggerFactory.getLogger(AzurePinotFS.class);
+  private static final int BUFFER_SIZE = 4096;
+  private ADLStoreClient _adlStoreClient;
+  private static final String[] EMPTY_ARR = new String[0];
+
+  public AzurePinotFS() {
+
+  }
+
+  @VisibleForTesting
+  public AzurePinotFS(ADLStoreClient adlStoreClient) {
+    _adlStoreClient = adlStoreClient;
+  }
+
+  @Override
+  public void init(Configuration config) {
+    // The ADL account id. Example: {@code mystore.azuredatalakestore.net}.
+    String account = config.getString(CommonConstants.SegmentOperations.AzureSegmentOperations.ACCOUNT_ID);
+    // The endpoint that should be used for authentication.
+    // Usually of the form {@code https://login.microsoftonline.com/<tenant-id>/oauth2/token}.
+    String authEndpoint = config.getString(CommonConstants.SegmentOperations.AzureSegmentOperations.AUTH_ENDPOINT);
+    // The clientId used to authenticate this application
+    String clientId = config.getString(CommonConstants.SegmentOperations.AzureSegmentOperations.CLIENT_ID);
+    // The secret key used to authenticate this application
+    String clientSecret = config.getString(CommonConstants.SegmentOperations.AzureSegmentOperations.CLIENT_SECRET);
+
+    AccessTokenProvider tokenProvider =
+        new ClientCredsTokenProvider(authEndpoint, clientId, clientSecret);
+    _adlStoreClient = ADLStoreClient.createClient(account, tokenProvider);
+  }
+
+  @Override
+  public boolean mkdir(URI uri) throws IOException {
+    return _adlStoreClient.createDirectory(uri.getPath());
+  }
+
+  @Override
+  public boolean delete(URI segmentUri, boolean forceDelete) throws IOException {
+    // Returns false if directory we want to delete is not empty
+    if (isDirectory(segmentUri)
+        && listFiles(segmentUri, false).length > 0
+        && !forceDelete) {
+      return false;
+    }
+    return _adlStoreClient.deleteRecursive(segmentUri.getPath());
+  }
+
+  @Override
+  public boolean move(URI srcUri, URI dstUri, boolean overwrite) throws IOException {
+    if (exists(dstUri) && !overwrite) {
+      return false;
+    }
+    //rename the file
+    return _adlStoreClient.rename(srcUri.getPath(), dstUri.getPath());
+  }
+
+  @Override
+  public boolean copy(URI srcUri, URI dstUri) throws IOException {
+    if (exists(dstUri)) {
+      delete(dstUri, true);
+    }
+
+    _adlStoreClient.createEmptyFile(dstUri.getPath());
+    try {
+      InputStream inputStream = _adlStoreClient.getReadStream(srcUri.getPath());
+      OutputStream outputStream = _adlStoreClient.getAppendStream(dstUri.getPath());
+
+      int bytesRead;
+      byte[] buffer = new byte[BUFFER_SIZE];
+      while ((bytesRead = inputStream.read(buffer)) != -1) {
+        outputStream.write(buffer, 0, bytesRead);
+      }
+      inputStream.close();
+      outputStream.close();
+    } catch (IOException e) {
+      LOGGER.error("Exception encountered during copy, input: '{}', output: '{}'.", srcUri.toString(),
+          dstUri.toString(), e);
+    }
+    return true;
+  }
+
+  @Override
+  public boolean exists(URI fileUri) throws IOException {
+    return _adlStoreClient.checkExists(fileUri.getPath());
+  }
+
+  @Override
+  public long length(URI fileUri) throws IOException {
+    // get file metadata
+    DirectoryEntry ent = _adlStoreClient.getDirectoryEntry(fileUri.getPath());
+    return ent.length;
+  }
+
+  @Override
+  public String[] listFiles(URI fileUri, boolean recursive) throws IOException {
+    DirectoryEntry rootDir = _adlStoreClient.getDirectoryEntry(fileUri.getPath());
+    if (rootDir == null) {
+      return EMPTY_ARR;
+    }
+
+    if (!recursive) {
+      List<DirectoryEntry> shallowDirectoryEntries = _adlStoreClient.enumerateDirectory(rootDir.fullName);
+      List<String> shallowDirPaths = new ArrayList<>(shallowDirectoryEntries.size());
+      for (DirectoryEntry directoryEntry : shallowDirectoryEntries) {
+        shallowDirPaths.add(directoryEntry.fullName);
+      }
+      return shallowDirPaths.toArray(new String[shallowDirPaths.size()]);
+    }
+
+    List<DirectoryEntry> directoryEntries = listFiles(rootDir);
+    List<String> fullFilePaths = new ArrayList<>(directoryEntries.size());
+    for (DirectoryEntry directoryEntry : directoryEntries) {
+      fullFilePaths.add(directoryEntry.fullName);
+    }
+    return fullFilePaths.toArray(new String[fullFilePaths.size()]);
+  }
+
+  private List<DirectoryEntry> listFiles(DirectoryEntry origDirEntry) throws IOException {
+    List<DirectoryEntry> fileList = new ArrayList<>();
+    if (origDirEntry.type.equals(DirectoryEntryType.DIRECTORY)) {
+      for (DirectoryEntry directoryEntry : _adlStoreClient.enumerateDirectory(origDirEntry.fullName)) {
+        fileList.add(directoryEntry);
+        fileList.addAll(listFiles(directoryEntry));
+      }
+    } else {
+      fileList.add(origDirEntry);
+    }
+    return fileList;
+  }
+
+  @Override
+  public void copyToLocalFile(URI srcUri, File dstFile) throws Exception {
+    if (dstFile.exists()) {
+      if (dstFile.isDirectory()) {
+        FileUtils.deleteDirectory(dstFile);
+      } else {
+        FileUtils.deleteQuietly(dstFile);
+      }
+    }
+    try (InputStream adlStream = _adlStoreClient.getReadStream(srcUri.getPath())) {
+      Path dstFilePath = Paths.get(dstFile.toURI());
+
+      /* Copy the source file to the destination directory as a file with the same name as the source,
+       * replace an existing file with the same name in the destination directory, if any.
+       * Set new file permissions on the copied file.
+       */
+      Files.copy(adlStream, dstFilePath);
+
+    } catch (Exception ex) {
+      throw ex;
+    }
+  }
+
+  @Override
+  public void copyFromLocalFile(File srcFile, URI dstUri) throws Exception {
+    OutputStream stream = _adlStoreClient.createFile(dstUri.getPath(), IfExists.OVERWRITE);
+    PrintStream out = new PrintStream(stream);
+    byte[] inputStream = IOUtils.toByteArray(new FileInputStream(srcFile));
+    out.write(inputStream);
+    out.close();
+  }
+
+  @Override
+  public boolean isDirectory(URI uri) {
+    DirectoryEntry dirEntry;
+    try {
+      dirEntry = _adlStoreClient.getDirectoryEntry(uri.getPath());
+    } catch (IOException e) {
+      LOGGER.error("Could not get directory entry for {}", uri);
+      throw new RuntimeException(e);
+    }
+
+    return dirEntry.type.equals(DirectoryEntryType.DIRECTORY);
+  }
+
+  @Override
+  public long lastModified(URI uri) {
+    try {
+      return _adlStoreClient.getDirectoryEntry(uri.getPath()).lastModifiedTime.getTime();
+    } catch (IOException e) {
+      LOGGER.error("Could not get directory entry for {}", uri);
+      throw new RuntimeException(e);
+    }
+  }
+}
diff --git a/pinot-azure-filesystem/src/test/java/com/linkedin/pinot/filesystem/test/AzurePinotFSTest.java b/pinot-azure-filesystem/src/test/java/com/linkedin/pinot/filesystem/test/AzurePinotFSTest.java
deleted file mode 100644
index b4bcff3..0000000
--- a/pinot-azure-filesystem/src/test/java/com/linkedin/pinot/filesystem/test/AzurePinotFSTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.filesystem.test;
-
-import com.linkedin.pinot.filesystem.AzurePinotFS;
-import com.microsoft.azure.datalake.store.ADLStoreClient;
-import com.microsoft.azure.datalake.store.MockADLFileInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import org.apache.commons.io.FileUtils;
-import org.mockito.ArgumentMatchers;
-import org.mockito.Mockito;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-
-/**
- * Tests the Azure implementation of PinotFS
- */
-public class AzurePinotFSTest {
-  private String _adlLocation;
-  private File _testFile;
-
-  @BeforeMethod
-  public void setup() throws IOException {
-    _adlLocation = new File(System.getProperty("java.io.tmpdir"), AzurePinotFSTest.class.getSimpleName()).getAbsolutePath();
-    FileUtils.deleteQuietly(new File(_adlLocation));
-    Assert.assertTrue(new File(_adlLocation).mkdir(), "Could not make directory" + _adlLocation);
-
-    try {
-      _testFile = new File(_adlLocation, "testFile");
-      Assert.assertTrue(_testFile.createNewFile(), "Could not create file " + _testFile.getPath());
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-
-    new File(_adlLocation).deleteOnExit();
-  }
-
-  @Test
-  public void testFS() throws Exception {
-    ADLStoreClient adlStoreClient = Mockito.mock(ADLStoreClient.class);
-    Mockito.when(adlStoreClient.checkExists(_adlLocation)).thenReturn(true);
-    Mockito.when(adlStoreClient.checkExists(_testFile.getPath())).thenReturn(true);
-
-    AzurePinotFS azurePinotFS = new AzurePinotFS(adlStoreClient);
-    URI testFileURI = _testFile.toURI();
-    Assert.assertTrue(azurePinotFS.exists(testFileURI));
-    Assert.assertTrue(azurePinotFS.exists(new URI(_adlLocation)));
-
-    File file = new File(_adlLocation, "testfile2");
-    MockADLFileInputStream adlFileInputStream = new MockADLFileInputStream(
-        new ByteArrayInputStream(Files.readAllBytes(Paths.get(testFileURI))));
-    Mockito.when(adlStoreClient.getReadStream(ArgumentMatchers.anyString())).thenReturn(adlFileInputStream);
-    azurePinotFS.copyToLocalFile(testFileURI, file);
-    Assert.assertTrue(file.exists());
-  }
-
-  @AfterClass
-  public void tearDown() {
-    new File(_adlLocation).delete();
-  }
-}
diff --git a/pinot-azure-filesystem/src/test/java/org/apache/pinot/filesystem/test/AzurePinotFSTest.java b/pinot-azure-filesystem/src/test/java/org/apache/pinot/filesystem/test/AzurePinotFSTest.java
new file mode 100644
index 0000000..00c8989
--- /dev/null
+++ b/pinot-azure-filesystem/src/test/java/org/apache/pinot/filesystem/test/AzurePinotFSTest.java
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.filesystem.test;
+
+import org.apache.pinot.filesystem.AzurePinotFS;
+import com.microsoft.azure.datalake.store.ADLStoreClient;
+import com.microsoft.azure.datalake.store.MockADLFileInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import org.apache.commons.io.FileUtils;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Mockito;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+
+/**
+ * Tests the Azure implementation of PinotFS
+ */
+public class AzurePinotFSTest {
+  private String _adlLocation;
+  private File _testFile;
+
+  @BeforeMethod
+  public void setup() throws IOException {
+    _adlLocation = new File(System.getProperty("java.io.tmpdir"), AzurePinotFSTest.class.getSimpleName()).getAbsolutePath();
+    FileUtils.deleteQuietly(new File(_adlLocation));
+    Assert.assertTrue(new File(_adlLocation).mkdir(), "Could not make directory" + _adlLocation);
+
+    try {
+      _testFile = new File(_adlLocation, "testFile");
+      Assert.assertTrue(_testFile.createNewFile(), "Could not create file " + _testFile.getPath());
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+
+    new File(_adlLocation).deleteOnExit();
+  }
+
+  @Test
+  public void testFS() throws Exception {
+    ADLStoreClient adlStoreClient = Mockito.mock(ADLStoreClient.class);
+    Mockito.when(adlStoreClient.checkExists(_adlLocation)).thenReturn(true);
+    Mockito.when(adlStoreClient.checkExists(_testFile.getPath())).thenReturn(true);
+
+    AzurePinotFS azurePinotFS = new AzurePinotFS(adlStoreClient);
+    URI testFileURI = _testFile.toURI();
+    Assert.assertTrue(azurePinotFS.exists(testFileURI));
+    Assert.assertTrue(azurePinotFS.exists(new URI(_adlLocation)));
+
+    File file = new File(_adlLocation, "testfile2");
+    MockADLFileInputStream adlFileInputStream = new MockADLFileInputStream(
+        new ByteArrayInputStream(Files.readAllBytes(Paths.get(testFileURI))));
+    Mockito.when(adlStoreClient.getReadStream(ArgumentMatchers.anyString())).thenReturn(adlFileInputStream);
+    azurePinotFS.copyToLocalFile(testFileURI, file);
+    Assert.assertTrue(file.exists());
+  }
+
+  @AfterClass
+  public void tearDown() {
+    new File(_adlLocation).delete();
+  }
+}
diff --git a/pinot-broker/pom.xml b/pinot-broker/pom.xml
index d975197..682da2b 100644
--- a/pinot-broker/pom.xml
+++ b/pinot-broker/pom.xml
@@ -24,10 +24,10 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <artifactId>pinot</artifactId>
-    <groupId>com.linkedin.pinot</groupId>
+    <groupId>org.apache.pinot</groupId>
     <version>0.016</version>
   </parent>
-  <groupId>com.linkedin.pinot</groupId>
+  <groupId>org.apache.pinot</groupId>
   <artifactId>pinot-broker</artifactId>
   <version>0.016</version>
   <name>pinot-broker</name>
@@ -82,24 +82,24 @@
       <artifactId>jersey-container-grizzly2-http</artifactId>
     </dependency>
     <dependency>
-      <groupId>com.linkedin.pinot</groupId>
+      <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-transport</artifactId>
     </dependency>
     <dependency>
-      <groupId>com.linkedin.pinot</groupId>
+      <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-common</artifactId>
     </dependency>
     <dependency>
-      <groupId>com.linkedin.pinot</groupId>
+      <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-core</artifactId>
     </dependency>
     <dependency>
-      <groupId>com.linkedin.pinot</groupId>
+      <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-controller</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>com.linkedin.pinot</groupId>
+      <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-server</artifactId>
       <scope>test</scope>
     </dependency>
@@ -148,14 +148,14 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>com.linkedin.pinot</groupId>
+      <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-common</artifactId>
       <version>${project.version}</version>
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>com.linkedin.pinot</groupId>
+      <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-controller</artifactId>
       <version>${project.version}</version>
       <type>test-jar</type>
diff --git a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/AccessControl.java b/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/AccessControl.java
deleted file mode 100644
index b315693..0000000
--- a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/AccessControl.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.broker.api;
-
-import com.linkedin.pinot.common.request.BrokerRequest;
-
-
-public interface AccessControl {
-  boolean hasAccess(RequesterIdentity requesterIdentity, BrokerRequest brokerRequest);
-}
diff --git a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/RequestStatistics.java b/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/RequestStatistics.java
deleted file mode 100644
index a4c0556..0000000
--- a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/RequestStatistics.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.broker.api;
-
-import com.linkedin.pinot.common.response.BrokerResponse;
-import java.util.concurrent.TimeUnit;
-
-
-/**
- * A class to hold the details regarding a request and the statistics.
- * This object can be used to publish the query processing statistics to a stream for
- * post-processing at a finer level than metrics.
- */
-public class RequestStatistics {
-  private int _errorCode = 0;
-  private String _pql;
-  private String _tableName = "NotYetParsed";
-  private long _processingTimeMillis = -1;
-
-  private long _totalDocs;
-  private long _numDocsScanned;
-  private long _numEntriesScannedInFilter;
-  private long _numEntriesScannedPostFilter;
-  private long _numSegmentsQueried;
-  private long _numSegmentsProcessed;
-  private long _numSegmentsMatched;
-  private int _numServersQueried;
-  private int _numServersResponded;
-  private boolean _isNumGroupsLimitReached;
-  private int _numExceptions;
-  private String _brokerId;
-  private long _requestId;
-
-  public String getBrokerId() {
-    return _brokerId;
-  }
-
-  public long getRequestId() {
-    return _requestId;
-  }
-
-  public long getRequestArrivalTimeMillis() {
-    return _requestArrivalTimeMillis;
-  }
-
-  public long getReduceTimeMillis() {
-    return _reduceTimeMillis;
-  }
-
-  private long _requestArrivalTimeMillis;
-  private long _reduceTimeMillis;
-
-  public enum FanoutType {
-    OFFLINE,
-    REALTIME,
-    HYBRID
-  }
-
-  private FanoutType _fanoutType;
-
-  public RequestStatistics() {
-  }
-
-  public void setErrorCode(int errorCode) {
-    _errorCode = errorCode;
-  }
-
-  public void setPql(String pql) {
-    _pql = pql;
-  }
-
-  public void setTableName(String tableName) {
-    _tableName = tableName;
-  }
-
-  public void setQueryProcessingTime(long processingTimeMillis) {
-    _processingTimeMillis = processingTimeMillis;
-  }
-
-  public void setStatistics(BrokerResponse brokerResponse) {
-    _totalDocs = brokerResponse.getTotalDocs();
-    _numDocsScanned = brokerResponse.getNumDocsScanned();
-    _numEntriesScannedInFilter = brokerResponse.getNumEntriesScannedInFilter();
-    _numEntriesScannedPostFilter = brokerResponse.getNumEntriesScannedPostFilter();
-    _numSegmentsQueried = brokerResponse.getNumSegmentsQueried();
-    _numSegmentsProcessed = brokerResponse.getNumSegmentsProcessed();
-    _numSegmentsMatched = brokerResponse.getNumSegmentsMatched();
-    _numServersQueried = brokerResponse.getNumServersQueried();
-    _numSegmentsProcessed = brokerResponse.getNumSegmentsProcessed();
-    _numServersResponded = brokerResponse.getNumServersResponded();
-    _isNumGroupsLimitReached = brokerResponse.isNumGroupsLimitReached();
-    _numExceptions = brokerResponse.getExceptionsSize();
-  }
-
-  public void setBrokerId(String brokerId) {
-    _brokerId = brokerId;
-  }
-
-  public void setRequestId(long requestId) {
-    _requestId = requestId;
-  }
-
-  public void setRequestArrivalTimeMillis(long requestArrivalTimeMillis) {
-    _requestArrivalTimeMillis = requestArrivalTimeMillis;
-  }
-
-  public void setReduceTimeNanos(long reduceTimeNanos) {
-    _reduceTimeMillis = TimeUnit.MILLISECONDS.convert(reduceTimeNanos, TimeUnit.NANOSECONDS);
-  }
-
-  public void setFanoutType(FanoutType fanoutType) {
-    _fanoutType = fanoutType;
-  }
-
-  public FanoutType getFanoutType() {
-    return _fanoutType;
-  }
-
-  public int getErrorCode() {
-    return _errorCode;
-  }
-
-  public String getPql() {
-    return _pql;
-  }
-
-  public String getTableName() {
-    return _tableName;
-  }
-
-  public long getProcessingTimeMillis() {
-    return _processingTimeMillis;
-  }
-
-  public long getTotalDocs() {
-    return _totalDocs;
-  }
-
-  public long getNumDocsScanned() {
-    return _numDocsScanned;
-  }
-
-  public long getNumEntriesScannedInFilter() {
-    return _numEntriesScannedInFilter;
-  }
-
-  public long getNumEntriesScannedPostFilter() {
-    return _numEntriesScannedPostFilter;
-  }
-
-  public long getNumSegmentsQueried() {
-    return _numSegmentsQueried;
-  }
-
-  public long getNumSegmentsProcessed() {
-    return _numSegmentsProcessed;
-  }
-
-  public long getNumSegmentsMatched() {
-    return _numSegmentsMatched;
-  }
-
-  public int getNumServersQueried() {
-    return _numServersQueried;
-  }
-
-  public int getNumServersResponded() {
-    return _numServersResponded;
-  }
-
-  public boolean isNumGroupsLimitReached() {
-    return _isNumGroupsLimitReached;
-  }
-
-  public int getNumExceptions() {
-    return _numExceptions;
-  }
-}
diff --git a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/RequesterIdentity.java b/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/RequesterIdentity.java
deleted file mode 100644
index e1fed0d..0000000
--- a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/RequesterIdentity.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.broker.api;
-
-public abstract class RequesterIdentity {
-}
diff --git a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/resources/PinotBrokerDebug.java b/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/resources/PinotBrokerDebug.java
deleted file mode 100644
index cfac240..0000000
--- a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/resources/PinotBrokerDebug.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.broker.api.resources;
-
-import com.linkedin.pinot.broker.routing.RoutingTable;
-import com.linkedin.pinot.broker.routing.TimeBoundaryService;
-import com.linkedin.pinot.common.config.TableNameBuilder;
-import com.linkedin.pinot.common.metrics.BrokerMeter;
-import com.linkedin.pinot.common.metrics.BrokerMetrics;
-import com.linkedin.pinot.common.utils.CommonConstants;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-@Api(tags = "Debug")
-@Path("/debug")
-public class PinotBrokerDebug {
-  private static final Logger LOGGER = LoggerFactory.getLogger(PinotBrokerDebug.class);
-
-  @Inject
-  private RoutingTable _routingTable;
-
-  @Inject
-  private BrokerMetrics _brokerMetrics;
-
-  @Inject
-  private TimeBoundaryService _timeBoundaryService;
-
-  @GET
-  @Produces(MediaType.APPLICATION_JSON)
-  @Path("/routingTable/{tableName}")
-  @ApiOperation(value = "Debugging routing table")
-  @ApiResponses(value = {
-      @ApiResponse(code = 200, message = "Routing table information of a table"),
-      @ApiResponse(code = 500, message = "Internal server error")
-  })
-  public String debugRoutingTable(
-      @ApiParam(value = "Name of the table") @PathParam("tableName") String tableName
-  ) {
-    try {
-      return _routingTable.dumpSnapshot(tableName);
-    } catch (Exception e) {
-      LOGGER.error("Caught exception while processing GET request", e);
-      _brokerMetrics.addMeteredGlobalValue(BrokerMeter.UNCAUGHT_GET_EXCEPTIONS, 1);
-      throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
-    }
-  }
-
-  @GET
-  @Produces(MediaType.APPLICATION_JSON)
-  @Path("/timeBoundary/{tableName}")
-  @ApiOperation(value = "Debugging time boundary service")
-  @ApiResponses(value = {
-      @ApiResponse(code = 200, message = "Time boundary information of a table"),
-      @ApiResponse(code = 500, message = "Internal server error")
-  })
-  public String debugTimeBoundaryService(
-      @ApiParam(value = "Name of the table") @PathParam("tableName") String tableName
-  ) {
-    try {
-      String response = "{}";
-      if (!tableName.isEmpty()) {
-        CommonConstants.Helix.TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName);
-        if (tableType == null) {
-          tableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName);
-        }
-        TimeBoundaryService.TimeBoundaryInfo tbInfo = _timeBoundaryService.getTimeBoundaryInfoFor(tableName);
-        if (tbInfo != null) {
-          response = tbInfo.toJsonString();
-        }
-      }
-      return response;
-    } catch (Exception e) {
-      LOGGER.error("Caught exception while processing GET request", e);
-      _brokerMetrics.addMeteredGlobalValue(BrokerMeter.UNCAUGHT_GET_EXCEPTIONS, 1);
-      throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
-    }
-  }
-}
diff --git a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/resources/PinotBrokerHealthCheck.java b/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/resources/PinotBrokerHealthCheck.java
deleted file mode 100644
index b2bdae8..0000000
--- a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/resources/PinotBrokerHealthCheck.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.broker.api.resources;
-
-import com.linkedin.pinot.broker.broker.BrokerServerBuilder;
-import com.linkedin.pinot.common.metrics.BrokerMeter;
-import com.linkedin.pinot.common.metrics.BrokerMetrics;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@Api(tags = "Health")
-@Path("/")
-public class PinotBrokerHealthCheck {
-
-  @Inject
-  private BrokerServerBuilder brokerServerBuilder;
-
-  @Inject
-  private BrokerMetrics brokerMetrics;
-
-  @GET
-  @Produces(MediaType.TEXT_PLAIN)
-  @Path("health")
-  @ApiOperation(value = "Checking broker health")
-  @ApiResponses(value = {
-      @ApiResponse(code = 200, message = "Broker is healthy"),
-      @ApiResponse(code = 503, message = "Broker is disabled")
-  })
-  public String getBrokerHealth() {
-    if (brokerServerBuilder != null
-        && this.brokerServerBuilder.getCurrentState() == BrokerServerBuilder.State.RUNNING) {
-      brokerMetrics.addMeteredGlobalValue(BrokerMeter.HEALTHCHECK_OK_CALLS, 1);
-      return "OK";
-    } else {
-      brokerMetrics.addMeteredGlobalValue(BrokerMeter.HEALTHCHECK_BAD_CALLS, 1);
-      throw new WebApplicationException("Pinot broker is disabled", Response.Status.SERVICE_UNAVAILABLE);
-    }
-  }
-}
diff --git a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/resources/PinotClientRequest.java b/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/resources/PinotClientRequest.java
deleted file mode 100644
index 354d420..0000000
--- a/pinot-broker/src/main/java/com/linkedin/pinot/broker/api/resources/PinotClientRequest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.broker.api.resources;
-
-import com.linkedin.pinot.broker.api.RequestStatistics;
-import com.linkedin.pinot.broker.requesthandler.BrokerRequestHandler;
-import com.linkedin.pinot.common.metrics.BrokerMeter;
-import com.linkedin.pinot.common.metrics.BrokerMetrics;
-import com.linkedin.pinot.common.response.BrokerResponse;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static com.linkedin.pinot.common.utils.CommonConstants.Broker.Request.*;
-
-
-@Api(tags = "Query")
-@Path("/")
-public class PinotClientRequest {
-  private static final Logger LOGGER = LoggerFactory.getLogger(PinotClientRequest.class);
-
-  @Inject
-  private BrokerRequestHandler requestHandler;
-
-  @Inject
-  private BrokerMetrics brokerMetrics;
-
-  @GET
-  @Produces(MediaType.APPLICATION_JSON)
-  @Path("query")
-  @ApiOperation(value = "Querying pinot")
-  @ApiResponses(value = {
-      @ApiResponse(code = 200, message = "Query response"),
-      @ApiResponse(code = 500, message = "Internal Server Error")
-  })
-  public String processQueryGet(
-      // Query param "bql" is for backward compatibility
-      @ApiParam(value = "Query", required = true) @QueryParam("bql") String query,
-      @ApiParam(value = "Trace enabled") @QueryParam(TRACE) String traceEnabled,
-      @ApiParam(value = "Debug options") @QueryParam(DEBUG_OPTIONS) String debugOptions
-  ) {
-    try {
-      JSONObject requestJson = new JSONObject();
-      requestJson.put(PQL, query);
-      if (traceEnabled != null) {
-        requestJson.put(TRACE, traceEnabled);
-      }
-      if (debugOptions != null) {
-        requestJson.put(DEBUG_OPTIONS, debugOptions);
-      }
-      BrokerResponse brokerResponse = requestHandler.handleRequest(requestJson, null, new RequestStatistics());
-      return brokerResponse.toJsonString();
-    } catch (Exception e) {
-      LOGGER.error("Caught exception while processing GET request", e);
-      brokerMetrics.addMeteredGlobalValue(BrokerMeter.UNCAUGHT_GET_EXCEPTIONS, 1);
-      throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
-    }
-  }
-
-  @POST
-  @Produces(MediaType.APPLICATION_JSON)
-  @Path("query")
-  @ApiOperation(value = "Querying pinot")
-  @ApiResponses(value = {
-      @ApiResponse(code = 200, message = "Query response"),
-      @ApiResponse(code = 500, message = "Internal Server Error")
-  })
-  public String processQueryPost(String query) {
-    try {
-      JSONObject requestJson = new JSONObject(query);
-      BrokerResponse brokerResponse = requestHandler.handleRequest(requestJson, null, new RequestStatistics());
-      return brokerResponse.toJsonString();
-    } catch (Exception e) {
-      LOGGER.error("Caught exception while processing GET request", e);
-      brokerMetrics.addMeteredGlobalValue(BrokerMeter.UNCAUGHT_GET_EXCEPTIONS, 1);
-      throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
-    }
-  }
-}
diff --git a/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/AccessControlFactory.java b/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/AccessControlFactory.java
deleted file mode 100644
index 7181549..0000000
--- a/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/AccessControlFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.broker.broker;
-
-import com.linkedin.pinot.broker.api.AccessControl;
-import org.apache.commons.configuration.Configuration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public abstract class AccessControlFactory {
-  public static final Logger LOGGER = LoggerFactory.getLogger(AccessControlFactory.class);
-  public static final String ACCESS_CONTROL_CLASS_CONFIG = "class";
-
-  public abstract  void init(Configuration confguration);
-
-  public abstract  AccessControl create();
-
-  public static AccessControlFactory loadFactory(Configuration configuration) {
-    AccessControlFactory accessControlFactory;
-    String accessControlFactoryClassName = configuration.getString(ACCESS_CONTROL_CLASS_CONFIG);
-    if (accessControlFactoryClassName == null) {
-      accessControlFactoryClassName = AllowAllAccessControlFactory.class.getName();
-    }
-    try {
-      LOGGER.info("Instantiating Access control factory class {}", accessControlFactoryClassName);
-      accessControlFactory =  (AccessControlFactory) Class.forName(accessControlFactoryClassName).newInstance();
-      LOGGER.info("Initializing Access control factory class {}", accessControlFactoryClassName);
-      accessControlFactory.init(configuration);
-      return accessControlFactory;
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-}
diff --git a/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/AllowAllAccessControlFactory.java b/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/AllowAllAccessControlFactory.java
deleted file mode 100644
index c8ebf51..0000000
--- a/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/AllowAllAccessControlFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.broker.broker;
-
-import com.linkedin.pinot.broker.api.AccessControl;
-import com.linkedin.pinot.broker.api.RequesterIdentity;
-import com.linkedin.pinot.common.request.BrokerRequest;
-import org.apache.commons.configuration.Configuration;
-
-
-public class AllowAllAccessControlFactory extends AccessControlFactory {
-  private final AccessControl _accessControl;
-  public AllowAllAccessControlFactory() {
-    _accessControl = new AllowAllAccessControl();
-  }
-
-  public void init(Configuration configuration) {
-  }
-
-  public AccessControl create() {
-    return _accessControl;
-  }
-
-  private static class AllowAllAccessControl implements AccessControl {
-    @Override
-    public boolean hasAccess(RequesterIdentity requesterIdentity, BrokerRequest brokerRequest) {
-      return true;
-    }
-  }
-}
diff --git a/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/BrokerAdminApiApplication.java b/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/BrokerAdminApiApplication.java
deleted file mode 100644
index f0e70af..0000000
--- a/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/BrokerAdminApiApplication.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.broker.broker;
-
-import com.google.common.base.Preconditions;
-import com.linkedin.pinot.broker.requesthandler.BrokerRequestHandler;
-import com.linkedin.pinot.broker.routing.RoutingTable;
-import com.linkedin.pinot.broker.routing.TimeBoundaryService;
-import com.linkedin.pinot.common.metrics.BrokerMetrics;
-import io.swagger.jaxrs.config.BeanConfig;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
-import org.glassfish.grizzly.http.server.CLStaticHttpHandler;
-import org.glassfish.grizzly.http.server.HttpHandler;
-import org.glassfish.grizzly.http.server.HttpServer;
-import org.glassfish.hk2.utilities.binding.AbstractBinder;
-import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
-import org.glassfish.jersey.server.ResourceConfig;
-
-
-public class BrokerAdminApiApplication extends ResourceConfig {
-  private static final String RESOURCE_PACKAGE = "com.linkedin.pinot.broker.api.resources";
-
-  private URI _baseUri;
-  private HttpServer _httpServer;
-
-  public BrokerAdminApiApplication(BrokerServerBuilder brokerServerBuilder) {
-    packages(RESOURCE_PACKAGE);
-    register(new AbstractBinder() {
-      @Override
-      protected void configure() {
-        bind(brokerServerBuilder).to(BrokerServerBuilder.class);
-        bind(brokerServerBuilder.getRoutingTable()).to(RoutingTable.class);
-        bind(brokerServerBuilder.getTimeBoundaryService()).to(TimeBoundaryService.class);
-        bind(brokerServerBuilder.getBrokerMetrics()).to(BrokerMetrics.class);
-        bind(brokerServerBuilder.getBrokerRequestHandler()).to(BrokerRequestHandler.class);
-      }
-    });
-    registerClasses(io.swagger.jaxrs.listing.ApiListingResource.class);
-    registerClasses(io.swagger.jaxrs.listing.SwaggerSerializers.class);
-  }
-
-  public void start(int httpPort) {
-    Preconditions.checkArgument(httpPort > 0);
-    _baseUri = URI.create("http://0.0.0.0:" + httpPort + "/");
-    _httpServer = GrizzlyHttpServerFactory.createHttpServer(_baseUri, this);
-    setupSwagger();
-  }
-
-  private void setupSwagger() {
-    BeanConfig beanConfig = new BeanConfig();
-    beanConfig.setTitle("Pinot Broker API");
-    beanConfig.setDescription("APIs for accessing Pinot broker information");
-    beanConfig.setContact("https://github.com/linkedin/pinot");
-    beanConfig.setVersion("1.0");
-    beanConfig.setSchemes(new String[]{"http"});
-    beanConfig.setBasePath(_baseUri.getPath());
-    beanConfig.setResourcePackage(RESOURCE_PACKAGE);
-    beanConfig.setScan(true);
-
-    HttpHandler httpHandler = new CLStaticHttpHandler(BrokerAdminApiApplication.class.getClassLoader(), "/api/");
-    // map both /api and /help to swagger docs. /api because it looks nice. /help for backward compatibility
-    _httpServer.getServerConfiguration().addHttpHandler(httpHandler, "/api", "/help");
-
-    URL swaggerDistLocation =
-        BrokerAdminApiApplication.class.getClassLoader().getResource("META-INF/resources/webjars/swagger-ui/2.2.2/");
-    CLStaticHttpHandler swaggerDist = new CLStaticHttpHandler(new URLClassLoader(new URL[]{swaggerDistLocation}));
-    _httpServer.getServerConfiguration().addHttpHandler(swaggerDist, "/swaggerui-dist/");
-  }
-
-  public void stop() {
-    if (_httpServer != null) {
-      _httpServer.shutdownNow();
-    }
-  }
-}
diff --git a/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/BrokerServerBuilder.java b/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/BrokerServerBuilder.java
deleted file mode 100644
index e1b85a8..0000000
--- a/pinot-broker/src/main/java/com/linkedin/pinot/broker/broker/BrokerServerBuilder.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.linkedin.pinot.broker.broker;
-
-import com.google.common.base.Preconditions;
-import com.linkedin.pinot.broker.broker.helix.LiveInstancesChangeListenerImpl;
-import com.linkedin.pinot.broker.queryquota.TableQueryQuotaManager;
-import com.linkedin.pinot.broker.requesthandler.BrokerRequestHandler;
-import com.linkedin.pinot.broker.requesthandler.ConnectionPoolBrokerRequestHandler;
-import com.linkedin.pinot.broker.requesthandler.SingleConnectionBrokerRequestHandler;
-import com.linkedin.pinot.broker.routing.RoutingTable;
-import com.linkedin.pinot.broker.routing.TimeBoundaryService;
-import com.linkedin.pinot.common.Utils;
-import com.linkedin.pinot.common.metrics.BrokerMetrics;
-import com.linkedin.pinot.common.metrics.MetricsHelper;
-import com.linkedin.pinot.common.utils.CommonConstants;
-import com.yammer.metrics.core.MetricsRegistry;
-import java.util.concurrent.atomic.AtomicReference;
-import org.apache.commons.configuration.Configuration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class BrokerServerBuilder {
-  private static final Logger LOGGER = LoggerFactory.getLogger(BrokerServerBuilder.class);
-
-  public static final String DELAY_SHUTDOWN_TIME_MS_CONFIG = "pinot.broker.delayShutdownTimeMs";
-  public static final long DEFAULT_DELAY_SHUTDOWN_TIME_MS = 10_000;
-  public static final String ACCESS_CONTROL_PREFIX = "pinot.broker.access.control";
-  public static final String METRICS_CONFIG_PREFIX = "pinot.broker.metrics";
-  public static final String TABLE_LEVEL_METRICS_CONFIG = "pinot.broker.enableTableLevelMetrics";
-  public static final String REQUEST_HANDLER_TYPE_CONFIG = "pinot.broker.requestHandlerType";
... 512749 lines suppressed ...


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org