mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#include "AggregateFunctionTimeSeriesGroupSum.h"
|
|
#include "AggregateFunctionFactory.h"
|
|
#include "FactoryHelpers.h"
|
|
#include "Helpers.h"
|
|
#include "registerAggregateFunctions.h"
|
|
|
|
|
|
namespace DB
|
|
{
|
|
namespace ErrorCodes
|
|
{
|
|
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
|
}
|
|
namespace
|
|
{
|
|
template <bool rate>
|
|
AggregateFunctionPtr createAggregateFunctionTimeSeriesGroupSum(const std::string & name, const DataTypes & arguments, const Array & params)
|
|
{
|
|
assertNoParameters(name, params);
|
|
|
|
if (arguments.size() < 3)
|
|
throw Exception("Not enough event arguments for aggregate function " + name, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
|
|
|
return std::make_shared<AggregateFunctionTimeSeriesGroupSum<rate>>(arguments);
|
|
}
|
|
|
|
}
|
|
|
|
void registerAggregateFunctionTimeSeriesGroupSum(AggregateFunctionFactory & factory)
|
|
{
|
|
factory.registerFunction("timeSeriesGroupSum", createAggregateFunctionTimeSeriesGroupSum<false>, AggregateFunctionFactory::CaseInsensitive);
|
|
factory.registerFunction("timeSeriesGroupRateSum", createAggregateFunctionTimeSeriesGroupSum<true>, AggregateFunctionFactory::CaseInsensitive);
|
|
}
|
|
|
|
}
|