mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix
This commit is contained in:
parent
7ec73e1f20
commit
269e96f17e
@ -120,10 +120,12 @@ struct CustomizeAggregateFunctionsSuffixData
|
||||
|
||||
void visit(ASTFunction & func, ASTPtr &)
|
||||
{
|
||||
if (AggregateFunctionFactory::instance().isAggregateFunctionName(func.name)
|
||||
&& !endsWith(func.name, customized_func_suffix))
|
||||
const auto & instance = AggregateFunctionFactory::instance();
|
||||
if (instance.isAggregateFunctionName(func.name) && !endsWith(func.name, customized_func_suffix))
|
||||
{
|
||||
func.name = func.name + customized_func_suffix;
|
||||
auto properties = instance.tryGetProperties(func.name);
|
||||
if (properties && !properties->returns_default_when_only_null)
|
||||
func.name = func.name + customized_func_suffix;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,8 +1,16 @@
|
||||
0
|
||||
\N
|
||||
0
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
0
|
||||
\N
|
||||
45
|
||||
45
|
||||
10
|
||||
10
|
||||
45
|
||||
45
|
||||
10
|
||||
10
|
||||
|
@ -7,11 +7,15 @@ CREATE TABLE defaults
|
||||
|
||||
SELECT sum(n) FROM defaults;
|
||||
SELECT sumOrNull(n) FROM defaults;
|
||||
SELECT count(n) FROM defaults;
|
||||
SELECT countOrNull(n) FROM defaults;
|
||||
|
||||
SET aggregate_functions_null_for_empty=1;
|
||||
|
||||
SELECT sum(n) FROM defaults;
|
||||
SELECT sumOrNull(n) FROM defaults;
|
||||
SELECT count(n) FROM defaults;
|
||||
SELECT countOrNull(n) FROM defaults;
|
||||
|
||||
INSERT INTO defaults SELECT * FROM numbers(10);
|
||||
|
||||
@ -19,10 +23,14 @@ SET aggregate_functions_null_for_empty=0;
|
||||
|
||||
SELECT sum(n) FROM defaults;
|
||||
SELECT sumOrNull(n) FROM defaults;
|
||||
SELECT count(n) FROM defaults;
|
||||
SELECT countOrNull(n) FROM defaults;
|
||||
|
||||
SET aggregate_functions_null_for_empty=1;
|
||||
|
||||
SELECT sum(n) FROM defaults;
|
||||
SELECT sumOrNull(n) FROM defaults;
|
||||
SELECT count(n) FROM defaults;
|
||||
SELECT countOrNull(n) FROM defaults;
|
||||
|
||||
DROP TABLE defaults;
|
||||
|
Loading…
Reference in New Issue
Block a user