2015-09-24 12:40:36 +00:00
|
|
|
#include <DB/AggregateFunctions/AggregateFunctionFactory.h>
|
|
|
|
#include <DB/AggregateFunctions/AggregateFunctionGroupArray.h>
|
|
|
|
#include <DB/AggregateFunctions/Helpers.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
|
|
|
AggregateFunctionPtr createAggregateFunctionGroupArray(const std::string & name, const DataTypes & argument_types)
|
|
|
|
{
|
2015-11-15 04:54:56 +00:00
|
|
|
if (argument_types.size() != 1)
|
|
|
|
throw Exception("Incorrect number of arguments for aggregate function " + name,
|
|
|
|
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
|
|
|
|
2016-05-28 15:42:22 +00:00
|
|
|
AggregateFunctionPtr res(createWithNumericType<AggregateFunctionGroupArrayNumeric>(*argument_types[0]));
|
2015-11-15 04:54:56 +00:00
|
|
|
|
|
|
|
if (!res)
|
2016-05-28 15:42:22 +00:00
|
|
|
res = std::make_shared<AggregateFunctionGroupArrayGeneric>();
|
2015-11-15 04:54:56 +00:00
|
|
|
|
|
|
|
return res;
|
2015-09-24 12:40:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void registerAggregateFunctionGroupArray(AggregateFunctionFactory & factory)
|
|
|
|
{
|
2016-07-14 05:22:09 +00:00
|
|
|
factory.registerFunction("groupArray", createAggregateFunctionGroupArray);
|
2015-09-24 12:40:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|