@Override
  public void doLastBatchWork() {
    if (!isGroupResultNull) {
      avg.set(sum);
      temp.setFromLong(nonNullGroupCount);
      avg.mutateDivide(temp);
    }
  }
This class evaluates HiveDecimal avg() for a PTF group.

Sum up non-null column values; group result is sum / non-null count.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/ptf/VectorPTFEvaluatorDecimalAvg.java