org.apache.hadoop.hbase.client.coprocessor
Class BigDecimalColumnInterpreter

java.lang.Object
  extended by org.apache.hadoop.hbase.client.coprocessor.BigDecimalColumnInterpreter
All Implemented Interfaces:
ColumnInterpreter<BigDecimal,BigDecimal>, org.apache.hadoop.io.Writable

public class BigDecimalColumnInterpreter
extends Object
implements ColumnInterpreter<BigDecimal,BigDecimal>

ColumnInterpreter for doing Aggregation's with BigDecimal columns. This class is required at the RegionServer also.


Constructor Summary
BigDecimalColumnInterpreter()
           
 
Method Summary
 BigDecimal add(BigDecimal val1, BigDecimal val2)
           
 BigDecimal castToReturnType(BigDecimal val)
          provides casting opportunity between the data types.
 int compare(BigDecimal val1, BigDecimal val2)
          This takes care if either of arguments are null.
 double divideForAvg(BigDecimal val1, Long paramLong)
          used for computing average of data values.
 BigDecimal getMaxValue()
          returns the maximum value for this type T
 BigDecimal getMinValue()
           
 BigDecimal getValue(byte[] family, byte[] qualifier, KeyValue kv)
           
 BigDecimal increment(BigDecimal val)
           
 BigDecimal multiply(BigDecimal val1, BigDecimal val2)
           
 void readFields(DataInput arg0)
           
 void write(DataOutput arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BigDecimalColumnInterpreter

public BigDecimalColumnInterpreter()
Method Detail

readFields

public void readFields(DataInput arg0)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

write

public void write(DataOutput arg0)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

getValue

public BigDecimal getValue(byte[] family,
                           byte[] qualifier,
                           KeyValue kv)
                    throws IOException
Specified by:
getValue in interface ColumnInterpreter<BigDecimal,BigDecimal>
Returns:
value of type T
Throws:
IOException

add

public BigDecimal add(BigDecimal val1,
                      BigDecimal val2)
Specified by:
add in interface ColumnInterpreter<BigDecimal,BigDecimal>
Returns:
sum or non null value among (if either of them is null); otherwise returns a null.

getMaxValue

public BigDecimal getMaxValue()
Description copied from interface: ColumnInterpreter
returns the maximum value for this type T

Specified by:
getMaxValue in interface ColumnInterpreter<BigDecimal,BigDecimal>
Returns:
max

getMinValue

public BigDecimal getMinValue()
Specified by:
getMinValue in interface ColumnInterpreter<BigDecimal,BigDecimal>

multiply

public BigDecimal multiply(BigDecimal val1,
                           BigDecimal val2)
Specified by:
multiply in interface ColumnInterpreter<BigDecimal,BigDecimal>
Returns:
multiplication

increment

public BigDecimal increment(BigDecimal val)
Specified by:
increment in interface ColumnInterpreter<BigDecimal,BigDecimal>
Returns:
increment

castToReturnType

public BigDecimal castToReturnType(BigDecimal val)
Description copied from interface: ColumnInterpreter
provides casting opportunity between the data types.

Specified by:
castToReturnType in interface ColumnInterpreter<BigDecimal,BigDecimal>
Returns:
cast

compare

public int compare(BigDecimal val1,
                   BigDecimal val2)
Description copied from interface: ColumnInterpreter
This takes care if either of arguments are null. returns 0 if they are equal or both are null;

divideForAvg

public double divideForAvg(BigDecimal val1,
                           Long paramLong)
Description copied from interface: ColumnInterpreter
used for computing average of data values. Not providing the divide method that takes two values as it is not needed as of now.

Specified by:
divideForAvg in interface ColumnInterpreter<BigDecimal,BigDecimal>
Returns:
Average


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.