@Override
  protected DecimalTypeInfo deriveResultDecimalTypeInfo(int prec1, int scale1, int prec2, int scale2) {
    // From https://msdn.microsoft.com/en-us/library/ms190476.aspx
    // e1 + e2
    // Precision: max(s1, s2) + max(p1-s1, p2-s2) + 1
    // Scale: max(s1, s2)
    int intPart = Math.max(prec1 - scale1, prec2 - scale2);
    int scale = Math.max(scale1, scale2);
    int prec =  intPart + scale + 1;
    return adjustPrecScale(prec, scale);
  }
The reason that we list evaluate methods with all numeric types is for both
better performance and type checking (so we know int + int is still an int
instead of a double); otherwise a single method that takes (Number a, Number
b) and use a.doubleValue() == b.doubleValue() is enough.

The case of int + double will be handled by implicit type casting using
UDFRegistry.implicitConvertable method.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNumericPlus.java