Merge pull request #46972 from Avogar/json-date-int-inference

Fix date and int inference from string in JSON
This commit is contained in:
Kruglov Pavel 2023-03-06 20:40:38 +01:00 committed by GitHub
commit 479cd9b90b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 4 deletions

View File

@ -131,6 +131,7 @@ namespace
type_indexes.erase(TypeIndex::Date);
type_indexes.erase(TypeIndex::DateTime);
type_indexes.insert(TypeIndex::String);
return;
}

View File

@ -173,19 +173,19 @@ void chooseResultColumnType(
ErrorCodes::TYPE_MISMATCH,
"Automatically defined type {} for column '{}' in row {} differs from type defined by previous rows: {}. "
"You can specify the type for this column using setting schema_inference_hints",
type->getName(),
new_type->getName(),
column_name,
row,
new_type->getName());
type->getName());
else
throw Exception(
ErrorCodes::TYPE_MISMATCH,
"Automatically defined type {} for column '{}' in row {} differs from type defined by previous rows: {}. "
"Column types from setting schema_inference_hints couldn't be parsed because of error: {}",
type->getName(),
new_type->getName(),
column_name,
row,
new_type->getName(),
type->getName(),
hints_parsing_error);
}
}

View File

@ -0,0 +1 @@
x Nullable(String)

View File

@ -0,0 +1,2 @@
desc format(JSONEachRow, '{"x" : "2020-01-01"}, {"x" : "1000"}')