-DATASET CSV empty

--

-CASE JsonMergePathTestFromDuckDB

-LOAD_DYNAMIC_EXTENSION json

-STATEMENT RETURN typeof(json_merge_patch('{"name": "Alicia"}', '{"age": 28}'));
---- 1
json

-STATEMENT RETURN json_merge_patch('{"a": 1}', '{"a": 2}')
---- 1
{"a":2}


-STATEMENT RETURN json_merge_patch('{"a": 1}', '{"b": 2}')
---- 1
{"a":1,"b":2}


-STATEMENT RETURN json_merge_patch('{"a": {"c": 1}}', '{"a": {"d": 2}}')
---- 1
{"a":{"c":1,"d":2}}


-STATEMENT RETURN json_merge_patch('{"a": {"b": 1}}', '{"a": {"b": 2}}')
---- 1
{"a":{"b":2}}

# from MySQL documentation

-STATEMENT RETURN JSON_MERGE_PATCH('[1, 2]', '[true, false]');
---- 1
[true,false]


-STATEMENT RETURN JSON_MERGE_PATCH('{"name": "x"}', '{"id": 47}');
---- 1
{"name":"x","id":47}


-STATEMENT RETURN JSON_MERGE_PATCH('1', 'true');
---- 1
true


-STATEMENT RETURN JSON_MERGE_PATCH('[1, 2]', '{"id": 47}');
---- 1
{"id":47}


-STATEMENT RETURN JSON_MERGE_PATCH('{ "a": 1, "b":2 }','{ "a": 3, "c":4 }');
---- 1
{"b":2,"a":3,"c":4}


-STATEMENT RETURN JSON_MERGE_PATCH('{"a":1, "b":2}', '{"b":null}');
---- 1
{"a":1}


-STATEMENT RETURN JSON_MERGE_PATCH('{"a":{"x":1}}', '{"a":{"y":2}}');
---- 1
{"a":{"x":1,"y":2}}

# test NULL behaviour

-STATEMENT RETURN json_merge_patch(NULL, '3')
---- ok

-STATEMENT RETURN json_merge_patch('3', NULL)
---- ok


-STATEMENT RETURN json_merge_patch(NULL, NULL)
---- ok

-CASE JsonMergePathTestFromDuckDB_multiple_input
-SKIP
#(TODO): we may need to support multiple paths merge
-STATEMENT RETURN JSON_MERGE_PATCH('{ "a": 1, "b":2 }','{ "a": 3, "c":4 }','{ "a": 5, "d":6 }');
---- 1
{"b":2,"c":4,"a":5,"d":6}

-STATEMENT RETURN json_merge_patch('{"a":1}', '{"b":2}', '{"c":3}')
---- 1
{"a":1,"b":2,"c":3}


-STATEMENT RETURN json_merge_patch(NULL, '{"b":2}', '{"c":3}')
---- 1
{"b":2,"c":3}


-STATEMENT RETURN json_merge_patch('{"a":1}', NULL, '{"c":3}')
---- 1
{"c":3}


-STATEMENT RETURN json_merge_patch('{"a":1}', '{"b":2}', NULL)
---- 1
NULL
