Fix limiting the number of threads for VIEW.

This commit is contained in:
Nikolai Kochetov 2020-07-02 15:35:51 +03:00
parent f87c3af097
commit 6527e04ec3
3 changed files with 10 additions and 3 deletions

View File

@ -167,6 +167,13 @@ public:
/// Set upper limit for the recommend number of threads
void setMaxThreads(size_t max_threads_) { max_threads = max_threads_; }
/// Update upper limit for the recommend number of threads
void limitMaxThreads(size_t max_threads_)
{
if (max_threads == 0 || max_threads_ < max_threads)
max_threads = max_threads_;
}
/// Convert query pipeline to single or several pipes.
Pipe getPipe() &&;
Pipes getPipes() &&;

View File

@ -153,8 +153,8 @@ QueryPipelinePtr QueryPlan::buildQueryPipeline()
bool limit_max_threads = frame.pipelines.empty();
last_pipeline = frame.node->step->updatePipeline(std::move(frame.pipelines));
if (limit_max_threads)
last_pipeline->setMaxThreads(max_threads);
if (limit_max_threads && max_threads)
last_pipeline->limitMaxThreads(max_threads);
stack.pop();
}

View File

@ -113,7 +113,7 @@ ReadFromStorageStep::ReadFromStorageStep(
}
}
if (pipes.size() == 1)
if (pipes.size() == 1 && !storage->isView())
pipeline->setMaxThreads(1);
for (auto & pipe : pipes)