From 9d2ee35407781f340b918b833df8787fdd698e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Wed, 24 Apr 2024 18:53:29 +0200 Subject: [PATCH] Add more tests --- .../03131_rewrite_sum_if_nullable.reference | 10 ++++++++++ .../0_stateless/03131_rewrite_sum_if_nullable.sql | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/tests/queries/0_stateless/03131_rewrite_sum_if_nullable.reference b/tests/queries/0_stateless/03131_rewrite_sum_if_nullable.reference index 4d8c835e921..ba2fbbfbeaf 100644 --- a/tests/queries/0_stateless/03131_rewrite_sum_if_nullable.reference +++ b/tests/queries/0_stateless/03131_rewrite_sum_if_nullable.reference @@ -2,8 +2,18 @@ -- { echoOn } SELECT sum(if(materialize(0), toNullable(1), 0)); 0 +SELECT sum(if(materialize(0), toNullable(1), materialize(0))); +0 +SELECT sum(if(materialize(0), materialize(toNullable(1)), materialize(0))); +0 +SELECT sum(if(materialize(0), materialize(1), materialize(0))); +0 SELECT sum(if(dummy, 0, toNullable(0))); 0 +SELECT sum(if(dummy, materialize(0), toNullable(0))); +0 +SELECT sum(if(dummy, materialize(0), materialize(toNullable(0)))); +0 SELECT sum(if(s == '', v, 0)) b from VALUES ('v Nullable(Int64), s String',(1, 'x')); 0 SELECT sumOrNull(if(materialize(0), toNullable(1), 0)); diff --git a/tests/queries/0_stateless/03131_rewrite_sum_if_nullable.sql b/tests/queries/0_stateless/03131_rewrite_sum_if_nullable.sql index a4e175378c1..ecc4db6fcf3 100644 --- a/tests/queries/0_stateless/03131_rewrite_sum_if_nullable.sql +++ b/tests/queries/0_stateless/03131_rewrite_sum_if_nullable.sql @@ -1,7 +1,12 @@ -- https://github.com/ClickHouse/ClickHouse/issues/62890 -- { echoOn } SELECT sum(if(materialize(0), toNullable(1), 0)); +SELECT sum(if(materialize(0), toNullable(1), materialize(0))); +SELECT sum(if(materialize(0), materialize(toNullable(1)), materialize(0))); +SELECT sum(if(materialize(0), materialize(1), materialize(0))); SELECT sum(if(dummy, 0, toNullable(0))); +SELECT sum(if(dummy, materialize(0), toNullable(0))); +SELECT sum(if(dummy, materialize(0), materialize(toNullable(0)))); SELECT sum(if(s == '', v, 0)) b from VALUES ('v Nullable(Int64), s String',(1, 'x')); SELECT sumOrNull(if(materialize(0), toNullable(1), 0));