@Override
        public Pair<List<S>, Long> call(AggregateService instance) throws IOException {
          RpcController controller = new AggregationClientRpcController();
          CoprocessorRpcUtils.BlockingRpcCallback<AggregateResponse> rpcCallback =
            new CoprocessorRpcUtils.BlockingRpcCallback<>();
          instance.getStd(controller, requestArg, rpcCallback);
          AggregateResponse response = rpcCallback.get();
          if (controller.failed()) {
            throw new IOException(controller.errorText());
          }
          Pair<List<S>, Long> pair = new Pair<>(new ArrayList<>(), 0L);
          if (response.getFirstPartCount() == 0) {
            return pair;
          }
          List<S> list = new ArrayList<>();
          for (int i = 0; i < response.getFirstPartCount(); i++) {
            ByteString b = response.getFirstPart(i);
            T t = getParsedGenericInstance(ci.getClass(), 4, b);
            S s = ci.getPromotedValueFromProto(t);
            list.add(s);
          }
          pair.setFirst(list);
          ByteBuffer bb =
            ByteBuffer.allocate(8).put(getBytesFromResponse(response.getSecondPart()));
          bb.rewind();
          pair.setSecond(bb.getLong());
          return pair;
        }
It computes a global standard deviation for a given column and its value. Standard deviation is
square root of (average of squares - average*average). From individual regions, it obtains sum,
square sum and number of rows. With these, the above values are computed to get the global std.
@param table table to scan.
@param scan  the HBase scan object to use to read data from HBase
@return standard deviations
@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