@HiveDecimalWritableVersionV1
  @Override
  public boolean equals(Object other) {
    if (!isSet) {
      return false;
    }
    if (this == other) {
      return true;
    }
    if (other == null || getClass() != other.getClass()) {
      return false;
    }
    HiveDecimalWritable otherHiveDecWritable = (HiveDecimalWritable) other;
    if (!otherHiveDecWritable.isSet()) {
      return false;
    }
    return fastEquals((FastHiveDecimal) otherHiveDecWritable);

  }
Allocate scratchLongs with HiveDecimal.SCRATCH_LONGS_LEN longs.
And, allocate scratch scratchBuffer with HiveDecimal.SCRATCH_BUFFER_LEN_BIG_INTEGER_BYTES bytes.
storage-api/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java