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
38 lines
879 B
C++
38 lines
879 B
C++
#pragma once
|
|
|
|
#include <AggregateFunctions/IAggregateFunctionCombinator.h>
|
|
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/** Create aggregate function combinator by matching suffix in aggregate function name.
|
|
*/
|
|
class AggregateFunctionCombinatorFactory final: private boost::noncopyable
|
|
{
|
|
private:
|
|
using Dict = std::unordered_map<std::string, AggregateFunctionCombinatorPtr>;
|
|
Dict dict;
|
|
|
|
public:
|
|
|
|
static AggregateFunctionCombinatorFactory & instance();
|
|
|
|
/// Not thread safe. You must register before using tryGet.
|
|
void registerCombinator(const AggregateFunctionCombinatorPtr & value);
|
|
|
|
/// Example: if the name is 'avgIf', it will return combinator -If.
|
|
AggregateFunctionCombinatorPtr tryFindSuffix(const std::string & name) const;
|
|
|
|
const Dict & getAllAggregateFunctionCombinators() const
|
|
{
|
|
return dict;
|
|
}
|
|
};
|
|
|
|
}
|