mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Merge pull request #63323 from ClickHouse/use-getparentpartname
Try fix segfault in `MergeTreeReadPoolBase::createTask`
This commit is contained in:
commit
d1c20d08c3
@ -6,6 +6,11 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
MergeTreeReadPoolBase::MergeTreeReadPoolBase(
|
||||
RangesInDataParts && parts_,
|
||||
VirtualFields shared_virtual_fields_,
|
||||
@ -113,9 +118,25 @@ MergeTreeReadTaskPtr MergeTreeReadPoolBase::createTask(
|
||||
? std::make_unique<MergeTreeBlockSizePredictor>(*read_info->shared_size_predictor)
|
||||
: nullptr; /// make a copy
|
||||
|
||||
auto get_part_name = [](const auto & task_info) -> const String &
|
||||
auto get_part_name = [](const auto & task_info) -> String
|
||||
{
|
||||
return task_info.data_part->isProjectionPart() ? task_info.data_part->getParentPart()->name : task_info.data_part->name;
|
||||
const auto & data_part = task_info.data_part;
|
||||
|
||||
if (data_part->isProjectionPart())
|
||||
{
|
||||
auto parent_part_name = data_part->getParentPartName();
|
||||
|
||||
auto parent_part = data_part->storage.getPartIfExists(
|
||||
parent_part_name, {MergeTreeDataPartState::PreActive, MergeTreeDataPartState::Active, MergeTreeDataPartState::Outdated});
|
||||
|
||||
if (!parent_part)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Did not find parent part {} for projection part {}",
|
||||
parent_part_name, data_part->getDataPartStorage().getFullPath());
|
||||
|
||||
return parent_part_name;
|
||||
}
|
||||
|
||||
return data_part->name;
|
||||
};
|
||||
|
||||
auto extras = getExtras();
|
||||
|
Loading…
Reference in New Issue
Block a user