From 307aa127d470b4f8e8099f59445cab4cb4ba1418 Mon Sep 17 00:00:00 2001 From: Smita Kulkarni Date: Tue, 25 Apr 2023 13:27:20 +0200 Subject: [PATCH] Updated to calculate and send max_parsing_threads --- src/Storages/StorageFile.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Storages/StorageFile.cpp b/src/Storages/StorageFile.cpp index 9972549c292..fc36b4a9f62 100644 --- a/src/Storages/StorageFile.cpp +++ b/src/Storages/StorageFile.cpp @@ -51,6 +51,7 @@ #include #include #include +#include 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));