Do not build multithread insert pipeline for tables without support

This commit is contained in:
vdimir 2024-04-05 12:57:02 +00:00
parent f8ef9fc5d3
commit 8b2c719aa6
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862
4 changed files with 17 additions and 3 deletions

View File

@ -522,7 +522,8 @@ BlockIO InterpreterInsertQuery::execute()
auto views = DatabaseCatalog::instance().getDependentViews(table_id); auto views = DatabaseCatalog::instance().getDependentViews(table_id);
/// It breaks some views-related tests and we have dedicated `parallel_view_processing` for views, so let's just skip them. /// It breaks some views-related tests and we have dedicated `parallel_view_processing` for views, so let's just skip them.
const bool resize_to_max_insert_threads = !table->isView() && views.empty(); /// Also it doesn't make sense to reshuffle data if storage doesn't support parallel inserts.
const bool resize_to_max_insert_threads = !table->isView() && views.empty() && table->supportsParallelInsert();
pre_streams_size = resize_to_max_insert_threads ? settings.max_insert_threads pre_streams_size = resize_to_max_insert_threads ? settings.max_insert_threads
: std::min<size_t>(settings.max_insert_threads, pipeline.getNumStreams()); : std::min<size_t>(settings.max_insert_threads, pipeline.getNumStreams());

View File

@ -13,8 +13,6 @@
#include <QueryPipeline/ReadProgressCallback.h> #include <QueryPipeline/ReadProgressCallback.h>
#include <Columns/ColumnConst.h> #include <Columns/ColumnConst.h>
#include <QueryPipeline/printPipeline.h>
namespace DB namespace DB
{ {

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
DATA_FILE="data_$CLICKHOUSE_TEST_UNIQUE_NAME.csv"
$CLICKHOUSE_CLIENT --max_insert_threads=4 --query="
EXPLAIN PIPELINE INSERT INTO FUNCTION file('$DATA_FILE') SELECT * FROM numbers_mt(1000000) ORDER BY number DESC
" | grep -o MaterializingTransform | wc -l
DATA_FILE_PATH=$($CLICKHOUSE_CLIENT_BINARY --query "select _path from file('$DATA_FILE', 'One')")
rm $DATA_FILE_PATH