public final class Decimals extends Object
| Modifier and Type | Field and Description |
|---|---|
static BigInteger |
MAX_DECIMAL_UNSCALED_VALUE |
static int |
MAX_PRECISION |
static int |
MAX_SHORT_PRECISION |
static BigInteger |
MIN_DECIMAL_UNSCALED_VALUE |
| Modifier and Type | Method and Description |
|---|---|
static BigInteger |
bigIntegerTenToNth(int n) |
static BigInteger |
decodeUnscaledValue(io.airlift.slice.Slice valueSlice) |
static io.airlift.slice.Slice |
encodeScaledValue(BigDecimal value)
|
static io.airlift.slice.Slice |
encodeScaledValue(BigDecimal value,
int scale) |
static long |
encodeShortScaledValue(BigDecimal value,
int scale) |
static io.airlift.slice.Slice |
encodeUnscaledValue(BigInteger unscaledValue) |
static io.airlift.slice.Slice |
encodeUnscaledValue(long unscaledValue) |
static boolean |
isLongDecimal(Type type) |
static boolean |
isShortDecimal(Type type) |
static long |
longTenToNth(int n) |
static boolean |
overflows(BigDecimal value,
long precision) |
static boolean |
overflows(BigInteger value) |
static boolean |
overflows(BigInteger value,
int precision) |
static boolean |
overflows(long value,
int precision) |
static DecimalParseResult |
parse(String stringValue) |
static DecimalParseResult |
parseIncludeLeadingZerosInPrecision(String stringValue) |
static BigDecimal |
readBigDecimal(DecimalType type,
Block block,
int position) |
static BigDecimal |
rescale(BigDecimal value,
DecimalType type) |
static BigInteger |
rescale(BigInteger value,
int fromScale,
int toScale) |
static long |
rescale(long value,
int fromScale,
int toScale) |
static String |
toString(BigInteger unscaledValue,
int scale) |
static String |
toString(long unscaledValue,
int scale) |
static String |
toString(io.airlift.slice.Slice unscaledValue,
int scale) |
static void |
writeBigDecimal(DecimalType decimalType,
BlockBuilder blockBuilder,
BigDecimal value) |
static void |
writeShortDecimal(BlockBuilder blockBuilder,
long value) |
public static final int MAX_PRECISION
public static final int MAX_SHORT_PRECISION
public static final BigInteger MAX_DECIMAL_UNSCALED_VALUE
public static final BigInteger MIN_DECIMAL_UNSCALED_VALUE
public static long longTenToNth(int n)
public static BigInteger bigIntegerTenToNth(int n)
public static DecimalParseResult parse(String stringValue)
public static DecimalParseResult parseIncludeLeadingZerosInPrecision(String stringValue)
public static io.airlift.slice.Slice encodeUnscaledValue(BigInteger unscaledValue)
public static io.airlift.slice.Slice encodeUnscaledValue(long unscaledValue)
public static long encodeShortScaledValue(BigDecimal value, int scale)
public static io.airlift.slice.Slice encodeScaledValue(BigDecimal value, int scale)
public static io.airlift.slice.Slice encodeScaledValue(BigDecimal value)
BigDecimal to Slice representing it for long DecimalType.
It is caller responsibility to ensure that value.scale() equals to DecimalType.getScale().public static BigInteger decodeUnscaledValue(io.airlift.slice.Slice valueSlice)
public static String toString(long unscaledValue, int scale)
public static String toString(io.airlift.slice.Slice unscaledValue, int scale)
public static String toString(BigInteger unscaledValue, int scale)
public static boolean overflows(long value,
int precision)
public static boolean overflows(BigInteger value, int precision)
public static boolean overflows(BigInteger value)
public static boolean overflows(BigDecimal value, long precision)
public static BigDecimal readBigDecimal(DecimalType type, Block block, int position)
public static void writeBigDecimal(DecimalType decimalType, BlockBuilder blockBuilder, BigDecimal value)
public static BigDecimal rescale(BigDecimal value, DecimalType type)
public static void writeShortDecimal(BlockBuilder blockBuilder, long value)
public static long rescale(long value,
int fromScale,
int toScale)
public static BigInteger rescale(BigInteger value, int fromScale, int toScale)
public static boolean isShortDecimal(Type type)
public static boolean isLongDecimal(Type type)
Copyright © 2012–2022. All rights reserved.