Widens numeric types and converts strings to numbers when appropriate.
Loosely based on rules from "Hadoop: The Definitive Guide" 2nd edition, by Tom White
The implicit conversion rules can be summarized as follows:
Any integral numeric type can be implicitly converted to a wider type.
All the integral numeric types, FLOAT, and (perhaps surprisingly) STRING can be implicitly
converted to DOUBLE.
TINYINT, SMALLINT, and INT can all be converted to FLOAT.
BOOLEAN types cannot be converted to any other type.
Any integral numeric type can be implicitly converted to decimal type.
two different decimal types will be converted into a wider decimal type for both of them.
decimal type will be converted into double if there float or double together with it.
Additionally, all types when UNION-ed with strings will be promoted to strings.
Other string conversions are handled by PromoteStrings.
Widening types might result in loss of precision in the following cases:
- IntegerType to FloatType
- LongType to FloatType
- LongType to DoubleType
- DecimalType to Double
This rule is only applied to Union/Except/Intersect
Widens numeric types and converts strings to numbers when appropriate.
Loosely based on rules from "Hadoop: The Definitive Guide" 2nd edition, by Tom White
The implicit conversion rules can be summarized as follows:
Additionally, all types when UNION-ed with strings will be promoted to strings. Other string conversions are handled by PromoteStrings.
Widening types might result in loss of precision in the following cases: - IntegerType to FloatType - LongType to FloatType - LongType to DoubleType - DecimalType to Double
This rule is only applied to Union/Except/Intersect