-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Unexpected result in a distributed query #7666
Comments
It seems some scalar function is not suitable for scalar optimization. Try setting |
There is no such setting in 19.16.2 |
I tried 19.17.2.4 and got an exception for both version() and uptime(): DB::Exception: Block structure mismatch in MergingSorted stream: different values of constants, actual: '19.13.7.57', expected: '19.17.2.4' DB::Exception: Block structure mismatch in MergingSorted stream: different values of constants, actual: 705665, expected: 424
|
Suppose I need to continue fixing it. |
I have just realized that the exception only happens when I sort the data:
The same happens with dictGet called with a constant argument:
|
some more examples (19.17.6.36).
SELECT
version() AS v,
hostName() AS h,
uptime() AS u
FROM cluster(cluster, system, one)
SELECT
version() AS v,
hostName() AS h,
uptime() AS u
FROM cluster(cluster, system, one)
ORDER BY h ASC
SELECT
version() AS v,
hostName() AS h,
uptime() AS u
FROM cluster(cluster, system, one)
GROUP BY h
NOTE: incorrect result and there are no errors 'Column X is not under aggregate function and not in GROUP BY' for columns v and u
SELECT
hostName() AS h,
count()
FROM cluster(cluster, system, one)
GROUP BY h
SELECT
hostName() AS h,
count()
FROM cluster(cluster, default, raw_events_log_shard)
GROUP BY h
SELECT
hostName() AS h,
sum(1)
FROM cluster(cluster, default, raw_events_log_shard)
GROUP BY h
SELECT
uptime() AS u,
count()
FROM cluster(cluster, system, one)
GROUP BY u
b) non-system table SELECT
uptime() AS u,
count()
FROM cluster(cluster, default, raw_events_log_shard)
GROUP BY u
NOTE: correct result for count() but incorrect for grouping column
SELECT
materialize(uptime()) AS u,
count()
FROM cluster(cluster, system, one)
GROUP BY u
b) non-system table SELECT
materialize(uptime()) AS u,
count()
FROM cluster(cluster, default, raw_events_log_shard)
GROUP BY u
|
I cannot reproduce the sorting issue anymore ( |
The grouping issue:
|
@alexey-milovidov the problem is the same as I showed for |
@KochetovNicolai Ok, let's do it. I see that the |
The grouping issue is still relevant in 20.9.3.45 |
Looks like has been fixed in 983aaa3/93e4802fa4919894 (#16618, 20.12+)
@KochetovNicolai but isn't it |
I think it is not suitable. Because otherwise we could replace this function calculation by constant (it has not arguments and return constant result). It is hard to detect if we have some other node which returns different version result. |
I'm talking about that, that query, with In other words |
This is broken again in 21.3
|
Workaround: |
The place where the expression in SQL query is executed is not specified for distributed queries. |
I installed 19.16.2 on one node of the cluster that runs 19.13.7, and I observe unexpected behaviour when I try to run a distributed query across the cluster:
Connected to ClickHouse server version 19.16.2 revision 54427.
Connected to ClickHouse server version 19.13.7 revision 54425.
Sometimes when I run this query on 19.16.2 I get an exception:
@amosbird @KochetovNicolai could you please help with investigation?
The text was updated successfully, but these errors were encountered: