@HiveDecimalVersionV1
  public static HiveDecimalV1 enforcePrecisionScale(HiveDecimalV1 dec, int maxPrecision, int maxScale) {
    if (dec == null) {
      return null;
    }

    // Minor optimization, avoiding creating new objects.
    if (dec.precision() - dec.scale() <= maxPrecision - maxScale &&
        dec.scale() <= maxScale) {
      return dec;
    }

    BigDecimal bd = enforcePrecisionScale(dec.bd, maxPrecision, maxScale);
    if (bd == null) {
      return null;
    }

    return HiveDecimalV1.create(bd);
  }
Specially handling the case that bd=0, and we are converting it to a type where precision=scale,
such as decimal(1, 1).
storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimalV1.java