From 14e29f2c11c3eacd8192c0640ad7db24312ca7ca Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 20 Jun 2020 21:00:00 +0300 Subject: [PATCH] Disable bad optimization #10047 --- src/Core/Settings.h | 2 +- .../0_stateless/01328_bad_peephole_optimization.reference | 1 + tests/queries/0_stateless/01328_bad_peephole_optimization.sql | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 tests/queries/0_stateless/01328_bad_peephole_optimization.reference create mode 100644 tests/queries/0_stateless/01328_bad_peephole_optimization.sql diff --git a/src/Core/Settings.h b/src/Core/Settings.h index b3124de2b3b..6d856eaf88e 100644 --- a/src/Core/Settings.h +++ b/src/Core/Settings.h @@ -361,7 +361,7 @@ struct Settings : public SettingsCollection M(SettingBool, optimize_trivial_count_query, true, "Process trivial 'SELECT count() FROM table' query from metadata.", 0) \ M(SettingUInt64, mutations_sync, 0, "Wait for synchronous execution of ALTER TABLE UPDATE/DELETE queries (mutations). 0 - execute asynchronously. 1 - wait current server. 2 - wait all replicas if they exist.", 0) \ M(SettingBool, optimize_move_functions_out_of_any, true, "Move functions out of aggregate functions 'any', 'anyLast'.", 0) \ - M(SettingBool, optimize_arithmetic_operations_in_aggregate_functions, true, "Move arithmetic operations out of aggregation functions", 0) \ + M(SettingBool, optimize_arithmetic_operations_in_aggregate_functions, false, "Move arithmetic operations out of aggregation functions", 0) \ M(SettingBool, optimize_duplicate_order_by_and_distinct, true, "Remove duplicate ORDER BY and DISTINCT if it's possible", 0) \ M(SettingBool, optimize_if_chain_to_miltiif, false, "Replace if(cond1, then1, if(cond2, ...)) chains to multiIf. Currently it's not beneficial for numeric types.", 0) \ M(SettingBool, allow_experimental_alter_materialized_view_structure, false, "Allow atomic alter on Materialized views. Work in progress.", 0) \ diff --git a/tests/queries/0_stateless/01328_bad_peephole_optimization.reference b/tests/queries/0_stateless/01328_bad_peephole_optimization.reference new file mode 100644 index 00000000000..00750edc07d --- /dev/null +++ b/tests/queries/0_stateless/01328_bad_peephole_optimization.reference @@ -0,0 +1 @@ +3 diff --git a/tests/queries/0_stateless/01328_bad_peephole_optimization.sql b/tests/queries/0_stateless/01328_bad_peephole_optimization.sql new file mode 100644 index 00000000000..ff07a8037e5 --- /dev/null +++ b/tests/queries/0_stateless/01328_bad_peephole_optimization.sql @@ -0,0 +1 @@ +select max(a + b) from (SELECT 1 AS a, 2 AS b);