From 3f6eb904d61a385da10689236cb4e47ece4a6003 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 24 Dec 2015 22:57:27 +0300 Subject: [PATCH] dbms: fixed exception message [#METR-19516]. --- .../DataStreams/IProfilingBlockInputStream.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dbms/src/DataStreams/IProfilingBlockInputStream.cpp b/dbms/src/DataStreams/IProfilingBlockInputStream.cpp index 52dc17b5310..40a3bb74af9 100644 --- a/dbms/src/DataStreams/IProfilingBlockInputStream.cpp +++ b/dbms/src/DataStreams/IProfilingBlockInputStream.cpp @@ -151,8 +151,7 @@ void IProfilingBlockInputStream::updateExtremes(Block & block) bool IProfilingBlockInputStream::checkLimits() { /// Проверка ограничений. - if ((limits.max_rows_to_read && info.rows > limits.max_rows_to_read) - || (limits.max_bytes_to_read && info.bytes > limits.max_bytes_to_read)) + if (limits.max_rows_to_read && info.rows > limits.max_rows_to_read) { if (limits.read_overflow_mode == OverflowMode::THROW) throw Exception(std::string("Limit for ") @@ -167,6 +166,21 @@ bool IProfilingBlockInputStream::checkLimits() throw Exception("Logical error: unknown overflow mode", ErrorCodes::LOGICAL_ERROR); } + if (limits.max_bytes_to_read && info.bytes > limits.max_bytes_to_read) + { + if (limits.read_overflow_mode == OverflowMode::THROW) + throw Exception(std::string("Limit for ") + + (limits.mode == LIMITS_CURRENT ? "result bytes (uncompressed)" : "(uncompressed) bytes to read") + + " exceeded: read " + toString(info.bytes) + + " bytes, maximum: " + toString(limits.max_bytes_to_read), + ErrorCodes::TOO_MUCH_ROWS); + + if (limits.read_overflow_mode == OverflowMode::BREAK) + return false; + + throw Exception("Logical error: unknown overflow mode", ErrorCodes::LOGICAL_ERROR); + } + if (limits.max_execution_time != 0 && info.total_stopwatch.elapsed() > static_cast(limits.max_execution_time.totalMicroseconds()) * 1000) {