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

java.lang.Object
  extended by org.apache.hadoop.hbase.coprocessor.ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
      extended by org.apache.hadoop.hbase.client.coprocessor.BigDecimalColumnInterpreter

@InterfaceAudience.Private
public class BigDecimalColumnInterpreter
extends ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>

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


Constructor Summary
BigDecimalColumnInterpreter()
           
 
Method Summary
 BigDecimal add(BigDecimal bd1, BigDecimal bd2)
           
 BigDecimal castToCellType(BigDecimal bd)
          The response message comes as type S.
 BigDecimal castToReturnType(BigDecimal bd)
          provides casting opportunity between the data types.
 int compare(BigDecimal bd1, BigDecimal bd2)
          This takes care if either of arguments are null.
 double divideForAvg(BigDecimal bd1, Long l2)
          used for computing average of data values.
 BigDecimal getCellValueFromProto(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg q)
          This method gets the PB message corresponding to the cell type
 BigDecimal getMaxValue()
          returns the maximum value for this type T
 BigDecimal getMinValue()
           
 BigDecimal getPromotedValueFromProto(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg r)
          This method gets the promoted type from the proto message
 org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg getProtoForCellType(BigDecimal t)
          This method gets the PB message corresponding to the cell type
 org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg getProtoForPromotedType(BigDecimal s)
          This method gets the PB message corresponding to the promoted type
 org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg getRequestData()
          This method should return any additional data that is needed on the server side to construct the ColumnInterpreter.
 BigDecimal getValue(byte[] colFamily, byte[] colQualifier, Cell kv)
          TODO: when removing ColumnInterpreter.getValue(byte[], byte[], KeyValue), this method should be made abstract
 BigDecimal increment(BigDecimal bd)
           
 void initialize(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg msg)
          This method should initialize any field(s) of the ColumnInterpreter with a parsing of the passed message bytes (used on the server side).
 BigDecimal multiply(BigDecimal bd1, BigDecimal bd2)
           
 
Methods inherited from class org.apache.hadoop.hbase.coprocessor.ColumnInterpreter
getValue
 
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

getValue

public BigDecimal getValue(byte[] colFamily,
                           byte[] colQualifier,
                           Cell kv)
                    throws IOException
Description copied from class: ColumnInterpreter
TODO: when removing ColumnInterpreter.getValue(byte[], byte[], KeyValue), this method should be made abstract

Overrides:
getValue in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
value of type T
Throws:
IOException

add

public BigDecimal add(BigDecimal bd1,
                      BigDecimal bd2)
Specified by:
add in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
sum or non null value among (if either of them is null); otherwise returns a null.

compare

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

getMaxValue

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

Specified by:
getMaxValue in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
max

increment

public BigDecimal increment(BigDecimal bd)
Specified by:
increment in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
increment

multiply

public BigDecimal multiply(BigDecimal bd1,
                           BigDecimal bd2)
Specified by:
multiply in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
multiplication

getMinValue

public BigDecimal getMinValue()
Specified by:
getMinValue in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>

divideForAvg

public double divideForAvg(BigDecimal bd1,
                           Long l2)
Description copied from class: 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 class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
Average

castToReturnType

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

Specified by:
castToReturnType in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
cast

castToCellType

public BigDecimal castToCellType(BigDecimal bd)
Description copied from class: ColumnInterpreter
The response message comes as type S. This will convert/cast it to T. In some sense, performs the opposite of ColumnInterpreter.castToReturnType(Object)

Specified by:
castToCellType in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
cast

getRequestData

public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg getRequestData()
Description copied from class: ColumnInterpreter
This method should return any additional data that is needed on the server side to construct the ColumnInterpreter. The server will pass this to the ColumnInterpreter.initialize(P) method. If there is no ColumnInterpreter specific data (for e.g., LongColumnInterpreter) then null should be returned.

Specified by:
getRequestData in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
the PB message

initialize

public void initialize(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg msg)
Description copied from class: ColumnInterpreter
This method should initialize any field(s) of the ColumnInterpreter with a parsing of the passed message bytes (used on the server side).

Specified by:
initialize in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>

getProtoForCellType

public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg getProtoForCellType(BigDecimal t)
Description copied from class: ColumnInterpreter
This method gets the PB message corresponding to the cell type

Specified by:
getProtoForCellType in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
the PB message for the cell-type instance

getProtoForPromotedType

public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg getProtoForPromotedType(BigDecimal s)
Description copied from class: ColumnInterpreter
This method gets the PB message corresponding to the promoted type

Specified by:
getProtoForPromotedType in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
the PB message for the promoted-type instance

getPromotedValueFromProto

public BigDecimal getPromotedValueFromProto(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg r)
Description copied from class: ColumnInterpreter
This method gets the promoted type from the proto message

Specified by:
getPromotedValueFromProto in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
the promoted-type instance from the PB message

getCellValueFromProto

public BigDecimal getCellValueFromProto(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg q)
Description copied from class: ColumnInterpreter
This method gets the PB message corresponding to the cell type

Specified by:
getCellValueFromProto in class ColumnInterpreter<BigDecimal,BigDecimal,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg,org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg>
Returns:
the cell-type instance from the PB message


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.