Backport #70530 to 24.8: Make async insert print nothing

This commit is contained in:
robot-clickhouse 2024-10-10 15:08:27 +00:00
parent 60411c8e33
commit f1702eaf25
3 changed files with 5 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#include <QueryPipeline/BlockIO.h> #include <QueryPipeline/BlockIO.h>
#include <Processors/Transforms/CountingTransform.h> #include <Processors/Transforms/CountingTransform.h>
#include <Processors/Transforms/getSourceFromASTInsertQuery.h> #include <Processors/Transforms/getSourceFromASTInsertQuery.h>
#include <Processors/Formats/Impl/NullFormat.h>
#include <Parsers/ASTIdentifier.h> #include <Parsers/ASTIdentifier.h>
#include <Parsers/ASTInsertQuery.h> #include <Parsers/ASTInsertQuery.h>
@ -1080,6 +1081,7 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
auto timeout = settings.wait_for_async_insert_timeout.totalMilliseconds(); auto timeout = settings.wait_for_async_insert_timeout.totalMilliseconds();
auto source = std::make_shared<WaitForAsyncInsertSource>(std::move(result.future), timeout); auto source = std::make_shared<WaitForAsyncInsertSource>(std::move(result.future), timeout);
res.pipeline = QueryPipeline(Pipe(std::move(source))); res.pipeline = QueryPipeline(Pipe(std::move(source)));
res.pipeline.complete(std::make_shared<NullOutputFormat>(Block()));
} }
const auto & table_id = insert_query->table_id; const auto & table_id = insert_query->table_id;

View File

@ -10,3 +10,4 @@
10 j 10 j
11 k 11 k
12 l 12 l
13 m

View File

@ -32,6 +32,8 @@ ${CLICKHOUSE_CURL} -sS "$url" -d 'INSERT INTO async_inserts FORMAT CSVWithNames
12,"l" 12,"l"
' & ' &
${CLICKHOUSE_CURL} -sS "$url" -H 'X-Clickhouse-Format: XML' -d 'INSERT INTO async_inserts FORMAT JSONEachRow {"id": 13, "s": "m"}' &
wait wait
${CLICKHOUSE_CLIENT} -q "SELECT * FROM async_inserts ORDER BY id" ${CLICKHOUSE_CLIENT} -q "SELECT * FROM async_inserts ORDER BY id"