dec.update(value);
HiveDecimalWritable witness = new HiveDecimalWritable();
witness.set(HiveDecimal.create(value));
int bufferUsed = dec.fastSerializeForHiveDecimal(scratch);
HiveDecimalWritable hdw = new HiveDecimalWritable();
hdw.set(scratch.getBytes(bufferUsed), dec.getScale());
HiveDecimal hd = hdw.getHiveDecimal();