Backport #70147 to 24.9: Fix Dynamic type creation of JSON subcolumn

This commit is contained in:
robot-clickhouse 2024-10-01 19:09:06 +00:00
parent 9a435e4c9e
commit 03aab5abad
3 changed files with 14 additions and 1 deletions

View File

@ -404,7 +404,7 @@ std::unique_ptr<ISerialization::SubstreamData> DataTypeObject::getDynamicSubcolu
else
{
res = std::make_unique<SubstreamData>(std::make_shared<SerializationDynamic>());
res->type = std::make_shared<DataTypeDynamic>();
res->type = std::make_shared<DataTypeDynamic>(max_dynamic_types);
}
/// If column was provided, we should create a column for requested subcolumn.

View File

@ -0,0 +1,5 @@
Dynamic(max_types=1)
Dynamic(max_types=1)
1
1
1

View File

@ -0,0 +1,8 @@
set allow_experimental_json_type=1;
set enable_analyzer=1;
drop table if exists test;
create table test (json JSON(max_dynamic_types=1)) engine=Memory;
insert into test values ('{"c0" : 1}'), ('{"c0" : 2}');
select toTypeName(json.c0) from test;
SELECT 1 FROM (SELECT 1 AS c0) tx FULL OUTER JOIN test ON test.json.Float32 = tx.c0;
drop table test;