#pragma once #include #include namespace DB { /** AST for function application or operator. */ class ASTFunction : public ASTWithAlias { public: String name; ASTPtr query; // It's possible for a function to accept a query as its only argument. ASTPtr arguments; /// parameters - for parametric aggregate function. Example: quantile(0.9)(x) - what in first parens are 'parameters'. ASTPtr parameters; public: /** Get text identifying the AST node. */ String getID(char delim) const override; ASTPtr clone() const override; void updateTreeHashImpl(SipHash & hash_state) const override; protected: void formatImplWithoutAlias(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override; void appendColumnNameImpl(WriteBuffer & ostr) const override; }; template std::shared_ptr makeASTFunction(const String & name, Args &&... args) { auto function = std::make_shared(); function->name = name; function->arguments = std::make_shared(); function->children.push_back(function->arguments); function->arguments->children = { std::forward(args)... }; return function; } }