v.24.11Experimental Feature

Support String to JSON Alter and Upgrade Serialization to V2

Support alter from String to JSON. This PR also changes the serialization of JSON and Dynamic types to new version V2. Old version V1 can be still used by enabling setting merge_tree_use_v1_object_and_dynamic_serialization (can be used during upgrade to be able to rollback the version without issues). #70442 (Pavel Kruglov).
Support for altering columns from String to JSON type and upgrade of JSON and Dynamic type serialization to a new version V2, with backward compatibility through a configurable setting.

Why it matters

This feature enables users to change column types from String to JSON seamlessly, addressing the need for better JSON data handling and type management within ClickHouse tables. The updated serialization format (V2) improves efficiency and functionality, while the option to revert to the older V1 serialization ensures smooth upgrades and rollback capabilities without data or compatibility issues.

How to use it

To use this feature, you can perform an ALTER operation to change a column type from String to JSON. By default, the new V2 serialization format for JSON and Dynamic types is used. During upgrades, if rollback is required, enable the setting merge_tree_use_v1_object_and_dynamic_serialization to temporarily switch back to the V1 serialization.