diff --git a/dbms/src/Processors/Executors/PipelineExecutor.cpp b/dbms/src/Processors/Executors/PipelineExecutor.cpp index f4be5a84518..767bd3b6805 100644 --- a/dbms/src/Processors/Executors/PipelineExecutor.cpp +++ b/dbms/src/Processors/Executors/PipelineExecutor.cpp @@ -690,14 +690,14 @@ void PipelineExecutor::executeImpl(size_t num_threads) bool finished_flag = false; SCOPE_EXIT( - if (!finished_flag) - { - finish(); + if (!finished_flag) + { + finish(); - for (auto & thread : threads) - if (thread.joinable()) - thread.join(); - } + for (auto & thread : threads) + if (thread.joinable()) + thread.join(); + } ); addChildlessProcessorsToStack(stack);