2021-05-09 09:47:29 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/IInterpreter.h>
|
2021-08-23 14:31:58 +00:00
|
|
|
|
2021-05-09 09:47:29 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-07-19 23:34:04 +00:00
|
|
|
class Context;
|
2021-05-09 09:47:29 +00:00
|
|
|
|
2021-08-18 09:29:52 +00:00
|
|
|
class InterpreterCreateFunctionQuery : public IInterpreter, WithContext
|
2021-05-09 09:47:29 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-08-18 09:29:52 +00:00
|
|
|
InterpreterCreateFunctionQuery(const ASTPtr & query_ptr_, ContextPtr context_, bool is_internal_)
|
|
|
|
: WithContext(context_)
|
|
|
|
, query_ptr(query_ptr_)
|
|
|
|
, is_internal(is_internal_) {}
|
2021-05-09 09:47:29 +00:00
|
|
|
|
|
|
|
BlockIO execute() override;
|
|
|
|
|
2021-07-20 20:20:23 +00:00
|
|
|
void setInternal(bool internal_);
|
|
|
|
|
2021-05-10 22:35:22 +00:00
|
|
|
private:
|
2021-07-03 20:17:02 +00:00
|
|
|
static void validateFunction(ASTPtr function, const String & name);
|
2021-08-18 21:54:55 +00:00
|
|
|
static std::unordered_set<String> getIdentifiers(ASTPtr node);
|
2021-07-03 20:17:02 +00:00
|
|
|
static void validateFunctionRecursiveness(ASTPtr node, const String & function_to_create);
|
2021-05-10 22:35:22 +00:00
|
|
|
|
2021-05-09 09:47:29 +00:00
|
|
|
ASTPtr query_ptr;
|
2021-08-18 09:29:52 +00:00
|
|
|
bool is_internal;
|
2021-05-09 09:47:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|