This commit is contained in:
Anton Popov 2023-10-25 23:55:39 +00:00
parent 0ca1b006f3
commit 95df08dee2
2 changed files with 14 additions and 14 deletions

View File

@ -8,13 +8,13 @@
{"a":{"b":[3,4],"c":2}}
{"a":5,"b":2,"c":4,"d":6}
{"a":1,"b":null}
{"k0":"0","k1":"1"}
{"k2":"2","k3":"3"}
{"k4":"4","k5":"5"}
{"k6":"6","k7":"7"}
{"k8":"8","k9":"9"}
{"k10":"222","k11":"11"}
{"k12":"222","k13":"13"}
{"k14":"222","k15":"15"}
{"k16":"222","k17":"17"}
{"k18":"222","k19":"19"}
{"k0":0,"k1":1}
{"k2":2,"k3":3}
{"k4":4,"k5":5}
{"k6":6,"k7":7}
{"k8":8,"k9":9}
{"k10":222,"k11":11}
{"k12":222,"k13":13}
{"k14":222,"k15":15}
{"k16":222,"k17":17}
{"k18":222,"k19":19}

View File

@ -14,11 +14,11 @@ select jsonMergePatch('[1]'); -- { serverError BAD_ARGUMENTS }
select jsonMergePatch('{"a": "1","b": 2,"c": [true,"qrdzkzjvnos": true,"yxqhipj": false,"oesax": "33o8_6AyUy"}]}', '{"c": "1"}'); -- { serverError BAD_ARGUMENTS }
drop table if exists t_json_merge;
create table t_json_merge (s1 String, s2 String) engine = Memory;
create table t_json_merge (id UInt64, s1 String, s2 String) engine = Memory;
insert into t_json_merge select toJSONString(map('k' || toString(number * 2), number * 2)), toJSONString(map('k' || toString(number * 2 + 1), number * 2 + 1)) from numbers(5);
insert into t_json_merge select toJSONString(map('k' || toString(number * 2), number * 2)), toJSONString(map('k' || toString(number * 2 + 1), number * 2 + 1, 'k' || toString(number * 2), 222)) from numbers(5, 5);
insert into t_json_merge select number, format('{{ "k{0}": {0} }}', toString(number * 2)), format('{{ "k{0}": {0} }}', toString(number * 2 + 1)) from numbers(5);
insert into t_json_merge select number, format('{{ "k{0}": {0} }}', toString(number * 2)), format('{{ "k{0}": {0}, "k{1}": 222 }}', toString(number * 2 + 1), toString(number * 2)) from numbers(5, 5);
select jsonMergePatch(s1, s2) from t_json_merge;
select jsonMergePatch(s1, s2) from t_json_merge ORDER BY id;
drop table t_json_merge;