Even if we will not have MIN/MAX optimisation (as in MENT-693) we can get gail from early filtering by MIN/MAX pushdown.
The idea of this task is to lift WHERE/GROUP BY limitations of MENT-693.
We can clone WHERE condition portion which depend on field under MAX/MIN and GROUP BY (if possible to clone and to separate this portion from other condition (could be side effect, random, outer references mixed with the fields)), clone GROUP BY list (also if possible), in both (WHERE & GROUP BY) change fields of UNION result by references (direct reference?) on SELECT LIST of each underlying SELECT. Cloned WHERE will be add (AND) to the WHERE of each underlying SELECT and GROUP BY just add to each such SELECT (the select should not have own GROUP BY).