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

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

public class LongColumnInterpreter
extends Object
implements ColumnInterpreter<Long,Long>

a concrete column interpreter implementation. The cell value is a Long value and its promoted data type is also a Long value. For computing aggregation function, this class is used to find the datatype of the cell value. Client is supposed to instantiate it and passed along as a parameter. See TestAggregateProtocol methods for its sample usage. Its methods handle null arguments gracefully.


Constructor Summary
LongColumnInterpreter()
           
 
Method Summary
 Long add(Long l1, Long l2)
           
 Long castToReturnType(Long o)
          provides casting opportunity between the data types.
 int compare(Long l1, Long l2)
          This takes care if either of arguments are null.
 double divideForAvg(Long l1, Long l2)
          used for computing average of data values.
 Long getMaxValue()
          returns the maximum value for this type T
 Long getMinValue()
           
 Long getValue(byte[] colFamily, byte[] colQualifier, KeyValue kv)
           
 Long increment(Long o)
           
 Long multiply(Long l1, Long l2)
           
 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

LongColumnInterpreter

public LongColumnInterpreter()
Method Detail

getValue

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

add

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

compare

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

getMaxValue

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

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

increment

public Long increment(Long o)
Specified by:
increment in interface ColumnInterpreter<Long,Long>
Returns:
increment

multiply

public Long multiply(Long l1,
                     Long l2)
Specified by:
multiply in interface ColumnInterpreter<Long,Long>
Returns:
multiplication

getMinValue

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

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

divideForAvg

public double divideForAvg(Long l1,
                           Long l2)
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<Long,Long>
Returns:
Average

castToReturnType

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

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


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