org.apache.hadoop.hbase.coprocessor

Class AggregateImplementation<T,S,P extends com.google.protobuf.Message,Q extends com.google.protobuf.Message,R extends com.google.protobuf.Message>

    • Field Detail

      • log

        protected static final org.apache.commons.logging.Log log
    • Constructor Detail

      • AggregateImplementation

        public AggregateImplementation()
    • Method Detail

      • getMax

        public void getMax(com.google.protobuf.RpcController controller,
                  AggregateProtos.AggregateRequest request,
                  com.google.protobuf.RpcCallback<AggregateProtos.AggregateResponse> done)
        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 class AggregateProtos.AggregateService
      • getMin

        public void getMin(com.google.protobuf.RpcController controller,
                  AggregateProtos.AggregateRequest request,
                  com.google.protobuf.RpcCallback<AggregateProtos.AggregateResponse> done)
        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 class AggregateProtos.AggregateService
      • getSum

        public void getSum(com.google.protobuf.RpcController controller,
                  AggregateProtos.AggregateRequest request,
                  com.google.protobuf.RpcCallback<AggregateProtos.AggregateResponse> done)
        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 class AggregateProtos.AggregateService
      • getAvg

        public void getAvg(com.google.protobuf.RpcController controller,
                  AggregateProtos.AggregateRequest request,
                  com.google.protobuf.RpcCallback<AggregateProtos.AggregateResponse> done)
        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 class AggregateProtos.AggregateService
      • getStd

        public void getStd(com.google.protobuf.RpcController controller,
                  AggregateProtos.AggregateRequest request,
                  com.google.protobuf.RpcCallback<AggregateProtos.AggregateResponse> done)
        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 class AggregateProtos.AggregateService
      • getMedian

        public void getMedian(com.google.protobuf.RpcController controller,
                     AggregateProtos.AggregateRequest request,
                     com.google.protobuf.RpcCallback<AggregateProtos.AggregateResponse> done)
        Gives a List containing sum of values and sum of weights. It is computed for the combination of column family and column qualifier(s) in the given row range as defined in the Scan object. In its current implementation, it takes one column family and two column qualifiers. The first qualifier is for values column and the second qualifier (optional) is for weight column.
        Specified by:
        getMedian in class AggregateProtos.AggregateService
      • start

        public void start(CoprocessorEnvironment env)
                   throws IOException
        Stores a reference to the coprocessor environment provided by the RegionCoprocessorHost from the region where this coprocessor is loaded. Since this is a coprocessor endpoint, it always expects to be loaded on a table region, so always expects this to be an instance of RegionCoprocessorEnvironment.
        Specified by:
        start in interface Coprocessor
        Parameters:
        env - the environment provided by the coprocessor host
        Throws:
        IOException - if the provided environment is not an instance of RegionCoprocessorEnvironment

Copyright © 2014 The Apache Software Foundation. All rights reserved.