From 5d94c052b50261b939ca255995aab970779d9277 Mon Sep 17 00:00:00 2001 From: Anton Ivashkin Date: Fri, 21 Nov 2025 11:51:44 +0100 Subject: [PATCH] Revert support for 'IN' in cluster requests --- src/Storages/IStorageCluster.cpp | 2 +- .../integration/test_database_iceberg/test.py | 67 ++++++++++--------- tests/integration/test_s3_cluster/test.py | 26 +++---- .../integration/test_storage_iceberg/test.py | 63 ++++++++--------- 4 files changed, 82 insertions(+), 76 deletions(-) diff --git a/src/Storages/IStorageCluster.cpp b/src/Storages/IStorageCluster.cpp index 7d0c6fb97177..b3a1f7653bd4 100644 --- a/src/Storages/IStorageCluster.cpp +++ b/src/Storages/IStorageCluster.cpp @@ -573,7 +573,7 @@ QueryProcessingStage::Enum IStorageCluster::getQueryProcessingStage( "object_storage_cluster_join_mode!='allow' is not supported without allow_experimental_analyzer=true"); auto info = getQueryTreeInfo(query_info.query_tree, context); - if (info.has_join || info.has_cross_join || info.has_local_columns_in_where) + if (info.has_join || info.has_cross_join /*|| info.has_local_columns_in_where*/) return QueryProcessingStage::Enum::FetchColumns; } diff --git a/tests/integration/test_database_iceberg/test.py b/tests/integration/test_database_iceberg/test.py index 74279463220b..a92a1581dc48 100644 --- a/tests/integration/test_database_iceberg/test.py +++ b/tests/integration/test_database_iceberg/test.py @@ -724,6 +724,7 @@ def test_cluster_joins(started_cluster): FROM {CATALOG_NAME}.`{root_namespace}.{table_name}` AS t1 JOIN {CATALOG_NAME}.`{root_namespace}.{table_name_2}` AS t2 ON t1.tag=t2.id + WHERE t1.tag < 10 AND t2.id < 20 ORDER BY ALL SETTINGS object_storage_cluster='cluster_simple', @@ -733,22 +734,22 @@ def test_cluster_joins(started_cluster): assert res == "Jack\tSparrow\nJohn\tDow\n" - res = node.query( - f""" - SELECT name - FROM {CATALOG_NAME}.`{root_namespace}.{table_name}` - WHERE tag in ( - SELECT id - FROM {CATALOG_NAME}.`{root_namespace}.{table_name_2}` - ) - ORDER BY ALL - SETTINGS - object_storage_cluster='cluster_simple', - object_storage_cluster_join_mode='local' - """ - ) - - assert res == "Jack\nJohn\n" + #res = node.query( + # f""" + # SELECT name + # FROM {CATALOG_NAME}.`{root_namespace}.{table_name}` + # WHERE tag in ( + # SELECT id + # FROM {CATALOG_NAME}.`{root_namespace}.{table_name_2}` + # ) + # ORDER BY ALL + # SETTINGS + # object_storage_cluster='cluster_simple', + # object_storage_cluster_join_mode='local' + # """ + #) + + #assert res == "Jack\nJohn\n" res = node.query( f""" @@ -756,6 +757,7 @@ def test_cluster_joins(started_cluster): FROM {CATALOG_NAME}.`{root_namespace}.{table_name}` AS t1 JOIN `{table_name_local}` AS t2 ON t1.tag=t2.id + WHERE t1.tag < 10 AND t2.id < 20 ORDER BY ALL SETTINGS object_storage_cluster='cluster_simple', @@ -765,28 +767,29 @@ def test_cluster_joins(started_cluster): assert res == "Jack\tBlack\nJohn\tSilver\n" - res = node.query( - f""" - SELECT name - FROM {CATALOG_NAME}.`{root_namespace}.{table_name}` - WHERE tag in ( - SELECT id - FROM `{table_name_local}` - ) - ORDER BY ALL - SETTINGS - object_storage_cluster='cluster_simple', - object_storage_cluster_join_mode='local' - """ - ) - - assert res == "Jack\nJohn\n" + #res = node.query( + # f""" + # SELECT name + # FROM {CATALOG_NAME}.`{root_namespace}.{table_name}` + # WHERE tag in ( + # SELECT id + # FROM `{table_name_local}` + # ) + # ORDER BY ALL + # SETTINGS + # object_storage_cluster='cluster_simple', + # object_storage_cluster_join_mode='local' + # """ + #) + + #assert res == "Jack\nJohn\n" res = node.query( f""" SELECT t1.name,t2.second_name FROM {CATALOG_NAME}.`{root_namespace}.{table_name}` AS t1 CROSS JOIN `{table_name_local}` AS t2 + WHERE t1.tag < 10 AND t2.id < 20 ORDER BY ALL SETTINGS object_storage_cluster='cluster_simple', diff --git a/tests/integration/test_s3_cluster/test.py b/tests/integration/test_s3_cluster/test.py index e8d73c24dcbb..5cecf58f37b0 100644 --- a/tests/integration/test_s3_cluster/test.py +++ b/tests/integration/test_s3_cluster/test.py @@ -1163,19 +1163,19 @@ def test_joins(started_cluster): res = list(map(str.split, result5.splitlines())) assert len(res) == 6 - result6 = node.query( - f""" - SELECT name FROM - s3Cluster('cluster_simple', - 'http://minio1:9001/root/data/{{clickhouse,database}}/*', 'minio', '{minio_secret_key}', 'CSV', - 'name String, value UInt32, polygon Array(Array(Tuple(Float64, Float64)))') - WHERE value IN (SELECT id FROM join_table) - ORDER BY name - SETTINGS object_storage_cluster_join_mode='local'; - """ - ) - res = list(map(str.split, result6.splitlines())) - assert len(res) == 25 + #result6 = node.query( + # f""" + # SELECT name FROM + # s3Cluster('cluster_simple', + # 'http://minio1:9001/root/data/{{clickhouse,database}}/*', 'minio', '{minio_secret_key}', 'CSV', + # 'name String, value UInt32, polygon Array(Array(Tuple(Float64, Float64)))') + # WHERE value IN (SELECT id FROM join_table) + # ORDER BY name + # SETTINGS object_storage_cluster_join_mode='local'; + # """ + #) + #res = list(map(str.split, result6.splitlines())) + #assert len(res) == 25 def test_graceful_shutdown(started_cluster): diff --git a/tests/integration/test_storage_iceberg/test.py b/tests/integration/test_storage_iceberg/test.py index a4a09c8349af..6885e976c3b0 100644 --- a/tests/integration/test_storage_iceberg/test.py +++ b/tests/integration/test_storage_iceberg/test.py @@ -3623,6 +3623,7 @@ def execute_spark_query(query: str, table_name): FROM {creation_expression} AS t1 JOIN {creation_expression_2} AS t2 ON t1.tag=t2.id + WHERE t1.tag < 10 AND t2.id < 20 ORDER BY ALL SETTINGS object_storage_cluster='cluster_simple', @@ -3632,22 +3633,22 @@ def execute_spark_query(query: str, table_name): assert res == "jack\tsparrow\njohn\tdow\n" - res = instance.query( - f""" - SELECT name - FROM {creation_expression} - WHERE tag in ( - SELECT id - FROM {creation_expression_2} - ) - ORDER BY ALL - SETTINGS - object_storage_cluster='cluster_simple', - object_storage_cluster_join_mode='local' - """ - ) + #res = instance.query( + # f""" + # SELECT name + # FROM {creation_expression} + # WHERE tag in ( + # SELECT id + # FROM {creation_expression_2} + # ) + # ORDER BY ALL + # SETTINGS + # object_storage_cluster='cluster_simple', + # object_storage_cluster_join_mode='local' + # """ + #) - assert res == "jack\njohn\n" + #assert res == "jack\njohn\n" res = instance.query( f""" @@ -3655,6 +3656,7 @@ def execute_spark_query(query: str, table_name): FROM {creation_expression} AS t1 JOIN `{TABLE_NAME_LOCAL}` AS t2 ON t1.tag=t2.id + WHERE t1.tag < 10 AND t2.id < 20 ORDER BY ALL SETTINGS object_storage_cluster='cluster_simple', @@ -3664,28 +3666,29 @@ def execute_spark_query(query: str, table_name): assert res == "jack\tblack\njohn\tsilver\n" - res = instance.query( - f""" - SELECT name - FROM {creation_expression} - WHERE tag in ( - SELECT id - FROM `{TABLE_NAME_LOCAL}` - ) - ORDER BY ALL - SETTINGS - object_storage_cluster='cluster_simple', - object_storage_cluster_join_mode='local' - """ - ) + #res = instance.query( + # f""" + # SELECT name + # FROM {creation_expression} + # WHERE tag in ( + # SELECT id + # FROM `{TABLE_NAME_LOCAL}` + # ) + # ORDER BY ALL + # SETTINGS + # object_storage_cluster='cluster_simple', + # object_storage_cluster_join_mode='local' + # """ + #) - assert res == "jack\njohn\n" + #assert res == "jack\njohn\n" res = instance.query( f""" SELECT t1.name,t2.second_name FROM {creation_expression} AS t1 CROSS JOIN `{TABLE_NAME_LOCAL}` AS t2 + WHERE t1.tag < 10 AND t2.id < 20 ORDER BY ALL SETTINGS object_storage_cluster='cluster_simple',