mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix nested JSON Objects schema inference
This commit is contained in:
parent
487100a4fd
commit
acf87c1d10
@ -218,7 +218,6 @@ namespace JSONUtils
|
||||
{
|
||||
auto object = field.getObject();
|
||||
DataTypes value_types;
|
||||
bool have_object_value = false;
|
||||
for (const auto key_value_pair : object)
|
||||
{
|
||||
auto type = getDataTypeFromFieldImpl(key_value_pair.second, settings, numbers_parsed_from_json_strings);
|
||||
@ -226,10 +225,7 @@ namespace JSONUtils
|
||||
continue;
|
||||
|
||||
if (isObject(type))
|
||||
{
|
||||
have_object_value = true;
|
||||
break;
|
||||
}
|
||||
return std::make_shared<DataTypeObject>("json", true);
|
||||
|
||||
value_types.push_back(type);
|
||||
}
|
||||
@ -242,7 +238,7 @@ namespace JSONUtils
|
||||
for (size_t i = 1; i < value_types.size(); ++i)
|
||||
are_types_equal &= value_types[i]->equals(*value_types[0]);
|
||||
|
||||
if (have_object_value || !are_types_equal)
|
||||
if (!are_types_equal)
|
||||
return std::make_shared<DataTypeObject>("json", true);
|
||||
|
||||
return std::make_shared<DataTypeMap>(std::make_shared<DataTypeString>(), value_types[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user