Merge pull request #49971 from azat/revert-48593-group_array_nullable

[RFC] Revert "`groupArray` returns cannot be nullable"
This commit is contained in:
Alexey Milovidov 2023-05-18 09:17:42 +03:00 committed by GitHub
commit 5065049154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 4 additions and 12 deletions

View File

@ -121,7 +121,7 @@ AggregateFunctionPtr createAggregateFunctionGroupArraySample(
void registerAggregateFunctionGroupArray(AggregateFunctionFactory & factory) void registerAggregateFunctionGroupArray(AggregateFunctionFactory & factory)
{ {
AggregateFunctionProperties properties = { .returns_default_when_only_null = true, .is_order_dependent = true }; AggregateFunctionProperties properties = { .returns_default_when_only_null = false, .is_order_dependent = true };
factory.registerFunction("groupArray", { createAggregateFunctionGroupArray<false>, properties }); factory.registerFunction("groupArray", { createAggregateFunctionGroupArray<false>, properties });
factory.registerFunction("groupArraySample", { createAggregateFunctionGroupArraySample, properties }); factory.registerFunction("groupArraySample", { createAggregateFunctionGroupArraySample, properties });

View File

@ -72,7 +72,7 @@ public:
{ {
/// Currently the only functions that returns not-NULL on all NULL arguments are count and uniq, and they returns UInt64. /// Currently the only functions that returns not-NULL on all NULL arguments are count and uniq, and they returns UInt64.
if (properties.returns_default_when_only_null) if (properties.returns_default_when_only_null)
return std::make_shared<AggregateFunctionNothing>(arguments, params, nested_function->getResultType()); return std::make_shared<AggregateFunctionNothing>(arguments, params, std::make_shared<DataTypeUInt64>());
else else
return std::make_shared<AggregateFunctionNothing>(arguments, params, std::make_shared<DataTypeNullable>(std::make_shared<DataTypeNothing>())); return std::make_shared<AggregateFunctionNothing>(arguments, params, std::make_shared<DataTypeNullable>(std::make_shared<DataTypeNothing>()));
} }

View File

@ -3,7 +3,7 @@
1 1
1 1
[[1],[-1]] [[1],[-1]]
[] \N
1 1
42 42 42 42
[NULL,'','',NULL] [NULL,'','',NULL]

View File

@ -1 +1 @@
['\0','\0','\0'] [0,0,0]

View File

@ -1,3 +0,0 @@
[1]
[0,1,2,3,4,5,6,7,8,9]
[8,9]

View File

@ -1,5 +0,0 @@
SET aggregate_functions_null_for_empty = 1;
SELECT groupArray(1);
SELECT groupArray(number) FROM numbers(10);
SELECT groupArrayLast(2)(number) FROM numbers(10);