mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Merge pull request #37760 from Avogar/fix-segfault-template-format
Fix possible segfault in schema inference
This commit is contained in:
commit
9bb9df9928
@ -100,18 +100,21 @@ ColumnsDescription readSchemaFromFormat(
|
||||
catch (...)
|
||||
{
|
||||
auto exception_message = getCurrentExceptionMessage(false);
|
||||
size_t rows_read = schema_reader->getNumRowsRead();
|
||||
assert(rows_read <= max_rows_to_read);
|
||||
max_rows_to_read -= schema_reader->getNumRowsRead();
|
||||
if (rows_read != 0 && max_rows_to_read == 0)
|
||||
if (schema_reader)
|
||||
{
|
||||
exception_message += "\nTo increase the maximum number of rows to read for structure determination, use setting input_format_max_rows_to_read_for_schema_inference";
|
||||
if (iterations > 1)
|
||||
size_t rows_read = schema_reader->getNumRowsRead();
|
||||
assert(rows_read <= max_rows_to_read);
|
||||
max_rows_to_read -= schema_reader->getNumRowsRead();
|
||||
if (rows_read != 0 && max_rows_to_read == 0)
|
||||
{
|
||||
exception_messages += "\n" + exception_message;
|
||||
break;
|
||||
exception_message += "\nTo increase the maximum number of rows to read for structure determination, use setting input_format_max_rows_to_read_for_schema_inference";
|
||||
if (iterations > 1)
|
||||
{
|
||||
exception_messages += "\n" + exception_message;
|
||||
break;
|
||||
}
|
||||
retry = false;
|
||||
}
|
||||
retry = false;
|
||||
}
|
||||
|
||||
if (!retry || !isRetryableSchemaInferenceError(getCurrentExceptionCode()))
|
||||
|
2
tests/queries/0_stateless/02318_template_schema_inference_bug.sql
Executable file
2
tests/queries/0_stateless/02318_template_schema_inference_bug.sql
Executable file
@ -0,0 +1,2 @@
|
||||
insert into function file(data_02318.tsv) select * from numbers(10);
|
||||
desc file('data_02318.tsv', 'Template') SETTINGS format_template_row='nonexist', format_template_resultset='nonexist'; -- {serverError CANNOT_EXTRACT_TABLE_STRUCTURE}
|
Loading…
Reference in New Issue
Block a user