Merge pull request #70230 from ClickHouse/backport/24.9/70147

Backport #70147 to 24.9: Fix Dynamic type creation of JSON subcolumn
This commit is contained in:
robot-ch-test-poll3 2024-10-02 00:20:33 +02:00 committed by GitHub
commit 97d03dadc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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;