Apache Pinot is a distributed, real-time OLAP (Online Analytical Processing) datastore designed for low-latency analytics at scale. This document provides a high-level overview of Pinot's architecture, core components, and how they interact to support both batch and real-time data ingestion with fast query execution.
For detailed information about specific subsystems:
Sources: pom.xml1-38
Pinot operates as a distributed system with four primary component tiers that work together to provide scalable, real-time analytics:
Diagram: Pinot Four-Tier Architecture with Core Classes
| Tier | Primary Class | Maven Module | Purpose |
|---|---|---|---|
| Broker | BaseBrokerStarter | pinot-broker | Query gateway; receives SQL queries, routes to servers, reduces results |
| Controller | BaseControllerStarter | pinot-controller | Cluster orchestrator; manages tables, schemas, segments, and metadata |
| Server | BaseServerStarter | pinot-server | Data node; hosts segments, executes queries, ingests real-time data |
| Minion | BaseMinionStarter | pinot-minion | Background task executor; performs segment optimization, rebalancing |
Sources: pom.xml40-64 pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BaseBrokerStarter.java120-136 pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java165-166 pinot-server/src/main/java/org/apache/pinot/server/starter/helix/BaseServerStarter.java158-159 pinot-minion/src/main/java/org/apache/pinot/minion/BaseMinionStarter.java1-22
Each Pinot component follows a common initialization pattern through the ServiceStartable interface:
Diagram: Component Initialization Sequence
All four component types share this initialization flow:
PinotConfiguration object containing properties from configuration files and cluster configsPluginManager loads plugins for file systems, stream ingestion, input formats, and metricsPinotHelixResourceManager for Controller, InstanceDataManager for Server)Sources: pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BaseBrokerStarter.java188-244 pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java232-244 pinot-server/src/main/java/org/apache/pinot/server/starter/helix/BaseServerStarter.java188-192
Pinot uses Apache Helix for distributed cluster coordination. Helix manages cluster state, resource assignments, and state transitions across all components.
Diagram: Helix Integration Points in Pinot Components
PinotHelixResourceManagerBrokerRoutingManager/CONFIGS), schemas (/SCHEMAS), and segment metadata (/SEGMENTS)SegmentOnlineOfflineStateModel (for offline tables) and includes CONSUMING state (for real-time tables) to manage segment lifecycle transitionsSources: pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java1-32 pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java165-180 pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java101-205
Pinot supports two query execution engines: single-stage (scatter-gather) and multi-stage (distributed SQL).
Diagram: Query Execution Path Through Broker and Server
| Component | Class | Purpose |
|---|---|---|
| SQL Parser | CalciteSqlParser | Parses SQL into SqlNode AST using Apache Calcite |
| Query Compiler | QueryEnvironment | Compiles SqlNode to logical plan, then to physical DispatchableSubPlan |
| Single-Stage Handler | BaseSingleStageBrokerRequestHandler | Scatter-gather for simple aggregations and filters |
| Multi-Stage Handler | MultiStageBrokerRequestHandler | Complex queries with joins, window functions, sub-queries |
| Query Dispatcher | QueryDispatcher | Distributes multi-stage query plans to workers |
| Query Router | QueryRouter | Routes requests to appropriate servers based on segment assignment |
Sources: pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java76-144 pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java1-97 pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java114-152 pinot-query-planner/src/main/java/org/apache/pinot/query/QueryEnvironment.java108-157
Pinot supports both batch and real-time streaming ingestion:
Diagram: Data Ingestion and Storage Flow
Batch Ingestion:
pinot-avro), Parquet (pinot-parquet), ORC (pinot-orc), JSON (pinot-json), CSV (pinot-csv), Protobuf (pinot-protobuf), Thrift (pinot-thrift)pinot-batch-ingestion-spark-2.4, pinot-batch-ingestion-spark-3), Hadoop-based (pinot-batch-ingestion-hadoop), or standaloneFileUploadDownloadClient and stores metadata in ZooKeeperReal-Time Ingestion:
pinot-kafka-2.0), Kafka 3.x (pinot-kafka-3.0), Kinesis (pinot-kinesis), Pulsar (pinot-pulsar)MutableSegmentImpl in memorySources: pom.xml640-697 pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java234-260 pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java95-99
Pinot's extensibility is built on a Service Provider Interface (SPI) pattern with plugins loaded via Java's ServiceLoader:
Diagram: Plugin Architecture with SPI Contracts and Implementations
Plugins are:
shade.phase.prop properties in plugin POMs)META-INF/services files following Java ServiceLoader conventionPluginManager during component initializationPinotConfiguration allowing plugin-specific configurationExample from S3 plugin POM:
This tells Maven to shade the plugin JAR, bundling AWS SDK dependencies so they don't conflict with Pinot core dependencies.
Sources: pom.xml640-778 pinot-plugins/pom.xml1-20 pinot-plugins/pinot-file-system/pinot-adls/pom.xml29-54 pinot-plugins/pinot-file-system/pinot-s3/pom.xml1-21 pinot-plugins/pinot-stream-ingestion/pinot-pulsar/pom.xml29-69 pinot-plugins/pinot-input-format/pinot-parquet/pom.xml1-23 pinot-plugins/pinot-input-format/pinot-protobuf/pom.xml1-19
The Pinot codebase is organized into multiple Maven modules:
| Module | Purpose | Key Dependencies |
|---|---|---|
| pinot-spi | Service Provider Interfaces for plugins | Commons, Jackson |
| pinot-segment-spi | Segment format and index SPIs | pinot-spi |
| pinot-common | Common utilities, metrics, request/response models | pinot-segment-spi, Helix, Calcite |
| pinot-segment-local | Segment creation and local indexing | pinot-common |
| pinot-core | Query execution, operators, data structures | pinot-segment-local |
| pinot-broker | Broker implementation | pinot-core |
| pinot-server | Server implementation | pinot-core |
| pinot-controller | Controller implementation | pinot-core |
| pinot-minion | Minion implementation | pinot-core |
| pinot-query-planner | Multi-stage query planning | pinot-common, Calcite |
| pinot-query-runtime | Multi-stage query execution | pinot-query-planner |
| pinot-plugins | All plugin modules | Various |
| pinot-tools | CLI tools and utilities | All components |
| pinot-distribution | Assembly and packaging | pinot-tools |
| pinot-integration-tests | End-to-end tests | All components |
Sources: pom.xml40-64 pinot-spi/pom.xml24-34 pinot-common/pom.xml22-31 pinot-core/pom.xml22-34 pinot-broker/pom.xml1-27 pinot-server/pom.xml1-24 pinot-controller/pom.xml1-28 pinot-tools/pom.xml22-34 pinot-distribution/pom.xml22-36 pinot-integration-tests/pom.xml22-36
Pinot uses a hierarchical configuration system with multiple precedence levels:
Diagram: Configuration Hierarchy and Precedence
SET statements or query parameters (e.g., SET timeoutMs = 10000)TableConfig JSON stored in ZooKeeper under /CONFIGSClusterConfig, applied via ServiceStartableUtils.applyClusterConfig()pinot-broker.conf)CommonConstants.Broker.CONFIG_OF_BROKER_TIMEOUT_MS)PinotConfigurationPinotConfiguration passed to BaseBrokerStarterSources: pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java30-327 pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java52-103 pinot-common/src/main/java/org/apache/pinot/common/utils/config/QueryOptionsUtils.java1-84 pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BaseBrokerStarter.java124-135
Pinot is packaged as a binary distribution using the Maven Assembly plugin:
Diagram: Binary Distribution Structure
The distribution is assembled by pinot-assembly.xml:
bin/ that invoke Java with appropriate classpath and JVM optionslib/plugins/ subdirectories, loaded separately to avoid conflictsconf/Each start script (e.g., start-controller.sh) wraps pinot-admin.sh with component-specific class:
org.apache.pinot.tools.admin.PinotControllerorg.apache.pinot.tools.admin.PinotBrokerorg.apache.pinot.tools.admin.PinotServerorg.apache.pinot.tools.admin.PinotMinionSources: pinot-distribution/pinot-assembly.xml1-14 pinot-distribution/pom.xml28-46 pinot-tools/pom.xml204-297
Pinot includes comprehensive integration tests that demonstrate end-to-end functionality:
Diagram: Integration Test Cluster Lifecycle
The OfflineClusterIntegrationTest demonstrates:
This test serves as both validation and a reference implementation for cluster setup.
Sources: pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java107-277 pinot-integration-tests/pom.xml22-36
Apache Pinot is a distributed OLAP system with:
This overview provides the foundation for understanding Pinot's architecture. For deeper dives into specific subsystems, refer to the linked sections at the top of this document.
Refresh this wiki
This wiki was recently refreshed. Please wait 7 days to refresh again.