From 86069ffb40aaec51688491c7d964ba8861f311e1 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 20 Apr 2021 09:03:32 +0300 Subject: [PATCH] Fix LOGICAL_ERROR for max_distributed_connections=0 --- src/Interpreters/InterpreterSelectQuery.cpp | 2 +- tests/queries/0_stateless/01831_max_streams.reference | 1 + tests/queries/0_stateless/01831_max_streams.sql | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 tests/queries/0_stateless/01831_max_streams.reference create mode 100644 tests/queries/0_stateless/01831_max_streams.sql diff --git a/src/Interpreters/InterpreterSelectQuery.cpp b/src/Interpreters/InterpreterSelectQuery.cpp index f44e55a3df9..06922527eaa 100644 --- a/src/Interpreters/InterpreterSelectQuery.cpp +++ b/src/Interpreters/InterpreterSelectQuery.cpp @@ -1658,7 +1658,7 @@ void InterpreterSelectQuery::executeFetchColumns(QueryProcessingStage::Enum proc { /// Table. if (max_streams == 0) - throw Exception("Logical error: zero number of streams requested", ErrorCodes::LOGICAL_ERROR); + max_streams = 1; /// If necessary, we request more sources than the number of threads - to distribute the work evenly over the threads. if (max_streams > 1 && !is_remote) diff --git a/tests/queries/0_stateless/01831_max_streams.reference b/tests/queries/0_stateless/01831_max_streams.reference new file mode 100644 index 00000000000..573541ac970 --- /dev/null +++ b/tests/queries/0_stateless/01831_max_streams.reference @@ -0,0 +1 @@ +0 diff --git a/tests/queries/0_stateless/01831_max_streams.sql b/tests/queries/0_stateless/01831_max_streams.sql new file mode 100644 index 00000000000..aa835dea5ac --- /dev/null +++ b/tests/queries/0_stateless/01831_max_streams.sql @@ -0,0 +1 @@ +select * from remote('127.1', system.one) settings max_distributed_connections=0;