mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Merge pull request #71785 from Avogar/fix-json-parsing
Slightly better JSON type parsing
This commit is contained in:
commit
1aceb608f3
@ -1443,7 +1443,8 @@ public:
|
||||
auto shared_variant_discr = column_dynamic.getSharedVariantDiscriminator();
|
||||
auto insert_settings_with_no_type_conversion = insert_settings;
|
||||
insert_settings_with_no_type_conversion.allow_type_conversion = false;
|
||||
for (size_t i = 0; i != variant_info.variant_names.size(); ++i)
|
||||
auto order = SerializationVariant::getVariantsDeserializeTextOrder(assert_cast<const DataTypeVariant &>(*variant_info.variant_type).getVariants());
|
||||
for (size_t i : order)
|
||||
{
|
||||
if (i != shared_variant_discr)
|
||||
{
|
||||
|
@ -9,5 +9,5 @@
|
||||
('key_6','String')
|
||||
('key_7','Float64')
|
||||
('key_7','Int64')
|
||||
{"obj":{"id":"1","key_0":[{"key_1":[{"key_3":[{"key_4":"1048576","key_5":0.0001048576,"key_6":25.5,"key_7":"1025"},{"key_6":"","key_7":"2"}]}]},{},{"key_1":[{"key_3":[{"key_5":-1,"key_6":"aqbjfiruu","key_7":-922337203685477600},{"key_4":"","key_6":"","key_7":65537}]},{"key_3":[{"key_4":"ghdqyeiom","key_5":1048575,"key_7":21474836.48}]}]}]}}
|
||||
{"obj":{"id":"1","key_0":[{"key_1":[{"key_3":[{"key_4":"1048576","key_5":0.0001048576,"key_6":25.5,"key_7":"1025"},{"key_6":"","key_7":"2"}]}]},{},{"key_1":[{"key_3":[{"key_5":-1,"key_6":"aqbjfiruu","key_7":-922337203685477600},{"key_4":"","key_6":"","key_7":"65537"}]},{"key_3":[{"key_4":"ghdqyeiom","key_5":1048575,"key_7":21474836.48}]}]}]}}
|
||||
[[[1048576,NULL]],[],[[NULL,''],['ghdqyeiom']]] [[[0.0001048576,NULL]],[],[[-1,NULL],[1048575]]] [[[25.5,'']],[],[['aqbjfiruu',''],[NULL]]] [[[1025,2]],[],[[-922337203685477600,65537],[21474836.48]]]
|
||||
|
@ -0,0 +1,3 @@
|
||||
Int64 42
|
||||
Float64 42.42
|
||||
Int64 43
|
@ -0,0 +1,8 @@
|
||||
set allow_experimental_json_type = 1;
|
||||
drop table if exists test;
|
||||
create table test (json JSON) engine=Memory;
|
||||
insert into test format JSONAsObject {"a" : 42}, {"a" : 42.42}, {"a" : 43};
|
||||
|
||||
select dynamicType(json.a), json.a from test;
|
||||
drop table test;
|
||||
|
Loading…
Reference in New Issue
Block a user