mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Minor modification
This commit is contained in:
parent
e1ccebe8f3
commit
612382b74e
@ -14,6 +14,7 @@
|
|||||||
#include <Storages/StorageValues.h>
|
#include <Storages/StorageValues.h>
|
||||||
#include <Storages/LiveView/StorageLiveView.h>
|
#include <Storages/LiveView/StorageLiveView.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ PushingToViewsBlockOutputStream::PushingToViewsBlockOutputStream(
|
|||||||
* but it's clear that here is not the best place for this functionality.
|
* but it's clear that here is not the best place for this functionality.
|
||||||
*/
|
*/
|
||||||
addTableLock(
|
addTableLock(
|
||||||
storage->lockForShare(context.getInitialQueryId(), context.getSettingsRef().lock_acquire_timeout));
|
storage->lockForShare(context.getInitialQueryId(), context.getSettingsRef().lock_acquire_timeout));
|
||||||
|
|
||||||
/// If the "root" table deduplicates blocks, there are no need to make deduplication for children
|
/// If the "root" table deduplicates blocks, there are no need to make deduplication for children
|
||||||
/// Moreover, deduplication for AggregatingMergeTree children could produce false positives due to low size of inserting blocks
|
/// Moreover, deduplication for AggregatingMergeTree children could produce false positives due to low size of inserting blocks
|
||||||
@ -74,7 +75,7 @@ PushingToViewsBlockOutputStream::PushingToViewsBlockOutputStream(
|
|||||||
if (auto * materialized_view = dynamic_cast<StorageMaterializedView *>(dependent_table.get()))
|
if (auto * materialized_view = dynamic_cast<StorageMaterializedView *>(dependent_table.get()))
|
||||||
{
|
{
|
||||||
addTableLock(
|
addTableLock(
|
||||||
materialized_view->lockForShare(context.getInitialQueryId(), context.getSettingsRef().lock_acquire_timeout));
|
materialized_view->lockForShare(context.getInitialQueryId(), context.getSettingsRef().lock_acquire_timeout));
|
||||||
|
|
||||||
StoragePtr inner_table = materialized_view->getTargetTable();
|
StoragePtr inner_table = materialized_view->getTargetTable();
|
||||||
auto inner_table_id = inner_table->getStorageID();
|
auto inner_table_id = inner_table->getStorageID();
|
||||||
@ -86,15 +87,17 @@ PushingToViewsBlockOutputStream::PushingToViewsBlockOutputStream(
|
|||||||
|
|
||||||
/// Get list of columns we get from select query.
|
/// Get list of columns we get from select query.
|
||||||
auto header = InterpreterSelectQuery(query, *select_context, SelectQueryOptions().analyze())
|
auto header = InterpreterSelectQuery(query, *select_context, SelectQueryOptions().analyze())
|
||||||
.getSampleBlock();
|
.getSampleBlock();
|
||||||
|
|
||||||
/// Insert only columns returned by select.
|
/// Insert only columns returned by select.
|
||||||
auto list = std::make_shared<ASTExpressionList>();
|
auto list = std::make_shared<ASTExpressionList>();
|
||||||
const auto & inner_table_columns = inner_metadata_snapshot->getColumns();
|
const auto & inner_table_columns = inner_metadata_snapshot->getColumns();
|
||||||
for (auto & column : header)
|
for (const auto & column : header)
|
||||||
|
{
|
||||||
/// But skip columns which storage doesn't have.
|
/// But skip columns which storage doesn't have.
|
||||||
if (inner_table_columns.hasPhysical(column.name))
|
if (inner_table_columns.hasPhysical(column.name))
|
||||||
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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user