diff --git a/tests/queries/0_stateless/01388_multi_if_optimization.reference b/tests/queries/0_stateless/01388_multi_if_optimization.reference new file mode 100644 index 00000000000..6dbe0f0d96f --- /dev/null +++ b/tests/queries/0_stateless/01388_multi_if_optimization.reference @@ -0,0 +1,4 @@ +SELECT if(number = 1, \'hello\', if(number = 2, \'world\', \'xyz\')) +FROM numbers(10) +SELECT multiIf(number = 1, \'hello\', number = 2, \'world\', \'xyz\') +FROM numbers(10) diff --git a/tests/queries/0_stateless/01388_multi_if_optimization.sql b/tests/queries/0_stateless/01388_multi_if_optimization.sql new file mode 100644 index 00000000000..345fcfb6fcc --- /dev/null +++ b/tests/queries/0_stateless/01388_multi_if_optimization.sql @@ -0,0 +1,5 @@ +-- If you are reading this test please note that as of now this setting does not provide benefits in most of the cases. +SET optimize_if_chain_to_multiif = 0; +EXPLAIN SYNTAX SELECT number = 1 ? 'hello' : (number = 2 ? 'world' : 'xyz') FROM numbers(10); +SET optimize_if_chain_to_multiif = 1; +EXPLAIN SYNTAX SELECT number = 1 ? 'hello' : (number = 2 ? 'world' : 'xyz') FROM numbers(10);