mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Add more tests, fix conflicts
This commit is contained in:
parent
55ede2dab6
commit
835fc9ca76
@ -411,6 +411,12 @@ void SerializationObject::serializeBinaryBulkWithMultipleStreams(
|
||||
const auto & shared_data = column_object.getSharedDataPtr();
|
||||
auto * object_state = checkAndGetState<SerializeBinaryBulkStateObject>(state);
|
||||
|
||||
if (column_object.getMaxDynamicPaths() != object_state->max_dynamic_paths)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Mismatch of max_dynamic_paths parameter of Object. Expected: {}, Got: {}", object_state->max_dynamic_paths, column_object.getMaxDynamicPaths());
|
||||
|
||||
if (column_object.getDynamicPaths().size() != object_state->sorted_dynamic_paths.size())
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Mismatch of number of dynamic paths in Object. Expected: {}, Got: {}", object_state->sorted_dynamic_paths.size(), column_object.getDynamicPaths().size());
|
||||
|
||||
settings.path.push_back(Substream::ObjectData);
|
||||
|
||||
for (const auto & path : sorted_typed_paths)
|
||||
@ -532,6 +538,7 @@ void SerializationObject::deserializeBinaryBulkWithMultipleStreams(
|
||||
/// If it's a new object column, set dynamic paths and statistics.
|
||||
if (column_object.empty())
|
||||
{
|
||||
column_object.setMaxDynamicPaths(structure_state->max_dynamic_paths);
|
||||
column_object.setDynamicPaths(structure_state->sorted_dynamic_paths);
|
||||
column_object.setStatistics(structure_state->statistics);
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
Array(Nullable(Int64)) true
|
||||
Int64 false
|
||||
Array(Nullable(Int64)) false
|
||||
Int64 false
|
@ -0,0 +1,12 @@
|
||||
set allow_experimental_json_type = 1;
|
||||
|
||||
drop table if exists test;
|
||||
create table test (json JSON(max_dynamic_paths=1)) engine=MergeTree order by tuple() settings min_rows_for_wide_part = 1, min_bytes_for_wide_part = 1;
|
||||
insert into test select '{"b" : 42}' from numbers(5);
|
||||
insert into test select '{"a" : 42, "b" : [1, 2, 3]}' from numbers(5);
|
||||
optimize table test final;
|
||||
select distinct dynamicType(json.b) as type, isDynamicElementInSharedData(json.b) from test order by type;
|
||||
insert into test select '{"b" : 42}' from numbers(5);
|
||||
optimize table test final;
|
||||
select distinct dynamicType(json.b) as type, isDynamicElementInSharedData(json.b) from test order by type;
|
||||
drop table test;
|
@ -0,0 +1,22 @@
|
||||
Array(JSON(max_dynamic_types=16, max_dynamic_paths=2)) true
|
||||
Int64 false
|
||||
Array(JSON(max_dynamic_types=16, max_dynamic_paths=2)) false
|
||||
Int64 false
|
||||
['c']
|
||||
['d']
|
||||
Array(JSON(max_dynamic_types=16, max_dynamic_paths=2)) false
|
||||
Int64 false
|
||||
['c']
|
||||
['d']
|
||||
Int64 true
|
||||
None false
|
||||
Int64 true
|
||||
None false
|
||||
Array(JSON(max_dynamic_types=16, max_dynamic_paths=2)) false
|
||||
Int64 false
|
||||
['c']
|
||||
['d']
|
||||
Int64 false
|
||||
None false
|
||||
Int64 false
|
||||
None false
|
@ -0,0 +1,25 @@
|
||||
set allow_experimental_json_type = 1;
|
||||
|
||||
drop table if exists test;
|
||||
create table test (json JSON(max_dynamic_paths=8)) engine=MergeTree order by tuple() settings min_rows_for_wide_part = 1, min_bytes_for_wide_part = 1;
|
||||
insert into test select materialize('{"a" : 42}')::JSON(max_dynamic_paths=8) from numbers(5);
|
||||
insert into test select materialize('{"a1" : 42, "a2" : 42, "a3" : 42, "a4" : 42, "a5" : 42, "a6" : 42, "a7" : 42, "a8" : 42, "a" : [{"c" : 42}]}')::JSON(max_dynamic_paths=8) from numbers(5);
|
||||
optimize table test final;
|
||||
select distinct dynamicType(json.a) as type, isDynamicElementInSharedData(json.a) from test order by type;
|
||||
insert into test select materialize('{"a1" : 42, "a2" : 42, "a3" : 42, "a4" : 42, "a5" : 42, "a6" : 42, "a7" : 42, "a8" : 42, "a" : [{"d" : 42}]}')::JSON(max_dynamic_paths=8) from numbers(5);
|
||||
optimize table test final;
|
||||
select distinct dynamicType(json.a) as type, isDynamicElementInSharedData(json.a) from test order by type;
|
||||
select distinct JSONSharedDataPaths(arrayJoin(json.a[])) as path from test order by path;
|
||||
insert into test select materialize('{"a" : 42}')::JSON(max_dynamic_paths=8) from numbers(5);
|
||||
optimize table test final;
|
||||
select distinct dynamicType(json.a) as type, isDynamicElementInSharedData(json.a) from test order by type;
|
||||
select distinct JSONDynamicPaths(arrayJoin(json.a[])) as path from test order by path;
|
||||
select distinct dynamicType(arrayJoin(json.a[].c)) as type, isDynamicElementInSharedData(arrayJoin(json.a[].c)) from test order by type;
|
||||
select distinct dynamicType(arrayJoin(json.a[].d)) as type, isDynamicElementInSharedData(arrayJoin(json.a[].d)) from test order by type;
|
||||
insert into test select materialize('{"a" : 42}')::JSON(max_dynamic_paths=8) from numbers(5);
|
||||
optimize table test final;
|
||||
select distinct dynamicType(json.a) as type, isDynamicElementInSharedData(json.a) from test order by type;
|
||||
select distinct JSONDynamicPaths(arrayJoin(json.a[])) as path from test order by path;
|
||||
select distinct dynamicType(arrayJoin(json.a[].c)) as type, isDynamicElementInSharedData(arrayJoin(json.a[].c)) from test order by type;
|
||||
select distinct dynamicType(arrayJoin(json.a[].d)) as type, isDynamicElementInSharedData(arrayJoin(json.a[].d)) from test order by type;
|
||||
drop table test;
|
Loading…
Reference in New Issue
Block a user