Conversation
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>
3c1bcdb to
8cd0586
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Reuse `assertUnary`, consolidate state handling, and shorten repetitive comments and documentation. Merge overlapping HLL tests while retaining interoperability, cross-resolution, corruption, and dependency coverage. Use the canonical `Enum` documentation type to avoid a logical-error exception when reading `system.functions`. Validation: rebuilt ClickHouse and passed all four remaining PR tests with the pinned DataSketches revision; no tests skipped. Related: #2398
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
CI triage — @zvonandVerdict: Only one class of failure is caused by this PR, and it's the expected one — the regression suite noticing the new function isn't covered yet. Everything else is pre-existing / flaky / infra. Nothing points to a bug in the Head SHA analyzed: 🔴 PR-caused (1 root cause — action needed, but not in this repo)
This is the Altinity clickhouse-regression Fix: add 🟡 Not PR-caused — pre-existing / flaky / infra (safe to re-run or ignore)Stateless tests — all failures are unrelated to aggregate functions and are confirmed transient by CI's own auto-rerun:
Stress test (amd_asan_ubsan, cas s3 storage) — Integration tests (arm_binary, distributed plan, 3/4) — Grype Scan (keeper + server-alpine) — Other regression suites — TL;DR
🤖 Automated CI triage by @blau-ai. Evidence: praktika |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c9c7fbb49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ation - Construct `hll_union` with the requested `lg_k` instead of flooring it at 7, so `uniqApacheHLLMerge(4..6)` produces sketches with the requested `lg_k`. `hll_union` accepts `lg_max_k` in [4, 21]. - Serialize an untouched state as the library's compact empty sketch instead of a zero-length vector, so external DataSketches consumers can read it. Related: #2398 (comment) Related: #2398 (comment)
|
AI audit note: This review comment was generated by AI. Audit update for PR #2398 ( Confirmed defects: Medium: Fast test and any
Medium: Empty
Coverage summary:
|
uniqApacheHLL is an Antalya-only aggregate function (Altinity/ClickHouse#2398) whose state is compatible with Apache DataSketches HLL. The suite reuses the any checks for supported types and adds checks for rejected types, HLL estimation mode, lg_k and HLL type parameters, empty strings, and reading an external DataSketches state. Skipped on non-Antalya builds and before 26.6. Snapshots are x86_64 only; aarch64 follows. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: CarlosFelipeOR <carlosfelipeor@gmail.com>
|
I added SELECT uniq(NULL), uniqTheta(NULL); -- 0 0
SELECT uniqApacheHLL(NULL); -- Code: 43. Illegal type Nullable(Nothing) of argument for aggregate function uniqApacheHLLThe failing checks are AI analysis: for an all-NULL argument, the factory still calls the creator with |
Changelog category (leave one):
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
CI/CD Options
Exclude tests:
Regression jobs to run: