public static double calculateMerge(
      long partialCount, long mergeCount, double partialSum, double mergeSum,
      double partialVariance, double mergeVariance) {

    final double doublePartialCount = (double) partialCount;
    final double doubleMergeCount = (double) mergeCount;

    double t = (doublePartialCount / doubleMergeCount) * mergeSum - partialSum;
    mergeVariance +=
        partialVariance + ((doubleMergeCount / doublePartialCount) /
            (doubleMergeCount + doublePartialCount)) * t * t;
    return mergeVariance;
  }
Compute the variance. This class is extended by: GenericUDAFVarianceSample
GenericUDAFStd GenericUDAFStdSample
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVariance.java