org.apache.hadoop.hive.common.type
Class HiveDecimal

java.lang.Object
  extended by org.apache.hadoop.hive.common.type.HiveDecimal
All Implemented Interfaces:
Comparable<HiveDecimal>

public class HiveDecimal
extends Object
implements Comparable<HiveDecimal>

HiveDecimal. Simple wrapper for BigDecimal. Adds fixed max precision and non scientific string representation


Field Summary
static int MAX_PRECISION
           
static HiveDecimal ONE
           
static int ROUND_CEILING
           
static int ROUND_FLOOR
           
static int ROUND_HALF_UP
           
static HiveDecimal ZERO
           
 
Constructor Summary
HiveDecimal(BigDecimal b)
           
HiveDecimal(BigDecimal b, boolean allowRounding)
           
HiveDecimal(BigInteger bi)
           
HiveDecimal(BigInteger unscaled, int scale)
           
HiveDecimal(int i)
           
HiveDecimal(long l)
           
HiveDecimal(String dec)
           
 
Method Summary
 HiveDecimal abs()
           
 HiveDecimal add(HiveDecimal dec)
           
 BigDecimal bigDecimalValue()
           
 byte byteValue()
           
 int compareTo(HiveDecimal dec)
           
 HiveDecimal divide(HiveDecimal dec)
           
 double doubleValue()
           
 boolean equals(Object obj)
           
 float floatValue()
           
 int hashCode()
           
 int intValue()
           
 long longValue()
           
 HiveDecimal multiply(HiveDecimal dec)
           
 HiveDecimal negate()
           
 HiveDecimal pow(int n)
           
 int precision()
           
 HiveDecimal remainder(HiveDecimal dec)
           
 int scale()
           
 HiveDecimal scaleByPowerOfTen(int n)
           
 HiveDecimal setScale(int i)
           
 HiveDecimal setScale(int adjustedScale, int rm)
           
 short shortValue()
           
 HiveDecimal subtract(HiveDecimal dec)
           
 String toString()
           
 BigInteger unscaledValue()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final HiveDecimal ZERO

MAX_PRECISION

public static final int MAX_PRECISION
See Also:
Constant Field Values

ONE

public static final HiveDecimal ONE

ROUND_FLOOR

public static final int ROUND_FLOOR
See Also:
Constant Field Values

ROUND_CEILING

public static final int ROUND_CEILING
See Also:
Constant Field Values

ROUND_HALF_UP

public static final int ROUND_HALF_UP
See Also:
Constant Field Values
Constructor Detail

HiveDecimal

public HiveDecimal(BigDecimal b)

HiveDecimal

public HiveDecimal(BigDecimal b,
                   boolean allowRounding)

HiveDecimal

public HiveDecimal(BigInteger unscaled,
                   int scale)

HiveDecimal

public HiveDecimal(String dec)

HiveDecimal

public HiveDecimal(BigInteger bi)

HiveDecimal

public HiveDecimal(int i)

HiveDecimal

public HiveDecimal(long l)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

setScale

public HiveDecimal setScale(int i)

compareTo

public int compareTo(HiveDecimal dec)
Specified by:
compareTo in interface Comparable<HiveDecimal>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

scale

public int scale()

precision

public int precision()

intValue

public int intValue()

doubleValue

public double doubleValue()

longValue

public long longValue()

shortValue

public short shortValue()

floatValue

public float floatValue()

bigDecimalValue

public BigDecimal bigDecimalValue()

byteValue

public byte byteValue()

setScale

public HiveDecimal setScale(int adjustedScale,
                            int rm)

subtract

public HiveDecimal subtract(HiveDecimal dec)

multiply

public HiveDecimal multiply(HiveDecimal dec)

unscaledValue

public BigInteger unscaledValue()

scaleByPowerOfTen

public HiveDecimal scaleByPowerOfTen(int n)

abs

public HiveDecimal abs()

negate

public HiveDecimal negate()

add

public HiveDecimal add(HiveDecimal dec)

pow

public HiveDecimal pow(int n)

remainder

public HiveDecimal remainder(HiveDecimal dec)

divide

public HiveDecimal divide(HiveDecimal dec)


Copyright © 2012 The Apache Software Foundation