Avoid getting callbacks from context for local plan

This commit is contained in:
Igor Nikonov 2024-07-20 20:53:18 +00:00
parent daabf2275e
commit 4e69cd0d52
3 changed files with 14 additions and 7 deletions

View File

@ -85,7 +85,7 @@ std::pair<std::unique_ptr<QueryPlan>, bool> createLocalPlanForParallelReplicas(
{ return coordinator->handleRequest(std::move(req)); };
auto read_from_merge_tree_parallel_replicas
= reading->createLocalParallelReplicasReadingStep(analyzed_result_ptr, all_ranges_cb, read_task_cb);
= reading->createLocalParallelReplicasReadingStep(analyzed_result_ptr, std::move(all_ranges_cb), std::move(read_task_cb));
node->step = std::move(read_from_merge_tree_parallel_replicas);
addConvertingActions(*query_plan, header, /*has_missing_objects=*/false);

View File

@ -303,8 +303,15 @@ ReadFromMergeTree::ReadFromMergeTree(
{
if (is_parallel_reading_from_replicas)
{
all_ranges_callback = all_ranges_callback_.value_or(context->getMergeTreeAllRangesCallback());
read_task_callback = read_task_callback_.value_or(context->getMergeTreeReadTaskCallback());
if (all_ranges_callback_.has_value())
all_ranges_callback = all_ranges_callback_.value();
else
all_ranges_callback = context->getMergeTreeAllRangesCallback();
if (read_task_callback_.has_value())
read_task_callback = read_task_callback_.value();
else
read_task_callback = context->getMergeTreeReadTaskCallback();
}
const auto & settings = context->getSettingsRef();
@ -340,8 +347,8 @@ ReadFromMergeTree::ReadFromMergeTree(
std::unique_ptr<ReadFromMergeTree> ReadFromMergeTree::createLocalParallelReplicasReadingStep(
AnalysisResultPtr analyzed_result_ptr_,
std::optional<MergeTreeAllRangesCallback> all_ranges_callback_,
std::optional<MergeTreeReadTaskCallback> read_task_callback_)
MergeTreeAllRangesCallback all_ranges_callback_,
MergeTreeReadTaskCallback read_task_callback_)
{
const auto number_of_local_replica = 0;
const bool enable_parallel_reading = true;

View File

@ -128,8 +128,8 @@ public:
std::unique_ptr<ReadFromMergeTree> createLocalParallelReplicasReadingStep(
AnalysisResultPtr analyzed_result_ptr_,
std::optional<MergeTreeAllRangesCallback> all_ranges_callback_,
std::optional<MergeTreeReadTaskCallback> read_task_callback_);
MergeTreeAllRangesCallback all_ranges_callback_,
MergeTreeReadTaskCallback read_task_callback_);
static constexpr auto name = "ReadFromMergeTree";
String getName() const override { return name; }