public static DecimalTypeInfo getDecimalTypeForPrimitiveCategory(PrimitiveTypeInfo a) {
    if (a instanceof DecimalTypeInfo) return (DecimalTypeInfo)a;
    int prec = HiveDecimalUtils.getPrecisionForType(a);
    int scale = HiveDecimalUtils.getScaleForType(a);
    prec =  Math.min(prec, HiveDecimal.MAX_PRECISION);
    scale = Math.min(scale, HiveDecimal.MAX_PRECISION - (prec - scale));
    return TypeInfoFactory.getDecimalTypeInfo(prec, scale);
  }
Need to keep consistent with JdbcColumn.columnScale()
serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/HiveDecimalUtils.java