# SEGMENTPARTITIONEDDISTINCTCOUNT

Returns the count of distinct values of a column when the column is pre-partitioned for each segment, where there is no common value within different segments. This function calculates the exact count of distinct values within the segment, then simply sums up the results from different segments to get the final result.

{% hint style="warning" %}
This function relies on the expression values being partitioned for each segment, where there are no common values within different segments.
{% endhint %}

## Signature

> SEGMENTPARTITIONEDDISTINCTCOUNT(colName)

## Usage Examples

These examples are based on the [Batch Quick Start](https://docs.pinot.apache.org/release-0.12.0/basics/getting-started/quick-start#batch).

```sql
select SEGMENTPARTITIONEDDISTINCTCOUNT(teamID) AS value
from baseballStats 
```

| value |
| ----- |
| 149   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pinot.apache.org/release-0.12.0/configuration-reference/functions/segmentpartitioneddistinctcount.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
