> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.firebolt.io/feedback

```json
{
  "path": "/reference-sql/functions-reference/array/array-count-distinct",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

> Reference material for ARRAY_COUNT_DISTINCT function

# ARRAY_COUNT_DISTINCT

Returns the number of distinct (unique) elements in the array. As with `COUNT` and `COUNT(DISTINCT ...)` aggregations, `NULL` is not counted as a value if it occurs.

## Syntax

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
ARRAY_COUNT_DISTINCT(<array>)
```

## Parameters

| Parameter | Description                                        | Supported input types |
| :-------- | :------------------------------------------------- | :-------------------- |
| `<array>` | The array of which to count the distinct elements. | Any `ARRAY` type      |

## Return Type

`INTEGER`

## Example

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT ARRAY_COUNT_DISTINCT([ 1, 2, 4, 5, 2, NULL, 5, 1 ]) AS res;
```

**Returns**: `4`
