databendlabs / databend

๐——๐—ฎ๐˜๐—ฎ, ๐—”๐—ป๐—ฎ๐—น๐˜†๐˜๐—ถ๐—ฐ๐˜€ & ๐—”๐—œ. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
https://docs.databend.com
Other
7.85k stars 750 forks source link

feat(query): support `json_object_insert` function #16636

Closed b41sh closed 4 weeks ago

b41sh commented 4 weeks ago

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

support json_object_insert function for example:

MySQL [(none)]> SELECT json_object_insert('{"a":1,"b":2}'::variant, 'c', 3);
+------------------------------------------------------+
| json_object_insert('{"a":1,"b":2}'::VARIANT, 'c', 3) |
+------------------------------------------------------+
| {"a":1,"b":2,"c":3}                                  |
+------------------------------------------------------+
1 row in set (0.043 sec)

MySQL [(none)]> SELECT json_object_insert('{"city":"San Mateo","state":"CA"}'::variant, 'city', 'San Jose', true);
+--------------------------------------------------------------------------------------------+
| json_object_insert('{"city":"San Mateo","state":"CA"}'::VARIANT, 'city', 'San Jose', TRUE) |
+--------------------------------------------------------------------------------------------+
| {"city":"San Jose","state":"CA"}                                                           |
+--------------------------------------------------------------------------------------------+
1 row in set (0.040 sec)

Tests

Type of change


This change isโ€‚Reviewable