diff options
| author | vitalyisaev <[email protected]> | 2023-11-14 09:58:56 +0300 |
|---|---|---|
| committer | vitalyisaev <[email protected]> | 2023-11-14 10:20:20 +0300 |
| commit | c2b2dfd9827a400a8495e172a56343462e3ceb82 (patch) | |
| tree | cd4e4f597d01bede4c82dffeb2d780d0a9046bd0 /contrib/clickhouse/src/TableFunctions/ITableFunctionFileLike.h | |
| parent | d4ae8f119e67808cb0cf776ba6e0cf95296f2df7 (diff) | |
YQ Connector: move tests from yql to ydb (OSS)
Перенос папки с тестами на Коннектор из папки yql в папку ydb (синхронизируется с github).
Diffstat (limited to 'contrib/clickhouse/src/TableFunctions/ITableFunctionFileLike.h')
| -rw-r--r-- | contrib/clickhouse/src/TableFunctions/ITableFunctionFileLike.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/contrib/clickhouse/src/TableFunctions/ITableFunctionFileLike.h b/contrib/clickhouse/src/TableFunctions/ITableFunctionFileLike.h new file mode 100644 index 00000000000..5fe86587797 --- /dev/null +++ b/contrib/clickhouse/src/TableFunctions/ITableFunctionFileLike.h @@ -0,0 +1,61 @@ +#pragma once + +#include <TableFunctions/ITableFunction.h> +#include "Parsers/IAST_fwd.h" + +namespace DB +{ +class ColumnsDescription; +class Context; + +/* + * function(source, [format, structure, compression_method]) - creates a temporary storage from formatted source + */ +class ITableFunctionFileLike : public ITableFunction +{ +public: + static constexpr auto signature = " - filename\n" + " - filename, format\n" + " - filename, format, structure\n" + " - filename, format, structure, compression_method\n"; + virtual String getSignature() const + { + return signature; + } + + bool needStructureHint() const override { return structure == "auto"; } + + void setStructureHint(const ColumnsDescription & structure_hint_) override { structure_hint = structure_hint_; } + + bool supportsReadingSubsetOfColumns(const ContextPtr & context) override; + + static size_t getMaxNumberOfArguments() { return 4; } + + static void addColumnsStructureToArguments(ASTs & args, const String & structure, const ContextPtr &); + +protected: + + void parseArguments(const ASTPtr & ast_function, ContextPtr context) override; + virtual void parseArgumentsImpl(ASTs & args, const ContextPtr & context); + + virtual void parseFirstArguments(const ASTPtr & arg, const ContextPtr & context); + virtual String getFormatFromFirstArgument(); + + String filename; + String path_to_archive; + String format = "auto"; + String structure = "auto"; + String compression_method = "auto"; + ColumnsDescription structure_hint; + +private: + StoragePtr executeImpl(const ASTPtr & ast_function, ContextPtr context, const std::string & table_name, ColumnsDescription cached_columns, bool is_insert_query) const override; + + virtual StoragePtr getStorage( + const String & source, const String & format, const ColumnsDescription & columns, ContextPtr global_context, + const std::string & table_name, const String & compression_method) const = 0; + + bool hasStaticStructure() const override { return structure != "auto"; } +}; + +} |
