From ade60b5b45283adddfcf166d5a5c865c7a4da16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Tue, 28 Nov 2023 14:12:26 +0100 Subject: [PATCH 1/6] Randomize disabled optimizations in CI --- tests/clickhouse-test | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/clickhouse-test b/tests/clickhouse-test index 115e5ac7ba3..bd2f2ca1d5d 100755 --- a/tests/clickhouse-test +++ b/tests/clickhouse-test @@ -555,8 +555,15 @@ class SettingsRandomizer: "prefer_localhost_replica": lambda: random.randint(0, 1), "max_block_size": lambda: random.randint(8000, 100000), "max_threads": lambda: random.randint(1, 64), - "optimize_or_like_chain": lambda: random.randint(0, 1), + "optimize_append_index": lambda: random.randint(0, 1), + "optimize_functions_to_subcolumns": lambda: random.randint(0, 1), + "optimize_syntax_fuse_functions": lambda: random.randint(0, 1), + "optimize_if_chain_to_multiif": lambda: random.randint(0, 1), + "optimize_if_transform_strings_to_enum": lambda: random.randint(0, 1), "optimize_read_in_order": lambda: random.randint(0, 1), + "optimize_or_like_chain": lambda: random.randint(0, 1), + "optimize_substitute_columns": lambda: random.randint(0, 1), + "optimize_using_constraints": lambda: random.randint(0, 1), "enable_multiple_prewhere_read_steps": lambda: random.randint(0, 1), "read_in_order_two_level_merge_threshold": lambda: random.randint(0, 100), "optimize_aggregation_in_order": lambda: random.randint(0, 1), From 025fcd3aa4ca3867c1c3510adb4804d7b85076c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Tue, 28 Nov 2023 18:22:49 +0100 Subject: [PATCH 2/6] Enable the settings to do a full run with them enabled --- tests/clickhouse-test | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/clickhouse-test b/tests/clickhouse-test index bd2f2ca1d5d..dc6614471a4 100755 --- a/tests/clickhouse-test +++ b/tests/clickhouse-test @@ -555,15 +555,15 @@ class SettingsRandomizer: "prefer_localhost_replica": lambda: random.randint(0, 1), "max_block_size": lambda: random.randint(8000, 100000), "max_threads": lambda: random.randint(1, 64), - "optimize_append_index": lambda: random.randint(0, 1), - "optimize_functions_to_subcolumns": lambda: random.randint(0, 1), - "optimize_syntax_fuse_functions": lambda: random.randint(0, 1), - "optimize_if_chain_to_multiif": lambda: random.randint(0, 1), - "optimize_if_transform_strings_to_enum": lambda: random.randint(0, 1), + "optimize_append_index": lambda: random.randint(1, 1), + "optimize_functions_to_subcolumns": lambda: random.randint(1, 1), + "optimize_syntax_fuse_functions": lambda: random.randint(1, 1), + "optimize_if_chain_to_multiif": lambda: random.randint(1, 1), + "optimize_if_transform_strings_to_enum": lambda: random.randint(1, 1), "optimize_read_in_order": lambda: random.randint(0, 1), - "optimize_or_like_chain": lambda: random.randint(0, 1), - "optimize_substitute_columns": lambda: random.randint(0, 1), - "optimize_using_constraints": lambda: random.randint(0, 1), + "optimize_or_like_chain": lambda: random.randint(1, 1), + "optimize_substitute_columns": lambda: random.randint(1, 1), + "optimize_using_constraints": lambda: random.randint(1, 1), "enable_multiple_prewhere_read_steps": lambda: random.randint(0, 1), "read_in_order_two_level_merge_threshold": lambda: random.randint(0, 100), "optimize_aggregation_in_order": lambda: random.randint(0, 1), From 64bd77fe9c0131ba9d9699c421e231e92242023a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Thu, 30 Nov 2023 14:05:19 +0100 Subject: [PATCH 3/6] Do not randomize optimize_functions_to_subcolumns --- tests/clickhouse-test | 1 - tests/queries/0_stateless/02498_analyzer_settings_push_down.sql | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/clickhouse-test b/tests/clickhouse-test index dc6614471a4..fcd8c7ba0b4 100755 --- a/tests/clickhouse-test +++ b/tests/clickhouse-test @@ -556,7 +556,6 @@ class SettingsRandomizer: "max_block_size": lambda: random.randint(8000, 100000), "max_threads": lambda: random.randint(1, 64), "optimize_append_index": lambda: random.randint(1, 1), - "optimize_functions_to_subcolumns": lambda: random.randint(1, 1), "optimize_syntax_fuse_functions": lambda: random.randint(1, 1), "optimize_if_chain_to_multiif": lambda: random.randint(1, 1), "optimize_if_transform_strings_to_enum": lambda: random.randint(1, 1), diff --git a/tests/queries/0_stateless/02498_analyzer_settings_push_down.sql b/tests/queries/0_stateless/02498_analyzer_settings_push_down.sql index 91bdce2cca9..67623869f0a 100644 --- a/tests/queries/0_stateless/02498_analyzer_settings_push_down.sql +++ b/tests/queries/0_stateless/02498_analyzer_settings_push_down.sql @@ -1,4 +1,5 @@ SET allow_experimental_analyzer = 1; +SET optimize_functions_to_subcolumns = 0; DROP TABLE IF EXISTS test_table; CREATE TABLE test_table (id UInt64, value Tuple(a UInt64)) ENGINE=MergeTree ORDER BY id; From 3867adbb10a83631a06e0b40c74b1bd4fee7ba3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Thu, 30 Nov 2023 19:19:26 +0100 Subject: [PATCH 4/6] Adapt tests and avoid using optimize_syntax_fuse_functions at all --- tests/clickhouse-test | 1 - tests/queries/0_stateless/01300_group_by_other_keys_having.sql | 1 + .../queries/0_stateless/01622_constraints_where_optimization.sql | 1 + .../0_stateless/02481_analyzer_optimize_grouping_sets_keys.sql | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/clickhouse-test b/tests/clickhouse-test index fcd8c7ba0b4..fe93864b202 100755 --- a/tests/clickhouse-test +++ b/tests/clickhouse-test @@ -556,7 +556,6 @@ class SettingsRandomizer: "max_block_size": lambda: random.randint(8000, 100000), "max_threads": lambda: random.randint(1, 64), "optimize_append_index": lambda: random.randint(1, 1), - "optimize_syntax_fuse_functions": lambda: random.randint(1, 1), "optimize_if_chain_to_multiif": lambda: random.randint(1, 1), "optimize_if_transform_strings_to_enum": lambda: random.randint(1, 1), "optimize_read_in_order": lambda: random.randint(0, 1), diff --git a/tests/queries/0_stateless/01300_group_by_other_keys_having.sql b/tests/queries/0_stateless/01300_group_by_other_keys_having.sql index 911f61a62e2..203e8322ad9 100644 --- a/tests/queries/0_stateless/01300_group_by_other_keys_having.sql +++ b/tests/queries/0_stateless/01300_group_by_other_keys_having.sql @@ -1,4 +1,5 @@ set optimize_group_by_function_keys = 1; +set optimize_syntax_fuse_functions = 0; set allow_experimental_analyzer = 1; -- { echoOn } diff --git a/tests/queries/0_stateless/01622_constraints_where_optimization.sql b/tests/queries/0_stateless/01622_constraints_where_optimization.sql index 2818351a120..d41b1988bdd 100644 --- a/tests/queries/0_stateless/01622_constraints_where_optimization.sql +++ b/tests/queries/0_stateless/01622_constraints_where_optimization.sql @@ -1,5 +1,6 @@ SET convert_query_to_cnf = 1; SET optimize_using_constraints = 1; +SET optimize_append_index = 0; DROP TABLE IF EXISTS t_constraints_where; diff --git a/tests/queries/0_stateless/02481_analyzer_optimize_grouping_sets_keys.sql b/tests/queries/0_stateless/02481_analyzer_optimize_grouping_sets_keys.sql index de9208ef009..fef71fdf94f 100644 --- a/tests/queries/0_stateless/02481_analyzer_optimize_grouping_sets_keys.sql +++ b/tests/queries/0_stateless/02481_analyzer_optimize_grouping_sets_keys.sql @@ -1,4 +1,5 @@ set allow_experimental_analyzer = 1; +set optimize_syntax_fuse_functions = 0; EXPLAIN QUERY TREE run_passes=1 SELECT avg(log(2) * number) AS k FROM numbers(10000000) From 3eb68a67403944a8ea096448d16cb8b2be91eebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Mon, 4 Dec 2023 10:08:46 +0000 Subject: [PATCH 5/6] optimize_using_constraints is broken --- tests/clickhouse-test | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/clickhouse-test b/tests/clickhouse-test index fe93864b202..006cc71bb4c 100755 --- a/tests/clickhouse-test +++ b/tests/clickhouse-test @@ -561,7 +561,6 @@ class SettingsRandomizer: "optimize_read_in_order": lambda: random.randint(0, 1), "optimize_or_like_chain": lambda: random.randint(1, 1), "optimize_substitute_columns": lambda: random.randint(1, 1), - "optimize_using_constraints": lambda: random.randint(1, 1), "enable_multiple_prewhere_read_steps": lambda: random.randint(0, 1), "read_in_order_two_level_merge_threshold": lambda: random.randint(0, 100), "optimize_aggregation_in_order": lambda: random.randint(0, 1), From 89b937339845741c5a564c420d1d101cf8c62759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Tue, 5 Dec 2023 18:17:47 +0000 Subject: [PATCH 6/6] More random after tests are successful --- tests/clickhouse-test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/clickhouse-test b/tests/clickhouse-test index 006cc71bb4c..b596ac2a5fc 100755 --- a/tests/clickhouse-test +++ b/tests/clickhouse-test @@ -555,12 +555,12 @@ class SettingsRandomizer: "prefer_localhost_replica": lambda: random.randint(0, 1), "max_block_size": lambda: random.randint(8000, 100000), "max_threads": lambda: random.randint(1, 64), - "optimize_append_index": lambda: random.randint(1, 1), - "optimize_if_chain_to_multiif": lambda: random.randint(1, 1), - "optimize_if_transform_strings_to_enum": lambda: random.randint(1, 1), + "optimize_append_index": lambda: random.randint(0, 1), + "optimize_if_chain_to_multiif": lambda: random.randint(0, 1), + "optimize_if_transform_strings_to_enum": lambda: random.randint(0, 1), "optimize_read_in_order": lambda: random.randint(0, 1), - "optimize_or_like_chain": lambda: random.randint(1, 1), - "optimize_substitute_columns": lambda: random.randint(1, 1), + "optimize_or_like_chain": lambda: random.randint(0, 1), + "optimize_substitute_columns": lambda: random.randint(0, 1), "enable_multiple_prewhere_read_steps": lambda: random.randint(0, 1), "read_in_order_two_level_merge_threshold": lambda: random.randint(0, 100), "optimize_aggregation_in_order": lambda: random.randint(0, 1),