ClickHouse/src/AggregateFunctions/AggregateFunctionMin.cpp

37 lines
1.3 KiB
C++
Raw Normal View History

2020-12-21 04:46:31 +00:00
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/HelpersMinMaxAny.h>
#include <AggregateFunctions/FactoryHelpers.h>
namespace DB
{
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
{
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
{
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 });
}
}