ClickHouse/src/TableFunctions/ITableFunctionFileLike.h

35 lines
989 B
C++
Raw Normal View History

2018-06-11 12:13:00 +00:00
#pragma once
#include <TableFunctions/ITableFunction.h>
namespace DB
{
2019-08-01 01:53:38 +00:00
class ColumnsDescription;
class Context;
2019-08-01 01:53:38 +00:00
2018-06-11 12:13:00 +00:00
/*
* function(source, format, structure[, compression_method]) - creates a temporary storage from formatted source
2018-06-11 12:13:00 +00:00
*/
class ITableFunctionFileLike : public ITableFunction
{
2021-09-08 19:28:22 +00:00
protected:
void parseArguments(const ASTPtr & ast_function, ContextPtr context) override;
String filename;
String format;
String structure = "auto";
2021-09-08 19:28:22 +00:00
String compression_method = "auto";
2018-06-11 12:13:00 +00:00
private:
StoragePtr executeImpl(const ASTPtr & ast_function, ContextPtr context, const std::string & table_name, ColumnsDescription cached_columns) const override;
2018-06-11 12:13:00 +00:00
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"; }
2018-06-11 12:13:00 +00:00
};
2018-06-11 12:13:00 +00:00
}