@Override
    public Object terminate(AggregationBuffer agg) throws HiveException {
      StdAgg myagg = (StdAgg) agg;

      if (myagg.count <= 1) {
        return null;
      } else {
        getResult().set(
            calculateVarianceSampleResult(myagg.variance, myagg.count));
        return getResult();
      }
    }
Compute the sample variance by extending GenericUDAFVarianceEvaluator and
overriding the terminate() method of the evaluator.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVarianceSample.java