mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 13:42:02 +00:00
48 lines
1.9 KiB
C++
48 lines
1.9 KiB
C++
#include <AggregateFunctions/AggregateFunctionFactory.h>
|
|
#include <AggregateFunctions/HelpersMinMaxAny.h>
|
|
#include <AggregateFunctions/FactoryHelpers.h>
|
|
#include "registerAggregateFunctions.h"
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
namespace
|
|
{
|
|
|
|
AggregateFunctionPtr createAggregateFunctionAny(const std::string & name, const DataTypes & argument_types, const Array & parameters)
|
|
{
|
|
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyData>(name, argument_types, parameters));
|
|
}
|
|
|
|
AggregateFunctionPtr createAggregateFunctionAnyLast(const std::string & name, const DataTypes & argument_types, const Array & parameters)
|
|
{
|
|
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyLastData>(name, argument_types, parameters));
|
|
}
|
|
|
|
AggregateFunctionPtr createAggregateFunctionAnyHeavy(const std::string & name, const DataTypes & argument_types, const Array & parameters)
|
|
{
|
|
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyHeavyData>(name, argument_types, parameters));
|
|
}
|
|
|
|
}
|
|
|
|
void registerAggregateFunctionsAny(AggregateFunctionFactory & factory)
|
|
{
|
|
AggregateFunctionProperties properties = { .returns_default_when_only_null = false, .is_order_dependent = true };
|
|
|
|
factory.registerFunction("any", { createAggregateFunctionAny, properties });
|
|
factory.registerFunction("anyLast", { createAggregateFunctionAnyLast, properties });
|
|
factory.registerFunction("anyHeavy", { createAggregateFunctionAnyHeavy, properties });
|
|
|
|
// Synonyms for use as window functions.
|
|
factory.registerFunction("first_value",
|
|
{ createAggregateFunctionAny, properties },
|
|
AggregateFunctionFactory::CaseInsensitive);
|
|
factory.registerFunction("last_value",
|
|
{ createAggregateFunctionAnyLast, properties },
|
|
AggregateFunctionFactory::CaseInsensitive);
|
|
}
|
|
|
|
}
|