2021-07-21 06:43:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Parsers/ASTFunction.h>
|
|
|
|
#include <Parsers/IAST.h>
|
|
|
|
#include <Interpreters/InDepthNodeVisitor.h>
|
|
|
|
#include <AggregateFunctions/AggregateFunctionQuantile.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-08-25 08:24:53 +00:00
|
|
|
/// Gather all the `quantile*` functions
|
2021-07-21 06:43:40 +00:00
|
|
|
class GatherFunctionQuantileData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct FuseQuantileAggregatesData
|
|
|
|
{
|
2021-08-25 08:24:53 +00:00
|
|
|
std::unordered_map<String, std::vector<ASTPtr *>> arg_map_function;
|
2021-07-21 06:43:40 +00:00
|
|
|
|
2021-09-15 12:15:42 +00:00
|
|
|
void addFuncNode(ASTPtr & ast);
|
2021-07-21 06:43:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
using TypeToVisit = ASTFunction;
|
2021-09-15 12:15:42 +00:00
|
|
|
|
2021-07-21 06:43:40 +00:00
|
|
|
std::unordered_map<String, FuseQuantileAggregatesData> fuse_quantile;
|
2021-08-25 08:24:53 +00:00
|
|
|
|
2021-09-15 12:15:42 +00:00
|
|
|
void visit(ASTFunction & function, ASTPtr & ast);
|
|
|
|
|
|
|
|
static String getFusedName(const String & func_name);
|
2021-07-21 06:43:40 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
using GatherFunctionQuantileVisitor = InDepthNodeVisitor<OneTypeMatcher<GatherFunctionQuantileData>, true>;
|
|
|
|
|
|
|
|
}
|