2017-04-01 09:19:00 +00:00
|
|
|
#include <AggregateFunctions/AggregateFunctionFactory.h>
|
|
|
|
#include <AggregateFunctions/HelpersMinMaxAny.h>
|
2017-12-20 07:36:30 +00:00
|
|
|
#include <AggregateFunctions/FactoryHelpers.h>
|
2019-12-15 06:34:43 +00:00
|
|
|
#include "registerAggregateFunctions.h"
|
2017-12-20 07:36:30 +00:00
|
|
|
|
2015-09-24 12:40:36 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
2017-12-20 07:36:30 +00:00
|
|
|
AggregateFunctionPtr createAggregateFunctionAny(const std::string & name, const DataTypes & argument_types, const Array & parameters)
|
2015-09-24 12:40:36 +00:00
|
|
|
{
|
2017-12-20 08:39:21 +00:00
|
|
|
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyData>(name, argument_types, parameters));
|
2015-09-24 12:40:36 +00:00
|
|
|
}
|
|
|
|
|
2017-12-20 07:36:30 +00:00
|
|
|
AggregateFunctionPtr createAggregateFunctionAnyLast(const std::string & name, const DataTypes & argument_types, const Array & parameters)
|
2015-09-24 12:40:36 +00:00
|
|
|
{
|
2017-12-20 08:39:21 +00:00
|
|
|
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyLastData>(name, argument_types, parameters));
|
2015-09-24 12:40:36 +00:00
|
|
|
}
|
|
|
|
|
2017-12-20 07:36:30 +00:00
|
|
|
AggregateFunctionPtr createAggregateFunctionAnyHeavy(const std::string & name, const DataTypes & argument_types, const Array & parameters)
|
2016-06-26 12:48:04 +00:00
|
|
|
{
|
2017-12-20 08:39:21 +00:00
|
|
|
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyHeavyData>(name, argument_types, parameters));
|
2016-06-26 12:48:04 +00:00
|
|
|
}
|
|
|
|
|
2017-12-20 07:36:30 +00:00
|
|
|
AggregateFunctionPtr createAggregateFunctionMin(const std::string & name, const DataTypes & argument_types, const Array & parameters)
|
2015-09-24 12:40:36 +00:00
|
|
|
{
|
2017-12-20 08:39:21 +00:00
|
|
|
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionMinData>(name, argument_types, parameters));
|
2015-09-24 12:40:36 +00:00
|
|
|
}
|
|
|
|
|
2017-12-20 07:36:30 +00:00
|
|
|
AggregateFunctionPtr createAggregateFunctionMax(const std::string & name, const DataTypes & argument_types, const Array & parameters)
|
2015-09-24 12:40:36 +00:00
|
|
|
{
|
2017-12-20 08:39:21 +00:00
|
|
|
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionMaxData>(name, argument_types, parameters));
|
2015-09-24 12:40:36 +00:00
|
|
|
}
|
|
|
|
|
2017-12-20 07:36:30 +00:00
|
|
|
AggregateFunctionPtr createAggregateFunctionArgMin(const std::string & name, const DataTypes & argument_types, const Array & parameters)
|
2015-09-24 12:40:36 +00:00
|
|
|
{
|
2017-12-20 08:39:21 +00:00
|
|
|
return AggregateFunctionPtr(createAggregateFunctionArgMinMax<AggregateFunctionMinData>(name, argument_types, parameters));
|
2015-09-24 12:40:36 +00:00
|
|
|
}
|
|
|
|
|
2017-12-20 07:36:30 +00:00
|
|
|
AggregateFunctionPtr createAggregateFunctionArgMax(const std::string & name, const DataTypes & argument_types, const Array & parameters)
|
2015-09-24 12:40:36 +00:00
|
|
|
{
|
2017-12-20 08:39:21 +00:00
|
|
|
return AggregateFunctionPtr(createAggregateFunctionArgMinMax<AggregateFunctionMaxData>(name, argument_types, parameters));
|
2015-09-24 12:40:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void registerAggregateFunctionsMinMaxAny(AggregateFunctionFactory & factory)
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
factory.registerFunction("any", createAggregateFunctionAny);
|
|
|
|
factory.registerFunction("anyLast", createAggregateFunctionAnyLast);
|
|
|
|
factory.registerFunction("anyHeavy", createAggregateFunctionAnyHeavy);
|
|
|
|
factory.registerFunction("min", createAggregateFunctionMin, AggregateFunctionFactory::CaseInsensitive);
|
|
|
|
factory.registerFunction("max", createAggregateFunctionMax, AggregateFunctionFactory::CaseInsensitive);
|
|
|
|
factory.registerFunction("argMin", createAggregateFunctionArgMin);
|
|
|
|
factory.registerFunction("argMax", createAggregateFunctionArgMax);
|
2015-09-24 12:40:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|