ClickHouse/dbms/src/AggregateFunctions/AggregateFunctionGroupArray.cpp

33 lines
841 B
C++
Raw Normal View History

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)
{
if (argument_types.size() != 1)
throw Exception("Incorrect number of arguments for aggregate function " + name,
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
AggregateFunctionPtr res(createWithNumericType<AggregateFunctionGroupArrayNumeric>(*argument_types[0]));
if (!res)
res = std::make_shared<AggregateFunctionGroupArrayGeneric>();
return res;
2015-09-24 12:40:36 +00:00
}
}
void registerAggregateFunctionGroupArray(AggregateFunctionFactory & factory)
{
factory.registerFunction("groupArray", createAggregateFunctionGroupArray);
2015-09-24 12:40:36 +00:00
}
}