@Override
    public HiveDecimalWritable add(HiveDecimalWritable t1, HiveDecimalWritable t2) {
      if (t1 == null && t2 == null) {
        return null;
      }

      if (t1 == null) {
        return new HiveDecimalWritable(t2);
      } else {
        HiveDecimalWritable result = new HiveDecimalWritable(t1);
        if (t2 != null) {
          result.mutateAdd(t2);
        }
        return result;
      }
    }
Define some type specific operation to used in the subclass
ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/BasePartitionEvaluator.java