#pragma once #include #include #include #include #include namespace DB { class ASTFunction; struct FindUsedFunctionsMatcher { using Visitor = ConstInDepthNodeVisitor; struct Data { const std::unordered_set & names; std::unordered_set & used_functions; std::vector call_stack = {}; }; static bool needChildVisit(const ASTPtr & node, const ASTPtr &); static void visit(const ASTPtr & ast, Data & data); static void visit(const ASTFunction & func, Data & data); }; using FindUsedFunctionsVisitor = FindUsedFunctionsMatcher::Visitor; struct ConvertStringsToEnumMatcher { struct Data { std::unordered_set & used_functions; }; static bool needChildVisit(const ASTPtr & node, const ASTPtr &); static void visit(ASTPtr & ast, Data & data); static void visit(ASTFunction & function_node, Data & data); }; using ConvertStringsToEnumVisitor = InDepthNodeVisitor; }