Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting parallelize_output_from_storages #49101

Merged
merged 7 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Core/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,8 @@ class IColumn;
\
M(String, workload, "default", "Name of workload to be used to access resources", 0) \
\
M(Bool, parallelize_output_from_storages, false, "Parallelize output for reading step from storage. It allows parallelizing query processing right after reading from storage if possible", 0) \
\
/** Experimental functions */ \
M(Bool, allow_experimental_funnel_functions, false, "Enable experimental functions for funnel analysis.", 0) \
M(Bool, allow_experimental_nlp_functions, false, "Enable experimental functions for natural language processing.", 0) \
Expand Down
4 changes: 2 additions & 2 deletions src/Storages/IStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ void IStorage::read(

/// parallelize processing if not yet
const size_t output_ports = pipe.numOutputPorts();
const auto storage_name = getName();
if (parallelizeOutputAfterReading() && output_ports > 0 && output_ports < num_streams)
const bool parallelize_output = context->getSettingsRef().parallelize_output_from_storages;
if (parallelize_output && parallelizeOutputAfterReading() && output_ports > 0 && output_ports < num_streams)
pipe.resize(num_streams);

readFromPipe(query_plan, std::move(pipe), column_names, storage_snapshot, query_info, context, getName());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- { echoOn }
set parallelize_output_from_storages=1;
select startsWith(trimLeft(explain),'Resize') as resize from (explain pipeline select * from file(data_02723.csv)) where resize;
1
-- no Resize in pipeline
set parallelize_output_from_storages=0;
select startsWith(trimLeft(explain),'Resize') as resize from (explain pipeline select * from file(data_02723.csv)) where resize;
12 changes: 12 additions & 0 deletions tests/queries/0_stateless/02723_parallelize_output_setting.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Tags: no-parallel

insert into function file(data_02723.csv) select number from numbers(5) settings engine_file_truncate_on_insert=1;

set max_threads=2;
-- { echoOn }
set parallelize_output_from_storages=1;
select startsWith(trimLeft(explain),'Resize') as resize from (explain pipeline select * from file(data_02723.csv)) where resize;
-- no Resize in pipeline
set parallelize_output_from_storages=0;
select startsWith(trimLeft(explain),'Resize') as resize from (explain pipeline select * from file(data_02723.csv)) where resize;