v.25.8Improvement

Fix usage of "compact" Variant discriminators serialization

Fix usage of "compact" Variant discriminators serialization in MergeTree. Perviously it wasn't used in some cases when it could be used. #84141 (Pavel Kruglov).
Fixes the usage of "compact" Variant discriminators serialization in MergeTree engines where it was previously not applied in some cases.

Why it matters

This fix resolves inconsistencies in how Variant discriminators are serialized using the "compact" format in MergeTree tables, improving storage efficiency and consistency when this optimization can be applied.

How to use it

The feature is applied internally during Variant type serialization in MergeTree engines and does not require explicit user action. Users benefit automatically from improved compact serialization of Variant discriminators after upgrading to this version.