Store context created from projection analysis.

This commit is contained in:
Nikolai Kochetov 2023-01-02 17:00:48 +00:00
parent 2892d447d4
commit 09325ff17e
3 changed files with 5 additions and 0 deletions

View File

@ -6118,6 +6118,7 @@ std::optional<ProjectionCandidate> MergeTreeData::getQueryProcessingStageWithAgg
{ {
ProjectionCandidate candidate{}; ProjectionCandidate candidate{};
candidate.desc = &projection; candidate.desc = &projection;
candidate.context = select.getContext();
auto sample_block = projection.sample_block; auto sample_block = projection.sample_block;
auto sample_block_for_keys = projection.sample_block_for_keys; auto sample_block_for_keys = projection.sample_block_for_keys;

View File

@ -466,6 +466,7 @@ QueryPlanPtr MergeTreeDataSelectExecutor::read(
fmt::format("MergeTree(with {} projection {})", query_info.projection->desc->type, query_info.projection->desc->name), fmt::format("MergeTree(with {} projection {})", query_info.projection->desc->type, query_info.projection->desc->name),
query_info.storage_limits); query_info.storage_limits);
plan->addStep(std::move(step)); plan->addStep(std::move(step));
plan->addInterpreterContext(query_info.projection->context);
return plan; return plan;
} }

View File

@ -163,6 +163,9 @@ struct ProjectionCandidate
SortDescription group_by_elements_order_descr; SortDescription group_by_elements_order_descr;
MergeTreeDataSelectAnalysisResultPtr merge_tree_projection_select_result_ptr; MergeTreeDataSelectAnalysisResultPtr merge_tree_projection_select_result_ptr;
MergeTreeDataSelectAnalysisResultPtr merge_tree_normal_select_result_ptr; MergeTreeDataSelectAnalysisResultPtr merge_tree_normal_select_result_ptr;
/// Becasue projection analysis uses a separate interpreter.
ContextPtr context;
}; };
/** Query along with some additional data, /** Query along with some additional data,