mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
dbms: fixed bad code [#METR-12726].
This commit is contained in:
parent
a800baba16
commit
bb60b4e859
@ -136,6 +136,7 @@ static ASTPtr buildWhereExpression(const ASTs & functions)
|
||||
|
||||
bool filterBlockWithQuery(ASTPtr query, Block & block, const Context & context)
|
||||
{
|
||||
query = query->clone();
|
||||
const ASTSelectQuery & select = typeid_cast<ASTSelectQuery & >(*query);
|
||||
if (!select.where_expression && !select.prewhere_expression)
|
||||
return false;
|
||||
|
@ -74,7 +74,7 @@ BlockInputStreams MergeTreeDataSelectExecutor::read(
|
||||
|
||||
/// Если запрошен хотя бы один виртуальный столбец, пробуем индексировать
|
||||
if (!virt_column_names.empty())
|
||||
VirtualColumnUtils::filterBlockWithQuery(query->clone(), virtual_columns_block, data.context);
|
||||
VirtualColumnUtils::filterBlockWithQuery(query, virtual_columns_block, data.context);
|
||||
|
||||
std::multiset<String> values = VirtualColumnUtils::extractSingleValueFromBlock<String>(virtual_columns_block, "_part");
|
||||
|
||||
|
@ -134,7 +134,7 @@ BlockInputStreams StorageChunkMerger::read(
|
||||
|
||||
/// Если запрошен хотя бы один виртуальный столбец, пробуем индексировать
|
||||
if (has_virtual_column)
|
||||
VirtualColumnUtils::filterBlockWithQuery(query->clone(), virtual_columns_block, context);
|
||||
VirtualColumnUtils::filterBlockWithQuery(query, virtual_columns_block, context);
|
||||
|
||||
std::multiset<String> values = VirtualColumnUtils::extractSingleValueFromBlock<String>(virtual_columns_block, _table_column_name);
|
||||
|
||||
|
@ -55,7 +55,7 @@ BlockInputStreams StorageChunks::read(
|
||||
return read(0, std::numeric_limits<size_t>::max(), column_names, query, settings, processed_stage, max_block_size, threads);
|
||||
|
||||
Block virtual_columns_block = getBlockWithVirtualColumns();
|
||||
if (!VirtualColumnUtils::filterBlockWithQuery(query->clone(), virtual_columns_block, context))
|
||||
if (!VirtualColumnUtils::filterBlockWithQuery(query, virtual_columns_block, context))
|
||||
return read(0, std::numeric_limits<size_t>::max(), column_names, query, settings, processed_stage, max_block_size, threads);
|
||||
std::multiset<String> values = VirtualColumnUtils::extractSingleValueFromBlock<String>(virtual_columns_block, _table_column_name);
|
||||
|
||||
|
@ -85,7 +85,7 @@ BlockInputStreams StorageMerge::read(
|
||||
|
||||
/// Если запрошен хотя бы один виртуальный столбец, пробуем индексировать
|
||||
if (!virt_column_names.empty())
|
||||
VirtualColumnUtils::filterBlockWithQuery(query->clone(), virtual_columns_block, context);
|
||||
VirtualColumnUtils::filterBlockWithQuery(query, virtual_columns_block, context);
|
||||
|
||||
std::multiset<String> values = VirtualColumnUtils::extractSingleValueFromBlock<String>(virtual_columns_block, "_table");
|
||||
|
||||
|
@ -2208,7 +2208,7 @@ BlockInputStreams StorageReplicatedMergeTree::read(
|
||||
|
||||
/// Если запрошен хотя бы один виртуальный столбец, пробуем индексировать
|
||||
if (!virt_column_names.empty())
|
||||
VirtualColumnUtils::filterBlockWithQuery(query->clone(), virtual_columns_block, context);
|
||||
VirtualColumnUtils::filterBlockWithQuery(query, virtual_columns_block, context);
|
||||
|
||||
std::multiset<UInt8> values = VirtualColumnUtils::extractSingleValueFromBlock<UInt8>(virtual_columns_block, "_replicated");
|
||||
|
||||
|
@ -62,7 +62,7 @@ BlockInputStreams StorageSystemParts::read(
|
||||
block.insert(ColumnWithNameAndType(database_column, new DataTypeString, "database"));
|
||||
|
||||
/// Отфильтруем блок со столбцом database.
|
||||
VirtualColumnUtils::filterBlockWithQuery(query->clone(), block, context);
|
||||
VirtualColumnUtils::filterBlockWithQuery(query, block, context);
|
||||
|
||||
if (!block.rows())
|
||||
return BlockInputStreams();
|
||||
@ -129,7 +129,7 @@ BlockInputStreams StorageSystemParts::read(
|
||||
}
|
||||
|
||||
/// Отфильтруем блок со столбцами database, table, engine, replicated и active.
|
||||
VirtualColumnUtils::filterBlockWithQuery(query->clone(), block, context);
|
||||
VirtualColumnUtils::filterBlockWithQuery(query, block, context);
|
||||
|
||||
if (!block.rows())
|
||||
return BlockInputStreams();
|
||||
|
Loading…
Reference in New Issue
Block a user