From 7af592d8e1e7b44a727bcd9ff432049f4d41e954 Mon Sep 17 00:00:00 2001 From: zhang2014 Date: Sun, 9 Sep 2018 19:29:23 +0800 Subject: [PATCH] ISSUES-3059 fix nullable type argument for aggregate function --- .../AggregateFunctions/AggregateFunctionFactory.cpp | 2 +- dbms/src/Storages/StorageDistributed.cpp | 1 - .../0_stateless/00614_array_nullable.reference | 3 ++- .../queries/0_stateless/00614_array_nullable.sql | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp b/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp index 7876f0dcffb..d644433ef3e 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp @@ -126,7 +126,7 @@ AggregateFunctionPtr AggregateFunctionFactory::getImpl( String nested_name = name.substr(0, name.size() - combinator->getName().size()); DataTypes nested_types = combinator->transformArguments(argument_types); - AggregateFunctionPtr nested_function = getImpl(nested_name, nested_types, parameters, recursion_level + 1); + AggregateFunctionPtr nested_function = get(nested_name, nested_types, parameters, recursion_level + 1); return combinator->transformAggregateFunction(nested_function, argument_types, parameters); } diff --git a/dbms/src/Storages/StorageDistributed.cpp b/dbms/src/Storages/StorageDistributed.cpp index 9b272c45741..7aa61c791ae 100644 --- a/dbms/src/Storages/StorageDistributed.cpp +++ b/dbms/src/Storages/StorageDistributed.cpp @@ -403,7 +403,6 @@ size_t StorageDistributed::getShardCount() const return getCluster()->getShardCount(); } - ClusterPtr StorageDistributed::getCluster() const { return owned_cluster ? owned_cluster : context.getCluster(cluster_name); diff --git a/dbms/tests/queries/0_stateless/00614_array_nullable.reference b/dbms/tests/queries/0_stateless/00614_array_nullable.reference index bcd29606aee..fff2ca51546 100644 --- a/dbms/tests/queries/0_stateless/00614_array_nullable.reference +++ b/dbms/tests/queries/0_stateless/00614_array_nullable.reference @@ -1 +1,2 @@ -2017-09-10 ['a','b'] +2017-09-10 [1,2,3,4,5,6,7,NULL] +4 diff --git a/dbms/tests/queries/0_stateless/00614_array_nullable.sql b/dbms/tests/queries/0_stateless/00614_array_nullable.sql index 2e5d5809a02..5e301821261 100644 --- a/dbms/tests/queries/0_stateless/00614_array_nullable.sql +++ b/dbms/tests/queries/0_stateless/00614_array_nullable.sql @@ -1,6 +1,6 @@ -USE test; -DROP TABLE IF EXISTS test; -CREATE TABLE test (date Date, keys Array(Nullable(String))) ENGINE = MergeTree(date, date, 1); -INSERT INTO test VALUES ('2017-09-10', ['a', 'b']); -SELECT * FROM test LIMIT 1; -DROP TABLE test; +DROP TABLE IF EXISTS test.test; +CREATE TABLE test.test(date Date, keys Array(Nullable(UInt8))) ENGINE = MergeTree(date, date, 1); +INSERT INTO test.test VALUES ('2017-09-10', [1, 2, 3, 4, 5, 6, 7, NULL]); +SELECT * FROM test.test LIMIT 1; +SELECT avgArray(keys) FROM test.test; +DROP TABLE test.test;