2020-12-21 04:46:31 +00:00
|
|
|
#include <AggregateFunctions/AggregateFunctionFactory.h>
|
|
|
|
#include <AggregateFunctions/HelpersMinMaxAny.h>
|
|
|
|
#include <AggregateFunctions/FactoryHelpers.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2021-05-26 11:32:14 +00:00
|
|
|
struct Settings;
|
2020-12-21 04:46:31 +00:00
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
2021-06-07 00:15:11 +00:00
|
|
|
AggregateFunctionPtr createAggregateFunctionMin(
|
|
|
|
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
|
2020-12-21 04:46:31 +00:00
|
|
|
{
|
2021-05-26 11:32:14 +00:00
|
|
|
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionMinData>(name, argument_types, parameters, settings));
|
2020-12-21 04:46:31 +00:00
|
|
|
}
|
|
|
|
|
2021-06-07 00:15:11 +00:00
|
|
|
AggregateFunctionPtr createAggregateFunctionArgMin(
|
|
|
|
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
|
2020-12-21 04:46:31 +00:00
|
|
|
{
|
2021-05-26 11:32:14 +00:00
|
|
|
return AggregateFunctionPtr(createAggregateFunctionArgMinMax<AggregateFunctionMinData>(name, argument_types, parameters, settings));
|
2020-12-21 04:46:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-21 05:51:11 +00:00
|
|
|
void registerAggregateFunctionsMin(AggregateFunctionFactory & factory)
|
2020-12-21 04:46:31 +00:00
|
|
|
{
|
|
|
|
factory.registerFunction("min", createAggregateFunctionMin, AggregateFunctionFactory::CaseInsensitive);
|
|
|
|
|
|
|
|
/// The functions below depend on the order of data.
|
|
|
|
AggregateFunctionProperties properties = { .returns_default_when_only_null = false, .is_order_dependent = true };
|
|
|
|
factory.registerFunction("argMin", { createAggregateFunctionArgMin, properties });
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|