public class DecimalUtility extends Object
修飾子とタイプ | フィールドと説明 |
---|---|
static int |
DECIMAL_BYTE_LENGTH |
static String[] |
decimalToString |
static int |
DIGITS_BASE |
static int |
DIGITS_MAX |
static int |
INTEGER_SIZE |
static int |
MAX_DIGITS |
static long[] |
scale_long_constants |
コンストラクタと説明 |
---|
DecimalUtility() |
修飾子とタイプ | メソッドと説明 |
---|---|
static long |
adjustScaleDivide(long input,
int factor) |
static long |
adjustScaleMultiply(long input,
int factor)
Math.pow returns a double and while multiplying with large digits
in the decimal data type we encounter noise.
|
static boolean |
checkPrecisionAndScale(BigDecimal value,
int vectorPrecision,
int vectorScale)
Check that the BigDecimal scale equals the vectorScale and that the BigDecimal precision is
less than or equal to the vectorPrecision.
|
static BigDecimal |
getBigDecimalFromArrowBuf(ArrowBuf bytebuf,
int index,
int scale)
Read an ArrowType.Decimal at the given value index in the ArrowBuf and convert to a BigDecimal
with the given scale.
|
static BigDecimal |
getBigDecimalFromByteBuffer(ByteBuffer bytebuf,
int scale)
Read an ArrowType.Decimal from the ByteBuffer and convert to a BigDecimal with the given
scale.
|
static byte[] |
getByteArrayFromArrowBuf(ArrowBuf bytebuf,
int index)
Read an ArrowType.Decimal from the ArrowBuf at the given value index and return it as a byte
array.
|
static long |
getPowerOfTen(int power)
Simple function that returns the static precomputed
power of ten, instead of using Math.pow
|
static StringBuilder |
toStringWithZeroes(int number,
int desiredLength)
Returns a string representation of the given integer
If the length of the given integer is less than the
passed length, this function will prepend zeroes to the string
|
static StringBuilder |
toStringWithZeroes(long number,
int desiredLength) |
static void |
writeBigDecimalToArrowBuf(BigDecimal value,
ArrowBuf bytebuf,
int index)
Write the given BigDecimal to the ArrowBuf at the given value index.
|
static void |
writeByteArrayToArrowBuf(byte[] bytes,
ArrowBuf bytebuf,
int index)
Write the given byte array to the ArrowBuf at the given value index.
|
public static final int MAX_DIGITS
public static final int DIGITS_BASE
public static final int DIGITS_MAX
public static final int INTEGER_SIZE
public static final String[] decimalToString
public static final long[] scale_long_constants
public static final int DECIMAL_BYTE_LENGTH
public static long getPowerOfTen(int power)
public static long adjustScaleMultiply(long input, int factor)
public static long adjustScaleDivide(long input, int factor)
public static StringBuilder toStringWithZeroes(int number, int desiredLength)
public static StringBuilder toStringWithZeroes(long number, int desiredLength)
public static BigDecimal getBigDecimalFromArrowBuf(ArrowBuf bytebuf, int index, int scale)
public static BigDecimal getBigDecimalFromByteBuffer(ByteBuffer bytebuf, int scale)
public static byte[] getByteArrayFromArrowBuf(ArrowBuf bytebuf, int index)
public static boolean checkPrecisionAndScale(BigDecimal value, int vectorPrecision, int vectorScale)
public static void writeBigDecimalToArrowBuf(BigDecimal value, ArrowBuf bytebuf, int index)
public static void writeByteArrayToArrowBuf(byte[] bytes, ArrowBuf bytebuf, int index)
Copyright © 2018 The Apache Software Foundation. All rights reserved.