Fix trash in schema inference

This commit is contained in:
Alexey Milovidov 2022-09-17 23:03:49 +02:00
parent 47167494d9
commit 0875d4632b

View File

@ -65,7 +65,7 @@ ColumnsDescription readSchemaFromFormat(
} }
catch (Exception & e) catch (Exception & e)
{ {
e.addMessage("Cannot extract table structure from {} format file. You can specify the structure manually", format_name); e.addMessage(fmt::format("Cannot extract table structure from {} format file. You can specify the structure manually", format_name));
throw; throw;
} }
} }
@ -86,6 +86,12 @@ ColumnsDescription readSchemaFromFormat(
break; break;
is_eof = buf->eof(); is_eof = buf->eof();
} }
catch (Exception & e)
{
e.addMessage(fmt::format(
"Cannot extract table structure from {} format file. You can specify the structure manually", format_name));
throw;
}
catch (...) catch (...)
{ {
auto exception_message = getCurrentExceptionMessage(false); auto exception_message = getCurrentExceptionMessage(false);
@ -137,7 +143,21 @@ ColumnsDescription readSchemaFromFormat(
} }
if (!retry || !isRetryableSchemaInferenceError(getCurrentExceptionCode())) if (!retry || !isRetryableSchemaInferenceError(getCurrentExceptionCode()))
throw Exception(ErrorCodes::CANNOT_EXTRACT_TABLE_STRUCTURE, "Cannot extract table structure from {} format file. Error: {}. You can specify the structure manually", format_name, exception_message); {
try
{
throw;
}
catch (Exception & e)
{
e.addMessage(fmt::format("Cannot extract table structure from {} format file. You can specify the structure manually", format_name));
throw;
}
catch (...)
{
throw Exception(ErrorCodes::CANNOT_EXTRACT_TABLE_STRUCTURE, "Cannot extract table structure from {} format file. Error: {}. You can specify the structure manually", format_name, exception_message);
}
}
exception_messages += "\n" + exception_message; exception_messages += "\n" + exception_message;
} }