mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-20 05:05:38 +00:00
Handle dynamic columns in typed paths
This commit is contained in:
parent
bcd53dcd20
commit
aaa7750bf9
@ -1211,6 +1211,16 @@ void ColumnObject::takeDynamicStructureFromSourceColumns(const DB::Columns & sou
|
||||
}
|
||||
column->takeDynamicStructureFromSourceColumns(dynamic_path_source_columns);
|
||||
}
|
||||
|
||||
/// Typed paths also can contain types with dynamic structure.
|
||||
for (auto & [path, column] : typed_paths)
|
||||
{
|
||||
Columns typed_path_source_columns;
|
||||
typed_path_source_columns.reserve(source_columns.size());
|
||||
for (const auto & source_column : source_columns)
|
||||
typed_path_source_columns.push_back(assert_cast<const ColumnObject &>(*source_column).typed_paths.at(path));
|
||||
column->takeDynamicStructureFromSourceColumns(typed_path_source_columns);
|
||||
}
|
||||
}
|
||||
|
||||
size_t ColumnObject::findPathLowerBoundInSharedData(StringRef path, const ColumnString & shared_data_paths, size_t start, size_t end)
|
||||
|
@ -0,0 +1,4 @@
|
||||
{"a":"42"}
|
||||
{"a":["1","2","3"]}
|
||||
{"a":"42"}
|
||||
{"a":["1","2","3"]}
|
17
tests/queries/0_stateless/03214_json_typed_dynamic_path.sql
Normal file
17
tests/queries/0_stateless/03214_json_typed_dynamic_path.sql
Normal file
@ -0,0 +1,17 @@
|
||||
-- Tags: no-fasttest
|
||||
|
||||
set allow_experimental_json_type = 1;
|
||||
drop table if exists test;
|
||||
create table test (json JSON(a Dynamic)) engine=MergeTree order by tuple() settings min_rows_for_wide_part=1, min_bytes_for_wide_part=1;
|
||||
insert into test select '{"a" : 42}';
|
||||
insert into test select '{"a" : [1, 2, 3]}';
|
||||
optimize table test;
|
||||
select * from test order by toString(json);
|
||||
drop table test;
|
||||
|
||||
create table test (json JSON(a Dynamic)) engine=MergeTree order by tuple() settings min_rows_for_wide_part=10000000, min_bytes_for_wide_part=10000000;
|
||||
insert into test select '{"a" : 42}';
|
||||
insert into test select '{"a" : [1, 2, 3]}';
|
||||
optimize table test;
|
||||
select * from test order by toString(json);
|
||||
drop table test;
|
Loading…
Reference in New Issue
Block a user