org.apache.hadoop.hbase.coprocessor
Interface AggregateProtocol

All Superinterfaces:
CoprocessorProtocol, VersionedProtocol
All Known Implementing Classes:
AggregateImplementation

public interface AggregateProtocol
extends CoprocessorProtocol

Defines the aggregation functions that are to be supported in this Coprocessor. For each method, it takes a Scan object and a columnInterpreter. The scan object should have a column family (else an exception will be thrown), and an optional column qualifier. In the current implementation AggregateImplementation, only one column family and column qualifier combination is served. In case there are more than one, only first one will be picked. Refer to AggregationClient for some general conditions on input parameters.


Field Summary
static long VERSION
           
 
Method Summary
<T,S> Pair<S,Long>
getAvg(ColumnInterpreter<T,S> ci, Scan scan)
          Gives a Pair with first object as Sum and second object as row count, computed for a given combination of column qualifier and column family in the given row range as defined in the Scan object.
<T,S> T
getMax(ColumnInterpreter<T,S> ci, Scan scan)
          Gives the maximum for a given combination of column qualifier and column family, in the given row range as defined in the Scan object.
<T,S> T
getMin(ColumnInterpreter<T,S> ci, Scan scan)
          Gives the minimum for a given combination of column qualifier and column family, in the given row range as defined in the Scan object.
<T,S> long
getRowNum(ColumnInterpreter<T,S> ci, Scan scan)
           
<T,S> Pair<List<S>,Long>
getStd(ColumnInterpreter<T,S> ci, Scan scan)
          Gives a Pair with first object a List containing Sum and sum of squares, and the second object as row count.
<T,S> S
getSum(ColumnInterpreter<T,S> ci, Scan scan)
          Gives the sum for a given combination of column qualifier and column family, in the given row range as defined in the Scan object.
 
Methods inherited from interface org.apache.hadoop.hbase.ipc.VersionedProtocol
getProtocolSignature, getProtocolVersion
 

Field Detail

VERSION

static final long VERSION
See Also:
Constant Field Values
Method Detail

getMax

<T,S> T getMax(ColumnInterpreter<T,S> ci,
               Scan scan)
         throws IOException
Gives the maximum for a given combination of column qualifier and column family, in the given row range as defined in the Scan object. In its current implementation, it takes one column family and one column qualifier (if provided). In case of null column qualifier, maximum value for the entire column family will be returned.

Parameters:
ci -
scan -
Returns:
max value as mentioned above
Throws:
IOException

getMin

<T,S> T getMin(ColumnInterpreter<T,S> ci,
               Scan scan)
         throws IOException
Gives the minimum for a given combination of column qualifier and column family, in the given row range as defined in the Scan object. In its current implementation, it takes one column family and one column qualifier (if provided). In case of null column qualifier, minimum value for the entire column family will be returned.

Parameters:
ci -
scan -
Returns:
min as mentioned above
Throws:
IOException

getSum

<T,S> S getSum(ColumnInterpreter<T,S> ci,
               Scan scan)
         throws IOException
Gives the sum for a given combination of column qualifier and column family, in the given row range as defined in the Scan object. In its current implementation, it takes one column family and one column qualifier (if provided). In case of null column qualifier, sum for the entire column family will be returned.

Parameters:
ci -
scan -
Returns:
sum of values as defined by the column interpreter
Throws:
IOException

getRowNum

<T,S> long getRowNum(ColumnInterpreter<T,S> ci,
                     Scan scan)
               throws IOException
Parameters:
ci -
scan -
Returns:
Row count for the given column family and column qualifier, in the given row range as defined in the Scan object.
Throws:
IOException

getAvg

<T,S> Pair<S,Long> getAvg(ColumnInterpreter<T,S> ci,
                          Scan scan)
                    throws IOException
Gives a Pair with first object as Sum and second object as row count, computed for a given combination of column qualifier and column family in the given row range as defined in the Scan object. In its current implementation, it takes one column family and one column qualifier (if provided). In case of null column qualifier, an aggregate sum over all the entire column family will be returned.

The average is computed in AggregationClient.avg(byte[], ColumnInterpreter, Scan) by processing results from all regions, so its "ok" to pass sum and a Long type.

Parameters:
ci -
scan -
Returns:
Average
Throws:
IOException

getStd

<T,S> Pair<List<S>,Long> getStd(ColumnInterpreter<T,S> ci,
                                Scan scan)
                          throws IOException
Gives a Pair with first object a List containing Sum and sum of squares, and the second object as row count. It is computed for a given combination of column qualifier and column family in the given row range as defined in the Scan object. In its current implementation, it takes one column family and one column qualifier (if provided). The idea is get the value of variance first: the average of the squares less the square of the average a standard deviation is square root of variance.

Parameters:
ci -
scan -
Returns:
STD
Throws:
IOException


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