/** * 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); }
@HiveDecimalWritableVersionV2 public void setFromBytes(byte[] bytes, int offset, int length, boolean trimBlanks) { fastReset(); isSet = fastSetFromBytes(bytes, offset, length, trimBlanks); if (!isSet) { fastReset(); } }
public DoubleWritable evaluate(HiveDecimalWritable i) { if (i == null || !i.isSet()) { return null; } else { doubleWritable.set(i.doubleValue()); return doubleWritable; } } }
public ShortWritable evaluate(HiveDecimalWritable i) { if (i == null || !i.isShort() || !i.isShort()) { return null; } else { shortWritable.set(i.shortValue()); return shortWritable; } }
/** * Create a decimal writable with an initial value from another decimal writable. * <p> * If the supplied writable has a value, isSet() will return true. * */ @HiveDecimalWritableVersionV1 public HiveDecimalWritable(HiveDecimalWritable writable) { super(); set(writable); }
/** * Create a decimal writable with an initial value from a long with scale 0. * <p> * Afterwards, the isSet() method will return true. * */ @HiveDecimalWritableVersionV1 public HiveDecimalWritable(long longValue) { super(); setFromLong(longValue); }
@HiveDecimalWritableVersionV2 public void mutateSetScale(int roundingPoint, int roundingMode) { if (!isSet) { return; } isSet = fastRound(roundingPoint, roundingMode, this); if (!isSet) { fastReset(); } }
@HiveDecimalWritableVersionV2 public boolean mutateEnforcePrecisionScale(int precision, int scale) { if (!isSet) { return false; } isSet = fastEnforcePrecisionScale(precision, scale); if (!isSet) { fastReset(); } return isSet; }
/** * Set a decimal writable's value to a long's value with scale 0. * <p> * Afterwards, the isSet() method will return true since all long values fit in a decimal. * */ @HiveDecimalWritableVersionV2 public void setFromLong(long longValue) { fastReset(); fastSetFromLong(longValue); isSet = true; }
@HiveDecimalWritableVersionV2 public void setFromBigIntegerBytesAndScale( byte[] bigIntegerBytes, int offset, int length, int scale) { fastReset(); isSet = fastSetFromBigIntegerBytesAndScale(bigIntegerBytes, offset, length, scale); if (!isSet) { fastReset(); } }
@HiveDecimalWritableVersionV2 public void mutateAbs() { if (!isSet) { return; } fastAbs(); }
@HiveDecimalWritableVersionV2 public void mutateDivide(HiveDecimalWritable decWritable) { if (!isSet || !decWritable.isSet) { isSet = false; return; } isSet = fastDivide(decWritable, this); }
@HiveDecimalWritableVersionV2 public void deserialize64( long decimal64Long, int scale) { fastDeserialize64(decimal64Long, scale); isSet = true; }
@HiveDecimalWritableVersionV2 public void mutateAdd(HiveDecimalWritable decWritable) { if (!isSet || !decWritable.isSet) { isSet = false; return; } isSet = fastAdd(decWritable, this); }
@HiveDecimalWritableVersionV2 public void mutateMultiply(HiveDecimalWritable decWritable) { if (!isSet || !decWritable.isSet) { isSet = false; return; } isSet = fastMultiply(decWritable, this); }
@HiveDecimalWritableVersionV2 public void mutateScaleByPowerOfTen(int power) { if (!isSet) { return; } isSet = fastScaleByPowerOfTen(power, this); }
@HiveDecimalWritableVersionV2 public void mutateIntegerPortion() { if (!isSet) { return; } fastIntegerPortion(); }
@HiveDecimalWritableVersionV2 public void mutateNegate() { if (!isSet) { return; } fastNegate(); }
/** * Create a decimal writable with an initial value from a HiveDecimal. * <p> * Afterwards, the isSet() method will return true, unless value is null. * */ @HiveDecimalWritableVersionV1 public HiveDecimalWritable(HiveDecimal value) { super(); set(value); }