Skip to content

Feature/antalya 26.6/uniq apache hll - #2398

Open
UnamedRus wants to merge 2 commits into
antalya-26.6from
feature/antalya-26.6/uniq-apache-hll
Open

UnamedRus wants to merge 2 commits into
antalya-26.6from
feature/antalya-26.6/uniq-apache-hll

Conversation

@UnamedRus

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Aggregate function, which states are compatible with apache data sketches HLL implementation

@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

Workflow [PR], commit [8cd0586]

UnamedRus and others added 2 commits September 17, 2026 15:15
Backport of ClickHouse/ClickHouse@a067567, re-created
here rather than cherry-picked so that it carries a sign-off.

The submodule tracked `apache/datasketches-cpp` directly, pinned to `76edd74f`
(2024-05-16), an upstream development commit. It moves onto a `ClickHouse/`-prefixed
branch of our fork, the way `docs/development/contrib` asks:

    ClickHouse/datasketches-cpp, branch ClickHouse/5.2.0
      de8553ba  5.2.0, the newest upstream release (2025-01-15)
      23bd9b07  backport of apache/datasketches-cpp#512

apache/datasketches-cpp#512 is the HyperLogLog union fix. No upstream release carries
it, so it is cherry-picked onto the `5.2.0` tag there. `uniqApacheHLL`, added next,
needs it: without it a merged HLL sketch reports a wrong estimate and serializes a
state that other DataSketches implementations read differently.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: UnamedRus <dtitmoav@gmail.com>
…tion

Ported from `vk/uniq-apache-hll` (github.com/UnamedRus/ClickHouse), which develops the
function against `master`.

`uniqApacheHLL` counts distinct values into an Apache DataSketches HLL sketch, and its
`-State` serializes that sketch in the DataSketches format, so states can be exchanged
with Java, Python and C++ services through the standard `-State`/`-Merge` combinators.
Only the argument types those libraries hash the same way are accepted - integers of at
most 64 bits, Enum8/16, BFloat16, Float32/64, String, FixedString, UUID, IPv4, IPv6,
Date, Date32, DateTime and DateTime64 - so no state can be built here that an external
consumer cannot reproduce.

Two deviations from the branch this is taken from, both forced by the age of this base:

  - the state overrides `merge`, not `mergeImpl`. `IAggregateFunction::merge` is still
    the pure virtual here; the split into a non-virtual `merge` plus a `mergeImpl`
    override came later.
  - `introduced_in` says 26.6 rather than 26.9, this being the release it ships in.

NOT BUILT OR TESTED on this base - only ported and checked by inspection against the
26.6 headers. CI is the first real build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: UnamedRus <dtitmoav@gmail.com>
@UnamedRus
UnamedRus force-pushed the feature/antalya-26.6/uniq-apache-hll branch from 3c1bcdb to 8cd0586 Compare September 17, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant