From 24c03a20e36d9af1c62852760ef0f5d28dbd28c0 Mon Sep 17 00:00:00 2001
From: yawnt <yawnt@users.noreply.github.com>
Date: Fri, 27 Sep 2024 19:40:51 +0000
Subject: [PATCH] (fix) https://github.com/ClickHouse/ClickHouse/issues/66646
 do not run executable table storage queries in single threaded pipeline
 executor

---
 src/Processors/Sources/ShellCommandSource.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/Processors/Sources/ShellCommandSource.cpp b/src/Processors/Sources/ShellCommandSource.cpp
index f55a3713215..6c4af236e5f 100644
--- a/src/Processors/Sources/ShellCommandSource.cpp
+++ b/src/Processors/Sources/ShellCommandSource.cpp
@@ -667,7 +667,9 @@ Pipe ShellCommandSourceCoordinator::createPipe(
             input_pipes[i].addTransform(std::move(transform));
         }
 
+        auto num_streams = input_pipes[i].maxParallelStreams();
         auto pipeline = std::make_shared<QueryPipeline>(std::move(input_pipes[i]));
+        pipeline->setNumThreads(num_streams);
         auto out = context->getOutputFormat(configuration.format, *timeout_write_buffer, materializeBlock(pipeline->getHeader()));
         out->setAutoFlush();
         pipeline->complete(std::move(out));