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/TableFunctions/ITableFunctionCluster.h | |
| 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/TableFunctions/ITableFunctionCluster.h')
| -rw-r--r-- | contrib/clickhouse/src/TableFunctions/ITableFunctionCluster.h | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/contrib/clickhouse/src/TableFunctions/ITableFunctionCluster.h b/contrib/clickhouse/src/TableFunctions/ITableFunctionCluster.h deleted file mode 100644 index 4776ff44a30..00000000000 --- a/contrib/clickhouse/src/TableFunctions/ITableFunctionCluster.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once - -#include "clickhouse_config.h" - -#include <Interpreters/Context.h> -#include <Interpreters/evaluateConstantExpression.h> -#include <Storages/StorageS3Cluster.h> -#include <Storages/checkAndGetLiteralArgument.h> -#include <TableFunctions/ITableFunction.h> -#include <TableFunctions/TableFunctionAzureBlobStorage.h> -#include <TableFunctions/TableFunctionS3.h> - - -namespace DB -{ - -namespace ErrorCodes -{ - extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; - extern const int CLUSTER_DOESNT_EXIST; - extern const int LOGICAL_ERROR; -} - -/// Base class for *Cluster table functions that require cluster_name for the first argument. -template <typename Base> -class ITableFunctionCluster : public Base -{ -public: - String getName() const override = 0; - String getSignature() const override = 0; - - static void addColumnsStructureToArguments(ASTs & args, const String & desired_structure, const ContextPtr & context) - { - if (args.empty()) - throw Exception(ErrorCodes::LOGICAL_ERROR, "Unexpected empty list of arguments for {}Cluster table function", Base::name); - - ASTPtr cluster_name_arg = args.front(); - args.erase(args.begin()); - Base::addColumnsStructureToArguments(args, desired_structure, context); - args.insert(args.begin(), cluster_name_arg); - } - -protected: - void parseArguments(const ASTPtr & ast, ContextPtr context) override - { - /// Clone ast function, because we can modify its arguments like removing cluster_name - Base::parseArguments(ast->clone(), context); - } - - void parseArgumentsImpl(ASTs & args, const ContextPtr & context) override - { - if (args.empty()) - throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "The signature of table function {} shall be the following:\n{}", getName(), getSignature()); - - /// Evaluate only first argument, everything else will be done Base class - args[0] = evaluateConstantExpressionOrIdentifierAsLiteral(args[0], context); - - /// Cluster name is always the first - cluster_name = checkAndGetLiteralArgument<String>(args[0], "cluster_name"); - - if (!context->tryGetCluster(cluster_name)) - throw Exception(ErrorCodes::CLUSTER_DOESNT_EXIST, "Requested cluster '{}' not found", cluster_name); - - /// Just cut the first arg (cluster_name) and try to parse other table function arguments as is - args.erase(args.begin()); - - Base::parseArgumentsImpl(args, context); - } - - String cluster_name; -}; - -} |
