mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Added a test
This commit is contained in:
parent
add7b76b83
commit
3958a032ac
@ -33,6 +33,11 @@ public:
|
||||
AggregateFunctionPtr transformAggregateFunction(
|
||||
const AggregateFunctionPtr & nested_function, const DataTypes & arguments, const Array & params) const override
|
||||
{
|
||||
/// Special case for 'count' function. It could be called with Nullable arguments
|
||||
/// - that means - count number of calls, when all arguments are not NULL.
|
||||
if (nested_function && nested_function->getName() == "count")
|
||||
return std::make_shared<AggregateFunctionCountNotNullUnary>(arguments[0], params);
|
||||
|
||||
bool has_nullable_types = false;
|
||||
bool has_null_types = false;
|
||||
for (const auto & arg_type : arguments)
|
||||
@ -60,11 +65,6 @@ public:
|
||||
if (auto adapter = nested_function->getOwnNullAdapter(nested_function, arguments, params))
|
||||
return adapter;
|
||||
|
||||
/// Special case for 'count' function. It could be called with Nullable arguments
|
||||
/// - that means - count number of calls, when all arguments are not NULL.
|
||||
if (nested_function->getName() == "count")
|
||||
return std::make_shared<AggregateFunctionCountNotNullUnary>(arguments[0], params);
|
||||
|
||||
bool return_type_is_nullable = !nested_function->returnDefaultWhenOnlyNull() && nested_function->getReturnType()->canBeInsideNullable();
|
||||
bool serialize_flag = return_type_is_nullable || nested_function->returnDefaultWhenOnlyNull();
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
5
|
||||
5
|
||||
5
|
||||
0
|
||||
\N
|
||||
\N
|
@ -0,0 +1,12 @@
|
||||
SELECT uniq(number >= 10 ? number : NULL) FROM numbers(10);
|
||||
SELECT uniqExact(number >= 10 ? number : NULL) FROM numbers(10);
|
||||
SELECT count(DISTINCT number >= 10 ? number : NULL) FROM numbers(10);
|
||||
|
||||
SELECT uniq(number >= 5 ? number : NULL) FROM numbers(10);
|
||||
SELECT uniqExact(number >= 5 ? number : NULL) FROM numbers(10);
|
||||
SELECT count(DISTINCT number >= 5 ? number : NULL) FROM numbers(10);
|
||||
|
||||
SELECT count(NULL);
|
||||
-- These two returns NULL for now, but we want to change them to return 0.
|
||||
SELECT uniq(NULL);
|
||||
SELECT count(DISTINCT NULL);
|
Loading…
Reference in New Issue
Block a user