Description
Fix the bug of `TypeCoercion`, for example:
SELECT CAST(1 AS DECIMAL(28, 2)) UNION ALL SELECT CAST(1 AS DECIMAL(18, 2)) / CAST(1 AS DECIMAL(18, 2));
The union result data type is not correct according to the formula:
Operation | Result Precision | Result Scale |
---|---|---|
e1 union e2 | max(s1, s2) + max(p1-s1, p2-s2) | max(s1, s2) |
-- before -- query schema decimal(28,2) -- query output 1.00 1.00 -- after -- query schema decimal(38,20) -- query output 1.00000000000000000000 1.00000000000000000000