v.25.11Improvement

UNION should unify types

UNION should unify types with Variant if needed when use_variant_as_common_type is set. Resolves #82772. #83246 (Mithun p).
UNION now unifies types using Variant when use_variant_as_common_type is enabled.

Why it matters

This feature addresses the problem of type unification in UNION queries where columns have differing types that can't be unified by default. By introducing a Variant type as the common type, it ensures smoother query execution without type conflicts.

How to use it

To enable this behavior, set the setting use_variant_as_common_type to 1. For example:

SET use_variant_as_common_type = 1;
SELECT ... UNION ...


This forces the UNION operation to unify incompatible types using the Variant type.