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));