Update PushingToViewsBlockOutputStream

This commit is contained in:
Nikolai Kochetov 2020-01-23 20:51:43 +03:00
parent 9635c8d5c5
commit 50f66433e0

View File

@ -60,9 +60,16 @@ PushingToViewsBlockOutputStream::PushingToViewsBlockOutputStream(
std::unique_ptr<ASTInsertQuery> insert = std::make_unique<ASTInsertQuery>(); std::unique_ptr<ASTInsertQuery> insert = std::make_unique<ASTInsertQuery>();
insert->database = inner_table_id.database_name; insert->database = inner_table_id.database_name;
insert->table = inner_table_id.table_name; insert->table = inner_table_id.table_name;
//
// Context local_context = *views_context;
// local_context.addViewSource(
// StorageValues::create(storage->getStorageID(), storage->getColumns(),
// storage->getSampleBlock()));
auto header = InterpreterSelectQuery(query, *views_context, SelectQueryOptions().analyze())
.getSampleBlock();
auto list = std::make_shared<ASTExpressionList>(); auto list = std::make_shared<ASTExpressionList>();
for (auto & column : storage->getSampleBlock()) for (auto & column : header)
list->children.emplace_back(std::make_shared<ASTIdentifier>(column.name)); list->children.emplace_back(std::make_shared<ASTIdentifier>(column.name));
insert->columns = std::move(list); insert->columns = std::move(list);