forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTableFunctionFile.h
More file actions
38 lines (30 loc) · 1.1 KB
/
TableFunctionFile.h
File metadata and controls
38 lines (30 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include <TableFunctions/ITableFunctionFileLike.h>
namespace DB
{
/* file(path, format[, structure, compression]) - creates a temporary storage from file
*
* The file must be in the clickhouse data directory.
* The relative path begins with the clickhouse data directory.
*/
class TableFunctionFile : public ITableFunctionFileLike
{
public:
static constexpr auto name = "file";
std::string getName() const override
{
return name;
}
ColumnsDescription getActualTableStructure(ContextPtr context, bool is_insert_query) const override;
protected:
int fd = -1;
String path_to_archive;
void parseFirstArguments(const ASTPtr & arg, const ContextPtr & context) override;
std::optional<String> tryGetFormatFromFirstArgument() override;
private:
StoragePtr getStorage(
const String & source, const String & format_, const ColumnsDescription & columns, ContextPtr global_context,
const std::string & table_name, const std::string & compression_method_, bool) const override;
const char * getStorageTypeName() const override { return "File"; }
};
}