org.apache.hadoop.hbase.coprocessor
Class AggregateImplementation
java.lang.Object
org.apache.hadoop.hbase.coprocessor.BaseEndpointCoprocessor
org.apache.hadoop.hbase.coprocessor.AggregateImplementation
- All Implemented Interfaces:
- Coprocessor, AggregateProtocol, CoprocessorProtocol, VersionedProtocol
public class AggregateImplementation
- extends BaseEndpointCoprocessor
- implements AggregateProtocol
A concrete AggregateProtocol implementation. Its system level coprocessor
that computes the aggregate function at a region level.
Field Summary |
protected static org.apache.commons.logging.Log |
log
|
Method Summary |
|
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. |
|
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. |
|
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. |
ProtocolSignature |
getProtocolSignature(String protocol,
long version,
int clientMethodsHashCode)
Return protocol version corresponding to protocol interface. |
|
getRowNum(ColumnInterpreter<T,S> ci,
Scan scan)
|
|
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. |
|
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 class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.commons.logging.Log log
AggregateImplementation
public AggregateImplementation()
getProtocolSignature
public ProtocolSignature getProtocolSignature(String protocol,
long version,
int clientMethodsHashCode)
throws IOException
- Description copied from interface:
VersionedProtocol
- Return protocol version corresponding to protocol interface.
- Specified by:
getProtocolSignature
in interface VersionedProtocol
- Overrides:
getProtocolSignature
in class BaseEndpointCoprocessor
- Parameters:
protocol
- The classname of the protocol interfaceversion
- The version of the protocol that the client speaksclientMethodsHashCode
- the hashcode of client protocol methods
- Returns:
- the server protocol signature containing its version and
a list of its supported methods
- Throws:
IOException
- See Also:
for a default implementation
getMax
public <T,S> T getMax(ColumnInterpreter<T,S> ci,
Scan scan)
throws IOException
- Description copied from interface:
AggregateProtocol
- 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.
- Specified by:
getMax
in interface AggregateProtocol
- Returns:
- max value as mentioned above
- Throws:
IOException
getMin
public <T,S> T getMin(ColumnInterpreter<T,S> ci,
Scan scan)
throws IOException
- Description copied from interface:
AggregateProtocol
- 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.
- Specified by:
getMin
in interface AggregateProtocol
- Returns:
- min as mentioned above
- Throws:
IOException
getSum
public <T,S> S getSum(ColumnInterpreter<T,S> ci,
Scan scan)
throws IOException
- Description copied from interface:
AggregateProtocol
- 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.
- Specified by:
getSum
in interface AggregateProtocol
- Returns:
- sum of values as defined by the column interpreter
- Throws:
IOException
getRowNum
public <T,S> long getRowNum(ColumnInterpreter<T,S> ci,
Scan scan)
throws IOException
- Specified by:
getRowNum
in interface AggregateProtocol
- 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
public <T,S> Pair<S,Long> getAvg(ColumnInterpreter<T,S> ci,
Scan scan)
throws IOException
- Description copied from interface:
AggregateProtocol
- 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.
- Specified by:
getAvg
in interface AggregateProtocol
- Returns:
- Average
- Throws:
IOException
getStd
public <T,S> Pair<List<S>,Long> getStd(ColumnInterpreter<T,S> ci,
Scan scan)
throws IOException
- Description copied from interface:
AggregateProtocol
- 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.
- Specified by:
getStd
in interface AggregateProtocol
- Returns:
- STD
- Throws:
IOException
Copyright © 2012 The Apache Software Foundation. All Rights Reserved.