From 91c3de966416f3e5a1338ca7a82293984d92a672 Mon Sep 17 00:00:00 2001 From: feng lv Date: Wed, 9 Dec 2020 07:24:36 +0000 Subject: [PATCH] fix fix fix --- src/Interpreters/TreeRewriter.cpp | 11 +++++++---- .../01562_agg_null_for_empty_ahead.reference | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Interpreters/TreeRewriter.cpp b/src/Interpreters/TreeRewriter.cpp index 5df5d6f7a42..0a656383dc3 100644 --- a/src/Interpreters/TreeRewriter.cpp +++ b/src/Interpreters/TreeRewriter.cpp @@ -121,7 +121,7 @@ struct CustomizeAggregateFunctionsSuffixData void visit(ASTFunction & func, ASTPtr &) const { const auto & instance = AggregateFunctionFactory::instance(); - if (instance.isAggregateFunctionName(func.name)) + if (instance.isAggregateFunctionName(func.name) && !endsWith(func.name, "OrNull")) { auto properties = instance.tryGetProperties(func.name); if (properties && !properties->returns_default_when_only_null) @@ -165,10 +165,13 @@ struct CustomizeAggregateFunctionsMoveSuffixData const auto & instance = AggregateFunctionFactory::instance(); if (instance.isAggregateFunctionName(func.name)) { - auto properties = instance.tryGetProperties(func.name); - if (properties && !properties->returns_default_when_only_null) + if (endsWith(func.name, "OrNull")) { - func.name = moveSuffixAhead(func.name); + auto properties = instance.tryGetProperties(func.name); + if (properties && !properties->returns_default_when_only_null) + { + func.name = moveSuffixAhead(func.name); + } } } } diff --git a/tests/queries/0_stateless/01562_agg_null_for_empty_ahead.reference b/tests/queries/0_stateless/01562_agg_null_for_empty_ahead.reference index bda1162f4e9..a197ceee71f 100644 --- a/tests/queries/0_stateless/01562_agg_null_for_empty_ahead.reference +++ b/tests/queries/0_stateless/01562_agg_null_for_empty_ahead.reference @@ -2,7 +2,7 @@ 0 0 0 -\N +0 1 \N \N