ClickHouse/src/TableFunctions/TableFunctionExecutable.h

37 lines
1.1 KiB
C++
Raw Normal View History

2021-04-14 17:51:55 +00:00
#pragma once
2021-04-15 21:15:54 +00:00
#include <TableFunctions/ITableFunction.h>
2021-04-14 17:51:55 +00:00
namespace DB
{
2021-04-15 21:15:54 +00:00
2021-04-14 17:51:55 +00:00
class Context;
2021-04-15 21:15:54 +00:00
/* executable(script_name_optional_arguments, format, structure, input_query) - creates a temporary storage from executable file
2021-04-14 17:51:55 +00:00
*
*
* The file must be in the clickhouse data directory.
* The relative path begins with the clickhouse data directory.
*/
2021-04-15 21:15:54 +00:00
class TableFunctionExecutable : public ITableFunction
2021-04-14 17:51:55 +00:00
{
public:
static constexpr auto name = "executable";
2021-04-15 21:15:54 +00:00
std::string getName() const override { return name; }
bool hasStaticStructure() const override { return true; }
2021-04-14 17:51:55 +00:00
private:
2021-08-24 19:38:42 +00:00
StoragePtr executeImpl(const ASTPtr & ast_function, ContextPtr context, const std::string & table_name, ColumnsDescription cached_columns) const override;
2021-04-14 17:51:55 +00:00
const char * getStorageTypeName() const override { return "Executable"; }
2021-04-15 21:15:54 +00:00
2021-08-24 19:38:42 +00:00
ColumnsDescription getActualTableStructure(ContextPtr context) const override;
void parseArguments(const ASTPtr & ast_function, ContextPtr context) override;
2021-04-15 21:15:54 +00:00
String script_name;
std::vector<String> arguments;
2021-04-15 21:15:54 +00:00
String format;
String structure;
std::vector<ASTPtr> input_queries;
2021-04-15 21:15:54 +00:00
};
}