forceCommit API to immediately commit consuming segments. This API is usually used when we’ve made stream compatible changes to our table config, like changing segment.threshold parameters.
Prerequisites
You will need to install Docker to follow the code examples in this guide.Navigate to recipe
- If you haven’t already, download recipes.
- In terminal, go to the recipe by running the following command:
Launch Pinot Cluster
You can spin up a Pinot Cluster by running the following command:Data generator
This recipe contains a data generator that creates events with a timestamp, count, and UUID. You can generate data by running the following command:Kafka ingestion
We’re going to ingest this data into an Apache Kafka topic using the kcat command line tool. We’ll also usejq to structure the data in the key:payload structure that Kafka expects:
Pinot Schema and Table
Now let’s create a Pinot Schema and Table. First, the schema:Querying by segment
Once that’s been created, we can head over to the Pinot UI and run some queries. Pinot has several built-in virtual columns inside every schema that can be used for debugging purposes:
The one that’s useful for us is
$segmentName, which we can use like this to count the number of records in each segment:
Query Results
Now, let’s say that we decide we want to reduce the segment threshold to 1m rows. We can do that with the following table config:
forceCommit API:
Query Results

