From 99c1d7660423a67abfa5690651b60f36c5713c95 Mon Sep 17 00:00:00 2001 From: pufit Date: Thu, 21 Sep 2023 15:55:42 -0400 Subject: [PATCH] Fix division by zero in StorageS3 --- src/Storages/StorageS3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storages/StorageS3.cpp b/src/Storages/StorageS3.cpp index ec9cf84ce4b..42c62a3e8f8 100644 --- a/src/Storages/StorageS3.cpp +++ b/src/Storages/StorageS3.cpp @@ -1085,7 +1085,7 @@ Pipe StorageS3::read( && local_context->getSettingsRef().optimize_count_from_files; const size_t max_threads = local_context->getSettingsRef().max_threads; - const size_t max_parsing_threads = num_streams >= max_threads ? 1 : (max_threads / num_streams); + const size_t max_parsing_threads = num_streams >= max_threads ? 1 : (max_threads / std::max(num_streams, 1ul)); LOG_DEBUG(&Poco::Logger::get("StorageS3"), "Reading in {} streams, {} threads per stream", num_streams, max_parsing_threads); pipes.reserve(num_streams);