@HiveDecimalWritableVersionV1 public static HiveDecimalWritableV1 enforcePrecisionScale(HiveDecimalWritableV1 writable, int precision, int scale) { if (writable == null) { return null; } HiveDecimalV1 dec = HiveDecimalV1.enforcePrecisionScale(writable.getHiveDecimal(), precision, scale); return dec == null ? null : new HiveDecimalWritableV1(dec); } }
@HiveDecimalWritableVersionV1 public HiveDecimalWritableV1(HiveDecimalWritableV1 writable) { set(writable.getHiveDecimal()); }
@HiveDecimalWritableVersionV1 public HiveDecimalWritableV1(HiveDecimalV1 value) { set(value); }
@HiveDecimalWritableVersionV1 @Override public int compareTo(HiveDecimalWritableV1 that) { return getHiveDecimal().compareTo(that.getHiveDecimal()); }
@HiveDecimalWritableVersionV1 public HiveDecimalWritableV1(byte[] bytes, int scale) { set(bytes, scale); }
@HiveDecimalWritableVersionV1 @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } HiveDecimalWritableV1 bdw = (HiveDecimalWritableV1) other; // 'equals' and 'compareTo' are not compatible with HiveDecimals. We want // compareTo which returns true iff the numbers are equal (e.g.: 3.14 is // the same as 3.140). 'Equals' returns true iff equal and the same scale // is set in the decimals (e.g.: 3.14 is not the same as 3.140) return getHiveDecimal().compareTo(bdw.getHiveDecimal()) == 0; }
@HiveDecimalWritableVersionV1 public void set(HiveDecimalWritableV1 writable) { set(writable.getHiveDecimal()); }
@HiveDecimalWritableVersionV1 public HiveDecimalWritableV1(long value) { set((HiveDecimalV1.create(value))); }
@HiveDecimalWritableVersionV1 @Override public int hashCode() { return getHiveDecimal().hashCode(); }
@HiveDecimalWritableVersionV1 public static HiveDecimalWritableV1 enforcePrecisionScale(HiveDecimalWritableV1 writable, int precision, int scale) { if (writable == null) { return null; } HiveDecimalV1 dec = HiveDecimalV1.enforcePrecisionScale(writable.getHiveDecimal(), precision, scale); return dec == null ? null : new HiveDecimalWritableV1(dec); } }
@HiveDecimalWritableVersionV1 public void set(HiveDecimalWritableV1 writable) { set(writable.getHiveDecimal()); }
@HiveDecimalWritableVersionV1 public HiveDecimalWritableV1(String value) { set(HiveDecimalV1.create(value)); }
@HiveDecimalWritableVersionV1 @Override public String toString() { return getHiveDecimal().toString(); }
@HiveDecimalWritableVersionV1 public HiveDecimalWritableV1(HiveDecimalWritableV1 writable) { set(writable.getHiveDecimal()); }
@HiveDecimalWritableVersionV1 public void set(HiveDecimalV1 value, int maxPrecision, int maxScale) { set(HiveDecimalV1.enforcePrecisionScale(value, maxPrecision, maxScale)); }
@HiveDecimalWritableVersionV1 @Override public int compareTo(HiveDecimalWritableV1 that) { return getHiveDecimal().compareTo(that.getHiveDecimal()); }
@HiveDecimalWritableVersionV1 public void set(HiveDecimalV1 value) { set(value.unscaledValue().toByteArray(), value.scale()); }
@HiveDecimalWritableVersionV1 @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } HiveDecimalWritableV1 bdw = (HiveDecimalWritableV1) other; // 'equals' and 'compareTo' are not compatible with HiveDecimals. We want // compareTo which returns true iff the numbers are equal (e.g.: 3.14 is // the same as 3.140). 'Equals' returns true iff equal and the same scale // is set in the decimals (e.g.: 3.14 is not the same as 3.140) return getHiveDecimal().compareTo(bdw.getHiveDecimal()) == 0; }
@HiveDecimalWritableVersionV1 public HiveDecimalWritableV1(HiveDecimalV1 value) { set(value); }
@HiveDecimalWritableVersionV1 @Override public String toString() { return getHiveDecimal().toString(); }