public <R, S, P extends Message, Q extends Message, T extends Message> double
    avg(final TableName tableName, final ColumnInterpreter<R, S, P, Q, T> ci, Scan scan)
      throws Throwable {
    Pair<S, Long> p = getAvgArgs(tableName, ci, scan);
    return ci.divideForAvg(p.getFirst(), p.getSecond());
  }
This is the client side interface/handle for calling the average method for a given cf-cq
combination. It was necessary to add one more call stack as its return type should be a decimal
value, irrespective of what columninterpreter says. So, this methods collects the necessary
parameters to compute the average and returs the double value.
@param tableName the name of the table to scan
@param ci        the user's ColumnInterpreter implementation
@param scan      the HBase scan object to use to read data from HBase
@return &lt;R, S&gt;
@throws Throwable The caller is supposed to handle the exception as they are thrown &amp;
                  propagated to it.
hbase-endpoint/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java