mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 06:01:57 +00:00
* Fixing bug in StorageLiveView.cpp getHeader() method
that sometimes addressed invalid pointer when getHeader() method was called without holding the mutex
This commit is contained in:
parent
13978c03f3
commit
d6d0404c48
@ -158,11 +158,10 @@ bool StorageLiveView::hasColumn(const String & column_name) const
|
||||
Block StorageLiveView::getHeader() const
|
||||
{
|
||||
if (!sample_block)
|
||||
{
|
||||
if (!(*blocks_ptr) || (*blocks_ptr)->empty())
|
||||
{
|
||||
auto storage = global_context.getTable(select_database_name, select_table_name);
|
||||
sample_block = InterpreterSelectQuery(inner_query, global_context, storage, SelectQueryOptions(QueryProcessingStage::Complete)).getSampleBlock();
|
||||
sample_block = InterpreterSelectQuery(inner_query, global_context, storage,
|
||||
SelectQueryOptions(QueryProcessingStage::Complete)).getSampleBlock();
|
||||
sample_block.insert({DataTypeUInt64().createColumnConst(
|
||||
sample_block.rows(), 0)->convertToFullColumnIfConst(),
|
||||
std::make_shared<DataTypeUInt64>(),
|
||||
@ -174,11 +173,6 @@ Block StorageLiveView::getHeader() const
|
||||
sample_block.safeGetByPosition(i).column = sample_block.safeGetByPosition(i).column->convertToFullColumnIfConst();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sample_block = (*blocks_ptr)->front().cloneEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
return sample_block;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user