protected PrimitiveTypeInfo deriveResultExactTypeInfoBackwardsCompat() {
    // Preserve existing return type behavior for division:
    // Non-decimal division should return double
    if (leftOI.getPrimitiveCategory() != PrimitiveCategory.DECIMAL
        && rightOI.getPrimitiveCategory() != PrimitiveCategory.DECIMAL) {
      return TypeInfoFactory.doubleTypeInfo;
    }

    return deriveResultDecimalTypeInfo();
  }
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