ClickHouse/src/TableFunctions/TableFunctionView.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.0 KiB
C++
Raw Normal View History

2020-08-28 14:07:14 +00:00
#pragma once
#include <TableFunctions/ITableFunction.h>
#include <Parsers/ASTCreateQuery.h>
2021-10-02 07:13:14 +00:00
#include <base/types.h>
2020-08-28 14:07:14 +00:00
namespace DB
{
/* view(query)
* Turning subquery into a table.
* Useful for passing subquery around.
*/
class TableFunctionView : public ITableFunction
{
public:
static constexpr auto name = "view";
2023-01-26 10:52:40 +00:00
2020-08-28 14:07:14 +00:00
std::string getName() const override { return name; }
const ASTSelectWithUnionQuery & getSelectQuery() const;
2020-08-28 14:07:14 +00:00
private:
StoragePtr executeImpl(const ASTPtr & ast_function, ContextPtr context, const String & table_name, ColumnsDescription cached_columns, bool is_insert_query) const override;
2023-01-26 10:52:40 +00:00
2020-08-28 14:07:14 +00:00
const char * getStorageTypeName() const override { return "View"; }
2023-01-26 10:52:40 +00:00
std::vector<size_t> skipAnalysisForArguments(const QueryTreeNodePtr & query_node_table_function, ContextPtr context) const override;
void parseArguments(const ASTPtr & ast_function, ContextPtr context) override;
2023-01-26 10:52:40 +00:00
ColumnsDescription getActualTableStructure(ContextPtr context, bool is_insert_query) const override;
ASTCreateQuery create;
2020-08-28 14:07:14 +00:00
};
}