Class Decimals
java.lang.Object
io.trino.spi.type.Decimals
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic BigIntegerbigIntegerTenToNth(int n) static Int128encodeScaledValue(BigDecimal value, int scale) static Int128encodeScaledValue(BigDecimal value, int scale, RoundingMode roundingMode) static longencodeShortScaledValue(BigDecimal value, int scale) static longencodeShortScaledValue(BigDecimal value, int scale, RoundingMode roundingMode) static longlongTenToNth(int n) static booleanoverflows(long value, int precision) static booleanoverflows(long high, long low) static booleanstatic booleanstatic booleanoverflows(BigDecimal value, long precision) static booleanoverflows(BigInteger value, int precision) static DecimalParseResultstatic BigDecimalreadBigDecimal(DecimalType type, Block block, int position) static longrescale(long value, int fromScale, int toScale) static BigDecimalrescale(BigDecimal value, DecimalType type) static BigIntegerrescale(BigInteger value, int fromScale, int toScale) static StringtoString(long unscaledValue, int scale) static Stringstatic StringtoString(BigInteger unscaledValue, int scale) static longvalueOf(long value) static Int128valueOf(BigDecimal value) static Int128valueOf(BigInteger value) static longvalueOfShort(BigDecimal value) static voidwriteBigDecimal(DecimalType decimalType, BlockBuilder blockBuilder, BigDecimal value) static voidwriteShortDecimal(BlockBuilder blockBuilder, long value)
-
Field Details
-
MAX_UNSCALED_DECIMAL
-
MIN_UNSCALED_DECIMAL
-
MAX_PRECISION
public static final int MAX_PRECISION- See Also:
-
MAX_SHORT_PRECISION
public static final int MAX_SHORT_PRECISION- See Also:
-
-
Method Details
-
longTenToNth
public static long longTenToNth(int n) -
bigIntegerTenToNth
-
parse
-
encodeShortScaledValue
-
encodeShortScaledValue
-
encodeScaledValue
-
encodeScaledValue
-
toString
-
toString
-
toString
-
overflows
public static boolean overflows(long value, int precision) -
overflows
-
overflows
-
readBigDecimal
-
writeBigDecimal
public static void writeBigDecimal(DecimalType decimalType, BlockBuilder blockBuilder, BigDecimal value) -
rescale
-
writeShortDecimal
-
rescale
public static long rescale(long value, int fromScale, int toScale) -
rescale
-
valueOf
ConvertsBigDecimaltoInt128representing it for longDecimalType. It is caller responsibility to ensure thatvalue.scale()equals toDecimalType.getScale(). -
valueOfShort
ConvertsBigDecimaltolongrepresenting it for shortDecimalType. It is caller responsibility to ensure thatvalue.scale()equals toDecimalType.getScale(). -
valueOf
public static long valueOf(long value) -
valueOf
-
overflows
-
overflows
public static boolean overflows(long high, long low) -
overflows
-