ClickHouse/src/Interpreters/GatherFunctionQuantileVisitor.h

38 lines
888 B
C++
Raw Normal View History

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