public class HiveDecimal extends Object implements Comparable<HiveDecimal>
Modifier and Type | Field and Description |
---|---|
static int |
MAX_PRECISION |
static int |
MAX_SCALE |
static HiveDecimal |
ONE |
static int |
ROUND_CEILING |
static int |
ROUND_FLOOR |
static int |
ROUND_HALF_EVEN |
static int |
ROUND_HALF_UP |
static int |
SYSTEM_DEFAULT_PRECISION
Default precision/scale when system is not able to determine them, such as in case
of a non-generic udf.
|
static int |
SYSTEM_DEFAULT_SCALE |
static int |
USER_DEFAULT_PRECISION
Default precision/scale when user doesn't specify in the column metadata, such as
decimal and decimal(8).
|
static int |
USER_DEFAULT_SCALE |
static HiveDecimal |
ZERO |
Modifier and Type | Method and Description |
---|---|
HiveDecimal |
abs() |
HiveDecimal |
add(HiveDecimal dec) |
BigDecimal |
bigDecimalValue() |
byte |
byteValue() |
int |
compareTo(HiveDecimal dec) |
static HiveDecimal |
create(BigDecimal b) |
static HiveDecimal |
create(BigDecimal b,
boolean allowRounding) |
static HiveDecimal |
create(BigInteger bi) |
static HiveDecimal |
create(BigInteger unscaled,
int scale) |
static HiveDecimal |
create(int i) |
static HiveDecimal |
create(long l) |
static HiveDecimal |
create(String dec) |
HiveDecimal |
divide(HiveDecimal dec) |
double |
doubleValue() |
static HiveDecimal |
enforcePrecisionScale(HiveDecimal dec,
int maxPrecision,
int maxScale) |
boolean |
equals(Object obj) |
float |
floatValue() |
int |
hashCode() |
int |
intValue() |
long |
longValue() |
HiveDecimal |
multiply(HiveDecimal dec) |
HiveDecimal |
negate() |
HiveDecimal |
pow(int n) |
int |
precision()
Returns the number of digits (integer and fractional) in the number, which is equivalent
to SQL decimal precision.
|
HiveDecimal |
remainder(HiveDecimal dec) |
int |
scale() |
HiveDecimal |
scaleByPowerOfTen(int n) |
HiveDecimal |
setScale(int i) |
HiveDecimal |
setScale(int adjustedScale,
int rm) |
short |
shortValue() |
int |
signum()
Get the sign of the underlying decimal.
|
HiveDecimal |
subtract(HiveDecimal dec) |
String |
toFormatString(int scale)
Return a string representation of the number with the number of decimal digits as
the given scale.
|
String |
toString() |
BigInteger |
unscaledValue() |
public static final int MAX_PRECISION
public static final int MAX_SCALE
public static final int USER_DEFAULT_PRECISION
public static final int USER_DEFAULT_SCALE
public static final int SYSTEM_DEFAULT_PRECISION
public static final int SYSTEM_DEFAULT_SCALE
public static final HiveDecimal ZERO
public static final HiveDecimal ONE
public static final int ROUND_FLOOR
public static final int ROUND_CEILING
public static final int ROUND_HALF_UP
public static final int ROUND_HALF_EVEN
public static HiveDecimal create(BigDecimal b)
public static HiveDecimal create(BigDecimal b, boolean allowRounding)
public static HiveDecimal create(BigInteger unscaled, int scale)
public static HiveDecimal create(String dec)
public static HiveDecimal create(BigInteger bi)
public static HiveDecimal create(int i)
public static HiveDecimal create(long l)
public String toFormatString(int scale)
scale
- the number of digits after the decimal pointpublic HiveDecimal setScale(int i)
public int compareTo(HiveDecimal dec)
compareTo
in interface Comparable<HiveDecimal>
public int scale()
public int precision()
public int intValue()
public double doubleValue()
public long longValue()
public short shortValue()
public float floatValue()
public BigDecimal bigDecimalValue()
public byte byteValue()
public HiveDecimal setScale(int adjustedScale, int rm)
public HiveDecimal subtract(HiveDecimal dec)
public HiveDecimal multiply(HiveDecimal dec)
public BigInteger unscaledValue()
public HiveDecimal scaleByPowerOfTen(int n)
public HiveDecimal abs()
public HiveDecimal negate()
public HiveDecimal add(HiveDecimal dec)
public HiveDecimal pow(int n)
public HiveDecimal remainder(HiveDecimal dec)
public HiveDecimal divide(HiveDecimal dec)
public int signum()
public static HiveDecimal enforcePrecisionScale(HiveDecimal dec, int maxPrecision, int maxScale)
Copyright © 2016 The Apache Software Foundation. All rights reserved.