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