> For the complete documentation index, see [llms.txt](https://docs.pinot.apache.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pinot.apache.org/release-1.4.0/functions-1/distinctcountull.md).

# DISTINCTCOUNTULL

The [UltraLogLog Sketch](https://arxiv.org/abs/2308.16862) from Dynatrace is a variant of *HyperLogLog* and is used for approximate distinct counts. The UltraLogLog sketch shares many of the same properties of a typical HyperLogLog sketch but requires less space and also provides a simpler and faster estimator.

Pinot uses an production-ready Java implementation available in [Hash4j](https://github.com/dynatrace-oss/hash4j/tree/main) available under the Apache license.

For exact distinct counting, see [DISTINCTCOUNT](https://github.com/pinot-contrib/pinot-docs/blob/latest/configuration-reference/functions/distinctcount.md).

## Signature

> distinctCountULL(**\<ullSketchColumn>, \<ullSketchPrecision>**) -> Long

* `ullSketchColumn` (required): Name of the column to aggregate on.
* `ullSketchPrecision` (optional): p which is the precision parameter, which controls both the size and accuracy of the sketch. If not supplied, the Helix default is used.

## Usage examples

These examples are based on the [Batch Quick Start](https://github.com/pinot-contrib/pinot-docs/blob/latest/basics/getting-started/quick-start.md#batch).

```
select distinctCountULL(teamID) AS value
from baseballStats 
```

| value |
| ----- |
| 150   |

```
select distinctCountULL(teamID, 14) AS value
from baseballStats 
```

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pinot.apache.org/release-1.4.0/functions-1/distinctcountull.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
