HiveDecimalObjectInspector boi = (HiveDecimalObjectInspector) poi;
HiveDecimal dec = boi.getPrimitiveJavaObject(o);
// get the sign of the big decimal
int sign = dec.compareTo(HiveDecimal.ZERO);
// we'll encode the absolute value (sign is separate)
dec = dec.abs();
// get the scale factor to turn big decimal into a decimal < 1