/** * Create a decimal writable with an initial value from BigInteger bytes and a specified scale. * <p> * If the conversion to decimal is successful, isSet() will return true. * */ @HiveDecimalWritableVersionV1 public HiveDecimalWritable(byte[] bigIntegerBytes, int scale) { super(); setFromBigIntegerBytesAndScale(bigIntegerBytes, scale); }
/** * Set a decimal writable's value from BigInteger bytes and a specified scale. * <p> * If the conversion to decimal is successful, isSet() will return true. * */ @HiveDecimalWritableVersionV1 public void set(byte[] bigIntegerBytes, int scale) { setFromBigIntegerBytesAndScale(bigIntegerBytes, scale); }
public static void setFromBigIntegerBytesAndScale(byte[] bytes, int offset, int length, HiveDecimalWritable dec) { LazyBinaryUtils.VInt vInt = new LazyBinaryUtils.VInt(); LazyBinaryUtils.readVInt(bytes, offset, vInt); int scale = vInt.value; offset += vInt.length; LazyBinaryUtils.readVInt(bytes, offset, vInt); offset += vInt.length; dec.setFromBigIntegerBytesAndScale(bytes, offset, vInt.value, scale); }
currentHiveDecimalWritable.setFromBigIntegerBytesAndScale( bytes, saveStart, length, readScale); boolean decimalIsNull = !currentHiveDecimalWritable.isSet();
/** * Create a decimal writable with an initial value from BigInteger bytes and a specified scale. * <p> * If the conversion to decimal is successful, isSet() will return true. * */ @HiveDecimalWritableVersionV1 public HiveDecimalWritable(byte[] bigIntegerBytes, int scale) { super(); setFromBigIntegerBytesAndScale(bigIntegerBytes, scale); }
/** * Set a decimal writable's value from BigInteger bytes and a specified scale. * <p> * If the conversion to decimal is successful, isSet() will return true. * */ @HiveDecimalWritableVersionV1 public void set(byte[] bigIntegerBytes, int scale) { setFromBigIntegerBytesAndScale(bigIntegerBytes, scale); }
public static void setFromBigIntegerBytesAndScale(byte[] bytes, int offset, int length, HiveDecimalWritable dec) { LazyBinaryUtils.VInt vInt = new LazyBinaryUtils.VInt(); LazyBinaryUtils.readVInt(bytes, offset, vInt); int scale = vInt.value; offset += vInt.length; LazyBinaryUtils.readVInt(bytes, offset, vInt); offset += vInt.length; dec.setFromBigIntegerBytesAndScale(bytes, offset, vInt.value, scale); }
currentHiveDecimalWritable.setFromBigIntegerBytesAndScale( bytes, saveStart, length, readScale); boolean decimalIsNull = !currentHiveDecimalWritable.isSet();