cube-js / cube-js/cube

Native distinct counts in ClickHouse dialect

Open
#2,334 2 comments 1 reaction 0 assignees View on GitHub
driver:clickhouse good first issue help wanted
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Is your feature request related to a problem? Please describe.**
ClickHouse supports a number of functions to count distinct values: [uniq](https://clickhouse.tech/docs/en/sql-reference/aggregate-functions/reference/uniq/), uniqExact, [uniqHLL12](https://clickhouse.tech/docs/en/sql-reference/aggregate-functions/reference/uniqhll12/#agg_function-uniqhll12). However, they are not used in [ClickHouseQuery](https://github.com/cube-js/cube.js/blob/master/packages/cubejs-schema-compiler/src/adapter/ClickHouseQuery.js) adapter to support `countDistinctApprox` and other types of aggregations.

**Describe the solution you'd like**
With the guidance of the Cube.js team and taking other adapters as examples, these functions should be used in the adapter.

**Describe alternatives you've considered**

**Additional context**
Without this feature, `countDistinctApprox` is not supported at all, and — I think — `countDistinct` works slower than it could.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.