> ## 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/aggregation/hll-count-merge",
  "feedback": "Description of the issue"
}
```

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

</AgentInstructions>

> Reference material for HLL_COUNT_MERGE

# HLL_COUNT_MERGE

Merges one or more HLL++ sketches that were previously built using the aggregate
function [HLL\_COUNT\_BUILD](/reference-sql/functions-reference/aggregation/hll-count-build) into a new sketch.

Each sketch must be built on the same type and the same precision.
Attempts to merge sketches for different types or precisions results in an error.
For example, you cannot merge a sketch built from `INTEGER` data with one built from `TEXT` data,
or a sketch built with precision 13 and a sketch built with precision 14.

## Syntax

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
HLL_COUNT_MERGE(<expression>) [FILTER ([WHERE] <condition>)]
```

## Parameters

| Parameter      | Description                                                                                                                                          | Supported input types |
| :------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------- |
| `<expression>` | HLL++ sketch in a valid format, e.g. the output of the [HLL\_COUNT\_BUILD](/reference-sql/functions-reference/aggregation/hll-count-build) function. | `BYTEA`               |
| `<condition>`  | An optional boolean expression to filter rows used in aggregation                                                                                    | `BOOL`                |

## Return Type

`BYTEA`

## Example

Following the [example](/reference-sql/functions-reference/aggregation/hll-count-build#example) in [HLL\_COUNT\_BUILD](/reference-sql/functions-reference/aggregation/hll-count-build):

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT hll_count_estimate(hll_count_merge(a)) AS hll_estimate, hll_count_merge(a) AS merged_sketch
FROM sketch_of_data_to_count;
```

| hll\_estimate BIGINT | merged\_sketch BYTEA           |
| :------------------- | :----------------------------- |
| 6606880              | \x2f4167677265676174654675.... |
