There is a code in sql_union.cc which checks that an Item is OK as a UNION field.
Currently, this code has only one purpose: In case of character string data types it makes sure that the aggregated data type has a non-conflicting collation, to disallow this:
All other built-in data types have no additional requirements on the aggregated data type.
But user defined data types may want to have their own requirements.
This code should go into a new virtual method in Type_handler.