From 0897d2a9c4e2e34fa324615da6dc2e6b40efca1d Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Fri, 4 May 2018 15:11:57 +0300 Subject: [PATCH] Added ConvertColumnWithDictionaryToFullBlockInputStream. --- .../AggregateFunctionFactory.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp b/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp index eca854a031b..8a7c5443f27 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp @@ -13,6 +13,7 @@ #include #include +#include namespace DB @@ -41,6 +42,20 @@ void AggregateFunctionFactory::registerFunction(const String & name, Creator cre ErrorCodes::LOGICAL_ERROR); } +static DataTypes convertTypesWithDictionaryToNested(const DataTypes & types) +{ + DataTypes res_types; + res_types.reserve(types.size()); + for (const auto & type : types) + { + if (auto * type_with_dict = typeid_cast(type.get())) + res_types.push_back(type_with_dict->getDictionaryType()); + else + res_types.push_back(type); + } + + return std::move(res_types); +} AggregateFunctionPtr AggregateFunctionFactory::get( const String & name, @@ -57,7 +72,7 @@ AggregateFunctionPtr AggregateFunctionFactory::get( if (!combinator) throw Exception("Logical error: cannot find aggregate function combinator to apply a function to Nullable arguments.", ErrorCodes::LOGICAL_ERROR); - DataTypes nested_types = combinator->transformArguments(argument_types); + DataTypes nested_types = combinator->transformArguments(convertTypesWithDictionaryToNested(argument_types)); AggregateFunctionPtr nested_function;