Add ability to get SELECT query from TableFunctionView

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2022-02-18 17:42:32 +03:00
parent b1b10d7208
commit 132bbce29c
2 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,12 @@ namespace ErrorCodes
extern const int BAD_ARGUMENTS;
}
const ASTSelectWithUnionQuery & TableFunctionView::getSelectQuery() const
{
return *create.select;
}
void TableFunctionView::parseArguments(const ASTPtr & ast_function, ContextPtr /*context*/)
{
const auto * function = ast_function->as<ASTFunction>();

View File

@ -16,6 +16,9 @@ class TableFunctionView : public ITableFunction
public:
static constexpr auto name = "view";
std::string getName() const override { return name; }
const ASTSelectWithUnionQuery & getSelectQuery() const;
private:
StoragePtr executeImpl(const ASTPtr & ast_function, ContextPtr context, const String & table_name, ColumnsDescription cached_columns) const override;
const char * getStorageTypeName() const override { return "View"; }