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;
|
2020-05-20 20:16:32 +00:00
|
|
|
class Context;
|
2019-08-01 01:53:38 +00:00
|
|
|
|
2018-06-11 12:13:00 +00:00
|
|
|
/*
|
2021-12-15 11:30:57 +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;
|
2021-12-15 11:30:57 +00:00
|
|
|
String structure = "auto";
|
2021-09-08 19:28:22 +00:00
|
|
|
String compression_method = "auto";
|
|
|
|
|
2018-06-11 12:13:00 +00:00
|
|
|
private:
|
2021-04-10 23:33:54 +00:00
|
|
|
StoragePtr executeImpl(const ASTPtr & ast_function, ContextPtr context, const std::string & table_name, ColumnsDescription cached_columns) const override;
|
2020-10-14 12:19:29 +00:00
|
|
|
|
2018-06-11 12:13:00 +00:00
|
|
|
virtual StoragePtr getStorage(
|
2021-04-10 23:33:54 +00:00
|
|
|
const String & source, const String & format, const ColumnsDescription & columns, ContextPtr global_context,
|
2020-10-14 12:19:29 +00:00
|
|
|
const std::string & table_name, const String & compression_method) const = 0;
|
|
|
|
|
2021-12-15 11:30:57 +00:00
|
|
|
bool hasStaticStructure() const override { return structure != "auto"; }
|
2018-06-11 12:13:00 +00:00
|
|
|
};
|
2021-12-15 11:30:57 +00:00
|
|
|
|
2018-06-11 12:13:00 +00:00
|
|
|
}
|