Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uniqCombined is wrong #63066

Open
alexey-milovidov opened this issue Apr 27, 2024 · 1 comment
Open

uniqCombined is wrong #63066

alexey-milovidov opened this issue Apr 27, 2024 · 1 comment

Comments

@alexey-milovidov
Copy link
Member

Describe the unexpected behaviour

clickhouse-cloud :) SELECT count(), uniq(*) AS a, uniqCombined(*) AS b FROM planes_mercator \G

SELECT
    count(),
    uniq(*) AS a,
    uniqCombined(*) AS b
FROM planes_mercator

Query id: 5202ef0c-5f71-455c-af0f-95f305fd06a4

Row 1:
──────
count(): 50738937576
a:       48882212795
b:       6195774276

1 row in set. Elapsed: 56.120 sec. Processed 50.74 billion rows, 16.27 TB (904.11 million rows/s., 289.99 GB/s.)
Peak memory usage: 5.05 GiB.

WTF?

@UnamedRus
Copy link
Contributor

Probably, it's using 32bit based state, because of data types in *

SELECT uniqCombined64(number)
FROM numbers_mt(20000000000)

Query id: 33ae687b-2426-4c39-a8a1-9252ce613d7f

┌─uniqCombined64(number)─┐
│            20058723685 │ -- 20.06 billion
└────────────────────────┘

1 row in set. Elapsed: 19.479 sec. Processed 19.96 billion rows, 159.71 GB (1.02 billion rows/s., 8.20 GB/s.)
Peak memory usage: 1.83 MiB.

SELECT uniqCombined(number)
FROM numbers_mt(20000000000)

Query id: 9ffb671e-f417-41bc-b933-288e7b770cf4

┌─uniqCombined(number)─┐
│           6138591160 │ -- 6.14 billion
└──────────────────────┘

1 row in set. Elapsed: 19.841 sec. Processed 20.00 billion rows, 160.00 GB (1.01 billion rows/s., 8.06 GB/s.)
Peak memory usage: 1.38 MiB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants