a bit more verbose exceptions when reading from merge tree. [#METR-10202]

This commit is contained in:
Michael Kolupaev 2014-07-01 12:50:30 +04:00
parent 5f1fa12ee4
commit 201e63181c

View File

@ -49,6 +49,8 @@ public:
* Не добавляет столбцы, для которых нет файлов. Чтобы их добавить, нужно вызвать fillMissingColumns. * Не добавляет столбцы, для которых нет файлов. Чтобы их добавить, нужно вызвать fillMissingColumns.
* В блоке должно быть либо ни одного столбца из column_names, либо все, для которых есть файлы. */ * В блоке должно быть либо ни одного столбца из column_names, либо все, для которых есть файлы. */
void readRange(size_t from_mark, size_t to_mark, Block & res) void readRange(size_t from_mark, size_t to_mark, Block & res)
{
try
{ {
size_t max_rows_to_read = (to_mark - from_mark) * storage.index_granularity; size_t max_rows_to_read = (to_mark - from_mark) * storage.index_granularity;
@ -96,18 +98,7 @@ public:
else if (!append) else if (!append)
column.column = column.type->createColumn(); column.column = column.type->createColumn();
try
{
readData(column.name, *column.type, *column.column, from_mark, max_rows_to_read, 0, read_offsets); readData(column.name, *column.type, *column.column, from_mark, max_rows_to_read, 0, read_offsets);
}
catch (const Exception & e)
{
/// Более хорошая диагностика.
if (e.code() == ErrorCodes::CHECKSUM_DOESNT_MATCH || e.code() == ErrorCodes::TOO_LARGE_SIZE_COMPRESSED)
throw Exception(e.message() + " (while reading column " + *it + " from part " + path + ")", e.code());
else
throw;
}
if (!append && column.column->size()) if (!append && column.column->size())
res.insert(column); res.insert(column);
@ -116,6 +107,13 @@ public:
if (has_missing_columns && !res) if (has_missing_columns && !res)
throw Exception("All requested columns are missing", ErrorCodes::ALL_REQUESTED_COLUMNS_ARE_MISSING); throw Exception("All requested columns are missing", ErrorCodes::ALL_REQUESTED_COLUMNS_ARE_MISSING);
} }
catch (const Exception & e)
{
/// Более хорошая диагностика.
throw Exception(e.message() + " (while reading from part " + path + " from mark " + toString(from_mark) + " to "
+ toString(to_mark) + ")", e.code());
}
}
/// Заполняет столбцы, которых нет в блоке, значениями по умолчанию. /// Заполняет столбцы, которых нет в блоке, значениями по умолчанию.
void fillMissingColumns(Block & res) void fillMissingColumns(Block & res)
@ -178,10 +176,7 @@ public:
catch (const Exception & e) catch (const Exception & e)
{ {
/// Более хорошая диагностика. /// Более хорошая диагностика.
if (e.code() == ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH)
throw Exception(e.message() + " (while reading from part " + path + ")", e.code()); throw Exception(e.message() + " (while reading from part " + path + ")", e.code());
else
throw;
} }
} }