Merge pull request #64579 from ClickHouse/store-analysis-result

Cache first analysis result in ReadFromMergeTree
This commit is contained in:
Igor Nikonov 2024-06-05 11:21:50 +00:00 committed by GitHub
commit 22d50dcd3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -1811,8 +1811,10 @@ bool ReadFromMergeTree::requestOutputEachPartitionThroughSeparatePort()
ReadFromMergeTree::AnalysisResult ReadFromMergeTree::getAnalysisResult() const ReadFromMergeTree::AnalysisResult ReadFromMergeTree::getAnalysisResult() const
{ {
auto result_ptr = analyzed_result_ptr ? analyzed_result_ptr : selectRangesToRead(); if (!analyzed_result_ptr)
return *result_ptr; analyzed_result_ptr = selectRangesToRead();
return *analyzed_result_ptr;
} }
bool ReadFromMergeTree::isQueryWithSampling() const bool ReadFromMergeTree::isQueryWithSampling() const

View File

@ -261,7 +261,7 @@ private:
ReadFromMergeTree::AnalysisResult getAnalysisResult() const; ReadFromMergeTree::AnalysisResult getAnalysisResult() const;
AnalysisResultPtr analyzed_result_ptr; mutable AnalysisResultPtr analyzed_result_ptr;
VirtualFields shared_virtual_fields; VirtualFields shared_virtual_fields;
bool is_parallel_reading_from_replicas; bool is_parallel_reading_from_replicas;