@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: p1 - s1 + s2 + max(6, s1 + p2 + 1)
    // Scale: max(6, s1 + p2 + 1)
    int intDig = prec1 - scale1 + scale2;
    int scale = Math.max(6, scale1 + prec2 + 1);
    int prec = intDig + scale;
    return adjustPrecScale(prec, scale);
  }
Note that in SQL, the return type of divide is not necessarily the same
as the parameters. For example, 3 / 2 = 1.5, not 1. To follow SQL, we always
return a decimal for divide.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDivide.java