diff options
| author | AlexSm <[email protected]> | 2024-01-04 15:09:05 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-04 15:09:05 +0100 |
| commit | dab291146f6cd7d35684e3a1150e5bb1c412982c (patch) | |
| tree | 36ef35f6cacb6432845a4a33f940c95871036b32 /contrib/clickhouse/src/Interpreters/InterpreterCreateFunctionQuery.cpp | |
| parent | 63660ad5e7512029fd0218e7a636580695a24e1f (diff) | |
Library import 5, delete go dependencies (#832)
* Library import 5, delete go dependencies
* Fix yt client
Diffstat (limited to 'contrib/clickhouse/src/Interpreters/InterpreterCreateFunctionQuery.cpp')
| -rw-r--r-- | contrib/clickhouse/src/Interpreters/InterpreterCreateFunctionQuery.cpp | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/contrib/clickhouse/src/Interpreters/InterpreterCreateFunctionQuery.cpp b/contrib/clickhouse/src/Interpreters/InterpreterCreateFunctionQuery.cpp deleted file mode 100644 index ea59115b077..00000000000 --- a/contrib/clickhouse/src/Interpreters/InterpreterCreateFunctionQuery.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include <Interpreters/InterpreterCreateFunctionQuery.h> - -#include <Access/ContextAccess.h> -#include <Functions/UserDefined/IUserDefinedSQLObjectsStorage.h> -#include <Functions/UserDefined/UserDefinedSQLFunctionFactory.h> -#include <Interpreters/Context.h> -#include <Interpreters/executeDDLQueryOnCluster.h> -#include <Interpreters/removeOnClusterClauseIfNeeded.h> -#include <Interpreters/FunctionNameNormalizer.h> -#include <Parsers/ASTCreateFunctionQuery.h> - - -namespace DB -{ - -namespace ErrorCodes -{ - extern const int INCORRECT_QUERY; -} - -BlockIO InterpreterCreateFunctionQuery::execute() -{ - FunctionNameNormalizer().visit(query_ptr.get()); - const auto updated_query_ptr = removeOnClusterClauseIfNeeded(query_ptr, getContext()); - ASTCreateFunctionQuery & create_function_query = updated_query_ptr->as<ASTCreateFunctionQuery &>(); - - AccessRightsElements access_rights_elements; - access_rights_elements.emplace_back(AccessType::CREATE_FUNCTION); - - if (create_function_query.or_replace) - access_rights_elements.emplace_back(AccessType::DROP_FUNCTION); - - auto current_context = getContext(); - - if (!create_function_query.cluster.empty()) - { - if (current_context->getUserDefinedSQLObjectsStorage().isReplicated()) - throw Exception(ErrorCodes::INCORRECT_QUERY, "ON CLUSTER is not allowed because used-defined functions are replicated automatically"); - - DDLQueryOnClusterParams params; - params.access_to_check = std::move(access_rights_elements); - return executeDDLQueryOnCluster(updated_query_ptr, current_context, params); - } - - current_context->checkAccess(access_rights_elements); - - auto function_name = create_function_query.getFunctionName(); - bool throw_if_exists = !create_function_query.if_not_exists && !create_function_query.or_replace; - bool replace_if_exists = create_function_query.or_replace; - - UserDefinedSQLFunctionFactory::instance().registerFunction(current_context, function_name, updated_query_ptr, throw_if_exists, replace_if_exists); - - return {}; -} - -} |
