Fix trash in schema inference

This commit is contained in:
Alexey Milovidov 2022-09-17 23:03:49 +02:00
parent e3d75b0933
commit 2f0684b97c

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;
} }