Updated to calculate and send max_parsing_threads

This commit is contained in:
Smita Kulkarni 2023-04-25 13:27:20 +02:00
parent b70878aa0e
commit 307aa127d4

View File

@ -51,6 +51,7 @@
#include <re2/re2.h>
#include <filesystem>
#include <shared_mutex>
#include <cmath>
namespace ProfileEvents
@ -606,8 +607,11 @@ public:
if (!read_buf)
read_buf = createReadBuffer(current_path, storage->use_table_fd, storage->getName(), storage->table_fd, storage->compression_method, context);
const Settings & settings = context->getSettingsRef();
chassert(storage->paths.size());
const auto max_parsing_threads = std::max(settings.max_threads/storage->paths.size(),1UL);
auto format
= context->getInputFormat(storage->format_name, *read_buf, block_for_format, max_block_size, storage->format_settings, storage->paths.size());
= context->getInputFormat(storage->format_name, *read_buf, block_for_format, max_block_size, storage->format_settings, max_parsing_threads);
QueryPipelineBuilder builder;
builder.init(Pipe(format));