mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Backport #69146 to 24.8: Fix: parallel replicas duplicate announcement request
This commit is contained in:
parent
26e7879ca1
commit
81134df740
@ -1287,7 +1287,8 @@ void Planner::buildPlanForUnionNode()
|
|||||||
|
|
||||||
for (const auto & query_node : union_queries_nodes)
|
for (const auto & query_node : union_queries_nodes)
|
||||||
{
|
{
|
||||||
Planner query_planner(query_node, select_query_options);
|
Planner query_planner(query_node, select_query_options, planner_context->getGlobalPlannerContext());
|
||||||
|
|
||||||
query_planner.buildQueryPlanIfNeeded();
|
query_planner.buildQueryPlanIfNeeded();
|
||||||
for (const auto & row_policy : query_planner.getUsedRowPolicies())
|
for (const auto & row_policy : query_planner.getUsedRowPolicies())
|
||||||
used_row_policies.insert(row_policy);
|
used_row_policies.insert(row_policy);
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
0 Value_0
|
||||||
|
1 Value_1
|
@ -0,0 +1,23 @@
|
|||||||
|
DROP TABLE IF EXISTS test_table SYNC;
|
||||||
|
CREATE TABLE test_table
|
||||||
|
(
|
||||||
|
id UInt64,
|
||||||
|
value String
|
||||||
|
) ENGINE=ReplicatedMergeTree('/clickhouse/test/{database}/test_table', 'r1') ORDER BY tuple();
|
||||||
|
|
||||||
|
INSERT INTO test_table VALUES (0, 'Value_0'), (1, 'Value_1'), (2, 'Value_2');
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS test_table_for_in SYNC;
|
||||||
|
CREATE TABLE test_table_for_in
|
||||||
|
(
|
||||||
|
id UInt64
|
||||||
|
) ENGINE=ReplicatedMergeTree('/clickhouse/test/{database}/test_table_for_in', 'r1') ORDER BY tuple();
|
||||||
|
|
||||||
|
INSERT INTO test_table_for_in VALUES (0), (1);
|
||||||
|
|
||||||
|
SET allow_experimental_parallel_reading_from_replicas=1, max_parallel_replicas=3, cluster_for_parallel_replicas='test_cluster_one_shard_three_replicas_localhost';
|
||||||
|
|
||||||
|
SELECT id, value FROM test_table WHERE id IN (SELECT id FROM test_table_for_in UNION DISTINCT SELECT id FROM test_table_for_in);
|
||||||
|
|
||||||
|
DROP TABLE test_table SYNC;
|
||||||
|
DROP TABLE test_table_for_in SYNC;
|
@ -0,0 +1 @@
|
|||||||
|
CAT 2
|
@ -0,0 +1,45 @@
|
|||||||
|
DROP TABLE IF EXISTS ANIMAL SYNC;
|
||||||
|
|
||||||
|
CREATE TABLE ANIMAL ( ANIMAL Nullable(String) ) ENGINE = ReplicatedMergeTree('/clickhouse/test/{database}/animal', 'r1') ORDER BY tuple();
|
||||||
|
|
||||||
|
INSERT INTO ANIMAL (ANIMAL) VALUES ('CAT'), ('FISH'), ('DOG'), ('HORSE'), ('BIRD');
|
||||||
|
|
||||||
|
SET joined_subquery_requires_alias = 0;
|
||||||
|
SET allow_experimental_parallel_reading_from_replicas=1, max_parallel_replicas=3, cluster_for_parallel_replicas='test_cluster_one_shard_three_replicas_localhost';
|
||||||
|
|
||||||
|
SELECT *
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
x.b AS x,
|
||||||
|
countDistinct(x.c) AS ANIMAL
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
a.ANIMAL AS a,
|
||||||
|
'CAT' AS b,
|
||||||
|
c.ANIMAL AS c,
|
||||||
|
d.ANIMAL AS d
|
||||||
|
FROM ANIMAL AS a
|
||||||
|
INNER JOIN ANIMAL AS b ON a.ANIMAL = b.ANIMAL
|
||||||
|
LEFT JOIN ANIMAL AS c ON b.ANIMAL = c.ANIMAL
|
||||||
|
RIGHT JOIN
|
||||||
|
(
|
||||||
|
SELECT *
|
||||||
|
FROM ANIMAL
|
||||||
|
UNION ALL
|
||||||
|
SELECT *
|
||||||
|
FROM ANIMAL
|
||||||
|
UNION ALL
|
||||||
|
SELECT *
|
||||||
|
FROM ANIMAL
|
||||||
|
) AS d ON a.ANIMAL = d.ANIMAL
|
||||||
|
WHERE (d.ANIMAL != 'CAT') AND (c.ANIMAL != 'DOG') AND (b.ANIMAL != 'FISH')
|
||||||
|
) AS x
|
||||||
|
WHERE x.b >= 'CAT'
|
||||||
|
GROUP BY x.b
|
||||||
|
HAVING ANIMAL >= 0
|
||||||
|
) AS ANIMAL
|
||||||
|
WHERE ANIMAL.ANIMAL >= 0;
|
||||||
|
|
||||||
|
DROP TABLE ANIMAL SYNC;
|
Loading…
Reference in New Issue
Block a user